protected override void OnCreate(Bundle savedInstanceState) { _design.ApplyTheme(); base.OnCreate(savedInstanceState); Util.MakeSecureDisplay(this); _ioc = App.Kp2a.CurrentDb.Ioc; _intentReceiver = new LockCloseListActivityBroadcastReceiver(this); IntentFilter filter = new IntentFilter(); filter.AddAction(Intents.DatabaseLocked); filter.AddAction(Intent.ActionScreenOff); RegisterReceiver(_intentReceiver, filter); }
protected override void OnCreate(Bundle bundle) { _design.ApplyTheme(); base.OnCreate(bundle); //use FlagSecure to make sure the last (revealed) character of the password is not visible in recent apps Util.MakeSecureDisplay(this); _ioc = App.Kp2a.GetDbForQuickUnlock()?.Ioc; if (_ioc == null) { Finish(); return; } SetContentView(Resource.Layout.QuickUnlock); var toolbar = FindViewById <AndroidX.AppCompat.Widget.Toolbar>(Resource.Id.mytoolbar); SetSupportActionBar(toolbar); var collapsingToolbar = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar); collapsingToolbar.SetTitle(GetString(Resource.String.QuickUnlock_prefs)); if (App.Kp2a.GetDbForQuickUnlock().KpDatabase.Name != "") { FindViewById(Resource.Id.filename_label).Visibility = ViewStates.Visible; ((TextView)FindViewById(Resource.Id.filename_label)).Text = App.Kp2a.GetDbForQuickUnlock().KpDatabase.Name; } else { if ( PreferenceManager.GetDefaultSharedPreferences(this) .GetBoolean(GetString(Resource.String.RememberRecentFiles_key), Resources.GetBoolean(Resource.Boolean.RememberRecentFiles_default))) { ((TextView)FindViewById(Resource.Id.filename_label)).Text = App.Kp2a.GetFileStorage(_ioc).GetDisplayName(_ioc); } else { ((TextView)FindViewById(Resource.Id.filename_label)).Text = "*****"; } } TextView txtLabel = (TextView)FindViewById(Resource.Id.QuickUnlock_label); _quickUnlockLength = App.Kp2a.QuickUnlockKeyLength; if (PreferenceManager.GetDefaultSharedPreferences(this) .GetBoolean(GetString(Resource.String.QuickUnlockHideLength_key), false)) { txtLabel.Text = GetString(Resource.String.QuickUnlock_label_secure); } else { txtLabel.Text = GetString(Resource.String.QuickUnlock_label, new Java.Lang.Object[] { _quickUnlockLength }); } EditText pwd = (EditText)FindViewById(Resource.Id.QuickUnlock_password); pwd.SetEms(_quickUnlockLength); Util.MoveBottomBarButtons(Resource.Id.QuickUnlock_buttonLock, Resource.Id.QuickUnlock_button, Resource.Id.bottom_bar, this); Button btnUnlock = (Button)FindViewById(Resource.Id.QuickUnlock_button); btnUnlock.Click += (object sender, EventArgs e) => { OnUnlock(pwd); }; Button btnLock = (Button)FindViewById(Resource.Id.QuickUnlock_buttonLock); btnLock.Text = btnLock.Text.Replace("ß", "ss"); btnLock.Click += (object sender, EventArgs e) => { App.Kp2a.Lock(false); Finish(); }; pwd.EditorAction += (sender, args) => { if ((args.ActionId == ImeAction.Done) || ((args.ActionId == ImeAction.ImeNull) && (args.Event.Action == KeyEventActions.Down))) { OnUnlock(pwd); } }; _intentReceiver = new QuickUnlockBroadcastReceiver(this); IntentFilter filter = new IntentFilter(); filter.AddAction(Intents.DatabaseLocked); RegisterReceiver(_intentReceiver, filter); Util.SetNoPersonalizedLearning(FindViewById <EditText>(Resource.Id.QuickUnlock_password)); if (bundle != null) { numFailedAttempts = bundle.GetInt(NumFailedAttemptsKey, 0); } }