diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index 8125d40f7..d5ad6c0f8 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -317,6 +317,7 @@ + @@ -596,6 +597,9 @@ + + + diff --git a/src/Android/Controls/ExtendedSwitchCellRenderer.cs b/src/Android/Controls/ExtendedSwitchCellRenderer.cs index 6d36d7726..a5f6af606 100644 --- a/src/Android/Controls/ExtendedSwitchCellRenderer.cs +++ b/src/Android/Controls/ExtendedSwitchCellRenderer.cs @@ -28,7 +28,7 @@ namespace Bit.Android.Controls } else { - View.SetMainTextColor(Color.FromHex("d2d6de")); + View.SetMainTextColor(Color.FromHex("777777")); } } diff --git a/src/Android/Controls/ExtendedTableViewRenderer.cs b/src/Android/Controls/ExtendedTableViewRenderer.cs index 71875ffbe..740ac3f69 100644 --- a/src/Android/Controls/ExtendedTableViewRenderer.cs +++ b/src/Android/Controls/ExtendedTableViewRenderer.cs @@ -42,11 +42,18 @@ namespace Bit.Android.Controls private int ComputeHeight(AListView listView, int width) { + var element = Element as ExtendedTableView; + var adapter = listView.Adapter; var totalHeight = listView.PaddingTop + listView.PaddingBottom; var desiredWidth = MeasureSpec.MakeMeasureSpec(width, global::Android.Views.MeasureSpecMode.AtMost); for(var i = 0; i < adapter.Count; i++) { + if(i == 0 && (element?.NoHeader ?? false)) + { + continue; + } + var view = adapter.GetView(i, null, listView); view.LayoutParameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent); view.Measure(desiredWidth, MeasureSpec.MakeMeasureSpec(0, global::Android.Views.MeasureSpecMode.Unspecified)); diff --git a/src/Android/MainActivity.cs b/src/Android/MainActivity.cs index d47f28dc7..ad063c091 100644 --- a/src/Android/MainActivity.cs +++ b/src/Android/MainActivity.cs @@ -18,7 +18,10 @@ using System.Reflection; 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 { private const string HockeyAppId = "d3834185b4a643479047b86c65293d42"; @@ -27,7 +30,8 @@ namespace Bit.Android { base.OnCreate(bundle); Console.WriteLine("A OnCreate"); - Window.SetSoftInputMode(SoftInput.StateAlwaysHidden); + Window.SetSoftInputMode(SoftInput.StateHidden); + Window.AddFlags(WindowManagerFlags.Secure); var appIdService = Resolver.Resolve(); var authService = Resolver.Resolve(); diff --git a/src/Android/Resources/Resource.Designer.cs b/src/Android/Resources/Resource.Designer.cs index 95e4ccd1a..c1cdd0fd4 100644 --- a/src/Android/Resources/Resource.Designer.cs +++ b/src/Android/Resources/Resource.Designer.cs @@ -2710,8 +2710,8 @@ namespace Bit.Android // aapt resource value: 0x7f0200da public const int mr_ic_play_light = 2130837722; - // aapt resource value: 0x7f0200e1 - public const int notification_template_icon_bg = 2130837729; + // aapt resource value: 0x7f0200e2 + public const int notification_template_icon_bg = 2130837730; // aapt resource value: 0x7f0200db public const int plus = 2130837723; @@ -2726,10 +2726,13 @@ namespace Bit.Android public const int roundedbgdark = 2130837726; // aapt resource value: 0x7f0200df - public const int upload = 2130837727; + public const int splash_screen = 2130837727; // 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() { @@ -4520,6 +4523,9 @@ namespace Bit.Android // aapt resource value: 0x7f0d0175 public const int BitwardenTheme = 2131558773; + // aapt resource value: 0x7f0d0176 + public const int BitwardenTheme_Splash = 2131558774; + // aapt resource value: 0x7f0d0017 public const int CardView = 2131558423; diff --git a/src/Android/Resources/drawable/splash_screen.xml b/src/Android/Resources/drawable/splash_screen.xml new file mode 100644 index 000000000..34a08d168 --- /dev/null +++ b/src/Android/Resources/drawable/splash_screen.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/Android/Resources/values/styles.xml b/src/Android/Resources/values/styles.xml index 7da38b837..d6dfd718e 100644 --- a/src/Android/Resources/values/styles.xml +++ b/src/Android/Resources/values/styles.xml @@ -8,4 +8,8 @@ @color/lightgray @color/darkaccent + diff --git a/src/Android/SplashActivity.cs b/src/Android/SplashActivity.cs new file mode 100644 index 000000000..ea1c1b4fd --- /dev/null +++ b/src/Android/SplashActivity.cs @@ -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(); + } + } +} diff --git a/src/App/Pages/HomePage.cs b/src/App/Pages/HomePage.cs index 4c986feed..b5dd53231 100644 --- a/src/App/Pages/HomePage.cs +++ b/src/App/Pages/HomePage.cs @@ -54,7 +54,8 @@ namespace Bit.App.Pages Command = new Command(async () => await RegisterAsync()), VerticalOptions = LayoutOptions.End, 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 @@ -63,7 +64,8 @@ namespace Bit.App.Pages Command = new Command(async () => await LoginAsync()), VerticalOptions = LayoutOptions.End, Style = (Style)Application.Current.Resources["btn-primaryAccent"], - HorizontalOptions = LayoutOptions.Fill + HorizontalOptions = LayoutOptions.Fill, + BackgroundColor = Color.Transparent }; var buttonStackLayout = new StackLayout diff --git a/src/App/Pages/Lock/LockPasswordPage.cs b/src/App/Pages/Lock/LockPasswordPage.cs index 06cc5a5bd..19290d4b1 100644 --- a/src/App/Pages/Lock/LockPasswordPage.cs +++ b/src/App/Pages/Lock/LockPasswordPage.cs @@ -98,7 +98,7 @@ namespace Bit.App.Pages protected override void OnAppearing() { base.OnAppearing(); - PasswordCell.Entry.Focus(); + PasswordCell.Entry.FocusWithDelay(); } protected async Task CheckPasswordAsync() diff --git a/src/App/Pages/Lock/LockPinPage.cs b/src/App/Pages/Lock/LockPinPage.cs index bcc6b4c31..f9713303d 100644 --- a/src/App/Pages/Lock/LockPinPage.cs +++ b/src/App/Pages/Lock/LockPinPage.cs @@ -85,7 +85,7 @@ namespace Bit.App.Pages protected override void OnAppearing() { base.OnAppearing(); - PinControl.Entry.Focus(); + PinControl.Entry.FocusWithDelay(); } protected void PinEntered(object sender, EventArgs args) diff --git a/src/App/Pages/LoginPage.cs b/src/App/Pages/LoginPage.cs index 521950d50..fc76f43f8 100644 --- a/src/App/Pages/LoginPage.cs +++ b/src/App/Pages/LoginPage.cs @@ -138,11 +138,11 @@ namespace Bit.App.Pages { if(!string.IsNullOrWhiteSpace(EmailCell.Entry.Text)) { - PasswordCell.Entry.Focus(); + PasswordCell.Entry.FocusWithDelay(); } else { - EmailCell.Entry.Focus(); + EmailCell.Entry.FocusWithDelay(); } } } diff --git a/src/App/Pages/LoginTwoFactorPage.cs b/src/App/Pages/LoginTwoFactorPage.cs index 03b96a2b1..804a8c2ee 100644 --- a/src/App/Pages/LoginTwoFactorPage.cs +++ b/src/App/Pages/LoginTwoFactorPage.cs @@ -103,7 +103,7 @@ namespace Bit.App.Pages protected override void OnAppearing() { base.OnAppearing(); - CodeCell.Entry.Focus(); + CodeCell.Entry.FocusWithDelay(); } private async void Entry_Completed(object sender, EventArgs e) diff --git a/src/App/Pages/PasswordHintPage.cs b/src/App/Pages/PasswordHintPage.cs index 21239c875..867b5733a 100644 --- a/src/App/Pages/PasswordHintPage.cs +++ b/src/App/Pages/PasswordHintPage.cs @@ -93,7 +93,7 @@ namespace Bit.App.Pages protected override void OnAppearing() { base.OnAppearing(); - EmailCell.Entry.Focus(); + EmailCell.Entry.FocusWithDelay(); } private async void Entry_Completed(object sender, EventArgs e) diff --git a/src/App/Pages/RegisterPage.cs b/src/App/Pages/RegisterPage.cs index d810ca3ac..ac2f809a5 100644 --- a/src/App/Pages/RegisterPage.cs +++ b/src/App/Pages/RegisterPage.cs @@ -145,7 +145,7 @@ namespace Bit.App.Pages { base.OnAppearing(); MessagingCenter.Send(Application.Current, "ShowStatusBar", true); - EmailCell.Entry.Focus(); + EmailCell.Entry.FocusWithDelay(); } private async void Entry_Completed(object sender, EventArgs e) diff --git a/src/App/Pages/Settings/SettingsPinPage.cs b/src/App/Pages/Settings/SettingsPinPage.cs index 87a240806..f7516ca9b 100644 --- a/src/App/Pages/Settings/SettingsPinPage.cs +++ b/src/App/Pages/Settings/SettingsPinPage.cs @@ -70,7 +70,7 @@ namespace Bit.App.Pages protected override void OnAppearing() { base.OnAppearing(); - PinControl.Entry.Focus(); + PinControl.Entry.FocusWithDelay(); } protected void PinEntered(object sender, EventArgs args) diff --git a/src/App/Utilities/Extentions.cs b/src/App/Utilities/Extentions.cs index 46386b1ba..ab06365cf 100644 --- a/src/App/Utilities/Extentions.cs +++ b/src/App/Utilities/Extentions.cs @@ -28,5 +28,21 @@ namespace Bit.App { 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(); + } + } } }