mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-08-13 17:03:49 -04:00
+ Activity informing when app was killed while copy notifications were on
This commit is contained in:
parent
ffc735c02c
commit
3947d8b7a5
46
src/keepass2android/AppKilledInfo.cs
Normal file
46
src/keepass2android/AppKilledInfo.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
using Android.App;
|
||||||
|
using Android.Content;
|
||||||
|
using Android.OS;
|
||||||
|
using Android.Runtime;
|
||||||
|
using Android.Views;
|
||||||
|
using Android.Widget;
|
||||||
|
|
||||||
|
namespace keepass2android
|
||||||
|
{
|
||||||
|
[Activity(Label = AppNames.AppName)]
|
||||||
|
public class AppKilledInfo : Activity, IDialogInterfaceOnDismissListener
|
||||||
|
{
|
||||||
|
protected override void OnCreate(Bundle bundle)
|
||||||
|
{
|
||||||
|
base.OnCreate(bundle);
|
||||||
|
//as we expect this to happen only rarely (having a foreground service running when unlocked),
|
||||||
|
//we don't try to handle this better
|
||||||
|
//But at least explain to the user what happened!
|
||||||
|
((NotificationManager)GetSystemService(Context.NotificationService)).CancelAll();
|
||||||
|
AlertDialog.Builder b = new AlertDialog.Builder(this);
|
||||||
|
b.SetMessage(Resource.String.killed_by_os);
|
||||||
|
b.SetPositiveButton(Resource.String.ok, delegate
|
||||||
|
{
|
||||||
|
Intent i = new Intent(this, typeof(FileSelectActivity));
|
||||||
|
i.AddFlags(ActivityFlags.ClearTask | ActivityFlags.NewTask);
|
||||||
|
StartActivity(i);
|
||||||
|
|
||||||
|
});
|
||||||
|
b.SetNegativeButton(Resource.String.cancel, delegate { });
|
||||||
|
b.SetTitle(AppNames.AppName);
|
||||||
|
b.SetOnDismissListener(this);
|
||||||
|
var dialog = b.Create();
|
||||||
|
dialog.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDismiss(IDialogInterface dialog)
|
||||||
|
{
|
||||||
|
Finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user