Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
CustomTabs API
Browse files Browse the repository at this point in the history
moljac committed Jun 12, 2017
1 parent 21cfde7 commit 6c6cb64
Showing 5 changed files with 45 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -123,7 +123,6 @@
<Compile Include="Plugins\IRunInvoker.cs" />
<Compile Include="Plugins\UIThreadRunInvoker.LinkSource.cs" />
<Compile Include="AccountStoreException.cs" />
<Compile Include="Providers\Google\NativeUIAuthenticator.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(NuGetPackageRoot)' == ''">
<NuGetPackageRoot>$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">X:\x.a-m\source\Xamarin.Auth.UniversalWindowsPlatform\project.lock.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\moljac\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">ProjectJson</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">4.1.0</NuGetToolVersion>
</PropertyGroup>
<ImportGroup>
<Import Project="$(NuGetPackageRoot)\Microsoft.Bcl.Build\1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('$(NuGetPackageRoot)\Microsoft.Bcl.Build\1.0.21\build\Microsoft.Bcl.Build.targets')" />
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)microsoft.bcl.build\1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.bcl.build\1.0.21\build\Microsoft.Bcl.Build.targets')" />
</ImportGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -190,11 +190,22 @@ public static WebViewFallback WebViewFallback
set;
}



public static global::Android.Content.ActivityFlags ActivityFlags
{
get;
set;
}

public static void UICustomization()
{
ActivityFlags =
global::Android.Content.ActivityFlags.NoHistory
|
global::Android.Content.ActivityFlags.SingleTop
|
global::Android.Content.ActivityFlags.NewTask
;

/*
CustomTabsIntentBuilder
.SetToolbarColor(color_xamarin_blue)
@@ -355,16 +366,7 @@ public static void UICustomization()
//------------------------------------------------------------
// CustomTabsIntent property getter will call
// CustomTabsIntent.Builder.Build() internally
CustomTabsIntent
.Intent.AddFlags
(
global::Android.Content.ActivityFlags.NoHistory
|
global::Android.Content.ActivityFlags.SingleTop
|
global::Android.Content.ActivityFlags.NewTask
)
;
CustomTabsIntent.Intent.AddFlags(ActivityFlags);

return;
}
Original file line number Diff line number Diff line change
@@ -138,15 +138,9 @@ protected override void OnCreate(Bundle savedInstanceState)
CustomTabsConfiguration.UriAndroidOS != null
)
{
CustomTabsConfiguration.CustomTabsIntent
.Intent.AddFlags
(
global::Android.Content.ActivityFlags.NoHistory
|
global::Android.Content.ActivityFlags.SingleTop
|
global::Android.Content.ActivityFlags.NewTask
);
CustomTabsConfiguration
.CustomTabsIntent
.Intent.AddFlags(CustomTabsConfiguration.ActivityFlags);

CustomTabsConfiguration
.CustomTabActivityHelper
@@ -165,14 +159,8 @@ protected override void OnCreate(Bundle savedInstanceState)
{
// plain CustomTabs no customizations
CustomTabsIntent i = new CustomTabsIntent.Builder().Build();
i.Intent.AddFlags
(
global::Android.Content.ActivityFlags.NoHistory
|
global::Android.Content.ActivityFlags.SingleTop
|
global::Android.Content.ActivityFlags.NewTask
);
i.Intent.AddFlags(CustomTabsConfiguration.ActivityFlags);

i.LaunchUrl(this, CustomTabsConfiguration.UriAndroidOS);
}
//.......................................................
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(NuGetPackageRoot)' == ''">
<NuGetPackageRoot>$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">X:\x.a-m\source\XamarinForms\Xamarin.Auth.Forms.UniversalWindowsPlatform\project.lock.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\moljac\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">ProjectJson</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">4.1.0</NuGetToolVersion>
</PropertyGroup>
<ImportGroup>
<Import Project="$(NuGetPackageRoot)\Xamarin.Forms\2.3.4.247\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('$(NuGetPackageRoot)\Xamarin.Forms\2.3.4.247\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)xamarin.forms\2.3.4.247\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('$(NuGetPackageRoot)xamarin.forms\2.3.4.247\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
</ImportGroup>
</Project>

1 comment on commit 6c6cb64

@Lapinou42
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,
since you added the NoHistory flag, when the user start the custom tabs to sign in, if he closes the app (to background) then launch again, the custom tab is closed. The thing if we use authentication with phone number. So something, users switch to app Messages to see his code number then go back to the app.

Please sign in to comment.