mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-22 17:22:17 -05:00
automatically bring up keyboard selection
This commit is contained in:
parent
26064a0327
commit
7c292ebd57
@ -2,26 +2,36 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// Dieser Code wurde von einem Tool generiert.
|
// Dieser Code wurde von einem Tool generiert.
|
||||||
// Laufzeitversion:4.0.30319.296
|
// Laufzeitversion:4.0.30319.18033
|
||||||
//
|
//
|
||||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||||
// der Code erneut generiert wird.
|
// der Code erneut generiert wird.
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
[assembly: Android.Runtime.ResourceDesignerAttribute("KeePassLib2Android.Resource", IsApplication=false)]
|
[assembly: global::Android.Runtime.ResourceDesignerAttribute("KeePassLib2Android.Resource", IsApplication=false)]
|
||||||
|
|
||||||
namespace KeePassLib2Android
|
namespace KeePassLib2Android
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("Novell.MonoDroid.Build.Tasks", "1.0.0.0")]
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
|
||||||
public partial class Resource
|
public partial class Resource
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static Resource()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
public partial class Attribute
|
public partial class Attribute
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static Attribute()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private Attribute()
|
private Attribute()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -33,6 +43,11 @@ namespace KeePassLib2Android
|
|||||||
// aapt resource value: 0x7f020000
|
// aapt resource value: 0x7f020000
|
||||||
public static int library_name = 2130837504;
|
public static int library_name = 2130837504;
|
||||||
|
|
||||||
|
static String()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private String()
|
private String()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,7 @@ namespace keepass2android
|
|||||||
Intent showNotIntent = new Intent(this, typeof(CopyToClipboardService));
|
Intent showNotIntent = new Intent(this, typeof(CopyToClipboardService));
|
||||||
Intent.SetAction(Intents.SHOW_NOTIFICATION);
|
Intent.SetAction(Intents.SHOW_NOTIFICATION);
|
||||||
showNotIntent.PutExtra(KEY_ENTRY, mEntry.Uuid.ToHexString());
|
showNotIntent.PutExtra(KEY_ENTRY, mEntry.Uuid.ToHexString());
|
||||||
|
showNotIntent.PutExtra(KEY_CLOSE_AFTER_CREATE, closeAfterCreate);
|
||||||
|
|
||||||
StartService(showNotIntent);
|
StartService(showNotIntent);
|
||||||
|
|
||||||
|
76
src/keepass2android/Resources/Resource.designer.cs
generated
76
src/keepass2android/Resources/Resource.designer.cs
generated
@ -2,23 +2,28 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// Dieser Code wurde von einem Tool generiert.
|
// Dieser Code wurde von einem Tool generiert.
|
||||||
// Laufzeitversion:4.0.30319.296
|
// Laufzeitversion:4.0.30319.18033
|
||||||
//
|
//
|
||||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||||
// der Code erneut generiert wird.
|
// der Code erneut generiert wird.
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
[assembly: Android.Runtime.ResourceDesignerAttribute("keepass2android.Resource", IsApplication=true)]
|
[assembly: global::Android.Runtime.ResourceDesignerAttribute("keepass2android.Resource", IsApplication=true)]
|
||||||
|
|
||||||
namespace keepass2android
|
namespace keepass2android
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("Novell.MonoDroid.Build.Tasks", "1.0.0.0")]
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
|
||||||
public partial class Resource
|
public partial class Resource
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static Resource()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
public static void UpdateIdValues()
|
public static void UpdateIdValues()
|
||||||
{
|
{
|
||||||
KeePassLib2Android.Resource.String.library_name = keepass2android.Resource.String.library_name;
|
KeePassLib2Android.Resource.String.library_name = keepass2android.Resource.String.library_name;
|
||||||
@ -39,6 +44,11 @@ namespace keepass2android
|
|||||||
// aapt resource value: 0x7f040003
|
// aapt resource value: 0x7f040003
|
||||||
public const int anim_leave_back = 2130968579;
|
public const int anim_leave_back = 2130968579;
|
||||||
|
|
||||||
|
static Animation()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private Animation()
|
private Animation()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -62,6 +72,11 @@ namespace keepass2android
|
|||||||
// aapt resource value: 0x7f0a0001
|
// aapt resource value: 0x7f0a0001
|
||||||
public const int list_size_values = 2131361793;
|
public const int list_size_values = 2131361793;
|
||||||
|
|
||||||
|
static Array()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private Array()
|
private Array()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -70,6 +85,11 @@ namespace keepass2android
|
|||||||
public partial class Attribute
|
public partial class Attribute
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static Attribute()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private Attribute()
|
private Attribute()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -102,6 +122,11 @@ namespace keepass2android
|
|||||||
// aapt resource value: 0x7f090002
|
// aapt resource value: 0x7f090002
|
||||||
public const int sort_default = 2131296258;
|
public const int sort_default = 2131296258;
|
||||||
|
|
||||||
|
static Boolean()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private Boolean()
|
private Boolean()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -152,6 +177,11 @@ namespace keepass2android
|
|||||||
// aapt resource value: 0x7f06000c
|
// aapt resource value: 0x7f06000c
|
||||||
public const int light_gray = 2131099660;
|
public const int light_gray = 2131099660;
|
||||||
|
|
||||||
|
static Color()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private Color()
|
private Color()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -169,6 +199,11 @@ namespace keepass2android
|
|||||||
// aapt resource value: 0x7f070000
|
// aapt resource value: 0x7f070000
|
||||||
public const int key_height = 2131165184;
|
public const int key_height = 2131165184;
|
||||||
|
|
||||||
|
static Dimension()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private Dimension()
|
private Dimension()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -504,6 +539,11 @@ namespace keepass2android
|
|||||||
// aapt resource value: 0x7f02006c
|
// aapt resource value: 0x7f02006c
|
||||||
public const int YellowButton = 2130837612;
|
public const int YellowButton = 2130837612;
|
||||||
|
|
||||||
|
static Drawable()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private Drawable()
|
private Drawable()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -1010,6 +1050,11 @@ namespace keepass2android
|
|||||||
// aapt resource value: 0x7f0d0002
|
// aapt resource value: 0x7f0d0002
|
||||||
public const int version_title = 2131558402;
|
public const int version_title = 2131558402;
|
||||||
|
|
||||||
|
static Id()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private Id()
|
private Id()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -1123,6 +1168,11 @@ namespace keepass2android
|
|||||||
// aapt resource value: 0x7f030022
|
// aapt resource value: 0x7f030022
|
||||||
public const int url_credentials = 2130903074;
|
public const int url_credentials = 2130903074;
|
||||||
|
|
||||||
|
static Layout()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private Layout()
|
private Layout()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -1146,6 +1196,11 @@ namespace keepass2android
|
|||||||
// aapt resource value: 0x7f0c0004
|
// aapt resource value: 0x7f0c0004
|
||||||
public const int password = 2131492868;
|
public const int password = 2131492868;
|
||||||
|
|
||||||
|
static Menu()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private Menu()
|
private Menu()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -2012,6 +2067,11 @@ namespace keepass2android
|
|||||||
// aapt resource value: 0x7f0800b1
|
// aapt resource value: 0x7f0800b1
|
||||||
public const int yes = 2131230897;
|
public const int yes = 2131230897;
|
||||||
|
|
||||||
|
static String()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private String()
|
private String()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -2101,6 +2161,11 @@ namespace keepass2android
|
|||||||
// aapt resource value: 0x7f0b000c
|
// aapt resource value: 0x7f0b000c
|
||||||
public const int WhiteOnDarkSmall = 2131427340;
|
public const int WhiteOnDarkSmall = 2131427340;
|
||||||
|
|
||||||
|
static Style()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private Style()
|
private Style()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -2127,6 +2192,11 @@ namespace keepass2android
|
|||||||
// aapt resource value: 0x7f050005
|
// aapt resource value: 0x7f050005
|
||||||
public const int symbols_shift = 2131034117;
|
public const int symbols_shift = 2131034117;
|
||||||
|
|
||||||
|
static Xml()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
private Xml()
|
private Xml()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -74,18 +74,12 @@ namespace keepass2android
|
|||||||
Android.Util.Log.Debug("DEBUG","Received intent to provide access to entry");
|
Android.Util.Log.Debug("DEBUG","Received intent to provide access to entry");
|
||||||
|
|
||||||
String uuidBytes = intent.GetStringExtra(EntryActivity.KEY_ENTRY);
|
String uuidBytes = intent.GetStringExtra(EntryActivity.KEY_ENTRY);
|
||||||
|
bool closeAfterCreate = intent.GetBooleanExtra(EntryActivity.KEY_CLOSE_AFTER_CREATE, false);
|
||||||
|
|
||||||
PwUuid entryId = PwUuid.Zero;
|
PwUuid entryId = PwUuid.Zero;
|
||||||
if (uuidBytes != null)
|
if (uuidBytes != null)
|
||||||
entryId = new KeePassLib.PwUuid(MemUtil.HexStringToByteArray(uuidBytes));
|
entryId = new KeePassLib.PwUuid(MemUtil.HexStringToByteArray(uuidBytes));
|
||||||
|
|
||||||
/*Android.Util.Log.Debug("DEBUG","Uuid="+uuidBytes);
|
|
||||||
|
|
||||||
|
|
||||||
foreach (PwUuid key in App.getDB().entries.Keys)
|
|
||||||
{
|
|
||||||
Android.Util.Log.Debug("DEBUG",key.ToHexString() + " -> " + App.getDB().entries[key].Uuid.ToHexString());
|
|
||||||
}*/
|
|
||||||
PwEntry entry;
|
PwEntry entry;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -98,7 +92,7 @@ namespace keepass2android
|
|||||||
return StartCommandResult.NotSticky;
|
return StartCommandResult.NotSticky;
|
||||||
}
|
}
|
||||||
|
|
||||||
displayAccessNotifications(entry);
|
displayAccessNotifications(entry, closeAfterCreate);
|
||||||
|
|
||||||
|
|
||||||
return StartCommandResult.RedeliverIntent;
|
return StartCommandResult.RedeliverIntent;
|
||||||
@ -143,7 +137,7 @@ namespace keepass2android
|
|||||||
return PendingIntent.GetBroadcast(this, requestCode, intent, PendingIntentFlags.CancelCurrent);
|
return PendingIntent.GetBroadcast(this, requestCode, intent, PendingIntentFlags.CancelCurrent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayAccessNotifications(PwEntry entry)
|
public void displayAccessNotifications(PwEntry entry, bool closeAfterCreate)
|
||||||
{
|
{
|
||||||
// Notification Manager
|
// Notification Manager
|
||||||
mNM = (NotificationManager)GetSystemService(NotificationService);
|
mNM = (NotificationManager)GetSystemService(NotificationService);
|
||||||
@ -190,6 +184,13 @@ namespace keepass2android
|
|||||||
keyboard.DeleteIntent = createDeleteIntent(NOTIFY_KEYBOARD);
|
keyboard.DeleteIntent = createDeleteIntent(NOTIFY_KEYBOARD);
|
||||||
mNumElementsToWaitFor++;
|
mNumElementsToWaitFor++;
|
||||||
mNM.Notify(NOTIFY_KEYBOARD, keyboard);
|
mNM.Notify(NOTIFY_KEYBOARD, keyboard);
|
||||||
|
|
||||||
|
//if the app is about to be closed again (e.g. after searching for a URL and returning to the browser:
|
||||||
|
// automatically bring up the Keyboard selection dialog
|
||||||
|
if (closeAfterCreate)
|
||||||
|
{
|
||||||
|
ActivateKp2aKeyboard(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -347,7 +348,6 @@ namespace keepass2android
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CopyToClipboardBroadcastReceiver: BroadcastReceiver
|
class CopyToClipboardBroadcastReceiver: BroadcastReceiver
|
||||||
{
|
{
|
||||||
CopyToClipboardService mService;
|
CopyToClipboardService mService;
|
||||||
@ -379,39 +379,10 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
} else if (action.Equals(Intents.CHECK_KEYBOARD))
|
} else if (action.Equals(Intents.CHECK_KEYBOARD))
|
||||||
{
|
{
|
||||||
string currentIme = Android.Provider.Settings.Secure.GetString(
|
CopyToClipboardService.ActivateKp2aKeyboard(mService);
|
||||||
mService.ContentResolver,
|
|
||||||
Android.Provider.Settings.Secure.DefaultInputMethod);
|
|
||||||
|
|
||||||
string kp2aIme = mService.PackageName+"/keepass2android.softkeyboard.KP2AKeyboard";
|
|
||||||
|
|
||||||
InputMethodManager imeManager = (InputMethodManager)mService.ApplicationContext.GetSystemService(Context.InputMethodService);
|
|
||||||
|
|
||||||
if (currentIme == kp2aIme)
|
|
||||||
{
|
|
||||||
imeManager.ToggleSoftInput(ShowSoftInputFlags.Explicit, HideSoftInputFlags.None);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IList<InputMethodInfo> inputMethodProperties = imeManager.EnabledInputMethodList;
|
|
||||||
|
|
||||||
if (!inputMethodProperties.Any(imi => imi.Id.Equals(kp2aIme)))
|
|
||||||
{
|
|
||||||
Toast.MakeText(mService, Resource.String.please_activate_keyboard, ToastLength.Long).Show();
|
|
||||||
Intent settingsIntent = new Intent(Android.Provider.Settings.ActionInputMethodSettings);
|
|
||||||
settingsIntent.SetFlags(ActivityFlags.NewTask);
|
|
||||||
mService.StartActivity(settingsIntent);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (imeManager != null) {
|
|
||||||
imeManager.ShowInputMethodPicker();
|
|
||||||
} else {
|
|
||||||
Toast.MakeText(mService, Resource.String.not_possible_im_picker, ToastLength.Long).Show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NotificationDeletedBroadcastReceiver: BroadcastReceiver
|
class NotificationDeletedBroadcastReceiver: BroadcastReceiver
|
||||||
@ -432,6 +403,47 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
internal static void ActivateKp2aKeyboard(CopyToClipboardService service)
|
||||||
|
{
|
||||||
|
string currentIme = Android.Provider.Settings.Secure.GetString(
|
||||||
|
service.ContentResolver,
|
||||||
|
Android.Provider.Settings.Secure.DefaultInputMethod);
|
||||||
|
|
||||||
|
string kp2aIme = service.PackageName + "/keepass2android.softkeyboard.KP2AKeyboard";
|
||||||
|
|
||||||
|
InputMethodManager imeManager = (InputMethodManager)service.ApplicationContext.GetSystemService(Context.InputMethodService);
|
||||||
|
|
||||||
|
if (currentIme == kp2aIme)
|
||||||
|
{
|
||||||
|
imeManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.None);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
IList<InputMethodInfo> inputMethodProperties = imeManager.EnabledInputMethodList;
|
||||||
|
|
||||||
|
if (!inputMethodProperties.Any(imi => imi.Id.Equals(kp2aIme)))
|
||||||
|
{
|
||||||
|
Toast.MakeText(service, Resource.String.please_activate_keyboard, ToastLength.Long).Show();
|
||||||
|
Intent settingsIntent = new Intent(Android.Provider.Settings.ActionInputMethodSettings);
|
||||||
|
settingsIntent.SetFlags(ActivityFlags.NewTask);
|
||||||
|
service.StartActivity(settingsIntent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (imeManager != null)
|
||||||
|
{
|
||||||
|
imeManager.ShowInputMethodPicker();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Toast.MakeText(service, Resource.String.not_possible_im_picker, ToastLength.Long).Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user