protected override void OnCreate(Bundle savedInstanceState) { new ActivityDesign(this).ApplyTheme(); base.OnCreate(savedInstanceState); ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this); App.Kp2a.AskYesNoCancel(UiStringKey.ActivateAutoFillService_title, UiStringKey.ActivateAutoFillService_message, UiStringKey.ActivateAutoFillService_btnKeyboard, UiStringKey.ActivateAutoFillService_btnAutoFill, delegate { //yes CopyToClipboardService.ActivateKeyboard(this); Finish(); }, delegate { //no Intent intent = new Intent(Android.Provider.Settings.ActionAccessibilitySettings); StartActivity(intent); prefs.Edit().PutBoolean(GetString(Resource.String.OpenKp2aKeyboardAutomatically_key), false).Commit(); Toast.MakeText(this, Resource.String.ActivateAutoFillService_toast, ToastLength.Long).Show(); Finish(); }, delegate { //cancel Finish(); }, (sender, args) => Finish() //dismiss , this); }
public override void CompleteOnCreateEntryActivity(EntryActivity activity) { Context ctx = activity; if (ctx == null) { ctx = Application.Context; } if ((ShowUserNotifications == ShowUserNotificationsMode.Always) || ((ShowUserNotifications == ShowUserNotificationsMode.WhenTotp) && new Kp2aTotp().TryGetAdapter(new PwEntryOutput(activity.Entry, App.Kp2a.CurrentDb)) != null)) { //show the notifications activity.StartNotificationsService(ActivateKeyboard); } else { //to avoid getting into inconsistent state (LastOpenedEntry and Notifications): clear notifications: CopyToClipboardService.CancelNotifications(activity); } if (CloseAfterCreate) { //close activity.CloseAfterTaskComplete(); } }
public override void CompleteOnCreateEntryActivity(EntryActivity activity) { Context ctx = activity; if (ctx == null) { ctx = Application.Context; } if (ShowUserNotifications) { //show the notifications activity.StartNotificationsService(CloseAfterCreate); } else { //to avoid getting into inconsistent state (LastOpenedEntry and Notifications): clear notifications: CopyToClipboardService.CancelNotifications(activity); } if (CloseAfterCreate) { //close activity.CloseAfterTaskComplete(); } }
protected override void OnStart() { base.OnStart(); if (PreferenceManager.GetDefaultSharedPreferences(this) .GetBoolean(GetString(Resource.String.UseKp2aKeyboardInKp2a_key), false)) { CopyToClipboardService.ActivateKeyboard(this); } }
public override void OnReceive(Context context, Intent intent) { String action = intent.Action; //check if we have a last opened entry //this should always be non-null, but if the OS has killed the app, it might occur. if (App.Kp2a.LastOpenedEntry == null) { Intent i = new Intent(context, typeof(AppKilledInfo)); i.SetFlags(ActivityFlags.ClearTask | ActivityFlags.NewTask | ActivityFlags.ExcludeFromRecents); context.StartActivity(i); return; } if (action.Equals(Intents.CopyUsername)) { String username = App.Kp2a.LastOpenedEntry.OutputStrings.ReadSafe(PwDefs.UserNameField); if (username.Length > 0) { CopyToClipboardService.CopyValueToClipboardWithTimeout(context, username); } context.SendBroadcast(new Intent(Intent.ActionCloseSystemDialogs)); //close notification drawer } else if (action.Equals(Intents.CopyPassword)) { String password = App.Kp2a.LastOpenedEntry.OutputStrings.ReadSafe(PwDefs.PasswordField); if (password.Length > 0) { CopyToClipboardService.CopyValueToClipboardWithTimeout(context, password); } context.SendBroadcast(new Intent(Intent.ActionCloseSystemDialogs)); //close notification drawer } else if (action.Equals(Intents.CopyTotp)) { String totp = App.Kp2a.LastOpenedEntry.OutputStrings.ReadSafe(UpdateTotpTimerTask.TotpKey); if (totp.Length > 0) { CopyToClipboardService.CopyValueToClipboardWithTimeout(context, totp); } context.SendBroadcast(new Intent(Intent.ActionCloseSystemDialogs)); //close notification drawer } else if (action.Equals(Intents.CheckKeyboard)) { CopyToClipboardService.ActivateKeyboard(context); } }
public NotificationDeletedBroadcastReceiver(CopyToClipboardService service) { _service = service; }
public StopOnLockBroadcastReceiver(CopyToClipboardService service) { _service = service; }
public ClearClipboardTask(CopyToClipboardService service, String clearText, Handler handler) { _clearText = clearText; _service = service; _handler = handler; }
public void HandleClick() { CopyToClipboardService.CopyValueToClipboardWithTimeout(_context, _stringView.Text); }