Improved password + QuickUnlock screens by introducing AdjustResize (now working with design lib 22.2.1.0)
This commit is contained in:
88
src/keepass2android/FixedDrawerLayout.cs
Normal file
88
src/keepass2android/FixedDrawerLayout.cs
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
using System;
|
||||||
|
using Android.Content;
|
||||||
|
using Android.Graphics;
|
||||||
|
using Android.OS;
|
||||||
|
using Android.Runtime;
|
||||||
|
using Android.Util;
|
||||||
|
|
||||||
|
namespace keepass2android
|
||||||
|
{
|
||||||
|
public class FixedDrawerLayout : Android.Support.V4.Widget.DrawerLayout
|
||||||
|
{
|
||||||
|
private bool _fitsSystemWindows;
|
||||||
|
|
||||||
|
protected FixedDrawerLayout(IntPtr javaReference, JniHandleOwnership transfer)
|
||||||
|
: base(javaReference, transfer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public FixedDrawerLayout(Context context, IAttributeSet attrs, int defStyle)
|
||||||
|
: base(context, attrs, defStyle)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public FixedDrawerLayout(Context context, IAttributeSet attrs)
|
||||||
|
: base(context, attrs)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public FixedDrawerLayout(Context context)
|
||||||
|
: base(context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private int[] mInsets = new int[4];
|
||||||
|
|
||||||
|
protected override bool FitSystemWindows(Rect insets)
|
||||||
|
{
|
||||||
|
if (Build.VERSION.SdkInt >= Build.VERSION_CODES.Kitkat)
|
||||||
|
{
|
||||||
|
// Intentionally do not modify the bottom inset. For some reason,
|
||||||
|
// if the bottom inset is modified, window resizing stops working.
|
||||||
|
// TODO: Figure out why.
|
||||||
|
|
||||||
|
mInsets[0] = insets.Left;
|
||||||
|
mInsets[1] = insets.Top;
|
||||||
|
mInsets[2] = insets.Right;
|
||||||
|
|
||||||
|
insets.Left = 0;
|
||||||
|
insets.Top = 0;
|
||||||
|
insets.Right = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.FitSystemWindows(insets);
|
||||||
|
|
||||||
|
}
|
||||||
|
public int[] GetInsets()
|
||||||
|
{
|
||||||
|
return mInsets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct MeasureArgs
|
||||||
|
{
|
||||||
|
public int ActualHeight;
|
||||||
|
public int ProposedHeight;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler<MeasureArgs> MeasureEvent;
|
||||||
|
|
||||||
|
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
||||||
|
{
|
||||||
|
MeasureArgs args;
|
||||||
|
|
||||||
|
args.ProposedHeight = MeasureSpec.GetSize(heightMeasureSpec);
|
||||||
|
args.ActualHeight = Height;
|
||||||
|
|
||||||
|
|
||||||
|
OnMeasureEvent(args);
|
||||||
|
base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnMeasureEvent(MeasureArgs args)
|
||||||
|
{
|
||||||
|
var handler = MeasureEvent;
|
||||||
|
if (handler != null) handler(this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
64
src/keepass2android/MeasuringRelativeLayout.cs
Normal file
64
src/keepass2android/MeasuringRelativeLayout.cs
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
using System;
|
||||||
|
using Android.Content;
|
||||||
|
using Android.Runtime;
|
||||||
|
using Android.Util;
|
||||||
|
using Android.Widget;
|
||||||
|
|
||||||
|
namespace keepass2android
|
||||||
|
{
|
||||||
|
public class MeasuringRelativeLayout : RelativeLayout
|
||||||
|
{
|
||||||
|
protected MeasuringRelativeLayout(IntPtr javaReference, JniHandleOwnership transfer)
|
||||||
|
: base(javaReference, transfer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public MeasuringRelativeLayout(Context context)
|
||||||
|
: base(context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public MeasuringRelativeLayout(Context context, IAttributeSet attrs)
|
||||||
|
: base(context, attrs)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public MeasuringRelativeLayout(Context context, IAttributeSet attrs, int defStyleAttr)
|
||||||
|
: base(context, attrs, defStyleAttr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public MeasuringRelativeLayout(Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes)
|
||||||
|
: base(context, attrs, defStyleAttr, defStyleRes)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class MeasureArgs
|
||||||
|
{
|
||||||
|
public int ActualHeight;
|
||||||
|
public int ProposedHeight;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler<MeasureArgs> MeasureEvent;
|
||||||
|
|
||||||
|
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
||||||
|
{
|
||||||
|
MeasureArgs args = new MeasureArgs();
|
||||||
|
|
||||||
|
args.ProposedHeight = MeasureSpec.GetSize(heightMeasureSpec);
|
||||||
|
args.ActualHeight = Height;
|
||||||
|
|
||||||
|
|
||||||
|
OnMeasureEvent(args);
|
||||||
|
base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnMeasureEvent(MeasureArgs args)
|
||||||
|
{
|
||||||
|
var handler = MeasureEvent;
|
||||||
|
if (handler != null) handler(this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,7 +38,6 @@ using Android.Graphics;
|
|||||||
using Android.Support.Design.Widget;
|
using Android.Support.Design.Widget;
|
||||||
using Android.Support.V4.Widget;
|
using Android.Support.V4.Widget;
|
||||||
using Android.Support.V7.App;
|
using Android.Support.V7.App;
|
||||||
using Android.Util;
|
|
||||||
using keepass2android;
|
using keepass2android;
|
||||||
using KeePassLib.Keys;
|
using KeePassLib.Keys;
|
||||||
using KeePassLib.Serialization;
|
using KeePassLib.Serialization;
|
||||||
@@ -56,12 +55,14 @@ using Process = Android.OS.Process;
|
|||||||
|
|
||||||
using KeeChallenge;
|
using KeeChallenge;
|
||||||
using AlertDialog = Android.App.AlertDialog;
|
using AlertDialog = Android.App.AlertDialog;
|
||||||
|
using Toolbar = Android.Support.V7.Widget.Toolbar;
|
||||||
|
|
||||||
namespace keepass2android
|
namespace keepass2android
|
||||||
{
|
{
|
||||||
[Activity(Label = "@string/app_name",
|
[Activity(Label = "@string/app_name",
|
||||||
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden,
|
ConfigurationChanges = ConfigChanges.Orientation,
|
||||||
LaunchMode = LaunchMode.SingleInstance,
|
LaunchMode = LaunchMode.SingleInstance,
|
||||||
|
WindowSoftInputMode = SoftInput.AdjustResize,
|
||||||
Theme = "@style/MyTheme_Blue")] /*caution: also contained in AndroidManifest.xml*/
|
Theme = "@style/MyTheme_Blue")] /*caution: also contained in AndroidManifest.xml*/
|
||||||
//TODO: rotating device crashes the app
|
//TODO: rotating device crashes the app
|
||||||
public class PasswordActivity : LockingActivity {
|
public class PasswordActivity : LockingActivity {
|
||||||
@@ -149,7 +150,6 @@ namespace keepass2android
|
|||||||
private const string KeyFileOrProviderKey = "KeyFileOrProviderKey";
|
private const string KeyFileOrProviderKey = "KeyFileOrProviderKey";
|
||||||
|
|
||||||
|
|
||||||
private ActivityDesign _design;
|
|
||||||
private bool _performingLoad;
|
private bool _performingLoad;
|
||||||
private bool _keepPasswordInOnResume;
|
private bool _keepPasswordInOnResume;
|
||||||
private Typeface _passwordFont;
|
private Typeface _passwordFont;
|
||||||
@@ -161,12 +161,12 @@ namespace keepass2android
|
|||||||
public PasswordActivity (IntPtr javaReference, JniHandleOwnership transfer)
|
public PasswordActivity (IntPtr javaReference, JniHandleOwnership transfer)
|
||||||
: base(javaReference, transfer)
|
: base(javaReference, transfer)
|
||||||
{
|
{
|
||||||
_design = new ActivityDesign(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PasswordActivity()
|
public PasswordActivity()
|
||||||
{
|
{
|
||||||
_design = new ActivityDesign(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -680,10 +680,67 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int count = 1;
|
||||||
|
|
||||||
|
private DrawerLayout mDrawerLayout;
|
||||||
|
//private RecyclerView mDrawerList;
|
||||||
|
|
||||||
|
private string mDrawerTitle;
|
||||||
|
private MeasuringRelativeLayout.MeasureArgs _measureArgs;
|
||||||
|
internal class MyActionBarDrawerToggle : ActionBarDrawerToggle
|
||||||
|
{
|
||||||
|
PasswordActivity owner;
|
||||||
|
|
||||||
|
public MyActionBarDrawerToggle(PasswordActivity activity, DrawerLayout layout, int imgRes, int openRes, int closeRes)
|
||||||
|
: base(activity, layout, openRes, closeRes)
|
||||||
|
{
|
||||||
|
owner = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnDrawerClosed(View drawerView)
|
||||||
|
{
|
||||||
|
owner.SupportActionBar.Title = owner.Title;
|
||||||
|
owner.InvalidateOptionsMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnDrawerOpened(View drawerView)
|
||||||
|
{
|
||||||
|
owner.SupportActionBar.Title = owner.mDrawerTitle;
|
||||||
|
owner.InvalidateOptionsMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void UncollapseToolbar()
|
||||||
|
{
|
||||||
|
AppBarLayout appbarLayout = FindViewById<AppBarLayout>(Resource.Id.appbar);
|
||||||
|
var tmp = appbarLayout.LayoutParameters;
|
||||||
|
CoordinatorLayout.LayoutParams p = tmp.JavaCast<CoordinatorLayout.LayoutParams>();
|
||||||
|
var tmp2 = p.Behavior;
|
||||||
|
var behavior = tmp2.JavaCast<AppBarLayout.Behavior>();
|
||||||
|
if (behavior == null)
|
||||||
|
{
|
||||||
|
p.Behavior = behavior = new AppBarLayout.Behavior();
|
||||||
|
}
|
||||||
|
behavior.OnNestedFling(FindViewById<CoordinatorLayout>(Resource.Id.main_content), appbarLayout, null, 0, -10000, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CollapseToolbar()
|
||||||
|
{
|
||||||
|
AppBarLayout appbarLayout = FindViewById<AppBarLayout>(Resource.Id.appbar);
|
||||||
|
ViewGroup.LayoutParams tmp = appbarLayout.LayoutParameters;
|
||||||
|
CoordinatorLayout.LayoutParams p = tmp.JavaCast<CoordinatorLayout.LayoutParams>();
|
||||||
|
var tmp2 = p.Behavior;
|
||||||
|
var behavior = tmp2.JavaCast<AppBarLayout.Behavior>();
|
||||||
|
if (behavior == null)
|
||||||
|
{
|
||||||
|
p.Behavior = behavior = new AppBarLayout.Behavior();
|
||||||
|
}
|
||||||
|
behavior.OnNestedFling(FindViewById<CoordinatorLayout>(Resource.Id.main_content), appbarLayout, null, 0, 200, true);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnCreate(Bundle savedInstanceState)
|
protected override void OnCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
base.OnCreate(savedInstanceState);
|
base.OnCreate(savedInstanceState);
|
||||||
_design.ApplyTheme();
|
|
||||||
|
|
||||||
//use FlagSecure to make sure the last (revealed) character of the master password is not visible in recent apps
|
//use FlagSecure to make sure the last (revealed) character of the master password is not visible in recent apps
|
||||||
if (PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean(
|
if (PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean(
|
||||||
@@ -692,7 +749,6 @@ namespace keepass2android
|
|||||||
Window.SetFlags(WindowManagerFlags.Secure, WindowManagerFlags.Secure);
|
Window.SetFlags(WindowManagerFlags.Secure, WindowManagerFlags.Secure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Intent i = Intent;
|
Intent i = Intent;
|
||||||
|
|
||||||
//only load the AppTask if this is the "first" OnCreate (not because of kill/resume, i.e. savedInstanceState==null)
|
//only load the AppTask if this is the "first" OnCreate (not because of kill/resume, i.e. savedInstanceState==null)
|
||||||
@@ -758,13 +814,10 @@ namespace keepass2android
|
|||||||
App.Kp2a.LockDatabase(false);
|
App.Kp2a.LockDatabase(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SetContentView(Resource.Layout.password);
|
SetContentView(Resource.Layout.password);
|
||||||
|
|
||||||
InitializeToolbar();
|
InitializeToolbar();
|
||||||
|
|
||||||
|
|
||||||
InitializeFilenameView();
|
InitializeFilenameView();
|
||||||
|
|
||||||
if (KeyProviderType == KeyProviders.KeyFile)
|
if (KeyProviderType == KeyProviders.KeyFile)
|
||||||
@@ -772,7 +825,6 @@ namespace keepass2android
|
|||||||
UpdateKeyfileIocView();
|
UpdateKeyfileIocView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var passwordEdit = FindViewById<EditText>(Resource.Id.password_edit);
|
var passwordEdit = FindViewById<EditText>(Resource.Id.password_edit);
|
||||||
passwordEdit.TextChanged +=
|
passwordEdit.TextChanged +=
|
||||||
(sender, args) =>
|
(sender, args) =>
|
||||||
@@ -790,9 +842,6 @@ namespace keepass2android
|
|||||||
FindViewById<EditText>(Resource.Id.pass_otpsecret).TextChanged += (sender, args) => UpdateOkButtonState();
|
FindViewById<EditText>(Resource.Id.pass_otpsecret).TextChanged += (sender, args) => UpdateOkButtonState();
|
||||||
|
|
||||||
passwordEdit.Text = _password;
|
passwordEdit.Text = _password;
|
||||||
passwordEdit.RequestFocus();
|
|
||||||
Window.SetSoftInputMode(SoftInput.StateVisible);
|
|
||||||
|
|
||||||
|
|
||||||
var passwordFont = Typeface.CreateFromAsset(Assets, "SourceCodePro-Regular.ttf");
|
var passwordFont = Typeface.CreateFromAsset(Assets, "SourceCodePro-Regular.ttf");
|
||||||
passwordEdit.Typeface = passwordFont;
|
passwordEdit.Typeface = passwordFont;
|
||||||
@@ -821,6 +870,30 @@ namespace keepass2android
|
|||||||
.PrepareFileUsage(new FileStorageSetupInitiatorActivity(this, OnActivityResult, null), _ioConnection,
|
.PrepareFileUsage(new FileStorageSetupInitiatorActivity(this, OnActivityResult, null), _ioConnection,
|
||||||
RequestCodePrepareDbFile, false);
|
RequestCodePrepareDbFile, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mDrawerTitle = this.Title;
|
||||||
|
mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
|
||||||
|
var rootview = FindViewById<MeasuringRelativeLayout>(Resource.Id.relative_layout);
|
||||||
|
rootview.ViewTreeObserver.GlobalLayout += (sender, args2) =>
|
||||||
|
{
|
||||||
|
Android.Util.Log.Debug("KP2A", "GlobalLayout");
|
||||||
|
var args = _measureArgs;
|
||||||
|
if (args == null)
|
||||||
|
return;
|
||||||
|
Android.Util.Log.Debug("KP2A", "ActualHeight=" + args.ActualHeight);
|
||||||
|
Android.Util.Log.Debug("KP2A", "ProposedHeight=" + args.ProposedHeight);
|
||||||
|
if (args.ActualHeight < args.ProposedHeight)
|
||||||
|
UncollapseToolbar();
|
||||||
|
if (args.ActualHeight > args.ProposedHeight)
|
||||||
|
CollapseToolbar();
|
||||||
|
};
|
||||||
|
rootview.MeasureEvent += (sender, args) =>
|
||||||
|
{
|
||||||
|
//Snackbar.Make(rootview, "height="+args.ActualHeight, Snackbar.LengthLong).Show();
|
||||||
|
this._measureArgs = args;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeNavDrawerButtons()
|
private void InitializeNavDrawerButtons()
|
||||||
@@ -1507,7 +1580,12 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
base.OnResume();
|
base.OnResume();
|
||||||
|
|
||||||
_design.ReapplyTheme();
|
EditText pwd = FindViewById<EditText>(Resource.Id.password_edit);
|
||||||
|
pwd.PostDelayed(() =>
|
||||||
|
{
|
||||||
|
InputMethodManager keyboard = (InputMethodManager)GetSystemService(Context.InputMethodService);
|
||||||
|
keyboard.ShowSoftInput(pwd, 0);
|
||||||
|
}, 50);
|
||||||
|
|
||||||
View killButton = FindViewById(Resource.Id.kill_app);
|
View killButton = FindViewById(Resource.Id.kill_app);
|
||||||
if (PreferenceManager.GetDefaultSharedPreferences(this)
|
if (PreferenceManager.GetDefaultSharedPreferences(this)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:configChanges="keyboardHidden|orientation" android:label="@string/app_name" android:theme="@style/MyTheme_Blue" android:name="keepass2android.PasswordActivity" android:windowSoftInputMode="adjustResize">
|
<activity android:configChanges="orientation" android:label="@string/app_name" android:theme="@style/MyTheme_Blue" android:name="keepass2android.PasswordActivity" android:windowSoftInputMode="adjustResize">
|
||||||
<intent-filter android:label="@string/app_name">
|
<intent-filter android:label="@string/app_name">
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:configChanges="keyboardHidden|orientation" android:label="@string/app_name" android:theme="@style/MyTheme" android:name="keepass2android.PasswordActivity" android:windowSoftInputMode="adjustResize">
|
<activity android:configChanges="orientation" android:label="@string/app_name" android:theme="@style/MyTheme_Blue" android:name="keepass2android.PasswordActivity" android:windowSoftInputMode="adjustResize">
|
||||||
<intent-filter android:label="@string/app_name">
|
<intent-filter android:label="@string/app_name">
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|||||||
@@ -24,29 +24,30 @@ using Android.Widget;
|
|||||||
using Android.Content.PM;
|
using Android.Content.PM;
|
||||||
using KeePassLib.Keys;
|
using KeePassLib.Keys;
|
||||||
using Android.Preferences;
|
using Android.Preferences;
|
||||||
|
using Android.Runtime;
|
||||||
|
using Android.Support.Design.Widget;
|
||||||
using Android.Views.InputMethods;
|
using Android.Views.InputMethods;
|
||||||
using KeePassLib.Serialization;
|
using KeePassLib.Serialization;
|
||||||
|
|
||||||
namespace keepass2android
|
namespace keepass2android
|
||||||
{
|
{
|
||||||
[Activity(Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden,
|
[Activity(Label = "@string/app_name",
|
||||||
|
ConfigurationChanges = ConfigChanges.Orientation,
|
||||||
|
WindowSoftInputMode = SoftInput.AdjustResize,
|
||||||
|
MainLauncher = false,
|
||||||
Theme = "@style/MyTheme_Blue")]
|
Theme = "@style/MyTheme_Blue")]
|
||||||
public class QuickUnlock : LifecycleDebugActivity
|
public class QuickUnlock : LifecycleDebugActivity
|
||||||
{
|
{
|
||||||
private IOConnectionInfo _ioc;
|
private IOConnectionInfo _ioc;
|
||||||
private QuickUnlockBroadcastReceiver _intentReceiver;
|
private QuickUnlockBroadcastReceiver _intentReceiver;
|
||||||
|
|
||||||
private ActivityDesign _design;
|
|
||||||
|
|
||||||
public QuickUnlock()
|
public QuickUnlock()
|
||||||
{
|
{
|
||||||
_design = new ActivityDesign(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnCreate(Bundle bundle)
|
protected override void OnCreate(Bundle bundle)
|
||||||
{
|
{
|
||||||
base.OnCreate(bundle);
|
base.OnCreate(bundle);
|
||||||
_design.ApplyTheme();
|
|
||||||
|
|
||||||
//use FlagSecure to make sure the last (revealed) character of the password is not visible in recent apps
|
//use FlagSecure to make sure the last (revealed) character of the password is not visible in recent apps
|
||||||
if (PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean(
|
if (PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean(
|
||||||
@@ -63,7 +64,6 @@ namespace keepass2android
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SetContentView(Resource.Layout.QuickUnlock);
|
SetContentView(Resource.Layout.QuickUnlock);
|
||||||
|
|
||||||
if (App.Kp2a.GetDb().KpDatabase.Name != "")
|
if (App.Kp2a.GetDb().KpDatabase.Name != "")
|
||||||
@@ -122,8 +122,10 @@ namespace keepass2android
|
|||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.AddAction(Intents.DatabaseLocked);
|
filter.AddAction(Intents.DatabaseLocked);
|
||||||
RegisterReceiver(_intentReceiver, filter);
|
RegisterReceiver(_intentReceiver, filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void OnUnlock(int quickUnlockLength, EditText pwd)
|
private void OnUnlock(int quickUnlockLength, EditText pwd)
|
||||||
{
|
{
|
||||||
KcpPassword kcpPassword = (KcpPassword) App.Kp2a.GetDb().KpDatabase.MasterKey.GetUserKey(typeof (KcpPassword));
|
KcpPassword kcpPassword = (KcpPassword) App.Kp2a.GetDb().KpDatabase.MasterKey.GetUserKey(typeof (KcpPassword));
|
||||||
@@ -151,8 +153,6 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
base.OnResume();
|
base.OnResume();
|
||||||
|
|
||||||
_design.ReapplyTheme();
|
|
||||||
|
|
||||||
CheckIfUnloaded();
|
CheckIfUnloaded();
|
||||||
|
|
||||||
EditText pwd = (EditText) FindViewById(Resource.Id.QuickUnlock_password);
|
EditText pwd = (EditText) FindViewById(Resource.Id.QuickUnlock_password);
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:fitsSystemWindows="true">
|
||||||
|
<keepass2android.MeasuringRelativeLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent"
|
||||||
|
android:id="@+id/relative_layout">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/top"
|
android:id="@+id/top"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -150,4 +156,5 @@ android:paddingRight="16dp"
|
|||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</keepass2android.MeasuringRelativeLayout>
|
||||||
|
</LinearLayout>
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<keepass2android.FixedDrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/drawer_layout"
|
android:id="@+id/drawer_layout"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
<!-- activity view -->
|
<!-- activity view -->
|
||||||
<RelativeLayout
|
<keepass2android.MeasuringRelativeLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent"
|
||||||
|
android:id="@+id/relative_layout"
|
||||||
|
android:background="#ffffffff">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/top"
|
android:id="@+id/top"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -42,7 +44,6 @@
|
|||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_above="@id/bottom_bar"
|
android:layout_above="@id/bottom_bar"
|
||||||
android:background="#b8b8b8" />
|
android:background="#b8b8b8" />
|
||||||
|
|
||||||
<android.support.design.widget.CoordinatorLayout
|
<android.support.design.widget.CoordinatorLayout
|
||||||
android:id="@+id/main_content"
|
android:id="@+id/main_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -108,11 +109,7 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
|
|
||||||
android:paddingTop="16dp">
|
android:paddingTop="16dp">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/password_label"
|
android:id="@+id/password_label"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -123,22 +120,24 @@
|
|||||||
android:id="@+id/password_mode_spinner"
|
android:id="@+id/password_mode_spinner"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:entries="@array/password_modes"
|
android:layout_marginLeft="-8dp"
|
||||||
/>
|
android:entries="@array/password_modes" />
|
||||||
|
<View
|
||||||
|
android:id="@+id/line_below_spinner"
|
||||||
|
android:background="#e0e0e0ff"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="1dip"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_centerVertical="true" />
|
||||||
<TextView
|
<TextView
|
||||||
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:text="@string/hint_login_pass" />
|
android:text="@string/hint_login_pass" />
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
>
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
@@ -150,9 +149,8 @@
|
|||||||
android:paddingTop="0dp"
|
android:paddingTop="0dp"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
android:hint="@string/hint_login_pass" />
|
android:hint="@string/hint_login_pass" />
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -166,13 +164,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/ic_menu_view"
|
android:src="@drawable/ic_menu_view"
|
||||||
android:background="?android:selectableItemBackground" />
|
android:background="?android:selectableItemBackground" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/keyfileLine"
|
android:id="@+id/keyfileLine"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
@@ -180,56 +174,42 @@
|
|||||||
android:paddingTop="16dp"
|
android:paddingTop="16dp"
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/keyfile_heading"
|
android:id="@+id/keyfile_heading"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/keyfile_heading" />
|
android:text="@string/keyfile_heading" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/filestorage_logo"
|
android:id="@+id/filestorage_logo"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/ic_storage_file"
|
android:src="@drawable/ic_storage_file"
|
||||||
android:padding="5dp"
|
android:padding="5dp" />
|
||||||
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/filestorage_label"
|
android:id="@+id/filestorage_label"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
|
||||||
android:text="Local file (TODO!)"
|
android:text="Local file (TODO!)"
|
||||||
android:textSize="16dp" >
|
android:textSize="16dp" />
|
||||||
</TextView>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/label_keyfilename"
|
android:id="@+id/label_keyfilename"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="[path]"
|
android:text="[path]"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp" />
|
||||||
/>
|
<Button
|
||||||
|
android:id="@+id/btn_change_location"
|
||||||
<Button android:id="@+id/btn_change_location"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:text="@string/button_change_location"
|
android:text="@string/button_change_location"
|
||||||
style="@style/TextAppearance_SubElement"
|
style="@style/TextAppearance_SubElement" />
|
||||||
/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/otpView"
|
android:id="@+id/otpView"
|
||||||
@@ -238,19 +218,17 @@
|
|||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
>
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/otpInitView"
|
android:id="@+id/otpInitView"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
>
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/init_otp"
|
android:id="@+id/init_otp"
|
||||||
android:text="@string/init_otp"
|
android:text="@string/init_otp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/otps_pending"
|
android:id="@+id/otps_pending"
|
||||||
android:text="@string/otps_pending"
|
android:text="@string/otps_pending"
|
||||||
@@ -262,14 +240,12 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/otp_expl"
|
android:id="@+id/otp_expl"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/otp_explanation" />
|
android:text="@string/otp_explanation" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/otp1"
|
android:id="@+id/otp1"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
@@ -303,9 +279,7 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true" />
|
android:singleLine="true" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/otpSecretLine"
|
android:id="@+id/otpSecretLine"
|
||||||
@@ -323,8 +297,7 @@
|
|||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/otpsecret_format_spinner"
|
android:id="@+id/otpsecret_format_spinner"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content" />
|
||||||
/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/kill_app"
|
android:id="@+id/kill_app"
|
||||||
@@ -338,19 +311,15 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:text="@string/enable_quickunlock" />
|
android:text="@string/enable_quickunlock" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/spacing"
|
android:id="@+id/spacing"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="200dp"
|
android:layout_height="200dp"
|
||||||
android:background="#0000" />
|
android:background="#0000" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</android.support.v4.widget.NestedScrollView>
|
</android.support.v4.widget.NestedScrollView>
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
|
</keepass2android.MeasuringRelativeLayout>
|
||||||
</RelativeLayout>
|
|
||||||
<android.support.design.widget.NavigationView
|
<android.support.design.widget.NavigationView
|
||||||
android:id="@+id/navigation"
|
android:id="@+id/navigation"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -373,8 +342,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:src="@drawable/navheader_bg"
|
android:src="@drawable/navheader_bg" />
|
||||||
/>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -383,9 +351,8 @@
|
|||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:textColor="#fff"
|
android:textColor="#fff"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_marginBottom="16dp"/>
|
android:layout_marginBottom="16dp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_nav_change_db"
|
android:id="@+id/btn_nav_change_db"
|
||||||
android:text="@string/menu_change_db"
|
android:text="@string/menu_change_db"
|
||||||
@@ -396,19 +363,16 @@
|
|||||||
android:drawableLeft="@drawable/ic_nav_settings"
|
android:drawableLeft="@drawable/ic_nav_settings"
|
||||||
android:text="@string/menu_app_settings"
|
android:text="@string/menu_app_settings"
|
||||||
style="@style/NavDrawerButton" />
|
style="@style/NavDrawerButton" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_nav_donate"
|
android:id="@+id/btn_nav_donate"
|
||||||
android:drawableLeft="@drawable/ic_nav_donate"
|
android:drawableLeft="@drawable/ic_nav_donate"
|
||||||
android:text="@string/menu_donate"
|
android:text="@string/menu_donate"
|
||||||
style="@style/NavDrawerButton" />
|
style="@style/NavDrawerButton" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_nav_about"
|
android:id="@+id/btn_nav_about"
|
||||||
android:drawableLeft="@drawable/ic_nav_about"
|
android:drawableLeft="@drawable/ic_nav_about"
|
||||||
android:text="@string/menu_about"
|
android:text="@string/menu_about"
|
||||||
style="@style/NavDrawerButton" />
|
style="@style/NavDrawerButton" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</android.support.design.widget.NavigationView>
|
</android.support.design.widget.NavigationView>
|
||||||
</android.support.v4.widget.DrawerLayout>
|
</keepass2android.FixedDrawerLayout>
|
||||||
@@ -137,8 +137,8 @@
|
|||||||
<Compile Include="icons\DrawableFactory.cs" />
|
<Compile Include="icons\DrawableFactory.cs" />
|
||||||
<Compile Include="icons\Icons.cs" />
|
<Compile Include="icons\Icons.cs" />
|
||||||
<Compile Include="KeeChallenge.cs" />
|
<Compile Include="KeeChallenge.cs" />
|
||||||
<Compile Include="MainActivity.cs" />
|
<Compile Include="FixedDrawerLayout.cs" />
|
||||||
<Compile Include="MyRelativeLayout.cs" />
|
<Compile Include="MeasuringRelativeLayout.cs" />
|
||||||
<Compile Include="NfcOtpActivity.cs" />
|
<Compile Include="NfcOtpActivity.cs" />
|
||||||
<Compile Include="pluginhost\PluginArrayAdapter.cs" />
|
<Compile Include="pluginhost\PluginArrayAdapter.cs" />
|
||||||
<Compile Include="pluginhost\PluginDatabase.cs" />
|
<Compile Include="pluginhost\PluginDatabase.cs" />
|
||||||
@@ -1278,9 +1278,4 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable-xhdpi\oktoberfest.png" />
|
<AndroidResource Include="Resources\drawable-xhdpi\oktoberfest.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<AndroidResource Include="Resources\layout\Main.xml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</AndroidResource>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user