mirror of
https://github.com/bitwarden/android.git
synced 2024-12-29 20:38:31 +03:00
Splash screen, styling updates, focus with delay for android.
This commit is contained in:
parent
90a6855e39
commit
c27d427799
17 changed files with 101 additions and 17 deletions
|
@ -317,6 +317,7 @@
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Services\ReflectionService.cs" />
|
<Compile Include="Services\ReflectionService.cs" />
|
||||||
<Compile Include="Services\SqlService.cs" />
|
<Compile Include="Services\SqlService.cs" />
|
||||||
|
<Compile Include="SplashActivity.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
|
@ -596,6 +597,9 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable-xxxhdpi\globe.png" />
|
<AndroidResource Include="Resources\drawable-xxxhdpi\globe.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\drawable\splash_screen.xml" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||||
<Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
|
<Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace Bit.Android.Controls
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
View.SetMainTextColor(Color.FromHex("d2d6de"));
|
View.SetMainTextColor(Color.FromHex("777777"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,18 @@ namespace Bit.Android.Controls
|
||||||
|
|
||||||
private int ComputeHeight(AListView listView, int width)
|
private int ComputeHeight(AListView listView, int width)
|
||||||
{
|
{
|
||||||
|
var element = Element as ExtendedTableView;
|
||||||
|
|
||||||
var adapter = listView.Adapter;
|
var adapter = listView.Adapter;
|
||||||
var totalHeight = listView.PaddingTop + listView.PaddingBottom;
|
var totalHeight = listView.PaddingTop + listView.PaddingBottom;
|
||||||
var desiredWidth = MeasureSpec.MakeMeasureSpec(width, global::Android.Views.MeasureSpecMode.AtMost);
|
var desiredWidth = MeasureSpec.MakeMeasureSpec(width, global::Android.Views.MeasureSpecMode.AtMost);
|
||||||
for(var i = 0; i < adapter.Count; i++)
|
for(var i = 0; i < adapter.Count; i++)
|
||||||
{
|
{
|
||||||
|
if(i == 0 && (element?.NoHeader ?? false))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var view = adapter.GetView(i, null, listView);
|
var view = adapter.GetView(i, null, listView);
|
||||||
view.LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
|
view.LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
|
||||||
view.Measure(desiredWidth, MeasureSpec.MakeMeasureSpec(0, global::Android.Views.MeasureSpecMode.Unspecified));
|
view.Measure(desiredWidth, MeasureSpec.MakeMeasureSpec(0, global::Android.Views.MeasureSpecMode.Unspecified));
|
||||||
|
|
|
@ -18,7 +18,10 @@ using System.Reflection;
|
||||||
|
|
||||||
namespace Bit.Android
|
namespace Bit.Android
|
||||||
{
|
{
|
||||||
[Activity(Label = "bitwarden", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
[Activity(Label = "bitwarden",
|
||||||
|
Icon = "@drawable/icon",
|
||||||
|
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation,
|
||||||
|
WindowSoftInputMode = SoftInput.StateHidden)]
|
||||||
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
|
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
|
||||||
{
|
{
|
||||||
private const string HockeyAppId = "d3834185b4a643479047b86c65293d42";
|
private const string HockeyAppId = "d3834185b4a643479047b86c65293d42";
|
||||||
|
@ -27,7 +30,8 @@ namespace Bit.Android
|
||||||
{
|
{
|
||||||
base.OnCreate(bundle);
|
base.OnCreate(bundle);
|
||||||
Console.WriteLine("A OnCreate");
|
Console.WriteLine("A OnCreate");
|
||||||
Window.SetSoftInputMode(SoftInput.StateAlwaysHidden);
|
Window.SetSoftInputMode(SoftInput.StateHidden);
|
||||||
|
Window.AddFlags(WindowManagerFlags.Secure);
|
||||||
|
|
||||||
var appIdService = Resolver.Resolve<IAppIdService>();
|
var appIdService = Resolver.Resolve<IAppIdService>();
|
||||||
var authService = Resolver.Resolve<IAuthService>();
|
var authService = Resolver.Resolve<IAuthService>();
|
||||||
|
|
14
src/Android/Resources/Resource.Designer.cs
generated
14
src/Android/Resources/Resource.Designer.cs
generated
|
@ -2710,8 +2710,8 @@ namespace Bit.Android
|
||||||
// aapt resource value: 0x7f0200da
|
// aapt resource value: 0x7f0200da
|
||||||
public const int mr_ic_play_light = 2130837722;
|
public const int mr_ic_play_light = 2130837722;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e1
|
// aapt resource value: 0x7f0200e2
|
||||||
public const int notification_template_icon_bg = 2130837729;
|
public const int notification_template_icon_bg = 2130837730;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200db
|
// aapt resource value: 0x7f0200db
|
||||||
public const int plus = 2130837723;
|
public const int plus = 2130837723;
|
||||||
|
@ -2726,10 +2726,13 @@ namespace Bit.Android
|
||||||
public const int roundedbgdark = 2130837726;
|
public const int roundedbgdark = 2130837726;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200df
|
// aapt resource value: 0x7f0200df
|
||||||
public const int upload = 2130837727;
|
public const int splash_screen = 2130837727;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e0
|
// aapt resource value: 0x7f0200e0
|
||||||
public const int user = 2130837728;
|
public const int upload = 2130837728;
|
||||||
|
|
||||||
|
// aapt resource value: 0x7f0200e1
|
||||||
|
public const int user = 2130837729;
|
||||||
|
|
||||||
static Drawable()
|
static Drawable()
|
||||||
{
|
{
|
||||||
|
@ -4520,6 +4523,9 @@ namespace Bit.Android
|
||||||
// aapt resource value: 0x7f0d0175
|
// aapt resource value: 0x7f0d0175
|
||||||
public const int BitwardenTheme = 2131558773;
|
public const int BitwardenTheme = 2131558773;
|
||||||
|
|
||||||
|
// aapt resource value: 0x7f0d0176
|
||||||
|
public const int BitwardenTheme_Splash = 2131558774;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0d0017
|
// aapt resource value: 0x7f0d0017
|
||||||
public const int CardView = 2131558423;
|
public const int CardView = 2131558423;
|
||||||
|
|
||||||
|
|
9
src/Android/Resources/drawable/splash_screen.xml
Normal file
9
src/Android/Resources/drawable/splash_screen.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<color android:color="@color/lightgray"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<bitmap android:src="@drawable/logo" android:tileMode="disabled" android:gravity="center"/>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
|
@ -8,4 +8,8 @@
|
||||||
<item name="android:windowBackground">@color/lightgray</item>
|
<item name="android:windowBackground">@color/lightgray</item>
|
||||||
<item name="android:navigationBarColor">@color/darkaccent</item>
|
<item name="android:navigationBarColor">@color/darkaccent</item>
|
||||||
</style>
|
</style>
|
||||||
|
<style name="BitwardenTheme.Splash" parent="Theme.AppCompat.Light">
|
||||||
|
<item name="android:windowBackground">@drawable/splash_screen</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
32
src/Android/SplashActivity.cs
Normal file
32
src/Android/SplashActivity.cs
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
using System;
|
||||||
|
using Android.App;
|
||||||
|
using Android.OS;
|
||||||
|
using Android.Content;
|
||||||
|
using Android.Support.V7.App;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bit.Android
|
||||||
|
{
|
||||||
|
[Activity(Theme = "@style/BitwardenTheme.Splash",
|
||||||
|
MainLauncher = true,
|
||||||
|
NoHistory = true,
|
||||||
|
WindowSoftInputMode = global::Android.Views.SoftInput.StateHidden)]
|
||||||
|
public class SplashActivity : AppCompatActivity
|
||||||
|
{
|
||||||
|
public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState)
|
||||||
|
{
|
||||||
|
base.OnCreate(savedInstanceState, persistentState);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnResume()
|
||||||
|
{
|
||||||
|
base.OnResume();
|
||||||
|
var startupWork = new Task(() =>
|
||||||
|
{
|
||||||
|
StartActivity(new Intent(Application.Context, typeof(MainActivity)));
|
||||||
|
});
|
||||||
|
|
||||||
|
startupWork.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -54,7 +54,8 @@ namespace Bit.App.Pages
|
||||||
Command = new Command(async () => await RegisterAsync()),
|
Command = new Command(async () => await RegisterAsync()),
|
||||||
VerticalOptions = LayoutOptions.End,
|
VerticalOptions = LayoutOptions.End,
|
||||||
HorizontalOptions = LayoutOptions.Fill,
|
HorizontalOptions = LayoutOptions.Fill,
|
||||||
Style = (Style)Application.Current.Resources["btn-primary"]
|
Style = (Style)Application.Current.Resources["btn-primary"],
|
||||||
|
FontSize = Device.GetNamedSize(NamedSize.Default, typeof(Button))
|
||||||
};
|
};
|
||||||
|
|
||||||
var loginButton = new Button
|
var loginButton = new Button
|
||||||
|
@ -63,7 +64,8 @@ namespace Bit.App.Pages
|
||||||
Command = new Command(async () => await LoginAsync()),
|
Command = new Command(async () => await LoginAsync()),
|
||||||
VerticalOptions = LayoutOptions.End,
|
VerticalOptions = LayoutOptions.End,
|
||||||
Style = (Style)Application.Current.Resources["btn-primaryAccent"],
|
Style = (Style)Application.Current.Resources["btn-primaryAccent"],
|
||||||
HorizontalOptions = LayoutOptions.Fill
|
HorizontalOptions = LayoutOptions.Fill,
|
||||||
|
BackgroundColor = Color.Transparent
|
||||||
};
|
};
|
||||||
|
|
||||||
var buttonStackLayout = new StackLayout
|
var buttonStackLayout = new StackLayout
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace Bit.App.Pages
|
||||||
protected override void OnAppearing()
|
protected override void OnAppearing()
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
PasswordCell.Entry.Focus();
|
PasswordCell.Entry.FocusWithDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task CheckPasswordAsync()
|
protected async Task CheckPasswordAsync()
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace Bit.App.Pages
|
||||||
protected override void OnAppearing()
|
protected override void OnAppearing()
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
PinControl.Entry.Focus();
|
PinControl.Entry.FocusWithDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void PinEntered(object sender, EventArgs args)
|
protected void PinEntered(object sender, EventArgs args)
|
||||||
|
|
|
@ -138,11 +138,11 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
if(!string.IsNullOrWhiteSpace(EmailCell.Entry.Text))
|
if(!string.IsNullOrWhiteSpace(EmailCell.Entry.Text))
|
||||||
{
|
{
|
||||||
PasswordCell.Entry.Focus();
|
PasswordCell.Entry.FocusWithDelay();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EmailCell.Entry.Focus();
|
EmailCell.Entry.FocusWithDelay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ namespace Bit.App.Pages
|
||||||
protected override void OnAppearing()
|
protected override void OnAppearing()
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
CodeCell.Entry.Focus();
|
CodeCell.Entry.FocusWithDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Entry_Completed(object sender, EventArgs e)
|
private async void Entry_Completed(object sender, EventArgs e)
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace Bit.App.Pages
|
||||||
protected override void OnAppearing()
|
protected override void OnAppearing()
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
EmailCell.Entry.Focus();
|
EmailCell.Entry.FocusWithDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Entry_Completed(object sender, EventArgs e)
|
private async void Entry_Completed(object sender, EventArgs e)
|
||||||
|
|
|
@ -145,7 +145,7 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
MessagingCenter.Send(Application.Current, "ShowStatusBar", true);
|
MessagingCenter.Send(Application.Current, "ShowStatusBar", true);
|
||||||
EmailCell.Entry.Focus();
|
EmailCell.Entry.FocusWithDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Entry_Completed(object sender, EventArgs e)
|
private async void Entry_Completed(object sender, EventArgs e)
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace Bit.App.Pages
|
||||||
protected override void OnAppearing()
|
protected override void OnAppearing()
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
PinControl.Entry.Focus();
|
PinControl.Entry.FocusWithDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void PinEntered(object sender, EventArgs args)
|
protected void PinEntered(object sender, EventArgs args)
|
||||||
|
|
|
@ -28,5 +28,21 @@ namespace Bit.App
|
||||||
{
|
{
|
||||||
return !page.IsPortrait();
|
return !page.IsPortrait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void FocusWithDelay(this Entry entry, int delay = 500)
|
||||||
|
{
|
||||||
|
if(Device.OS == TargetPlatform.Android)
|
||||||
|
{
|
||||||
|
System.Threading.Tasks.Task.Run(async () =>
|
||||||
|
{
|
||||||
|
await System.Threading.Tasks.Task.Delay(delay);
|
||||||
|
Device.BeginInvokeOnMainThread(() => entry.Focus());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entry.Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue