migrate preferences to AndroidX, separate one large settings fragment into many smaller ones to get rid of "ToolbarPreference" workaround
This commit is contained in:
		| @@ -21,10 +21,7 @@ namespace keepass2android | ||||
| 		{ | ||||
| 			if ((_dialog == null) || (_dialog.IsShowing == false)) | ||||
| 			{ | ||||
| 				if (new ActivityDesign(this).UseDarkTheme) | ||||
| 					_dialog = new AboutDialog(this, Android.Resource.Style.ThemeHoloNoActionBarFullscreen); | ||||
| 				else | ||||
| 					_dialog = new AboutDialog(this, Android.Resource.Style.ThemeHoloLightNoActionBarFullscreen); | ||||
| 				_dialog = new AboutDialog(this); | ||||
| 				_dialog.SetOnDismissListener(this); | ||||
| 				_dialog.Show(); | ||||
| 			} | ||||
|   | ||||
| @@ -24,33 +24,36 @@ using Android.Runtime; | ||||
|  | ||||
| namespace keepass2android | ||||
| { | ||||
| 				 | ||||
| 	public abstract class LifecycleAwareActivity : AndroidX.AppCompat.App.AppCompatActivity | ||||
|  | ||||
|     public abstract class LifecycleAwareActivity : AndroidX.AppCompat.App.AppCompatActivity | ||||
|     { | ||||
| 		protected override void AttachBaseContext(Context baseContext) | ||||
| 		{ | ||||
| 			base.AttachBaseContext(LocaleManager.setLocale(baseContext)); | ||||
| 		} | ||||
| 		protected LifecycleAwareActivity (IntPtr javaReference, JniHandleOwnership transfer) | ||||
| 			: base(javaReference, transfer) | ||||
| 		{ | ||||
| 			 | ||||
| 		} | ||||
|         protected override void AttachBaseContext(Context baseContext) | ||||
|         { | ||||
|             base.AttachBaseContext(LocaleManager.setLocale(baseContext)); | ||||
|         } | ||||
|  | ||||
| 		protected LifecycleAwareActivity() | ||||
| 		{ | ||||
| 		} | ||||
|         protected LifecycleAwareActivity(IntPtr javaReference, JniHandleOwnership transfer) | ||||
|             : base(javaReference, transfer) | ||||
|         { | ||||
|  | ||||
|         } | ||||
|  | ||||
|         protected LifecycleAwareActivity() | ||||
|         { | ||||
|         } | ||||
|  | ||||
|  | ||||
| 		string _className; | ||||
| 		string ClassName | ||||
| 		{ | ||||
| 			get { | ||||
| 				if (_className == null) | ||||
| 					_className = GetType().Name; | ||||
| 				return _className; | ||||
| 			} | ||||
| 		} | ||||
|         string _className; | ||||
|  | ||||
|         string ClassName | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 if (_className == null) | ||||
|                     _className = GetType().Name; | ||||
|                 return _className; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         public string MyDebugName | ||||
|         { | ||||
| @@ -60,60 +63,87 @@ namespace keepass2android | ||||
|         private static int staticCount = 0; | ||||
|  | ||||
|         private int ID = staticCount++; | ||||
|  | ||||
|         protected override void OnNewIntent(Intent intent) | ||||
|         { | ||||
|             base.OnNewIntent(intent); | ||||
|             Kp2aLog.Log(ClassName + ".OnNewIntent " + ID); | ||||
| 		} | ||||
|         } | ||||
|  | ||||
|         public Action<Bundle>? OnCreateListener { get; set; } | ||||
|         public Action<Bundle>? OnSaveInstanceStateListener { get; set; } | ||||
|  | ||||
|         public Func<bool?>? OnSupportNavigateUpListener { get; set; } | ||||
|  | ||||
|         public override bool OnSupportNavigateUp() | ||||
|         { | ||||
|             bool baseRes = base.OnSupportNavigateUp(); | ||||
|             bool? res = OnSupportNavigateUpListener?.Invoke(); | ||||
|             if (res != null) | ||||
|                 return res.Value; | ||||
|             return baseRes; | ||||
|         } | ||||
|  | ||||
|         public Action? OnResumeListener { get; set; } | ||||
|  | ||||
|         protected override void OnResume() | ||||
| 		{ | ||||
| 			base.OnResume(); | ||||
| 			Kp2aLog.Log(ClassName+".OnResume " + ID); | ||||
| 			if (App.Kp2a.CurrentDb== null) | ||||
| 			{ | ||||
| 				Kp2aLog.Log(" DB null" + " " + ID); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				Kp2aLog.Log(" DatabaseIsUnlocked=" + App.Kp2a.DatabaseIsUnlocked + " " + ID); | ||||
| 			} | ||||
| 		} | ||||
|         { | ||||
|             base.OnResume(); | ||||
|             OnResumeListener?.Invoke(); | ||||
|  | ||||
| 		protected override void OnStart() | ||||
| 		{ | ||||
| 		    ProgressTask.SetNewActiveActivity(this); | ||||
| 			base.OnStart(); | ||||
| 			Kp2aLog.Log(ClassName+".OnStart" + " " + ID); | ||||
| 		} | ||||
|  | ||||
| 		protected override void OnCreate(Bundle bundle) | ||||
| 		{ | ||||
| 			 | ||||
| 			base.OnCreate(bundle); | ||||
| 			 | ||||
| 			Kp2aLog.Log(ClassName+".OnCreate" + " " + ID); | ||||
| 			Kp2aLog.Log(ClassName+":apptask="+Intent.GetStringExtra("KP2A_APP_TASK_TYPE") + " " + ID); | ||||
| 		} | ||||
|  | ||||
| 		protected override void OnDestroy() | ||||
| 		{ | ||||
| 			base.OnDestroy(); | ||||
| 			Kp2aLog.Log(ClassName+".OnDestroy"+IsFinishing.ToString() + " " + ID); | ||||
| 		} | ||||
|  | ||||
| 		protected override void OnPause() | ||||
| 		{ | ||||
| 			base.OnPause(); | ||||
| 			Kp2aLog.Log(ClassName+".OnPause" + " " + ID); | ||||
| 		} | ||||
|  | ||||
| 		protected override void OnStop() | ||||
| 		{ | ||||
| 			base.OnStop(); | ||||
| 			Kp2aLog.Log(ClassName+".OnStop" + " " + ID); | ||||
| 		    ProgressTask.RemoveActiveActivity(this); | ||||
|             Kp2aLog.Log(ClassName + ".OnResume " + ID); | ||||
|             if (App.Kp2a.CurrentDb == null) | ||||
|             { | ||||
|                 Kp2aLog.Log(" DB null" + " " + ID); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 Kp2aLog.Log(" DatabaseIsUnlocked=" + App.Kp2a.DatabaseIsUnlocked + " " + ID); | ||||
|             } | ||||
|         } | ||||
| 	} | ||||
|  | ||||
|         protected override void OnStart() | ||||
|         { | ||||
|             ProgressTask.SetNewActiveActivity(this); | ||||
|             base.OnStart(); | ||||
|             Kp2aLog.Log(ClassName + ".OnStart" + " " + ID); | ||||
|         } | ||||
|  | ||||
|         protected override void OnCreate(Bundle bundle) | ||||
|         { | ||||
|  | ||||
|             base.OnCreate(bundle); | ||||
|  | ||||
|             OnCreateListener?.Invoke(bundle); | ||||
|  | ||||
|             Kp2aLog.Log(ClassName + ".OnCreate" + " " + ID); | ||||
|             Kp2aLog.Log(ClassName + ":apptask=" + Intent.GetStringExtra("KP2A_APP_TASK_TYPE") + " " + ID); | ||||
|         } | ||||
|  | ||||
|         protected override void OnDestroy() | ||||
|         { | ||||
|             base.OnDestroy(); | ||||
|             Kp2aLog.Log(ClassName + ".OnDestroy" + IsFinishing.ToString() + " " + ID); | ||||
|         } | ||||
|  | ||||
|         protected override void OnPause() | ||||
|         { | ||||
|             base.OnPause(); | ||||
|             Kp2aLog.Log(ClassName + ".OnPause" + " " + ID); | ||||
|         } | ||||
|  | ||||
|         protected override void OnStop() | ||||
|         { | ||||
|             base.OnStop(); | ||||
|             Kp2aLog.Log(ClassName + ".OnStop" + " " + ID); | ||||
|             ProgressTask.RemoveActiveActivity(this); | ||||
|         } | ||||
|  | ||||
|         protected override void OnSaveInstanceState(Bundle outState) | ||||
|         { | ||||
|             base.OnSaveInstanceState(outState); | ||||
|             OnSaveInstanceStateListener?.Invoke(outState); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -0,0 +1,32 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!-- | ||||
|   | ||||
|       | ||||
|  This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin. | ||||
|  | ||||
|   Keepass2Android is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 2 of the License, or | ||||
|   (at your option) any later version. | ||||
|  | ||||
|   Keepass2Android is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
|  | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with Keepass2Android.  If not, see <http://www.gnu.org/licenses/>. | ||||
| --> | ||||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|   android:layout_width="fill_parent" | ||||
|   android:layout_height="fill_parent"> | ||||
| 	<EditText android:id="@+id/rounds"  | ||||
| 	  android:hint="@string/rounds_hint" | ||||
| 	  android:layout_height="wrap_content" | ||||
| 	  android:layout_width="fill_parent" | ||||
| 	  android:inputType="number"/>  | ||||
| 	<TextView android:id="@+id/rounds_explaination"  | ||||
| 	  android:layout_height="wrap_content" | ||||
| 	  android:layout_width="wrap_content"  | ||||
| 	  android:layout_below="@id/rounds"/> | ||||
| </RelativeLayout> | ||||
| @@ -1,16 +1,9 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|               android:layout_width="match_parent" | ||||
|               android:layout_height="match_parent"> | ||||
|  | ||||
|   <FrameLayout | ||||
|     android:id="@+id/settings" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:background="@color/bgColorLight" | ||||
|     android:orientation="vertical"> | ||||
|     <include | ||||
|         android:id="@+id/mytoolbar" | ||||
|         layout="@layout/toolbar" /> | ||||
|     <fragment | ||||
|         android:name="keepass2android.SettingsFragment" | ||||
|         android:id="@+id/settings_fragment" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="match_parent" | ||||
|         android:layout_below="@id/mytoolbar" /> | ||||
| </RelativeLayout> | ||||
|     android:layout_height="match_parent" /> | ||||
| </LinearLayout> | ||||
| @@ -0,0 +1,143 @@ | ||||
| <resources> | ||||
|     <color name="md_theme_primary">#ACE668</color> | ||||
|     <color name="md_theme_onPrimary">#1E3700</color> | ||||
|     <color name="md_theme_primaryContainer">#84BB43</color> | ||||
|     <color name="md_theme_onPrimaryContainer">#132600</color> | ||||
|     <color name="md_theme_secondary">#99CBFF</color> | ||||
|     <color name="md_theme_onSecondary">#003355</color> | ||||
|     <color name="md_theme_secondaryContainer">#006DAE</color> | ||||
|     <color name="md_theme_onSecondaryContainer">#FFFFFF</color> | ||||
|     <color name="md_theme_tertiary">#4CF0B1</color> | ||||
|     <color name="md_theme_onTertiary">#003825</color> | ||||
|     <color name="md_theme_tertiaryContainer">#00C48B</color> | ||||
|     <color name="md_theme_onTertiaryContainer">#002819</color> | ||||
|     <color name="md_theme_error">#FFB4AB</color> | ||||
|     <color name="md_theme_onError">#690005</color> | ||||
|     <color name="md_theme_errorContainer">#93000A</color> | ||||
|     <color name="md_theme_onErrorContainer">#FFDAD6</color> | ||||
|     <color name="md_theme_background">#11150C</color> | ||||
|     <color name="md_theme_onBackground">#E1E4D6</color> | ||||
|     <color name="md_theme_surface">#11150C</color> | ||||
|     <color name="md_theme_onSurface">#E1E4D6</color> | ||||
|     <color name="md_theme_surfaceVariant">#424939</color> | ||||
|     <color name="md_theme_onSurfaceVariant">#C2C9B4</color> | ||||
|     <color name="md_theme_outline">#8C9380</color> | ||||
|     <color name="md_theme_outlineVariant">#424939</color> | ||||
|     <color name="md_theme_scrim">#000000</color> | ||||
|     <color name="md_theme_inverseSurface">#E1E4D6</color> | ||||
|     <color name="md_theme_inverseOnSurface">#2E3228</color> | ||||
|     <color name="md_theme_inversePrimary">#3E6A00</color> | ||||
|     <color name="md_theme_primaryFixed">#B9F474</color> | ||||
|     <color name="md_theme_onPrimaryFixed">#0F2000</color> | ||||
|     <color name="md_theme_primaryFixedDim">#9ED75B</color> | ||||
|     <color name="md_theme_onPrimaryFixedVariant">#2E4F00</color> | ||||
|     <color name="md_theme_secondaryFixed">#CFE5FF</color> | ||||
|     <color name="md_theme_onSecondaryFixed">#001D34</color> | ||||
|     <color name="md_theme_secondaryFixedDim">#99CBFF</color> | ||||
|     <color name="md_theme_onSecondaryFixedVariant">#004A78</color> | ||||
|     <color name="md_theme_tertiaryFixed">#5DFDBE</color> | ||||
|     <color name="md_theme_onTertiaryFixed">#002114</color> | ||||
|     <color name="md_theme_tertiaryFixedDim">#36E0A3</color> | ||||
|     <color name="md_theme_onTertiaryFixedVariant">#005138</color> | ||||
|     <color name="md_theme_surfaceDim">#11150C</color> | ||||
|     <color name="md_theme_surfaceBright">#373A31</color> | ||||
|     <color name="md_theme_surfaceContainerLowest">#0C0F08</color> | ||||
|     <color name="md_theme_surfaceContainerLow">#191D14</color> | ||||
|     <color name="md_theme_surfaceContainer">#1D2118</color> | ||||
|     <color name="md_theme_surfaceContainerHigh">#282B22</color> | ||||
|     <color name="md_theme_surfaceContainerHighest">#32362C</color> | ||||
|     <color name="md_theme_primary_mediumContrast">#ACE668</color> | ||||
|     <color name="md_theme_onPrimary_mediumContrast">#122500</color> | ||||
|     <color name="md_theme_primaryContainer_mediumContrast">#84BB43</color> | ||||
|     <color name="md_theme_onPrimaryContainer_mediumContrast">#000000</color> | ||||
|     <color name="md_theme_secondary_mediumContrast">#A2CFFF</color> | ||||
|     <color name="md_theme_onSecondary_mediumContrast">#00182B</color> | ||||
|     <color name="md_theme_secondaryContainer_mediumContrast">#3F96DE</color> | ||||
|     <color name="md_theme_onSecondaryContainer_mediumContrast">#000000</color> | ||||
|     <color name="md_theme_tertiary_mediumContrast">#4CF0B1</color> | ||||
|     <color name="md_theme_onTertiary_mediumContrast">#002618</color> | ||||
|     <color name="md_theme_tertiaryContainer_mediumContrast">#00C48B</color> | ||||
|     <color name="md_theme_onTertiaryContainer_mediumContrast">#000000</color> | ||||
|     <color name="md_theme_error_mediumContrast">#FFBAB1</color> | ||||
|     <color name="md_theme_onError_mediumContrast">#370001</color> | ||||
|     <color name="md_theme_errorContainer_mediumContrast">#FF5449</color> | ||||
|     <color name="md_theme_onErrorContainer_mediumContrast">#000000</color> | ||||
|     <color name="md_theme_background_mediumContrast">#11150C</color> | ||||
|     <color name="md_theme_onBackground_mediumContrast">#E1E4D6</color> | ||||
|     <color name="md_theme_surface_mediumContrast">#11150C</color> | ||||
|     <color name="md_theme_onSurface_mediumContrast">#FAFCEE</color> | ||||
|     <color name="md_theme_surfaceVariant_mediumContrast">#424939</color> | ||||
|     <color name="md_theme_onSurfaceVariant_mediumContrast">#C7CDB8</color> | ||||
|     <color name="md_theme_outline_mediumContrast">#9FA592</color> | ||||
|     <color name="md_theme_outlineVariant_mediumContrast">#7F8673</color> | ||||
|     <color name="md_theme_scrim_mediumContrast">#000000</color> | ||||
|     <color name="md_theme_inverseSurface_mediumContrast">#E1E4D6</color> | ||||
|     <color name="md_theme_inverseOnSurface_mediumContrast">#282B22</color> | ||||
|     <color name="md_theme_inversePrimary_mediumContrast">#2F5100</color> | ||||
|     <color name="md_theme_primaryFixed_mediumContrast">#B9F474</color> | ||||
|     <color name="md_theme_onPrimaryFixed_mediumContrast">#081400</color> | ||||
|     <color name="md_theme_primaryFixedDim_mediumContrast">#9ED75B</color> | ||||
|     <color name="md_theme_onPrimaryFixedVariant_mediumContrast">#223D00</color> | ||||
|     <color name="md_theme_secondaryFixed_mediumContrast">#CFE5FF</color> | ||||
|     <color name="md_theme_onSecondaryFixed_mediumContrast">#001223</color> | ||||
|     <color name="md_theme_secondaryFixedDim_mediumContrast">#99CBFF</color> | ||||
|     <color name="md_theme_onSecondaryFixedVariant_mediumContrast">#00395E</color> | ||||
|     <color name="md_theme_tertiaryFixed_mediumContrast">#5DFDBE</color> | ||||
|     <color name="md_theme_onTertiaryFixed_mediumContrast">#00150C</color> | ||||
|     <color name="md_theme_tertiaryFixedDim_mediumContrast">#36E0A3</color> | ||||
|     <color name="md_theme_onTertiaryFixedVariant_mediumContrast">#003F2A</color> | ||||
|     <color name="md_theme_surfaceDim_mediumContrast">#11150C</color> | ||||
|     <color name="md_theme_surfaceBright_mediumContrast">#373A31</color> | ||||
|     <color name="md_theme_surfaceContainerLowest_mediumContrast">#0C0F08</color> | ||||
|     <color name="md_theme_surfaceContainerLow_mediumContrast">#191D14</color> | ||||
|     <color name="md_theme_surfaceContainer_mediumContrast">#1D2118</color> | ||||
|     <color name="md_theme_surfaceContainerHigh_mediumContrast">#282B22</color> | ||||
|     <color name="md_theme_surfaceContainerHighest_mediumContrast">#32362C</color> | ||||
|     <color name="md_theme_primary_highContrast">#F4FFE0</color> | ||||
|     <color name="md_theme_onPrimary_highContrast">#000000</color> | ||||
|     <color name="md_theme_primaryContainer_highContrast">#A2DC5F</color> | ||||
|     <color name="md_theme_onPrimaryContainer_highContrast">#000000</color> | ||||
|     <color name="md_theme_secondary_highContrast">#FAFAFF</color> | ||||
|     <color name="md_theme_onSecondary_highContrast">#000000</color> | ||||
|     <color name="md_theme_secondaryContainer_highContrast">#A2CFFF</color> | ||||
|     <color name="md_theme_onSecondaryContainer_highContrast">#000000</color> | ||||
|     <color name="md_theme_tertiary_highContrast">#EEFFF3</color> | ||||
|     <color name="md_theme_onTertiary_highContrast">#000000</color> | ||||
|     <color name="md_theme_tertiaryContainer_highContrast">#3CE4A7</color> | ||||
|     <color name="md_theme_onTertiaryContainer_highContrast">#000000</color> | ||||
|     <color name="md_theme_error_highContrast">#FFF9F9</color> | ||||
|     <color name="md_theme_onError_highContrast">#000000</color> | ||||
|     <color name="md_theme_errorContainer_highContrast">#FFBAB1</color> | ||||
|     <color name="md_theme_onErrorContainer_highContrast">#000000</color> | ||||
|     <color name="md_theme_background_highContrast">#11150C</color> | ||||
|     <color name="md_theme_onBackground_highContrast">#E1E4D6</color> | ||||
|     <color name="md_theme_surface_highContrast">#11150C</color> | ||||
|     <color name="md_theme_onSurface_highContrast">#FFFFFF</color> | ||||
|     <color name="md_theme_surfaceVariant_highContrast">#424939</color> | ||||
|     <color name="md_theme_onSurfaceVariant_highContrast">#F7FEE7</color> | ||||
|     <color name="md_theme_outline_highContrast">#C7CDB8</color> | ||||
|     <color name="md_theme_outlineVariant_highContrast">#C7CDB8</color> | ||||
|     <color name="md_theme_scrim_highContrast">#000000</color> | ||||
|     <color name="md_theme_inverseSurface_highContrast">#E1E4D6</color> | ||||
|     <color name="md_theme_inverseOnSurface_highContrast">#000000</color> | ||||
|     <color name="md_theme_inversePrimary_highContrast">#1A3000</color> | ||||
|     <color name="md_theme_primaryFixed_highContrast">#BDF978</color> | ||||
|     <color name="md_theme_onPrimaryFixed_highContrast">#000000</color> | ||||
|     <color name="md_theme_primaryFixedDim_highContrast">#A2DC5F</color> | ||||
|     <color name="md_theme_onPrimaryFixedVariant_highContrast">#0C1A00</color> | ||||
|     <color name="md_theme_secondaryFixed_highContrast">#D7E9FF</color> | ||||
|     <color name="md_theme_onSecondaryFixed_highContrast">#000000</color> | ||||
|     <color name="md_theme_secondaryFixedDim_highContrast">#A2CFFF</color> | ||||
|     <color name="md_theme_onSecondaryFixedVariant_highContrast">#00182B</color> | ||||
|     <color name="md_theme_tertiaryFixed_highContrast">#79FFC6</color> | ||||
|     <color name="md_theme_onTertiaryFixed_highContrast">#000000</color> | ||||
|     <color name="md_theme_tertiaryFixedDim_highContrast">#3CE4A7</color> | ||||
|     <color name="md_theme_onTertiaryFixedVariant_highContrast">#001B10</color> | ||||
|     <color name="md_theme_surfaceDim_highContrast">#11150C</color> | ||||
|     <color name="md_theme_surfaceBright_highContrast">#373A31</color> | ||||
|     <color name="md_theme_surfaceContainerLowest_highContrast">#0C0F08</color> | ||||
|     <color name="md_theme_surfaceContainerLow_highContrast">#191D14</color> | ||||
|     <color name="md_theme_surfaceContainer_highContrast">#1D2118</color> | ||||
|     <color name="md_theme_surfaceContainerHigh_highContrast">#282B22</color> | ||||
|     <color name="md_theme_surfaceContainerHighest_highContrast">#32362C</color> | ||||
| </resources> | ||||
| @@ -0,0 +1,46 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <!-- | ||||
|   | ||||
|       | ||||
|  This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin. | ||||
|  | ||||
|   Keepass2Android is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 2 of the License, or | ||||
|   (at your option) any later version. | ||||
|  | ||||
|   Keepass2Android is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
|  | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with Keepass2Android.  If not, see <http://www.gnu.org/licenses/>. | ||||
| --> | ||||
| <resources> | ||||
|  | ||||
|   <color name="bgColorLight">#fff</color> | ||||
|   <color name="bgColorDark">#0000</color> | ||||
|    | ||||
|   <color name="appPrimaryColor">#8bc34a</color> | ||||
|   <color name="appPrimaryDarkColor">#548a2e</color> | ||||
|   <color name="appAccentColor">#0277bd</color> | ||||
|   <color name="appAccentColorDark">#015080</color> | ||||
|  | ||||
| 	<color name="blue_highlight">#0000dd</color> | ||||
| 	<color name="group">#333333</color> | ||||
| 	<color name="icon_background">#00555555</color> | ||||
| 	<color name="icon_text">#000000</color> | ||||
| 	<color name="light_gray">#a8a8a8</color> | ||||
| 	<color name="dark_gray">#303030</color> | ||||
|  | ||||
| 	<color name="element_being_moved">#a8a8a8</color> | ||||
|  | ||||
| 	<color name="emphasis">#31b6e7</color> | ||||
| 	<color name="emphasis2">#4f7a8a</color> | ||||
|  | ||||
|   <color name="warning_color">#f4511e</color> | ||||
|   <color name="hint_color">#42000000</color> | ||||
|   <color name="success_color">#009688</color> | ||||
| 	 | ||||
| </resources>     | ||||
							
								
								
									
										134
									
								
								src/keepass2android-appSdkStyle/Resources/values/themes.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										134
									
								
								src/keepass2android-appSdkStyle/Resources/values/themes.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,134 @@ | ||||
| <resources> | ||||
|  | ||||
|   <style name="Kp2aTheme_ActionBar" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> | ||||
|     <item name="colorPrimary">@color/appPrimaryColor</item> | ||||
|     <item name="colorPrimaryVariant">@color/md_theme_primaryFixedDim_mediumContrast</item> | ||||
|     <item name="colorSecondary">@color/md_theme_secondaryContainer</item> | ||||
|     <item name="colorSecondaryVariant">@color/md_theme_secondary</item> | ||||
|  | ||||
|     <item name="colorPrimaryDark">@color/appPrimaryDarkColor</item> | ||||
|      | ||||
|   </style> | ||||
|  | ||||
|   <style name="Kp2aTheme_NoActionBar" parent="Theme.MaterialComponents.DayNight.NoActionBar"> | ||||
|     <item name="colorPrimary">@color/appPrimaryColor</item> | ||||
|     <item name="colorPrimaryVariant">@color/md_theme_primaryFixedDim_mediumContrast</item> | ||||
|     <item name="colorSecondary">@color/md_theme_secondaryContainer</item> | ||||
|     <item name="colorSecondaryVariant">@color/md_theme_secondary</item> | ||||
|  | ||||
|     <item name="colorPrimaryDark">@color/appPrimaryDarkColor</item> | ||||
|   </style> | ||||
|  | ||||
|   <style name="old_Kp2aTheme_NoActionBar" parent="Theme.Material3.DayNight.NoActionBar"> | ||||
|     <item name="colorPrimary">@color/md_theme_primary</item> | ||||
|     <item name="colorOnPrimary">@color/md_theme_onPrimary</item> | ||||
|     <item name="colorPrimaryContainer">@color/md_theme_primaryContainer</item> | ||||
|     <item name="colorOnPrimaryContainer">@color/md_theme_onPrimaryContainer</item> | ||||
|     <item name="colorSecondary">@color/md_theme_secondary</item> | ||||
|     <item name="colorOnSecondary">@color/md_theme_onSecondary</item> | ||||
|     <item name="colorSecondaryContainer">@color/md_theme_secondaryContainer</item> | ||||
|     <item name="colorOnSecondaryContainer">@color/md_theme_onSecondaryContainer</item> | ||||
|     <item name="colorTertiary">@color/md_theme_tertiary</item> | ||||
|     <item name="colorOnTertiary">@color/md_theme_onTertiary</item> | ||||
|     <item name="colorTertiaryContainer">@color/md_theme_tertiaryContainer</item> | ||||
|     <item name="colorOnTertiaryContainer">@color/md_theme_onTertiaryContainer</item> | ||||
|     <item name="colorError">@color/md_theme_error</item> | ||||
|     <item name="colorOnError">@color/md_theme_onError</item> | ||||
|     <item name="colorErrorContainer">@color/md_theme_errorContainer</item> | ||||
|     <item name="colorOnErrorContainer">@color/md_theme_onErrorContainer</item> | ||||
|     <item name="android:colorBackground">@color/md_theme_background</item> | ||||
|     <item name="colorOnBackground">@color/md_theme_onBackground</item> | ||||
|     <item name="colorSurface">@color/md_theme_surface</item> | ||||
|     <item name="colorOnSurface">@color/md_theme_onSurface</item> | ||||
|     <item name="colorSurfaceVariant">@color/md_theme_surfaceVariant</item> | ||||
|     <item name="colorOnSurfaceVariant">@color/md_theme_onSurfaceVariant</item> | ||||
|     <item name="colorOutline">@color/md_theme_outline</item> | ||||
|     <item name="colorOutlineVariant">@color/md_theme_outlineVariant</item> | ||||
|     <item name="colorSurfaceInverse">@color/md_theme_inverseSurface</item> | ||||
|     <item name="colorOnSurfaceInverse">@color/md_theme_inverseOnSurface</item> | ||||
|     <item name="colorPrimaryInverse">@color/md_theme_inversePrimary</item> | ||||
|     <item name="colorPrimaryFixed">@color/md_theme_primaryFixed</item> | ||||
|     <item name="colorOnPrimaryFixed">@color/md_theme_onPrimaryFixed</item> | ||||
|     <item name="colorPrimaryFixedDim">@color/md_theme_primaryFixedDim</item> | ||||
|     <item name="colorOnPrimaryFixedVariant">@color/md_theme_onPrimaryFixedVariant</item> | ||||
|     <item name="colorSecondaryFixed">@color/md_theme_secondaryFixed</item> | ||||
|     <item name="colorOnSecondaryFixed">@color/md_theme_onSecondaryFixed</item> | ||||
|     <item name="colorSecondaryFixedDim">@color/md_theme_secondaryFixedDim</item> | ||||
|     <item name="colorOnSecondaryFixedVariant">@color/md_theme_onSecondaryFixedVariant</item> | ||||
|     <item name="colorTertiaryFixed">@color/md_theme_tertiaryFixed</item> | ||||
|     <item name="colorOnTertiaryFixed">@color/md_theme_onTertiaryFixed</item> | ||||
|     <item name="colorTertiaryFixedDim">@color/md_theme_tertiaryFixedDim</item> | ||||
|     <item name="colorOnTertiaryFixedVariant">@color/md_theme_onTertiaryFixedVariant</item> | ||||
|     <item name="colorSurfaceDim">@color/md_theme_surfaceDim</item> | ||||
|     <item name="colorSurfaceBright">@color/md_theme_surfaceBright</item> | ||||
|     <item name="colorSurfaceContainerLowest">@color/md_theme_surfaceContainerLowest</item> | ||||
|     <item name="colorSurfaceContainerLow">@color/md_theme_surfaceContainerLow</item> | ||||
|     <item name="colorSurfaceContainer">@color/md_theme_surfaceContainer</item> | ||||
|     <item name="colorSurfaceContainerHigh">@color/md_theme_surfaceContainerHigh</item> | ||||
|     <item name="colorSurfaceContainerHighest">@color/md_theme_surfaceContainerHighest</item> | ||||
|   </style> | ||||
|  | ||||
|     <style name="tmp_Kp2aTheme_ActionBar" parent="Theme.Material3.DayNight"> | ||||
|         <item name="colorPrimary">@color/md_theme_primary</item> | ||||
|         <item name="colorOnPrimary">@color/md_theme_onPrimary</item> | ||||
|         <item name="colorPrimaryContainer">@color/md_theme_primaryContainer</item> | ||||
|         <item name="colorOnPrimaryContainer">@color/md_theme_onPrimaryContainer</item> | ||||
|         <item name="colorSecondary">@color/md_theme_secondary</item> | ||||
|         <item name="colorOnSecondary">@color/md_theme_onSecondary</item> | ||||
|         <item name="colorSecondaryContainer">@color/md_theme_secondaryContainer</item> | ||||
|         <item name="colorOnSecondaryContainer">@color/md_theme_onSecondaryContainer</item> | ||||
|         <item name="colorTertiary">@color/md_theme_tertiary</item> | ||||
|         <item name="colorOnTertiary">@color/md_theme_onTertiary</item> | ||||
|         <item name="colorTertiaryContainer">@color/md_theme_tertiaryContainer</item> | ||||
|         <item name="colorOnTertiaryContainer">@color/md_theme_onTertiaryContainer</item> | ||||
|         <item name="colorError">@color/md_theme_error</item> | ||||
|         <item name="colorOnError">@color/md_theme_onError</item> | ||||
|         <item name="colorErrorContainer">@color/md_theme_errorContainer</item> | ||||
|         <item name="colorOnErrorContainer">@color/md_theme_onErrorContainer</item> | ||||
|         <item name="android:colorBackground">@color/md_theme_background</item> | ||||
|         <item name="colorOnBackground">@color/md_theme_onBackground</item> | ||||
|         <item name="colorSurface">@color/md_theme_surface</item> | ||||
|         <item name="colorOnSurface">@color/md_theme_onSurface</item> | ||||
|         <item name="colorSurfaceVariant">@color/md_theme_surfaceVariant</item> | ||||
|         <item name="colorOnSurfaceVariant">@color/md_theme_onSurfaceVariant</item> | ||||
|         <item name="colorOutline">@color/md_theme_outline</item> | ||||
|         <item name="colorOutlineVariant">@color/md_theme_outlineVariant</item> | ||||
|         <item name="colorSurfaceInverse">@color/md_theme_inverseSurface</item> | ||||
|         <item name="colorOnSurfaceInverse">@color/md_theme_inverseOnSurface</item> | ||||
|         <item name="colorPrimaryInverse">@color/md_theme_inversePrimary</item> | ||||
|         <item name="colorPrimaryFixed">@color/md_theme_primaryFixed</item> | ||||
|         <item name="colorOnPrimaryFixed">@color/md_theme_onPrimaryFixed</item> | ||||
|         <item name="colorPrimaryFixedDim">@color/md_theme_primaryFixedDim</item> | ||||
|         <item name="colorOnPrimaryFixedVariant">@color/md_theme_onPrimaryFixedVariant</item> | ||||
|         <item name="colorSecondaryFixed">@color/md_theme_secondaryFixed</item> | ||||
|         <item name="colorOnSecondaryFixed">@color/md_theme_onSecondaryFixed</item> | ||||
|         <item name="colorSecondaryFixedDim">@color/md_theme_secondaryFixedDim</item> | ||||
|         <item name="colorOnSecondaryFixedVariant">@color/md_theme_onSecondaryFixedVariant</item> | ||||
|         <item name="colorTertiaryFixed">@color/md_theme_tertiaryFixed</item> | ||||
|         <item name="colorOnTertiaryFixed">@color/md_theme_onTertiaryFixed</item> | ||||
|         <item name="colorTertiaryFixedDim">@color/md_theme_tertiaryFixedDim</item> | ||||
|         <item name="colorOnTertiaryFixedVariant">@color/md_theme_onTertiaryFixedVariant</item> | ||||
|         <item name="colorSurfaceDim">@color/md_theme_surfaceDim</item> | ||||
|         <item name="colorSurfaceBright">@color/md_theme_surfaceBright</item> | ||||
|         <item name="colorSurfaceContainerLowest">@color/md_theme_surfaceContainerLowest</item> | ||||
|         <item name="colorSurfaceContainerLow">@color/md_theme_surfaceContainerLow</item> | ||||
|         <item name="colorSurfaceContainer">@color/md_theme_surfaceContainer</item> | ||||
|         <item name="colorSurfaceContainerHigh">@color/md_theme_surfaceContainerHigh</item> | ||||
|         <item name="colorSurfaceContainerHighest">@color/md_theme_surfaceContainerHighest</item> | ||||
|     </style> | ||||
|   <style name="Kp2aTheme_BlueActionBar" parent="Kp2aTheme_ActionBar"> | ||||
|     <item name="colorPrimary">@color/appAccentColor</item> | ||||
|     <item name="colorPrimaryDark">@color/appAccentColorDark</item> | ||||
|     <item name="colorAccent">@color/appPrimaryColor</item> | ||||
|     <item name="colorSurface">@color/appAccentColor</item> | ||||
|  | ||||
|   </style> | ||||
|  | ||||
|   <style name="Kp2aTheme_BlueNoActionBar" parent="Kp2aTheme_NoActionBar"> | ||||
|     <item name="colorPrimary">@color/appAccentColor</item> | ||||
|     <item name="colorPrimaryDark">@color/appAccentColorDark</item> | ||||
|     <item name="colorAccent">@color/appPrimaryColor</item> | ||||
|     <item name="colorSurface">@color/appAccentColor</item> | ||||
|  | ||||
|   </style> | ||||
| </resources> | ||||
							
								
								
									
										58
									
								
								src/keepass2android-appSdkStyle/Resources/xml/pref_app.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								src/keepass2android-appSdkStyle/Resources/xml/pref_app.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
|  | ||||
| <PreferenceScreen | ||||
| 	xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 	android:key="@string/app_key" | ||||
| 	android:title="@string/application" | ||||
| 	android:summary="@string/application_settings" | ||||
| 	xmlns:app="http://schemas.android.com/apk/res-auto"> | ||||
| 	<Preference | ||||
| 		android:key="@string/security_prefs_key" | ||||
| 		android:title="@string/security_prefs" | ||||
| 		app:fragment="keepass2android.settings.SecurityPreferenceFragment" | ||||
| 	/> | ||||
|  | ||||
| 	<Preference | ||||
| 		android:key="@string/display_prefs_key" | ||||
| 		android:title="@string/display_prefs" | ||||
| 		app:fragment="keepass2android.settings.DisplayPreferenceFragment" | ||||
| 	/> | ||||
|  | ||||
| 	<Preference | ||||
| 		android:key="@string/password_access_prefs_key" | ||||
| 		android:title="@string/password_access_prefs" | ||||
| 		app:fragment="keepass2android.settings.PasswordAccessPreferenceFragment" | ||||
| 	/> | ||||
|  | ||||
|  | ||||
| 	<Preference | ||||
| 		android:key="@string/QuickUnlock_prefs_key" | ||||
| 		android:title="@string/QuickUnlock_prefs" | ||||
| 		app:fragment="keepass2android.settings.QuickUnlockPreferenceFragment" | ||||
| 	/> | ||||
| 	 | ||||
| 	<Preference | ||||
| 		android:key="@string/FileHandling_prefs_key" | ||||
| 		android:title="@string/FileHandling_prefs" | ||||
| 		app:fragment="keepass2android.settings.FileHandlingPreferenceFragment" | ||||
| 	/> | ||||
| 	 | ||||
| 	<Preference | ||||
| 		android:key="keyboard_prefs" | ||||
| 		android:title="@string/keyboard_prefs" | ||||
| 	> | ||||
| 		<intent android:action="keepass2android.softkeyboard.LatinIMESettings" /> | ||||
| 	</Preference> | ||||
|  | ||||
| 	<Preference | ||||
| 		android:key="@string/TrayTotp_prefs_key" | ||||
| 		android:title="@string/TrayTotp_prefs" | ||||
| 		app:fragment="keepass2android.settings.TotpPreferenceFragment" | ||||
| 	/> | ||||
| 	<Preference | ||||
| 		android:key="@string/DebugLog_prefs_key" | ||||
| 		android:title="@string/DebugLog_prefs_prefs" | ||||
| 		app:fragment="keepass2android.settings.DebugLogPreferenceFragment" | ||||
| 	/> | ||||
|  | ||||
| </PreferenceScreen> | ||||
| @@ -0,0 +1,24 @@ | ||||
| <PreferenceScreen | ||||
| 	xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 	android:key="@string/DebugLog_prefs_key" | ||||
| 	android:title="@string/DebugLog_prefs_prefs" | ||||
| > | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/DebugLog_summary" | ||||
| 		android:defaultValue="false" | ||||
| 		android:title="@string/DebugLog_title" | ||||
| 		android:key="@string/DebugLog_key" /> | ||||
|  | ||||
| 	<Preference | ||||
| 		android:enabled="true" | ||||
| 		android:title="@string/DebugLog_send" | ||||
| 		android:key="@string/DebugLog_send_key" /> | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:defaultValue="false" | ||||
| 		android:title="@string/FtpDebug_title" | ||||
| 		android:key="@string/FtpDebug_key" /> | ||||
| </PreferenceScreen> | ||||
| @@ -0,0 +1,101 @@ | ||||
| <PreferenceScreen | ||||
| 	xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 	android:key="@string/display_prefs_key" | ||||
| 	android:title="@string/display_prefs" | ||||
| > | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/ShowUnlockedNotification_summary" | ||||
| 		android:defaultValue="@bool/ShowUnlockedNotification_default" | ||||
| 		android:title="@string/ShowUnlockedNotification_title" | ||||
| 		android:key="@string/ShowUnlockedNotification_key" /> | ||||
| 	<CheckBoxPreference | ||||
| 		android:key="@string/maskpass_key" | ||||
| 		android:title="@string/maskpass_title" | ||||
| 		android:summary="@string/maskpass_summary" | ||||
| 		android:defaultValue="@bool/maskpass_default" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:key="@string/masktotp_key" | ||||
| 		android:title="@string/masktotp_title" | ||||
| 		android:summary="@string/masktotp_summary" | ||||
| 		android:defaultValue="@bool/masktotp_default" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:key="@string/ShowUsernameInList_key" | ||||
| 		android:title="@string/ShowUsernameInList_title" | ||||
| 		android:summary="@string/ShowUsernameInList_summary" | ||||
| 		android:defaultValue="@bool/ShowUsernameInList_default" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:key="@string/ShowGroupnameInSearchResult_key" | ||||
| 		android:title="@string/ShowGroupnameInSearchResult_title" | ||||
| 		android:summary="@string/ShowGroupnameInSearchResult_resume" | ||||
| 		android:defaultValue="@bool/ShowGroupnameInSearchResult_default" /> | ||||
| 	<CheckBoxPreference | ||||
| 		android:key="ShowGroupInEntry" | ||||
| 		android:title="@string/ShowGroupInEntry_title" | ||||
| 		android:defaultValue="false" /> | ||||
| 	<ListPreference | ||||
| 		android:key="@string/list_size_key" | ||||
| 		android:title="@string/list_size_title" | ||||
| 		android:summary="@string/list_size_summary" | ||||
| 		android:entries="@array/list_size_options" | ||||
| 		android:entryValues="@array/list_size_values" | ||||
| 		android:dialogTitle="@string/list_size_summary" | ||||
| 		android:defaultValue="@string/list_size_default" /> | ||||
|  | ||||
| 	<keepass2android.IconSetPreference | ||||
| 		android:title="@string/IconSet_title" | ||||
| 		android:persistent="false" | ||||
| 		android:key="IconSetKey" /> | ||||
|  | ||||
| 	<ListPreference | ||||
| 		android:key="@string/design_key" | ||||
| 		android:title="@string/design_title" | ||||
| 		android:entries="@array/design_options" | ||||
| 		android:entryValues="@array/design_values" | ||||
| 		android:dialogTitle="@string/design_title" | ||||
| 		android:defaultValue="@string/design_default" /> | ||||
|  | ||||
| 	<ListPreference | ||||
| 		android:key="@string/app_language_pref_key" | ||||
| 		android:title="@string/app_language_pref_title" | ||||
| 		android:dialogTitle="@string/app_language_pref_title" | ||||
| 	/> | ||||
|  | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/ViewDatabaseSecure_summary" | ||||
| 		android:defaultValue="true" | ||||
| 		android:title="@string/ViewDatabaseSecure_title" | ||||
| 		android:key="@string/ViewDatabaseSecure_key" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/ActivateSearchViewOnStart_summary" | ||||
| 		android:defaultValue="false" | ||||
| 		android:title="@string/ActivateSearchViewOnStart_title" | ||||
| 		android:key="ActivateSearchView" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/NoDonateOption_summary" | ||||
| 		android:defaultValue="false" | ||||
| 		android:title="@string/NoDonateOption_title" | ||||
| 		android:key="@string/NoDonateOption_key" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/NoDonationReminder_summary" | ||||
| 		android:defaultValue="false" | ||||
| 		android:title="@string/NoDonationReminder_title" | ||||
| 		android:key="@string/NoDonationReminder_key" /> | ||||
| </PreferenceScreen> | ||||
| @@ -0,0 +1,84 @@ | ||||
| <PreferenceScreen | ||||
| 	xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 	android:key="@string/FileHandling_prefs_key" | ||||
| 	android:title="@string/FileHandling_prefs" | ||||
| > | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/UseOfflineCache_summary" | ||||
| 		android:defaultValue="true" | ||||
| 		android:title="@string/UseOfflineCache_title" | ||||
| 		android:key="@string/UseOfflineCache_key" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/CreateBackups_summary" | ||||
| 		android:defaultValue="true" | ||||
| 		android:title="@string/CreateBackups_title" | ||||
| 		android:key="@string/CreateBackups_key" /> | ||||
|  | ||||
| 	<ListPreference | ||||
| 		android:key="@string/AcceptAllServerCertificates_key" | ||||
| 		android:title="@string/AcceptAllServerCertificates_title" | ||||
| 		android:summary="@string/AcceptAllServerCertificates_summary" | ||||
| 		android:entries="@array/AcceptAllServerCertificates_options" | ||||
| 		android:entryValues="@array/AcceptAllServerCertificates_values" | ||||
| 		android:dialogTitle="@string/AcceptAllServerCertificates_title" | ||||
| 		android:defaultValue="@string/AcceptAllServerCertificates_default" /> | ||||
|  | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/CheckForFileChangesOnSave_summary" | ||||
| 		android:defaultValue="true" | ||||
| 		android:title="@string/CheckForFileChangesOnSave_title" | ||||
| 		android:key="@string/CheckForFileChangesOnSave_key" /> | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/UseFileTransactions_summary" | ||||
| 		android:defaultValue="true" | ||||
| 		android:title="@string/UseFileTransactions_title" | ||||
| 		android:key="@string/UseFileTransactions_key" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/PreloadDatabaseEnabled_summary" | ||||
| 		android:defaultValue="@bool/PreloadDatabaseEnabled_default" | ||||
| 		android:title="@string/PreloadDatabaseEnabled_title" | ||||
| 		android:key="@string/PreloadDatabaseEnabled_key" /> | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/SyncAfterQuickUnlock_summary" | ||||
| 		android:defaultValue="false" | ||||
| 		android:title="@string/SyncAfterQuickUnlock_title" | ||||
| 		android:key="@string/SyncAfterQuickUnlock_key" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/AlwaysMergeOnConflict_summary" | ||||
| 		android:defaultValue="false" | ||||
| 		android:title="@string/AlwaysMergeOnConflict_title" | ||||
| 		android:key="@string/AlwaysMergeOnConflict_key" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:key="@string/TanExpiresOnUse_key" | ||||
| 		android:title="@string/TanExpiresOnUse_title" | ||||
| 		android:summary="@string/TanExpiresOnUse_summary" | ||||
| 		android:defaultValue="@bool/TanExpiresOnUse_default" /> | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/CheckForDuplicateUuids_summary" | ||||
| 		android:defaultValue="true" | ||||
| 		android:title="@string/CheckForDuplicateUuids_title" | ||||
| 		android:key="@string/CheckForDuplicateUuids_key" /> | ||||
|  | ||||
| </PreferenceScreen> | ||||
| @@ -0,0 +1,52 @@ | ||||
| <PreferenceScreen | ||||
| 	xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 	xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
| 	android:key="@string/password_access_prefs_key" | ||||
| 	android:title="@string/password_access_prefs" | ||||
| > | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/ShowCopyToClipboardNotification_summary" | ||||
| 		android:defaultValue="@bool/CopyToClipboardNotification_default" | ||||
| 		android:title="@string/ShowCopyToClipboardNotification_title" | ||||
| 		android:key="@string/CopyToClipboardNotification_key" /> | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/ShowKp2aKeyboardNotification_summary" | ||||
| 		android:defaultValue="@bool/UseKp2aKeyboard_default" | ||||
| 		android:title="@string/ShowKp2aKeyboardNotification_title" | ||||
| 		android:key="@string/UseKp2aKeyboard_key" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/ShowSeparateNotifications_summary" | ||||
| 		android:defaultValue="@bool/ShowSeparateNotifications_default" | ||||
| 		android:title="@string/ShowSeparateNotifications_title" | ||||
| 		android:key="@string/ShowSeparateNotifications_key" /> | ||||
|  | ||||
| 	<Preference | ||||
| 		android:key="@string/keyboardswitch_prefs_key" | ||||
| 		android:title="@string/keyboardswitch_prefs" | ||||
| 		android:dependency="@string/UseKp2aKeyboard_key" | ||||
| 		app:fragment="keepass2android.settings.KeyboardSwitchPreferenceFragment" | ||||
| 	/> | ||||
| 	<Preference | ||||
| 		android:key="@string/AutoFill_prefs_screen_key" | ||||
| 		android:title="@string/AutoFill_prefs" | ||||
| 		app:fragment="keepass2android.settings.AutofillPreferenceFragment" | ||||
| 	/> | ||||
|  | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/AutoReturnFromQuery_summary" | ||||
| 		android:defaultValue="true" | ||||
| 		android:title="@string/AutoReturnFromQuery_title" | ||||
| 		android:key="@string/AutoReturnFromQuery_key" /> | ||||
|  | ||||
| </PreferenceScreen> | ||||
| @@ -0,0 +1,69 @@ | ||||
| <PreferenceScreen | ||||
| 	xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 	xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
| 	android:key="@string/AutoFill_prefs_screen_key" | ||||
| 	android:title="@string/AutoFill_prefs" | ||||
| > | ||||
|  | ||||
| 	<Preference | ||||
| 		android:key="@string/AutoFill_prefs_key" | ||||
| 		android:title="@string/AutoFill_prefs"> | ||||
|  | ||||
| 	</Preference> | ||||
|  | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/OfferSaveCredentials_summary" | ||||
| 		android:defaultValue="true" | ||||
| 		android:title="@string/OfferSaveCredentials_title" | ||||
| 		android:key="@string/OfferSaveCredentials_key" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/NoDalVerification_summary" | ||||
| 		android:defaultValue="false" | ||||
| 		android:title="@string/NoDalVerification_title" | ||||
| 		android:key="@string/NoDalVerification_key" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/InlineSuggestions_summary" | ||||
| 		android:defaultValue="true" | ||||
| 		android:title="@string/InlineSuggestions_title" | ||||
| 		android:key="@string/InlineSuggestions_key" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/LogAutofillView_summary" | ||||
| 		android:defaultValue="false" | ||||
| 		android:title="@string/LogAutofillView_title" | ||||
| 		android:key="@string/LogAutofillView_key" /> | ||||
|  | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/NoAutofillDisabling_summary" | ||||
| 		android:defaultValue="false" | ||||
| 		android:title="@string/NoAutofillDisabling_title" | ||||
| 		android:key="@string/NoAutofillDisabling_key" /> | ||||
|  | ||||
| 	<keepass2android.AutofillDisabledQueriesPreference | ||||
| 		android:title="@string/AutofillDisabledQueriesPreference_title" | ||||
| 		android:summary="@string/AutofillDisabledQueriesPreference_summary" | ||||
| 		android:persistent="false" | ||||
| 		android:key="AutofillDisabledQueriesPreference_key" /> | ||||
|  | ||||
| 	<Preference | ||||
| 		android:key="@string/AutoFillTotp_prefs_screen_key" | ||||
| 		android:title="@string/AutoFillTotp_prefs_title" | ||||
| 		app:fragment="keepass2android.settings.AutofillTotpPreferenceFragment"> | ||||
|  | ||||
| 	</Preference> | ||||
|  | ||||
| </PreferenceScreen> | ||||
| @@ -0,0 +1,30 @@ | ||||
| <PreferenceScreen | ||||
|     xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:key="@string/AutoFillTotp_prefs_screen_key" | ||||
|     android:title="@string/AutoFillTotp_prefs_title" | ||||
| > | ||||
|  | ||||
|  | ||||
|     <CheckBoxPreference android:key="AutoFillTotp_prefs_ShowNotification_key" | ||||
|         android:enabled="true" | ||||
|         android:persistent="true" | ||||
|         android:summary="@string/AutoFillTotp_prefs_ShowNotification_summary" | ||||
|         android:defaultValue="true" | ||||
|         android:title="@string/AutoFillTotp_prefs_ShowNotification_title" | ||||
|     /> | ||||
|     <CheckBoxPreference android:key="AutoFillTotp_prefs_CopyTotpToClipboard_key" | ||||
|         android:enabled="true" | ||||
|         android:persistent="true" | ||||
|         android:summary="@string/AutoFillTotp_prefs_CopyTotpToClipboard_summary" | ||||
|         android:defaultValue="true" | ||||
|         android:title="@string/AutoFillTotp_prefs_CopyTotpToClipboard_title" | ||||
|     /> | ||||
|     <CheckBoxPreference android:key="AutoFillTotp_prefs_ActivateKeyboard_key" | ||||
|         android:enabled="true" | ||||
|         android:persistent="true" | ||||
|         android:summary="@string/AutoFillTotp_prefs_ActivateKeyboard_summary" | ||||
|         android:defaultValue="false" | ||||
|         android:title="@string/AutoFillTotp_prefs_ActivateKeyboard_title" | ||||
|     /> | ||||
|  | ||||
| </PreferenceScreen> | ||||
| @@ -0,0 +1,57 @@ | ||||
| <PreferenceScreen | ||||
| 	xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 	android:key="@string/keyboardswitch_prefs_key" | ||||
| 	android:title="@string/keyboardswitch_prefs" | ||||
| > | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:key="kp2a_switch_rooted" | ||||
| 		android:title="@string/kp2a_switch_rooted" | ||||
| 		android:summary="@string/kp2a_switch_rooted_summary" | ||||
| 		android:persistent="true" | ||||
| 		android:defaultValue="false" | ||||
| 	/> | ||||
|  | ||||
| 	<Preference | ||||
| 		android:key="get_keyboardswap" | ||||
| 		android:summary="@string/get_keyboardswap_summary" | ||||
| 		android:title="@string/get_keyboardswap" | ||||
| 	/> | ||||
|  | ||||
| 	<!-- no autoswitch on root only--> | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/OpenKp2aKeyboardAutomatically_summary" | ||||
| 		android:defaultValue="@bool/OpenKp2aKeyboardAutomatically_default" | ||||
| 		android:title="@string/OpenKp2aKeyboardAutomatically_title" | ||||
| 		android:key="@string/OpenKp2aKeyboardAutomatically_key" /> | ||||
|  | ||||
| 	<!-- autoswitch on root only--> | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_summary" | ||||
| 		android:defaultValue="@bool/OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_default" | ||||
| 		android:title="@string/OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_title" | ||||
| 		android:key="@string/OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_key" /> | ||||
|  | ||||
|  | ||||
| 	<!-- with and without autoswitch on root--> | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/AutoSwitchBackKeyboard_summary" | ||||
| 		android:defaultValue="@bool/AutoSwitchBackKeyboard_default" | ||||
| 		android:title="@string/AutoSwitchBackKeyboard_title" | ||||
| 		android:key="@string/AutoSwitchBackKeyboard_key" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:key="kp2a_switch_on_sendgodone" | ||||
| 		android:title="@string/kp2a_switch_on_sendgodone" | ||||
| 		android:summary="@string/kp2a_switch_on_sendgodone_summary" | ||||
| 		android:persistent="true" | ||||
| 		android:defaultValue="false" | ||||
| 	/> | ||||
|  | ||||
| </PreferenceScreen> | ||||
| @@ -0,0 +1,52 @@ | ||||
| <PreferenceScreen | ||||
| 	xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 	android:key="@string/QuickUnlock_prefs_key" | ||||
| 	android:title="@string/QuickUnlock_prefs" | ||||
| > | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/QuickUnlockDefaultEnabled_summary" | ||||
| 		android:defaultValue="true" | ||||
| 		android:title="@string/QuickUnlockDefaultEnabled_title" | ||||
| 		android:key="@string/QuickUnlockDefaultEnabled_key" /> | ||||
| 	<EditTextPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/QuickUnlockLength_summary" | ||||
| 		android:numeric="integer" | ||||
| 		android:defaultValue="3" | ||||
| 		android:title="@string/QuickUnlockLength_title" | ||||
| 		android:key="@string/QuickUnlockLength_key" /> | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/QuickUnlockIconHidden_summary" | ||||
| 		android:defaultValue="false" | ||||
| 		android:title="@string/QuickUnlockIconHidden_title" | ||||
| 		android:key="@string/QuickUnlockIconHidden_key" /> | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/QuickUnlockIconHidden16_summary" | ||||
| 		android:defaultValue="true" | ||||
| 		android:title="@string/QuickUnlockIconHidden16_title" | ||||
| 		android:key="@string/QuickUnlockIconHidden16_key" /> | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/QuickUnlockHideLength_summary" | ||||
| 		android:defaultValue="false" | ||||
| 		android:title="@string/QuickUnlockHideLength_title" | ||||
| 		android:key="@string/QuickUnlockHideLength_key" /> | ||||
|  | ||||
| 	<CheckBoxPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/QuickUnlockKeyFromDatabase_summary" | ||||
| 		android:defaultValue="false" | ||||
| 		android:title="@string/QuickUnlockKeyFromDatabase_title" | ||||
| 		android:key="@string/QuickUnlockKeyFromDatabase_key" /> | ||||
|  | ||||
| </PreferenceScreen> | ||||
| @@ -0,0 +1,75 @@ | ||||
| <PreferenceScreen | ||||
|     xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:key="@string/security_prefs_key" | ||||
|     android:title="@string/security_prefs" | ||||
| > | ||||
|  | ||||
|  | ||||
|     <ListPreference | ||||
|         android:key="@string/clipboard_timeout_key" | ||||
|         android:title="@string/clipboard_timeout" | ||||
|         android:summary="@string/clipboard_timeout_summary" | ||||
|         android:entries="@array/clipboard_timeout_options" | ||||
|         android:entryValues="@array/clipboard_timeout_values" | ||||
|         android:dialogTitle="@string/clipboard_timeout" | ||||
|         android:defaultValue="@string/clipboard_timeout_default" /> | ||||
|     <ListPreference | ||||
|         android:key="@string/app_timeout_key" | ||||
|         android:title="@string/app_timeout" | ||||
|         android:summary="@string/app_timeout_summary" | ||||
|         android:entries="@array/clipboard_timeout_options" | ||||
|         android:entryValues="@array/clipboard_timeout_values" | ||||
|         android:dialogTitle="@string/app_timeout" | ||||
|         android:defaultValue="@string/clipboard_timeout_default" /> | ||||
|     <CheckBoxPreference | ||||
|         android:enabled="true" | ||||
|         android:persistent="true" | ||||
|         android:summary="@string/LockWhenScreenOff_summary" | ||||
|         android:defaultValue="false" | ||||
|         android:title="@string/LockWhenScreenOff_title" | ||||
|         android:key="@string/LockWhenScreenOff_key" /> | ||||
|  | ||||
|     <CheckBoxPreference | ||||
|         android:enabled="true" | ||||
|         android:persistent="true" | ||||
|         android:summary="@string/LockWhenNavigateBack_summary" | ||||
|         android:defaultValue="false" | ||||
|         android:title="@string/LockWhenNavigateBack_title" | ||||
|         android:key="@string/LockWhenNavigateBack_key" /> | ||||
|  | ||||
|     <CheckBoxPreference | ||||
|         android:key="@string/RememberRecentFiles_key" | ||||
|         android:title="@string/RememberRecentFiles_title" | ||||
|         android:summary="@string/RememberRecentFiles_summary" | ||||
|         android:defaultValue="@bool/RememberRecentFiles_default" /> | ||||
|  | ||||
|     <CheckBoxPreference | ||||
|         android:key="@string/keyfile_key" | ||||
|         android:title="@string/remember_keyfile_title" | ||||
|         android:summary="@string/remember_keyfile_summary" | ||||
|         android:defaultValue="@bool/keyfile_default" /> | ||||
|  | ||||
|     <CheckBoxPreference | ||||
|         android:key="@string/show_kill_app_key" | ||||
|         android:title="@string/show_kill_app" | ||||
|         android:summary="@string/show_kill_app_summary" | ||||
|         android:defaultValue="false" /> | ||||
|  | ||||
|     <CheckBoxPreference | ||||
|         android:enabled="true" | ||||
|         android:persistent="true" | ||||
|         android:summary="@string/ClearPasswordOnLeave_summary" | ||||
|         android:defaultValue="false" | ||||
|         android:title="@string/ClearPasswordOnLeave_title" | ||||
|         android:key="@string/ClearPasswordOnLeave_key" /> | ||||
|  | ||||
|     <CheckBoxPreference | ||||
|         android:enabled="true" | ||||
|         android:persistent="true" | ||||
|         android:summary="@string/UseKp2aKeyboardInKp2a_summary" | ||||
|         android:defaultValue="false" | ||||
|         android:title="@string/UseKp2aKeyboardInKp2a_title" | ||||
|         android:key="@string/UseKp2aKeyboardInKp2a_key" /> | ||||
|  | ||||
|  | ||||
| </PreferenceScreen> | ||||
| @@ -0,0 +1,22 @@ | ||||
| <PreferenceScreen | ||||
| 	xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 	android:key="@string/TrayTotp_prefs_key" | ||||
| 	android:title="@string/TrayTotp_prefs" | ||||
| > | ||||
|  | ||||
|  | ||||
| 	<EditTextPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/TrayTotp_SeedField_summary" | ||||
| 		android:defaultValue="TOTP Seed" | ||||
| 		android:title="@string/TrayTotp_SeedField_title" | ||||
| 		android:key="@string/TrayTotp_SeedField_key" /> | ||||
| 	<EditTextPreference | ||||
| 		android:enabled="true" | ||||
| 		android:persistent="true" | ||||
| 		android:summary="@string/TrayTotp_SettingsField_summary" | ||||
| 		android:defaultValue="TOTP Settings" | ||||
| 		android:title="@string/TrayTotp_SettingsField_title" | ||||
| 		android:key="@string/TrayTotp_SettingsField_key" /> | ||||
| </PreferenceScreen> | ||||
							
								
								
									
										100
									
								
								src/keepass2android-appSdkStyle/Resources/xml/pref_database.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								src/keepass2android-appSdkStyle/Resources/xml/pref_database.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,100 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <PreferenceScreen | ||||
| 	xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 	xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
| 	android:key="@string/db_key" | ||||
| 	android:title="@string/database" | ||||
| 	android:summary="@string/menu_db_settings"> | ||||
|  | ||||
| 	<PreferenceCategory | ||||
|     android:title="Database properties" | ||||
|      > | ||||
|  | ||||
| 	<EditTextPreference | ||||
| 		android:title="@string/database_name" | ||||
| 		android:persistent="false" | ||||
| 		android:key="@string/database_name_key" /> | ||||
| 		 | ||||
|   <EditTextPreference | ||||
|     android:title="@string/default_username" | ||||
|     android:persistent="false" | ||||
|     android:key="@string/default_username_key" /> | ||||
|  | ||||
| 	</PreferenceCategory> | ||||
|  | ||||
| 	 | ||||
|   <PreferenceCategory | ||||
|     android:title="Database security" | ||||
|   > | ||||
| 	 | ||||
|     <Preference android:key="@string/master_pwd_key" | ||||
|                 android:title="@string/menu_change_key" | ||||
|     /> | ||||
|  | ||||
| 	<ListPreference | ||||
| 		android:key="@string/algorithm_key" | ||||
| 		android:title="@string/algorithm" | ||||
| 		android:dialogTitle="@string/algorithm" /> | ||||
| 	<Preference | ||||
| 		app:fragment="keepass2android.settings.KeyDerivFuncPreferenceFragment" | ||||
| 		android:key="@string/kdf_screen_key" | ||||
| 		android:title="@string/KeyDerivFunc" /> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| 	<Preference | ||||
| 		android:key="fingerprint_prefs" | ||||
| 		android:title="@string/fingerprint_prefs" | ||||
| 	> | ||||
| 		<intent android:action="kp2a.action.FingerprintSetupActivity" /> | ||||
| 	</Preference> | ||||
|  | ||||
| 	</PreferenceCategory> | ||||
|  | ||||
|     <PreferenceCategory | ||||
|       android:title="Database setup" | ||||
|     > | ||||
|  | ||||
| 	<Preference android:key="AddTemplates_pref_key" | ||||
| 		android:title="@string/AddTemplates_pref" | ||||
| 	/> | ||||
|  | ||||
|  | ||||
| 	<Preference | ||||
| 		android:key="configure_child_dbs_prefs" | ||||
| 		android:title="@string/configure_child_dbs" | ||||
| 	> | ||||
| 		<intent android:action="kp2a.action.ConfigureChildDatabasesActivity" /> | ||||
| 	</Preference> | ||||
|  | ||||
| 	<PreferenceCategory | ||||
|     android:title="Import and export" /> | ||||
| 	 | ||||
|   <Preference | ||||
|     android:key="export_prefs" | ||||
|     android:title="@string/export_prefs" | ||||
|   > | ||||
|     <intent android:action="kp2a.action.ExportDatabaseActivity" /> | ||||
|   </Preference> | ||||
|  | ||||
|  | ||||
| 	<Preference | ||||
| 		android:key="import_db_prefs" | ||||
| 		android:title="@string/import_db_prefs" | ||||
| 	/> | ||||
|  | ||||
| 	<Preference | ||||
| 		android:key="import_keyfile_prefs" | ||||
| 		android:title="@string/import_keyfile_prefs" | ||||
| 	/> | ||||
|  | ||||
| 	<Preference | ||||
| 		android:key="export_keyfile_prefs" | ||||
| 		android:title="@string/export_keyfile_prefs" | ||||
| 	/> | ||||
| </PreferenceCategory> | ||||
|  | ||||
|  | ||||
| </PreferenceScreen> | ||||
| 	 | ||||
| @@ -0,0 +1,47 @@ | ||||
| <?xml version="1.0" encoding="utf-8" ?>  | ||||
| <PreferenceScreen | ||||
|       xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 	  android:key="@string/kdf_screen_key" | ||||
| 	  android:title="@string/KeyDerivFunc" > | ||||
|  | ||||
|       | ||||
|       <ListPreference | ||||
| 			  android:key="@string/kdf_key" | ||||
| 			  android:title="@string/KeyDerivFunc" | ||||
| 			  android:dialogTitle="@string/KeyDerivFunc"/> | ||||
|  | ||||
|        | ||||
|  | ||||
|     <keepass2android.settings.RoundsPreference | ||||
| 		  android:key="@string/rounds_key" | ||||
| 		  android:persistent="false" | ||||
| 		  android:title="@string/rounds" | ||||
| 		  android:dialogLayout="@layout/database_kdf_settings" | ||||
| 		  android:positiveButtonText="@string/entry_save" | ||||
| 		  android:negativeButtonText="@string/entry_cancel"/> | ||||
|      | ||||
|     <keepass2android.settings.Argon2RoundsPreference | ||||
| 		  android:key="argon2rounds" | ||||
| 		  android:persistent="false" | ||||
| 		  android:title="@string/rounds" | ||||
| 		  android:dialogLayout="@layout/database_kdf_settings" | ||||
| 		  android:positiveButtonText="@string/entry_save" | ||||
| 		  android:negativeButtonText="@string/entry_cancel"/> | ||||
|      | ||||
|     <keepass2android.settings.Argon2MemoryPreference | ||||
| 		  android:key="argon2memory" | ||||
| 		  android:persistent="false" | ||||
| 		  android:title="@string/argon2memory" | ||||
| 		  android:dialogLayout="@layout/database_kdf_settings" | ||||
| 		  android:positiveButtonText="@string/entry_save" | ||||
| 		  android:negativeButtonText="@string/entry_cancel"/> | ||||
|      | ||||
|     <keepass2android.settings.Argon2ParallelismPreference | ||||
| 		  android:key="argon2parallelism" | ||||
| 		  android:persistent="false" | ||||
| 		  android:title="@string/argon2parallelism" | ||||
| 		  android:dialogLayout="@layout/database_kdf_settings" | ||||
| 		  android:positiveButtonText="@string/entry_save" | ||||
| 		  android:negativeButtonText="@string/entry_cancel"/> | ||||
| </PreferenceScreen> | ||||
|    | ||||
| @@ -2,7 +2,8 @@ | ||||
| <!-- | ||||
|   | ||||
|       | ||||
|  This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin. | ||||
|  This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on | ||||
| Keepassdroid, Copyright Brian Pellin. | ||||
|  | ||||
|   Keepass2Android is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
| @@ -18,718 +19,38 @@ | ||||
|   along with Keepass2Android.  If not, see <http://www.gnu.org/licenses/>. | ||||
| --> | ||||
| <PreferenceScreen | ||||
| 	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" | ||||
|   android:key="mainprefs"> | ||||
| 	<PreferenceScreen | ||||
| 	  android:key="@string/db_key" | ||||
| 	  android:title="@string/database" | ||||
| 	  android:summary="@string/menu_db_settings"> | ||||
|     <keepass2android.ToolbarPreference | ||||
|  | ||||
|   <Preference | ||||
|     app:iconSpaceReserved="false" | ||||
|     app:fragment="keepass2android.settings.SettingsFragmentDatabase" | ||||
|     android:key="@string/db_key" | ||||
|     android:title="@string/database" /> | ||||
| 		<EditTextPreference | ||||
|                 android:title="@string/database_name" | ||||
|                 android:persistent="false" | ||||
|                 android:key="@string/database_name_key"/> | ||||
| 		 | ||||
|       <ListPreference | ||||
| 			  android:key="@string/algorithm_key" | ||||
| 			  android:title="@string/algorithm" | ||||
| 			  android:dialogTitle="@string/algorithm"/> | ||||
|     android:title="@string/database" | ||||
|     android:summary="@string/menu_db_settings" /> | ||||
|  | ||||
|     <PreferenceScreen | ||||
| 	  android:key="@string/kdf_screen_key" | ||||
| 	  android:title="@string/KeyDerivFunc" > | ||||
| <keepass2android.ToolbarPreference | ||||
|     android:key="@string/kdf_screen_key" | ||||
|     android:title="@string/KeyDerivFunc" /> | ||||
|       | ||||
|       <ListPreference | ||||
| 			  android:key="@string/kdf_key" | ||||
| 			  android:title="@string/KeyDerivFunc" | ||||
| 			  android:dialogTitle="@string/KeyDerivFunc"/> | ||||
|  | ||||
|        | ||||
|   <Preference | ||||
|     app:iconSpaceReserved="false" | ||||
|     app:fragment="keepass2android.settings.SettingsFragmentApp" | ||||
|     android:key="@string/app_key" | ||||
|     android:title="@string/application" | ||||
|     android:summary="@string/application_settings" /> | ||||
|  | ||||
|     <keepass2android.settings.RoundsPreference | ||||
| 		  android:key="@string/rounds_key" | ||||
| 		  android:persistent="false" | ||||
| 		  android:title="@string/rounds" | ||||
| 		  android:dialogLayout="@layout/database_settings" | ||||
| 		  android:positiveButtonText="@string/entry_save" | ||||
| 		  android:negativeButtonText="@string/entry_cancel"/> | ||||
|  | ||||
|   <Preference android:key="plugin_key" android:title="@string/plugins" app:iconSpaceReserved="false"> | ||||
|      | ||||
|     <keepass2android.settings.Argon2RoundsPreference | ||||
| 		  android:key="argon2rounds" | ||||
| 		  android:persistent="false" | ||||
| 		  android:title="@string/rounds" | ||||
| 		  android:dialogLayout="@layout/database_settings" | ||||
| 		  android:positiveButtonText="@string/entry_save" | ||||
| 		  android:negativeButtonText="@string/entry_cancel"/> | ||||
|      | ||||
|     <keepass2android.settings.Argon2MemoryPreference | ||||
| 		  android:key="argon2memory" | ||||
| 		  android:persistent="false" | ||||
| 		  android:title="@string/argon2memory" | ||||
| 		  android:dialogLayout="@layout/database_settings" | ||||
| 		  android:positiveButtonText="@string/entry_save" | ||||
| 		  android:negativeButtonText="@string/entry_cancel"/> | ||||
|      | ||||
|     <keepass2android.settings.Argon2ParallelismPreference | ||||
| 		  android:key="argon2parallelism" | ||||
| 		  android:persistent="false" | ||||
| 		  android:title="@string/argon2parallelism" | ||||
| 		  android:dialogLayout="@layout/database_settings" | ||||
| 		  android:positiveButtonText="@string/entry_save" | ||||
| 		  android:negativeButtonText="@string/entry_cancel"/> | ||||
| </PreferenceScreen> | ||||
|    | ||||
| 		<EditTextPreference | ||||
| 			  android:title="@string/default_username" | ||||
| 			  android:persistent="false" | ||||
| 			  android:key="@string/default_username_key"/> | ||||
| 		 | ||||
| 		<Preference android:key="@string/master_pwd_key" | ||||
| 		  android:title="@string/menu_change_key" | ||||
| 					/> | ||||
|      | ||||
|     <PreferenceScreen | ||||
|         android:key="fingerprint_prefs" | ||||
|         android:title="@string/fingerprint_prefs" | ||||
| 	  > | ||||
|       <intent android:action="kp2a.action.FingerprintSetupActivity"/> | ||||
|     </PreferenceScreen> | ||||
|     <intent android:action="kp2a.action.PluginListActivity" /> | ||||
|   </Preference> | ||||
|  | ||||
|     <Preference android:key="AddTemplates_pref_key" | ||||
| 		  android:title="@string/AddTemplates_pref" | ||||
| 					/> | ||||
|      | ||||
|  | ||||
|     <PreferenceScreen | ||||
| 	  android:key="export_prefs" | ||||
| 	  android:title="@string/export_prefs" | ||||
| 	  > | ||||
| 			<intent android:action="kp2a.action.ExportDatabaseActivity"/> | ||||
| 		</PreferenceScreen> | ||||
|  | ||||
|     <PreferenceScreen | ||||
|       android:key="configure_child_dbs_prefs" | ||||
|       android:title="@string/configure_child_dbs" | ||||
|     > | ||||
|       <intent android:action="kp2a.action.ConfigureChildDatabasesActivity"/> | ||||
|     </PreferenceScreen> | ||||
|  | ||||
| 		<Preference | ||||
| 	  android:key="import_db_prefs" | ||||
| 	  android:title="@string/import_db_prefs" | ||||
| 	  /> | ||||
| 		 | ||||
| 		<Preference | ||||
| 			  android:key="import_keyfile_prefs" | ||||
| 			  android:title="@string/import_keyfile_prefs" | ||||
| 	  /> | ||||
|  | ||||
|     <Preference | ||||
|       android:key="export_keyfile_prefs" | ||||
|       android:title="@string/export_keyfile_prefs" | ||||
|     /> | ||||
|   <Preference | ||||
|     app:iconSpaceReserved="false" | ||||
|     android:key="@string/about_prefs_key" | ||||
|     android:title="@string/menu_about" | ||||
|   > | ||||
|     <intent android:action="kp2a.action.AboutActivity" /> | ||||
|   </Preference> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|   </PreferenceScreen> | ||||
| 	 | ||||
|  | ||||
| 	<PreferenceScreen | ||||
| 	  android:key="@string/app_key" | ||||
| 	  android:title="@string/application" | ||||
| 	  android:summary="@string/application_settings"> | ||||
|     <keepass2android.ToolbarPreference | ||||
|         android:key="@string/app_key" | ||||
|         android:title="@string/application" /> | ||||
| 		<PreferenceScreen | ||||
| 	  android:key="@string/security_prefs_key" | ||||
| 	  android:title="@string/security_prefs" | ||||
| 	  > | ||||
|       <keepass2android.ToolbarPreference | ||||
|     android:key="@string/security_prefs_key" | ||||
| 	  android:title="@string/security_prefs" /> | ||||
|  | ||||
| 			<ListPreference | ||||
| 			  android:key="@string/clipboard_timeout_key" | ||||
| 			  android:title="@string/clipboard_timeout" | ||||
| 			  android:summary="@string/clipboard_timeout_summary" | ||||
| 			  android:entries="@array/clipboard_timeout_options" | ||||
| 			  android:entryValues="@array/clipboard_timeout_values" | ||||
| 			  android:dialogTitle="@string/clipboard_timeout" | ||||
| 			  android:defaultValue="@string/clipboard_timeout_default"/> | ||||
| 			<ListPreference | ||||
| 			  android:key="@string/app_timeout_key" | ||||
| 			  android:title="@string/app_timeout" | ||||
| 			  android:summary="@string/app_timeout_summary" | ||||
| 			  android:entries="@array/clipboard_timeout_options" | ||||
| 			  android:entryValues="@array/clipboard_timeout_values" | ||||
| 			  android:dialogTitle="@string/app_timeout" | ||||
| 			  android:defaultValue="@string/clipboard_timeout_default"/> | ||||
| 			<CheckBoxPreference | ||||
| 			   android:enabled="true" | ||||
| 				 android:persistent="true" | ||||
| 				 android:summary="@string/LockWhenScreenOff_summary" | ||||
| 				 android:defaultValue="false" | ||||
| 				 android:title="@string/LockWhenScreenOff_title" | ||||
| 				 android:key="@string/LockWhenScreenOff_key" /> | ||||
|  | ||||
| 			<CheckBoxPreference | ||||
| 			   android:enabled="true" | ||||
| 				 android:persistent="true" | ||||
| 				 android:summary="@string/LockWhenNavigateBack_summary" | ||||
| 				 android:defaultValue="false" | ||||
| 				 android:title="@string/LockWhenNavigateBack_title" | ||||
| 				 android:key="@string/LockWhenNavigateBack_key" /> | ||||
|  | ||||
| 			<CheckBoxPreference | ||||
| 				android:key="@string/RememberRecentFiles_key" | ||||
| 				android:title="@string/RememberRecentFiles_title" | ||||
| 				android:summary="@string/RememberRecentFiles_summary" | ||||
| 				android:defaultValue="@bool/RememberRecentFiles_default"/> | ||||
|  | ||||
| 			<CheckBoxPreference | ||||
| 				android:key="@string/keyfile_key" | ||||
| 				android:title="@string/remember_keyfile_title" | ||||
| 				android:summary="@string/remember_keyfile_summary" | ||||
| 				android:defaultValue="@bool/keyfile_default"/> | ||||
|  | ||||
| 			<CheckBoxPreference | ||||
| 				android:key="@string/show_kill_app_key" | ||||
| 				android:title="@string/show_kill_app" | ||||
| 				android:summary="@string/show_kill_app_summary" | ||||
| 				android:defaultValue="false"/> | ||||
| 			 | ||||
| 			<CheckBoxPreference | ||||
| 			     android:enabled="true" | ||||
| 				 android:persistent="true" | ||||
| 				 android:summary="@string/ClearPasswordOnLeave_summary" | ||||
| 				 android:defaultValue="false" | ||||
| 				 android:title="@string/ClearPasswordOnLeave_title" | ||||
| 				 android:key="@string/ClearPasswordOnLeave_key" /> | ||||
|  | ||||
| 		  <CheckBoxPreference | ||||
| 		    android:enabled="true" | ||||
| 		    android:persistent="true" | ||||
| 		    android:summary="@string/UseKp2aKeyboardInKp2a_summary" | ||||
| 		    android:defaultValue="false" | ||||
| 		    android:title="@string/UseKp2aKeyboardInKp2a_title" | ||||
| 		    android:key="@string/UseKp2aKeyboardInKp2a_key" /> | ||||
|  | ||||
|  | ||||
| 		</PreferenceScreen> | ||||
| 		<PreferenceScreen | ||||
| 	  android:key="@string/display_prefs_key" | ||||
| 	  android:title="@string/display_prefs" | ||||
| 	  > | ||||
|       <keepass2android.ToolbarPreference | ||||
|     android:key="@string/display_prefs_key" | ||||
| 	  android:title="@string/display_prefs" /> | ||||
| 			<CheckBoxPreference | ||||
| 				android:enabled="true" | ||||
| 					 android:persistent="true" | ||||
| 					 android:summary="@string/ShowUnlockedNotification_summary" | ||||
| 					 android:defaultValue="@bool/ShowUnlockedNotification_default" | ||||
| 					 android:title="@string/ShowUnlockedNotification_title" | ||||
| 					 android:key="@string/ShowUnlockedNotification_key" /> | ||||
| 			<CheckBoxPreference | ||||
| 			  android:key="@string/maskpass_key" | ||||
| 			  android:title="@string/maskpass_title" | ||||
| 			  android:summary="@string/maskpass_summary" | ||||
| 			  android:defaultValue="@bool/maskpass_default"/> | ||||
|  | ||||
|       <CheckBoxPreference | ||||
|         android:key="@string/masktotp_key" | ||||
|         android:title="@string/masktotp_title" | ||||
|         android:summary="@string/masktotp_summary" | ||||
|         android:defaultValue="@bool/masktotp_default"/> | ||||
|  | ||||
| 			<CheckBoxPreference | ||||
| 			  android:key="@string/ShowUsernameInList_key" | ||||
| 			  android:title="@string/ShowUsernameInList_title" | ||||
| 			  android:summary="@string/ShowUsernameInList_summary" | ||||
| 			  android:defaultValue="@bool/ShowUsernameInList_default"/> | ||||
|  | ||||
| 			<CheckBoxPreference | ||||
| 			  android:key="@string/ShowGroupnameInSearchResult_key" | ||||
| 			  android:title="@string/ShowGroupnameInSearchResult_title" | ||||
| 			  android:summary="@string/ShowGroupnameInSearchResult_resume" | ||||
| 			  android:defaultValue="@bool/ShowGroupnameInSearchResult_default"/> | ||||
| 			<CheckBoxPreference | ||||
| 			  android:key="ShowGroupInEntry" | ||||
| 			  android:title="@string/ShowGroupInEntry_title" | ||||
| 			  android:defaultValue="false"/> | ||||
| 			<ListPreference | ||||
| 			  android:key="@string/list_size_key" | ||||
| 			  android:title="@string/list_size_title" | ||||
| 			  android:summary="@string/list_size_summary" | ||||
| 			  android:entries="@array/list_size_options" | ||||
| 			  android:entryValues="@array/list_size_values" | ||||
| 			  android:dialogTitle="@string/list_size_summary" | ||||
| 			  android:defaultValue="@string/list_size_default"/> | ||||
|  | ||||
|       <keepass2android.IconSetPreference | ||||
|                 android:title="@string/IconSet_title" | ||||
|                 android:persistent="false" | ||||
|                 android:key="IconSetKey"/> | ||||
|  | ||||
|       <ListPreference | ||||
| 			  android:key="@string/design_key" | ||||
| 			  android:title="@string/design_title" | ||||
| 			  android:entries="@array/design_options" | ||||
| 			  android:entryValues="@array/design_values" | ||||
| 			  android:dialogTitle="@string/design_title" | ||||
| 			  android:defaultValue="@string/design_default"/> | ||||
|  | ||||
|       <ListPreference | ||||
|     android:key="@string/app_language_pref_key" | ||||
|     android:title="@string/app_language_pref_title" | ||||
|     android:dialogTitle="@string/app_language_pref_title" | ||||
|     /> | ||||
|  | ||||
|        | ||||
|       <CheckBoxPreference | ||||
| 				android:enabled="true" | ||||
| 					 android:persistent="true" | ||||
| 					 android:summary="@string/ViewDatabaseSecure_summary" | ||||
| 					 android:defaultValue="true" | ||||
| 					 android:title="@string/ViewDatabaseSecure_title" | ||||
| 					 android:key="@string/ViewDatabaseSecure_key" /> | ||||
|  | ||||
| 		  <CheckBoxPreference | ||||
| 		    android:enabled="true" | ||||
| 		    android:persistent="true" | ||||
| 		    android:summary="@string/ActivateSearchViewOnStart_summary" | ||||
| 		    android:defaultValue="false" | ||||
| 		    android:title="@string/ActivateSearchViewOnStart_title" | ||||
| 		    android:key="ActivateSearchView" /> | ||||
|        | ||||
| 			<CheckBoxPreference | ||||
| 				android:enabled="true" | ||||
| 					 android:persistent="true" | ||||
| 					 android:summary="@string/NoDonateOption_summary" | ||||
| 					 android:defaultValue="false" | ||||
| 					 android:title="@string/NoDonateOption_title" | ||||
| 					 android:key="@string/NoDonateOption_key" /> | ||||
|  | ||||
|       <CheckBoxPreference | ||||
| 				android:enabled="true" | ||||
| 					 android:persistent="true" | ||||
| 					 android:summary="@string/NoDonationReminder_summary" | ||||
| 					 android:defaultValue="false" | ||||
| 					 android:title="@string/NoDonationReminder_title" | ||||
| 					 android:key="@string/NoDonationReminder_key" /> | ||||
| 		</PreferenceScreen> | ||||
|  | ||||
| 		<PreferenceScreen | ||||
| 			  android:key="@string/password_access_prefs_key" | ||||
| 			  android:title="@string/password_access_prefs" | ||||
| 			  > | ||||
|       <keepass2android.ToolbarPreference | ||||
|     android:key="@string/password_access_prefs_key" | ||||
| 			  android:title="@string/password_access_prefs" /> | ||||
| 			<CheckBoxPreference | ||||
| 				android:enabled="true" | ||||
| 				  android:persistent="true" | ||||
| 				  android:summary="@string/ShowCopyToClipboardNotification_summary" | ||||
| 				  android:defaultValue="@bool/CopyToClipboardNotification_default" | ||||
| 				  android:title="@string/ShowCopyToClipboardNotification_title" | ||||
| 				  android:key="@string/CopyToClipboardNotification_key" /> | ||||
| 			<CheckBoxPreference | ||||
| 				android:enabled="true" | ||||
| 				  android:persistent="true" | ||||
| 				  android:summary="@string/ShowKp2aKeyboardNotification_summary" | ||||
| 				  android:defaultValue="@bool/UseKp2aKeyboard_default" | ||||
| 				  android:title="@string/ShowKp2aKeyboardNotification_title" | ||||
| 				  android:key="@string/UseKp2aKeyboard_key" /> | ||||
|  | ||||
| 			<CheckBoxPreference | ||||
| 				android:enabled="true" | ||||
| 				  android:persistent="true" | ||||
| 				  android:summary="@string/ShowSeparateNotifications_summary" | ||||
| 				  android:defaultValue="@bool/ShowSeparateNotifications_default" | ||||
| 				  android:title="@string/ShowSeparateNotifications_title" | ||||
| 				  android:key="@string/ShowSeparateNotifications_key" /> | ||||
|  | ||||
| 			<PreferenceScreen | ||||
| 				 android:key="@string/keyboardswitch_prefs_key" | ||||
| 	  android:title="@string/keyboardswitch_prefs" | ||||
| 				 			android:dependency="@string/UseKp2aKeyboard_key" | ||||
| 	  > | ||||
|         <keepass2android.ToolbarPreference | ||||
|   android:key="@string/keyboardswitch_prefs_key" | ||||
| 	  android:title="@string/keyboardswitch_prefs"/> | ||||
| 				<CheckBoxPreference | ||||
| 							android:key="kp2a_switch_rooted" | ||||
| 							android:title="@string/kp2a_switch_rooted" | ||||
| 							android:summary="@string/kp2a_switch_rooted_summary" | ||||
| 							android:persistent="true" | ||||
| 							android:defaultValue="false" | ||||
|             /> | ||||
|          | ||||
|         <Preference  | ||||
|           android:key="get_keyboardswap"  | ||||
|           		android:summary="@string/get_keyboardswap_summary" | ||||
|           android:title="@string/get_keyboardswap"  | ||||
|           /> | ||||
|  | ||||
| 				<!-- no autoswitch on root only--> | ||||
| 				<CheckBoxPreference | ||||
| 				android:enabled="true" | ||||
| 				  android:persistent="true" | ||||
| 				  android:summary="@string/OpenKp2aKeyboardAutomatically_summary" | ||||
| 				  android:defaultValue="@bool/OpenKp2aKeyboardAutomatically_default" | ||||
| 				  android:title="@string/OpenKp2aKeyboardAutomatically_title" | ||||
| 				  android:key="@string/OpenKp2aKeyboardAutomatically_key" /> | ||||
| 				 | ||||
| 				<!-- autoswitch on root only--> | ||||
| 				<CheckBoxPreference | ||||
| 				android:enabled="true" | ||||
| 				  android:persistent="true" | ||||
| 				  android:summary="@string/OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_summary" | ||||
| 				  android:defaultValue="@bool/OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_default" | ||||
| 				  android:title="@string/OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_title" | ||||
| 				  android:key="@string/OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_key" /> | ||||
| 				 | ||||
| 					 | ||||
| 				<!-- with and without autoswitch on root--> | ||||
| 				<CheckBoxPreference | ||||
| 				android:enabled="true" | ||||
| 				  android:persistent="true" | ||||
| 				  android:summary="@string/AutoSwitchBackKeyboard_summary" | ||||
| 				  android:defaultValue="@bool/AutoSwitchBackKeyboard_default" | ||||
| 				  android:title="@string/AutoSwitchBackKeyboard_title" | ||||
| 				  android:key="@string/AutoSwitchBackKeyboard_key" /> | ||||
| 				 | ||||
| 				<CheckBoxPreference | ||||
|             android:key="kp2a_switch_on_sendgodone" | ||||
|             android:title="@string/kp2a_switch_on_sendgodone" | ||||
|             android:summary="@string/kp2a_switch_on_sendgodone_summary" | ||||
|             android:persistent="true" | ||||
|             android:defaultValue="false" | ||||
|             /> | ||||
|  | ||||
| 			</PreferenceScreen> | ||||
|  | ||||
| 		  <PreferenceScreen | ||||
| 		    android:key="@string/AutoFill_prefs_screen_key" | ||||
| 		    android:title="@string/AutoFill_prefs" | ||||
| 		  > | ||||
|         <keepass2android.ToolbarPreference | ||||
|           android:key="@string/AutoFill_prefs_screen_key" | ||||
|           android:title="@string/AutoFill_prefs" /> | ||||
|       <Preference  | ||||
|         android:key="@string/AutoFill_prefs_key" | ||||
|         android:title="@string/AutoFill_prefs"> | ||||
|          | ||||
|       </Preference> | ||||
|          | ||||
|          | ||||
| 		    <CheckBoxPreference | ||||
| 		      android:enabled="true" | ||||
| 		      android:persistent="true" | ||||
| 		      android:summary="@string/OfferSaveCredentials_summary" | ||||
| 		      android:defaultValue="true" | ||||
| 		      android:title="@string/OfferSaveCredentials_title" | ||||
| 		      android:key="@string/OfferSaveCredentials_key" /> | ||||
|  | ||||
|         <CheckBoxPreference | ||||
|           android:enabled="true" | ||||
|           android:persistent="true" | ||||
|           android:summary="@string/NoDalVerification_summary" | ||||
|           android:defaultValue="false" | ||||
|           android:title="@string/NoDalVerification_title" | ||||
|           android:key="@string/NoDalVerification_key" /> | ||||
|  | ||||
|         <CheckBoxPreference | ||||
|        android:enabled="true" | ||||
|        android:persistent="true" | ||||
|        android:summary="@string/InlineSuggestions_summary" | ||||
|        android:defaultValue="true" | ||||
|        android:title="@string/InlineSuggestions_title" | ||||
|        android:key="@string/InlineSuggestions_key" /> | ||||
|  | ||||
|         <CheckBoxPreference | ||||
|           android:enabled="true" | ||||
|           android:persistent="true" | ||||
|           android:summary="@string/LogAutofillView_summary" | ||||
|           android:defaultValue="false" | ||||
|           android:title="@string/LogAutofillView_title" | ||||
|           android:key="@string/LogAutofillView_key" /> | ||||
|  | ||||
|      | ||||
|  | ||||
|         <CheckBoxPreference | ||||
|           android:enabled="true" | ||||
|           android:persistent="true" | ||||
|           android:summary="@string/NoAutofillDisabling_summary" | ||||
|           android:defaultValue="false" | ||||
|           android:title="@string/NoAutofillDisabling_title" | ||||
|           android:key="@string/NoAutofillDisabling_key" /> | ||||
|  | ||||
| 		  <keepass2android.AutofillDisabledQueriesPreference | ||||
| 		    android:title="@string/AutofillDisabledQueriesPreference_title" | ||||
| 		    android:summary="@string/AutofillDisabledQueriesPreference_summary" | ||||
| 		    android:persistent="false" | ||||
| 		    android:key="AutofillDisabledQueriesPreference_key"/> | ||||
|  | ||||
|         <PreferenceScreen | ||||
|           android:key="@string/AutoFillTotp_prefs_screen_key" | ||||
|           android:title="@string/AutoFillTotp_prefs_title" | ||||
|         > | ||||
|           <keepass2android.ToolbarPreference | ||||
|             android:key="@string/AutoFillTotp_prefs_screen_key" | ||||
|             android:title="@string/AutoFillTotp_prefs_title" /> | ||||
|  | ||||
| 					<CheckBoxPreference android:key="AutoFillTotp_prefs_ShowNotification_key" | ||||
|                               android:enabled="true" | ||||
|                               android:persistent="true" | ||||
|                               android:summary="@string/AutoFillTotp_prefs_ShowNotification_summary" | ||||
|                               android:defaultValue="true" | ||||
|                               android:title="@string/AutoFillTotp_prefs_ShowNotification_title" | ||||
|                               /> | ||||
|           <CheckBoxPreference android:key="AutoFillTotp_prefs_CopyTotpToClipboard_key" | ||||
|                               android:enabled="true" | ||||
|                               android:persistent="true" | ||||
|                               android:summary="@string/AutoFillTotp_prefs_CopyTotpToClipboard_summary" | ||||
|                               android:defaultValue="true" | ||||
|                               android:title="@string/AutoFillTotp_prefs_CopyTotpToClipboard_title" | ||||
|           /> | ||||
|           <CheckBoxPreference android:key="AutoFillTotp_prefs_ActivateKeyboard_key" | ||||
|                               android:enabled="true" | ||||
|                               android:persistent="true" | ||||
|                               android:summary="@string/AutoFillTotp_prefs_ActivateKeyboard_summary" | ||||
|                               android:defaultValue="false" | ||||
|                               android:title="@string/AutoFillTotp_prefs_ActivateKeyboard_title" | ||||
|           /> | ||||
|  | ||||
|         </PreferenceScreen> | ||||
|          | ||||
|       </PreferenceScreen> | ||||
|  | ||||
| 		  <CheckBoxPreference | ||||
| 		    android:enabled="true" | ||||
| 		    android:persistent="true" | ||||
| 		    android:summary="@string/AutoReturnFromQuery_summary" | ||||
| 		    android:defaultValue="true" | ||||
| 		    android:title="@string/AutoReturnFromQuery_title" | ||||
| 		    android:key="@string/AutoReturnFromQuery_key" /> | ||||
|  | ||||
|       </PreferenceScreen> | ||||
| 		<PreferenceScreen | ||||
| 			  android:key="@string/QuickUnlock_prefs_key" | ||||
| 			  android:title="@string/QuickUnlock_prefs" | ||||
| 			  > | ||||
|       <keepass2android.ToolbarPreference | ||||
|   android:key="@string/QuickUnlock_prefs_key" | ||||
| 			  android:title="@string/QuickUnlock_prefs"/> | ||||
| 			<CheckBoxPreference | ||||
| 			android:enabled="true" | ||||
| 				 android:persistent="true" | ||||
| 				 android:summary="@string/QuickUnlockDefaultEnabled_summary" | ||||
| 				 android:defaultValue="true" | ||||
| 				 android:title="@string/QuickUnlockDefaultEnabled_title" | ||||
| 				 android:key="@string/QuickUnlockDefaultEnabled_key" /> | ||||
| 			<EditTextPreference | ||||
| 				 android:enabled="true" | ||||
| 				 android:persistent="true" | ||||
| 				 android:summary="@string/QuickUnlockLength_summary" | ||||
| 				 android:numeric="integer" | ||||
| 				 android:defaultValue="3" | ||||
| 				 android:title="@string/QuickUnlockLength_title" | ||||
| 				 android:key="@string/QuickUnlockLength_key" /> | ||||
| 			<CheckBoxPreference | ||||
| 			android:enabled="true" | ||||
| 				 android:persistent="true" | ||||
| 				 android:summary="@string/QuickUnlockIconHidden_summary" | ||||
| 				 android:defaultValue="false" | ||||
| 				 android:title="@string/QuickUnlockIconHidden_title" | ||||
| 				 android:key="@string/QuickUnlockIconHidden_key" /> | ||||
| 			<CheckBoxPreference | ||||
| 			android:enabled="true" | ||||
| 				 android:persistent="true" | ||||
| 				 android:summary="@string/QuickUnlockIconHidden16_summary" | ||||
| 				 android:defaultValue="true" | ||||
| 				 android:title="@string/QuickUnlockIconHidden16_title" | ||||
| 				 android:key="@string/QuickUnlockIconHidden16_key" /> | ||||
| 		  <CheckBoxPreference | ||||
| 		    android:enabled="true" | ||||
| 		    android:persistent="true" | ||||
| 		    android:summary="@string/QuickUnlockHideLength_summary" | ||||
| 		    android:defaultValue="false" | ||||
| 		    android:title="@string/QuickUnlockHideLength_title" | ||||
| 		    android:key="@string/QuickUnlockHideLength_key" /> | ||||
|  | ||||
|       <CheckBoxPreference | ||||
|         android:enabled="true" | ||||
|         android:persistent="true" | ||||
|         android:summary="@string/QuickUnlockKeyFromDatabase_summary" | ||||
|         android:defaultValue="false" | ||||
|         android:title="@string/QuickUnlockKeyFromDatabase_title" | ||||
|         android:key="@string/QuickUnlockKeyFromDatabase_key" /> | ||||
|        | ||||
| 		</PreferenceScreen> | ||||
| 		<PreferenceScreen | ||||
| 	  android:key="@string/FileHandling_prefs_key" | ||||
| 	  android:title="@string/FileHandling_prefs" | ||||
| 		> | ||||
|       <keepass2android.ToolbarPreference | ||||
|   android:key="@string/FileHandling_prefs_key" | ||||
| 	  android:title="@string/FileHandling_prefs"/> | ||||
|  | ||||
| 			 | ||||
| 			<CheckBoxPreference | ||||
| 				  android:enabled="true" | ||||
| 				  android:persistent="true" | ||||
| 				  android:summary="@string/UseOfflineCache_summary" | ||||
| 				  android:defaultValue="true" | ||||
| 				  android:title="@string/UseOfflineCache_title" | ||||
| 				  android:key="@string/UseOfflineCache_key" /> | ||||
|  | ||||
| 		  <CheckBoxPreference | ||||
| 		    android:enabled="true" | ||||
| 		    android:persistent="true" | ||||
| 		    android:summary="@string/CreateBackups_summary" | ||||
| 		    android:defaultValue="true" | ||||
| 		    android:title="@string/CreateBackups_title" | ||||
| 		    android:key="@string/CreateBackups_key" /> | ||||
|        | ||||
| 			<ListPreference | ||||
| 			  android:key="@string/AcceptAllServerCertificates_key" | ||||
| 			  android:title="@string/AcceptAllServerCertificates_title" | ||||
| 			  android:summary="@string/AcceptAllServerCertificates_summary" | ||||
| 			  android:entries="@array/AcceptAllServerCertificates_options" | ||||
| 			  android:entryValues="@array/AcceptAllServerCertificates_values" | ||||
| 			  android:dialogTitle="@string/AcceptAllServerCertificates_title" | ||||
| 			  android:defaultValue="@string/AcceptAllServerCertificates_default"/> | ||||
| 			 | ||||
| 		 | ||||
| 			<CheckBoxPreference | ||||
| 				android:enabled="true" | ||||
| 				  android:persistent="true" | ||||
| 				  android:summary="@string/CheckForFileChangesOnSave_summary" | ||||
| 				  android:defaultValue="true" | ||||
| 				  android:title="@string/CheckForFileChangesOnSave_title" | ||||
| 				  android:key="@string/CheckForFileChangesOnSave_key" /> | ||||
| 			<CheckBoxPreference | ||||
| 			   android:enabled="true" | ||||
| 				 android:persistent="true" | ||||
| 				 android:summary="@string/UseFileTransactions_summary" | ||||
| 				 android:defaultValue="true" | ||||
| 				 android:title="@string/UseFileTransactions_title" | ||||
| 				 android:key="@string/UseFileTransactions_key" /> | ||||
|  | ||||
| 			<CheckBoxPreference | ||||
| 				android:enabled="true" | ||||
| 					 android:persistent="true" | ||||
| 					 android:summary="@string/PreloadDatabaseEnabled_summary" | ||||
| 					 android:defaultValue="@bool/PreloadDatabaseEnabled_default" | ||||
| 					 android:title="@string/PreloadDatabaseEnabled_title" | ||||
| 					 android:key="@string/PreloadDatabaseEnabled_key" /> | ||||
|       <CheckBoxPreference | ||||
|   android:enabled="true" | ||||
|   android:persistent="true" | ||||
|   android:summary="@string/SyncAfterQuickUnlock_summary" | ||||
|   android:defaultValue="false" | ||||
|   android:title="@string/SyncAfterQuickUnlock_title" | ||||
|   android:key="@string/SyncAfterQuickUnlock_key" /> | ||||
|  | ||||
|       <CheckBoxPreference | ||||
|         android:enabled="true" | ||||
|         android:persistent="true" | ||||
|         android:summary="@string/AlwaysMergeOnConflict_summary" | ||||
|         android:defaultValue="false" | ||||
|         android:title="@string/AlwaysMergeOnConflict_title" | ||||
|         android:key="@string/AlwaysMergeOnConflict_key" /> | ||||
|  | ||||
|       <CheckBoxPreference | ||||
|   android:key="@string/TanExpiresOnUse_key" | ||||
|   android:title="@string/TanExpiresOnUse_title" | ||||
|   android:summary="@string/TanExpiresOnUse_summary" | ||||
|   android:defaultValue="@bool/TanExpiresOnUse_default"/> | ||||
| 			<CheckBoxPreference | ||||
| 							android:enabled="true" | ||||
| 							  android:persistent="true" | ||||
| 							  android:summary="@string/CheckForDuplicateUuids_summary" | ||||
| 							  android:defaultValue="true" | ||||
| 							  android:title="@string/CheckForDuplicateUuids_title" | ||||
| 							  android:key="@string/CheckForDuplicateUuids_key" /> | ||||
|  | ||||
| 		</PreferenceScreen> | ||||
| 		<PreferenceScreen | ||||
| 	  android:key="keyboard_prefs" | ||||
| 	  android:title="@string/keyboard_prefs" | ||||
| 	  > | ||||
| 			<intent android:action="keepass2android.softkeyboard.LatinIMESettings"/> | ||||
| 		</PreferenceScreen> | ||||
| 		 | ||||
| 		<PreferenceScreen | ||||
| 	  android:key="@string/TrayTotp_prefs_key" | ||||
| 	  android:title="@string/TrayTotp_prefs" | ||||
| 		> | ||||
|       <keepass2android.ToolbarPreference | ||||
|         android:key="@string/TrayTotp_prefs_key" | ||||
| 	  android:title="@string/TrayTotp_prefs"/> | ||||
|        | ||||
| 			<EditTextPreference | ||||
| 				 android:enabled="true" | ||||
| 				 android:persistent="true" | ||||
| 				 android:summary="@string/TrayTotp_SeedField_summary" | ||||
| 				 android:defaultValue="TOTP Seed" | ||||
| 				 android:title="@string/TrayTotp_SeedField_title" | ||||
| 				 android:key="@string/TrayTotp_SeedField_key" /> | ||||
| 			<EditTextPreference | ||||
| 				 android:enabled="true" | ||||
| 				 android:persistent="true" | ||||
| 				 android:summary="@string/TrayTotp_SettingsField_summary" | ||||
| 				 android:defaultValue="TOTP Settings" | ||||
| 				 android:title="@string/TrayTotp_SettingsField_title" | ||||
| 				 android:key="@string/TrayTotp_SettingsField_key" /> | ||||
| 	</PreferenceScreen> | ||||
|  | ||||
|     <PreferenceScreen | ||||
| 	  android:key="@string/DebugLog_prefs_key" | ||||
| 	  android:title="@string/DebugLog_prefs_prefs" | ||||
| 		> | ||||
|       <CheckBoxPreference | ||||
| 							android:enabled="true" | ||||
| 							  android:persistent="true" | ||||
| 							  android:summary="@string/DebugLog_summary" | ||||
| 							  android:defaultValue="false" | ||||
| 							  android:title="@string/DebugLog_title" | ||||
| 							  android:key="@string/DebugLog_key" /> | ||||
|  | ||||
|       <Preference | ||||
|                android:enabled="true" | ||||
|                android:title="@string/DebugLog_send" | ||||
|                android:key="@string/DebugLog_send_key" /> | ||||
|       <CheckBoxPreference | ||||
| 							android:enabled="true" | ||||
| 							  android:persistent="true" | ||||
| 							  android:defaultValue="false" | ||||
| 							  android:title="@string/FtpDebug_title" | ||||
| 							  android:key="@string/FtpDebug_key" /> | ||||
|     </PreferenceScreen> | ||||
|     </PreferenceScreen> | ||||
|  | ||||
|    | ||||
|    | ||||
| 	<PreferenceScreen android:key="plugin_key" android:title="@string/plugins"> | ||||
| 		<intent android:action="kp2a.action.PluginListActivity"/> | ||||
| 	</PreferenceScreen> | ||||
|  | ||||
| 	<PreferenceScreen | ||||
| 			  android:key="@string/about_prefs_key" | ||||
| 			  android:title="@string/menu_about" | ||||
| 			  > | ||||
| 		<intent android:action="kp2a.action.AboutActivity"/> | ||||
| 	</PreferenceScreen> | ||||
| 	 | ||||
|  | ||||
| 		 | ||||
| </PreferenceScreen> | ||||
| </PreferenceScreen> | ||||
| @@ -551,7 +551,7 @@ | ||||
|     <None Remove="Resources\layout\configure_totp_dialog.xml" /> | ||||
|     <None Remove="Resources\layout\config_child_db.xml" /> | ||||
|     <None Remove="Resources\layout\create_database.xml" /> | ||||
|     <None Remove="Resources\layout\database_settings.xml" /> | ||||
|     <None Remove="Resources\layout\database_kdf_settings.xml" /> | ||||
|     <None Remove="Resources\layout\disabled_queries_preference_row.axml" /> | ||||
|     <None Remove="Resources\layout\donate.xml" /> | ||||
|     <None Remove="Resources\layout\donate_bday.xml" /> | ||||
| @@ -695,7 +695,7 @@ | ||||
|     <None Remove="Resources\values-zh-rTW\strings.xml" /> | ||||
|     <None Remove="Resources\values-zh\strings.xml" /> | ||||
|     <None Remove="Resources\values\attrs.xml" /> | ||||
|     <None Remove="Resources\values\colors.xml" /> | ||||
|     <None Remove="Resources\values\colors_kp2a.xml" /> | ||||
|     <None Remove="Resources\values\config.xml" /> | ||||
|     <None Remove="Resources\values\dimens.xml" /> | ||||
|     <None Remove="Resources\values\fonts.xml" /> | ||||
| @@ -705,6 +705,9 @@ | ||||
|     <None Remove="Resources\xml\autofillservice.xml" /> | ||||
|     <None Remove="Resources\xml\network_security_config.xml" /> | ||||
|     <None Remove="Resources\xml\preferences.xml" /> | ||||
|     <None Remove="Resources\xml\pref_app.xml" /> | ||||
|     <None Remove="Resources\xml\pref_database.xml" /> | ||||
|     <None Remove="Resources\xml\pref_database_key_deriv_func.xml" /> | ||||
|     <None Remove="Resources\xml\searchable.xml" /> | ||||
|     <None Remove="Resources\xml\searchable_debug.xml" /> | ||||
|     <None Remove="Resources\xml\searchable_mattest.xml" /> | ||||
|   | ||||
| @@ -25,7 +25,6 @@ using Android.Content; | ||||
| using Android.Content.PM; | ||||
| using Android.OS; | ||||
| using Android.Widget; | ||||
| using Android.Preferences; | ||||
| using Android.Provider; | ||||
| using Android.Views.Autofill; | ||||
| using Java.IO; | ||||
| @@ -40,856 +39,12 @@ using KeePassLib; | ||||
| using KeePassLib.Cryptography.KeyDerivation; | ||||
| using KeePassLib.Interfaces; | ||||
| using System.Collections.Generic; | ||||
| using AndroidX.Preference; | ||||
| using keepass2android_appSdkStyle; | ||||
|  | ||||
|  | ||||
| namespace keepass2android | ||||
| { | ||||
|     //http://stackoverflow.com/a/27422401/292233 | ||||
| #pragma warning disable CS0618 // Type or member is obsolete | ||||
|     public class SettingsFragment : PreferenceFragment | ||||
|     { | ||||
|  | ||||
|  | ||||
| 		 | ||||
|  | ||||
|         public class KeyboardSwitchPrefManager | ||||
|         { | ||||
|             private readonly Activity _act; | ||||
|             private CheckBoxPreference _switchPref; | ||||
|             private CheckBoxPreference _openKp2aAutoPref; | ||||
|             private CheckBoxPreference _openOnlyOnSearchPref; | ||||
|             private CheckBoxPreference _switchBackPref; | ||||
|             private PreferenceScreen _screen; | ||||
|             private PreferenceFragment _fragment; | ||||
|  | ||||
|             public KeyboardSwitchPrefManager(PreferenceFragment fragment) | ||||
|             { | ||||
|                 var act = fragment.Activity; | ||||
|                 this._act = act; | ||||
|                 this._fragment = fragment; | ||||
| 				this._screen = (PreferenceScreen)_fragment.FindPreference(act.GetString(Resource.String.keyboardswitch_prefs_key)); | ||||
|  | ||||
| 	            var keyboardSwapPref = _fragment.FindPreference("get_keyboardswap"); | ||||
| 	            var pm = act.PackageManager; | ||||
| 	            var intnt = Keepass2android.Kbbridge.ImeSwitcher.GetLaunchIntentForKeyboardSwap(act); | ||||
| 	            if ((intnt != null) && pm.QueryIntentActivities(intnt, 0).Any()) | ||||
| 	            { | ||||
| 		            _screen.RemovePreference(keyboardSwapPref); | ||||
| 	            } | ||||
| 	            else | ||||
| 	            { | ||||
| 		            keyboardSwapPref.PreferenceClick += (sender, args) => | ||||
| 		            { | ||||
| 						Util.GotoUrl(act, act.GetString(Resource.String.MarketURL) + "keepass2android.plugin.keyboardswap2"); | ||||
| 		            }; | ||||
| 	            } | ||||
|  | ||||
|                 _switchPref = (CheckBoxPreference)_fragment.FindPreference("kp2a_switch_rooted"); | ||||
|                 _openKp2aAutoPref = | ||||
|                     (CheckBoxPreference)_fragment.FindPreference(act.GetString(Resource.String.OpenKp2aKeyboardAutomatically_key)); | ||||
|                 _openOnlyOnSearchPref = | ||||
|                     (CheckBoxPreference) | ||||
|                     _fragment.FindPreference(act.GetString(Resource.String.OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_key)); | ||||
|                 _switchBackPref = | ||||
|                     (CheckBoxPreference)_fragment.FindPreference(act.GetString(Resource.String.AutoSwitchBackKeyboard_key)); | ||||
|                  | ||||
|                 EnableSwitchPreferences(_switchPref.Checked); | ||||
|  | ||||
|                 _switchPref.PreferenceChange += (sender, args) => | ||||
|                 { | ||||
|                     bool switchOnRooted = (bool)args.NewValue; | ||||
|                     EnableSwitchPreferences(switchOnRooted); | ||||
|                 }; | ||||
|             } | ||||
|  | ||||
|  | ||||
|             private void EnableSwitchPreferences(bool switchOnRooted) | ||||
|             { | ||||
|                 if (!switchOnRooted) | ||||
|                 { | ||||
|                     if (_fragment.FindPreference(_act.GetString(Resource.String.OpenKp2aKeyboardAutomatically_key)) == null) | ||||
|                     { | ||||
|                         _screen.AddPreference(_openKp2aAutoPref); | ||||
|                     } | ||||
|                     if (_fragment.FindPreference(_act.GetString(Resource.String.OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_key)) != null) | ||||
|                     { | ||||
|                         _screen.RemovePreference(_openOnlyOnSearchPref); | ||||
|                     } | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     { | ||||
|                         _screen.RemovePreference(_openKp2aAutoPref); | ||||
|                     } | ||||
|                     if (_fragment.FindPreference(_act.GetString(Resource.String.OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_key)) == null) | ||||
|                     { | ||||
|                         _screen.AddPreference(_openOnlyOnSearchPref); | ||||
|                     } | ||||
|                 } | ||||
|                 /*_openKp2aAutoPref.Enabled = !switchOnRooted; | ||||
|  | ||||
|                 _openOnlyOnSearchPref.Enabled = switchOnRooted; | ||||
|  | ||||
|                 _switchBackPref.Enabled = switchOnRooted;*/ | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private KeyboardSwitchPrefManager _switchPrefManager; | ||||
| 		private Preference aesRounds, argon2parallelism, argon2rounds, argon2memory; | ||||
|          | ||||
|  | ||||
|         void OnRememberKeyFileHistoryChanged(object sender, Preference.PreferenceChangeEventArgs eventArgs) | ||||
|         { | ||||
|             if (!(bool)eventArgs.NewValue) | ||||
|             { | ||||
|                 App.Kp2a.FileDbHelper.DeleteAllKeys(); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         void OnShowUnlockedNotificationChanged(object sender, Preference.PreferenceChangeEventArgs eventArgs) | ||||
|         { | ||||
|             App.Kp2a.UpdateOngoingNotification(); | ||||
|         } | ||||
|  | ||||
|         public override void OnResume() | ||||
|         { | ||||
|             base.OnResume(); | ||||
|  | ||||
|             UpdateAutofillPref(); | ||||
|         } | ||||
|  | ||||
|  | ||||
|         public override void OnCreate(Bundle savedInstanceState) | ||||
|         { | ||||
|             base.OnCreate(savedInstanceState); | ||||
|             AddPreferencesFromResource(Resource.Xml.preferences); | ||||
|  | ||||
|             // Re-use the change handlers for the application settings | ||||
|             FindPreference(GetString(Resource.String.keyfile_key)).PreferenceChange += OnRememberKeyFileHistoryChanged; | ||||
|             var unlockedNotificationPref = FindPreference(GetString(Resource.String.ShowUnlockedNotification_key)); | ||||
|             unlockedNotificationPref.PreferenceChange += OnShowUnlockedNotificationChanged; | ||||
|             if ((int)Build.VERSION.SdkInt >= 26) | ||||
|             { | ||||
|                 //use system notification channels to control notification visibility | ||||
|                 unlockedNotificationPref.Parent.RemovePreference(unlockedNotificationPref); | ||||
|             } | ||||
|  | ||||
|  | ||||
|             FindPreference(GetString(Resource.String.DebugLog_key)).PreferenceChange += OnDebugLogChanged; | ||||
|             FindPreference(GetString(Resource.String.DebugLog_send_key)).PreferenceClick += OnSendDebug; | ||||
|  | ||||
| #if !EXCLUDE_JAVAFILESTORAGE && !NoNet | ||||
|             FindPreference(GetString(Resource.String.FtpDebug_key)).PreferenceChange += OnJSchDebugChanged; | ||||
| #else | ||||
|             FindPreference(GetString(Resource.String.FtpDebug_key)).Enabled = false; | ||||
| #endif | ||||
|  | ||||
|             HashSet<string> supportedLocales = new HashSet<string>() { "en", "af", "ar", "az", "be", "bg", "ca", "cs", "da", "de", "el", "es", "eu", "fa", "fi", "fr", "gl", "he", "hr", "hu", "id", "in", "it", "iw", "ja", "ko", "ml", "nb", "nl", "nn", "no", "pl", "pt", "ro", "ru", "si", "sk", "sl", "sr", "sv", "tr", "uk", "vi", "zh" }; | ||||
|             var languagePref = (ListPreference)FindPreference(GetString(Resource.String.app_language_pref_key)); | ||||
|             new AppLanguageManager(this, languagePref, supportedLocales); | ||||
|  | ||||
|             UpdateAutofillPref(); | ||||
|  | ||||
|             var autofillPref = FindPreference(GetString(Resource.String.AutoFill_prefs_key)); | ||||
|             if (autofillPref != null) | ||||
|             { | ||||
|                 autofillPref.PreferenceClick += (sender, args) => | ||||
|                 { | ||||
|  | ||||
|                     var intent = new Intent(Settings.ActionRequestSetAutofillService); | ||||
|                     if (((AutofillManager)Activity.GetSystemService(Java.Lang.Class.FromType(typeof(AutofillManager)))) | ||||
|                         .HasEnabledAutofillServices) | ||||
|                     { | ||||
|                         intent.SetData(Android.Net.Uri.Parse("package:" + Context.PackageName + "notexisting")); //if we use our package name, the activity won't launch | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         intent.SetData(Android.Net.Uri.Parse("package:" + Context.PackageName)); | ||||
|                     } | ||||
|  | ||||
|                     try | ||||
|                     { | ||||
|                         Context.StartActivity(intent); | ||||
|                     } | ||||
|                     catch (ActivityNotFoundException e) | ||||
|                     { | ||||
|                         //this exception was reported by many Huawei users | ||||
|                         Kp2aLog.LogUnexpectedError(e); | ||||
|                         new AlertDialog.Builder(Context) | ||||
|                             .SetTitle(Resource.String.autofill_enable) | ||||
|                             .SetMessage(Resource.String.autofill_enable_failed) | ||||
|                             .SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => { }) | ||||
|                             .Show(); | ||||
|  | ||||
|                     } | ||||
|                     catch (Exception e) | ||||
|                     { | ||||
|                         Kp2aLog.LogUnexpectedError(e); | ||||
|                     } | ||||
|                 }; | ||||
|             } | ||||
|  | ||||
|  | ||||
|             PrepareNoDonatePreference(Activity, FindPreference(GetString(Resource.String.NoDonateOption_key))); | ||||
|             PrepareNoDonationReminderPreference(Activity, ((PreferenceScreen)FindPreference(GetString(Resource.String.display_prefs_key))), FindPreference(GetString(Resource.String.NoDonationReminder_key))); | ||||
|  | ||||
|             FindPreference(GetString(Resource.String.design_key)).PreferenceChange += (sender, args) => Activity.Recreate(); | ||||
|  | ||||
|             Database db = App.Kp2a.CurrentDb; | ||||
|             if (db != null) | ||||
|             { | ||||
|                 ListPreference kdfPref = (ListPreference)FindPreference(GetString(Resource.String.kdf_key)); | ||||
|                 kdfPref.SetEntries(KdfPool.Engines.Select(eng => eng.Name).ToArray()); | ||||
|                 string[] kdfValues = KdfPool.Engines.Select(eng => eng.Uuid.ToHexString()).ToArray(); | ||||
|                 kdfPref.SetEntryValues(kdfValues); | ||||
|                 kdfPref.SetValueIndex(kdfValues.Select((v, i) => new { kdf = v, index = i }).First(el => el.kdf == db.KpDatabase.KdfParameters.KdfUuid.ToHexString()).index); | ||||
|                 kdfPref.PreferenceChange += OnKdfChange; | ||||
|  | ||||
|                 aesRounds = FindPreference(GetString(Resource.String.rounds_key)); | ||||
|                 argon2rounds = FindPreference("argon2rounds"); | ||||
|                 argon2memory = FindPreference("argon2memory"); | ||||
|                 argon2parallelism = FindPreference("argon2parallelism"); | ||||
|  | ||||
|                 aesRounds.PreferenceChange += (sender, e) => UpdateKdfSummary(e.Preference); | ||||
|                 argon2rounds.PreferenceChange += (sender, e) => UpdateKdfSummary(e.Preference); | ||||
|                 argon2memory.PreferenceChange += (sender, e) => UpdateKdfSummary(e.Preference); | ||||
|                 argon2parallelism.PreferenceChange += (sender, e) => UpdateKdfSummary(e.Preference); | ||||
|  | ||||
|                 UpdateKdfScreen(); | ||||
|  | ||||
|                 PrepareDefaultUsername(db); | ||||
|                 PrepareDatabaseName(db); | ||||
|                 PrepareMasterPassword(); | ||||
|                 PrepareTemplates(db); | ||||
|  | ||||
|                 ListPreference algorithmPref = (ListPreference)FindPreference(GetString(Resource.String.algorithm_key)); | ||||
|                 algorithmPref.SetEntries(CipherPool.GlobalPool.Engines.Select(eng => eng.DisplayName).ToArray()); | ||||
|                 string[] algoValues = CipherPool.GlobalPool.Engines.Select(eng => eng.CipherUuid.ToHexString()).ToArray(); | ||||
|                 algorithmPref.SetEntryValues(algoValues); | ||||
|                 algorithmPref.SetValueIndex(algoValues.Select((v, i) => new { kdf = v, index = i }).First(el => el.kdf == db.KpDatabase.DataCipherUuid.ToHexString()).index); | ||||
|                 algorithmPref.PreferenceChange += AlgorithmPrefChange; | ||||
|                 algorithmPref.Summary = | ||||
|                     CipherPool.GlobalPool.GetCipher(App.Kp2a.CurrentDb.KpDatabase.DataCipherUuid).DisplayName; | ||||
|                 UpdateImportDbPref(); | ||||
|                 UpdateImportKeyfilePref(); | ||||
|             } | ||||
|  | ||||
|             try | ||||
|             { | ||||
|                 //depending on Android version, we offer to use a transparent icon for QuickUnlock or use the notification priority (since API level 16) | ||||
|                 Preference hideQuickUnlockTranspIconPref = FindPreference(GetString(Resource.String.QuickUnlockIconHidden_key)); | ||||
|                 Preference hideQuickUnlockIconPref = FindPreference(GetString(Resource.String.QuickUnlockIconHidden16_key)); | ||||
|                 var quickUnlockScreen = ((PreferenceScreen)FindPreference(GetString(Resource.String.QuickUnlock_prefs_key))); | ||||
|                 if ((int)Android.OS.Build.VERSION.SdkInt >= 26) | ||||
|                 { | ||||
|                     //use notification channels | ||||
|                     quickUnlockScreen.RemovePreference(hideQuickUnlockTranspIconPref); | ||||
|                     quickUnlockScreen.RemovePreference(hideQuickUnlockIconPref); | ||||
|                 } | ||||
|                 else if ((int)Android.OS.Build.VERSION.SdkInt >= 16) | ||||
|                 { | ||||
|                     quickUnlockScreen.RemovePreference(hideQuickUnlockTranspIconPref); | ||||
|                     unlockedNotificationPref.PreferenceChange += (sender, args) => App.Kp2a.UpdateOngoingNotification(); | ||||
|                     hideQuickUnlockIconPref.PreferenceChange += delegate { App.Kp2a.UpdateOngoingNotification(); }; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     //old version: only show transparent quickUnlock and no option to hide unlocked icon: | ||||
|                     quickUnlockScreen.RemovePreference(hideQuickUnlockIconPref); | ||||
|                     FindPreference(GetString(Resource.String.QuickUnlockIconHidden_key)).PreferenceChange += | ||||
|                         delegate { App.Kp2a.UpdateOngoingNotification(); }; | ||||
|  | ||||
|                     ((PreferenceScreen)FindPreference(GetString(Resource.String.display_prefs_key))).RemovePreference( | ||||
|                         unlockedNotificationPref); | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 Kp2aLog.LogUnexpectedError(ex); | ||||
|             } | ||||
|  | ||||
|  | ||||
|  | ||||
|             //AppSettingsActivity.PrepareKeyboardSwitchingPreferences(this); | ||||
|             _switchPrefManager = new KeyboardSwitchPrefManager(this); | ||||
|             PrepareSeparateNotificationsPreference(); | ||||
|  | ||||
|             FindPreference("IconSetKey").PreferenceChange += (sender, args) => | ||||
|             { | ||||
|                 if (App.Kp2a.CurrentDb != null) | ||||
|                     App.Kp2a.CurrentDb.DrawableFactory.Clear(); | ||||
|  | ||||
|             }; | ||||
|  | ||||
|             Preference cachingPreference = FindPreference(GetString(Resource.String.UseOfflineCache_key)); | ||||
|             cachingPreference.PreferenceChange += OnUseOfflineCacheChanged; | ||||
|  | ||||
|  | ||||
|         } | ||||
|  | ||||
|         private void UpdateAutofillPref() | ||||
|         { | ||||
|             var autofillScreen = FindPreference(GetString(Resource.String.AutoFill_prefs_screen_key)); | ||||
|             var autofillPref = FindPreference(GetString(Resource.String.AutoFill_prefs_key)); | ||||
|             var autofillDisabledPref = FindPreference(GetString(Resource.String.AutofillDisabledQueriesPreference_key)); | ||||
|             var autofillSavePref = FindPreference(GetString(Resource.String.OfferSaveCredentials_key)); | ||||
|             var autofillInlineSuggestions = FindPreference(GetString(Resource.String.InlineSuggestions_key)); | ||||
|             var noAutofillDisablingPref = FindPreference(GetString(Resource.String.NoAutofillDisabling_key)); | ||||
|             var autofillNoDalVerification = FindPreference(GetString(Resource.String.NoDalVerification_key)); | ||||
|             if (autofillPref == null) | ||||
|                 return; | ||||
|             if ((Android.OS.Build.VERSION.SdkInt < Android.OS.BuildVersionCodes.O) || | ||||
|                 !((AutofillManager) Activity.GetSystemService(Java.Lang.Class.FromType(typeof(AutofillManager)))) | ||||
|                     .IsAutofillSupported) | ||||
|             { | ||||
|                 var passwordAccessScreen = | ||||
|                     (PreferenceScreen) FindPreference(Activity.GetString(Resource.String.password_access_prefs_key)); | ||||
|                 passwordAccessScreen.RemovePreference(autofillScreen); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 if (((AutofillManager) Activity.GetSystemService(Java.Lang.Class.FromType(typeof(AutofillManager)))) | ||||
|                     .HasEnabledAutofillServices) | ||||
|                 { | ||||
|                     autofillDisabledPref.Enabled = true; | ||||
|                     autofillSavePref.Enabled = true; | ||||
|                     autofillNoDalVerification.Enabled = true; | ||||
|                     autofillInlineSuggestions.Enabled = true; | ||||
|                     noAutofillDisablingPref.Enabled = true; | ||||
|                     autofillPref.Summary = Activity.GetString(Resource.String.plugin_enabled); | ||||
|                     autofillPref.Intent = new Intent(Intent.ActionView); | ||||
|                     autofillPref.Intent.SetData(Android.Net.Uri.Parse("https://philippc.github.io/keepass2android/OreoAutoFill.html")); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     autofillNoDalVerification.Enabled = false; | ||||
|                     autofillDisabledPref.Enabled = false; | ||||
|                     autofillSavePref.Enabled = false; | ||||
|                     noAutofillDisablingPref.Enabled = false; | ||||
|                     autofillInlineSuggestions.Enabled = false; | ||||
|                     autofillPref.Summary = Activity.GetString(Resource.String.not_enabled); | ||||
|                 } | ||||
|                 if ((int)Android.OS.Build.VERSION.SdkInt < 30) | ||||
|                 { | ||||
|                     autofillInlineSuggestions.Summary = Activity.GetString(Resource.String.requires_android11); | ||||
|                     CheckBoxPreference cbp = autofillInlineSuggestions as CheckBoxPreference; | ||||
|                     if (cbp != null) | ||||
|                         cbp.Checked = false; | ||||
|                     autofillInlineSuggestions.Enabled = false; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void OnSendDebug(object sender, Preference.PreferenceClickEventArgs e) | ||||
| 	    { | ||||
| 		    Kp2aLog.SendLog(this.Activity); | ||||
| 	    } | ||||
|  | ||||
| 	    private void OnDebugLogChanged(object sender, Preference.PreferenceChangeEventArgs e) | ||||
| 	    { | ||||
|             if ((bool)e.NewValue) | ||||
|                 Kp2aLog.CreateLogFile(); | ||||
| 		    else | ||||
|                 Kp2aLog.FinishLogFile(); | ||||
|  | ||||
| #if !EXCLUDE_JAVAFILESTORAGE && !NoNet | ||||
|             SetJSchLogging(PreferenceManager.GetDefaultSharedPreferences(Application.Context) | ||||
|                 .GetBoolean(Application.Context.GetString(Resource.String.FtpDebug_key), false)); | ||||
| #endif | ||||
|         } | ||||
|  | ||||
| #if !EXCLUDE_JAVAFILESTORAGE && !NoNet | ||||
|         private void OnJSchDebugChanged(object sender, Preference.PreferenceChangeEventArgs e) | ||||
|         { | ||||
|             bool debugEnabled = (bool)e.NewValue; | ||||
|             SetJSchLogging(debugEnabled); | ||||
|  | ||||
|             string prefKey = Application.Context.GetString(Resource.String.FtpDebug_key); | ||||
|             PreferenceManager.SharedPreferences.Edit().PutBoolean(prefKey, debugEnabled).Apply(); | ||||
|         } | ||||
|  | ||||
|         private void SetJSchLogging(bool enabled) | ||||
|         { | ||||
|             var sftpStorage = new Keepass2android.Javafilestorage.SftpStorage(Context); | ||||
|             string? logFilename = null; | ||||
|             if (Kp2aLog.LogToFile) | ||||
|             { | ||||
|                 logFilename = Kp2aLog.LogFilename; | ||||
|             } | ||||
|             sftpStorage.SetJschLogging(enabled, logFilename); | ||||
|         } | ||||
|  | ||||
| #endif | ||||
|  | ||||
|         private void AlgorithmPrefChange(object sender, Preference.PreferenceChangeEventArgs preferenceChangeEventArgs) | ||||
| 	    { | ||||
| 			var db = App.Kp2a.CurrentDb; | ||||
| 			var previousCipher = db.KpDatabase.DataCipherUuid; | ||||
| 			db.KpDatabase.DataCipherUuid = new PwUuid(MemUtil.HexStringToByteArray((string)preferenceChangeEventArgs.NewValue)); | ||||
|  | ||||
| 			SaveDb save = new SaveDb(Activity, App.Kp2a, App.Kp2a.CurrentDb, new ActionOnFinish(Activity, (success, message, activity) => | ||||
| 			{ | ||||
| 				if (!success) | ||||
| 				{ | ||||
| 					db.KpDatabase.DataCipherUuid = previousCipher; | ||||
| 					Toast.MakeText(activity, message, ToastLength.Long).Show(); | ||||
| 					return; | ||||
| 				} | ||||
| 				preferenceChangeEventArgs.Preference.Summary = | ||||
| 					CipherPool.GlobalPool.GetCipher(db.KpDatabase.DataCipherUuid).DisplayName; | ||||
| 			})); | ||||
| 			ProgressTask pt = new ProgressTask(App.Kp2a, Activity, save); | ||||
| 			pt.Run(); | ||||
| 	    } | ||||
|  | ||||
| 	    private void UpdateKdfScreen() | ||||
| 	    { | ||||
| 		    var db = App.Kp2a.CurrentDb; | ||||
| 			var kdf = KdfPool.Get(db.KpDatabase.KdfParameters.KdfUuid); | ||||
|  | ||||
| 			var kdfpref = FindPreference(GetString(Resource.String.kdf_key)); | ||||
|  | ||||
|  | ||||
| 		    kdfpref.Summary = kdf.Name; | ||||
| 			 | ||||
| 			var kdfscreen = ((PreferenceScreen)FindPreference(GetString(Resource.String.kdf_screen_key))); | ||||
| 			if (kdf is AesKdf) | ||||
| 			{ | ||||
| 				if (kdfscreen.FindPreference(GetString(Resource.String.rounds_key)) == null) | ||||
| 					kdfscreen.AddPreference(aesRounds); | ||||
| 				kdfscreen.RemovePreference(argon2rounds); | ||||
| 				kdfscreen.RemovePreference(argon2memory); | ||||
| 				kdfscreen.RemovePreference(argon2parallelism); | ||||
|  | ||||
| 				aesRounds.Enabled = db.CanWrite; | ||||
| 				UpdateKdfSummary(aesRounds); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				kdfscreen.RemovePreference(aesRounds); | ||||
| 				if (kdfscreen.FindPreference("argon2rounds") == null) | ||||
| 				{ | ||||
| 					kdfscreen.AddPreference(argon2rounds); | ||||
| 					kdfscreen.AddPreference(argon2memory); | ||||
| 					kdfscreen.AddPreference(argon2parallelism); | ||||
| 				} | ||||
| 				UpdateKdfSummary(argon2rounds); | ||||
| 				UpdateKdfSummary(argon2memory); | ||||
| 				UpdateKdfSummary(argon2parallelism); | ||||
| 			} | ||||
| 				 | ||||
| 	    } | ||||
|  | ||||
| 	    private void OnKdfChange(object sender, Preference.PreferenceChangeEventArgs preferenceChangeEventArgs) | ||||
| 	    { | ||||
| 		    var db = App.Kp2a.CurrentDb; | ||||
| 		    var previousKdfParams = db.KpDatabase.KdfParameters; | ||||
| 			Kp2aLog.Log("previous kdf: " + KdfPool.Get(db.KpDatabase.KdfParameters.KdfUuid) + " " + db.KpDatabase.KdfParameters.KdfUuid.ToHexString() ); | ||||
| 		    db.KpDatabase.KdfParameters = | ||||
| 			    KdfPool.Get( | ||||
| 				    new PwUuid(MemUtil.HexStringToByteArray((string)preferenceChangeEventArgs.NewValue))) | ||||
| 				    .GetDefaultParameters(); | ||||
|  | ||||
| 			Kp2aLog.Log("--new    kdf: " + KdfPool.Get(db.KpDatabase.KdfParameters.KdfUuid) + " " + db.KpDatabase.KdfParameters.KdfUuid.ToHexString()); | ||||
| 		     | ||||
| 			SaveDb save = new SaveDb(Activity, App.Kp2a, App.Kp2a.CurrentDb, new ActionOnFinish(Activity, (success, message, activity) => | ||||
| 			{ | ||||
| 				if (!success) | ||||
| 				{ | ||||
| 					db.KpDatabase.KdfParameters = previousKdfParams; | ||||
| 					Toast.MakeText(activity, message, ToastLength.Long).Show(); | ||||
| 					return; | ||||
| 				} | ||||
| 				UpdateKdfScreen(); | ||||
| 				 | ||||
| 			})); | ||||
| 			ProgressTask pt = new ProgressTask(App.Kp2a, Activity, save); | ||||
| 			pt.Run(); | ||||
|  | ||||
| 	    } | ||||
|  | ||||
| 	    private void UpdateKdfSummary(Preference preference) | ||||
| 		{ | ||||
| 			preference.Summary = ((keepass2android.settings.KdfNumberParamPreference)preference).ParamValue.ToString(); | ||||
| 		} | ||||
|  | ||||
| 	    private void PrepareNoDonationReminderPreference(Activity ctx, PreferenceScreen screen, Preference preference) | ||||
| 	    { | ||||
| 			ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(ctx); | ||||
|  | ||||
| 			if (!prefs.GetBoolean("DismissedDonateReminder", false)) | ||||
| 			{ | ||||
| 				screen.RemovePreference(preference); | ||||
| 			} | ||||
| 				 | ||||
|  | ||||
| 	    } | ||||
| 	    private void PrepareTemplates(Database db) | ||||
| 	    { | ||||
| 			Preference pref = FindPreference("AddTemplates_pref_key"); | ||||
| 		    if ((!db.DatabaseFormat.SupportsTemplates) || (AddTemplateEntries.ContainsAllTemplates(App.Kp2a.CurrentDb))) | ||||
| 		    { | ||||
| 			    pref.Enabled = false; | ||||
| 		    } | ||||
| 			else | ||||
| 		    { | ||||
| 			    pref.PreferenceClick += (sender, args) => | ||||
| 			    { | ||||
| 					ProgressTask pt = new ProgressTask(App.Kp2a, Activity, | ||||
| 									new AddTemplateEntries(Activity, App.Kp2a, new ActionOnFinish(Activity, | ||||
| 										delegate | ||||
| 										{ | ||||
| 											pref.Enabled = false; | ||||
| 										}))); | ||||
| 					pt.Run();		 | ||||
| 			    }; | ||||
| 		    } | ||||
| 			 | ||||
| 	    } | ||||
|  | ||||
| 	    private void PrepareMasterPassword() | ||||
|         { | ||||
|             Preference changeMaster = FindPreference(GetString(Resource.String.master_pwd_key)); | ||||
|             if (App.Kp2a.CurrentDb.CanWrite) | ||||
|             { | ||||
|                 changeMaster.Enabled = true; | ||||
|                 changeMaster.PreferenceClick += delegate { new SetPasswordDialog(Activity).Show(); }; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void PrepareDatabaseName(Database db) | ||||
|         { | ||||
|             Preference databaseName = FindPreference(GetString(Resource.String.database_name_key)); | ||||
|             if (!db.DatabaseFormat.HasDatabaseName) | ||||
|             { | ||||
|                 ((PreferenceScreen) FindPreference(GetString(Resource.String.db_key))).RemovePreference(databaseName); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 databaseName.Enabled = db.CanWrite; | ||||
|                 ((EditTextPreference) databaseName).EditText.Text = db.KpDatabase.Name; | ||||
|                 ((EditTextPreference) databaseName).Text = db.KpDatabase.Name; | ||||
|                 databaseName.PreferenceChange += (sender, e) => | ||||
|                 { | ||||
|                     DateTime previousNameChanged = db.KpDatabase.NameChanged; | ||||
|                     String previousName = db.KpDatabase.Name; | ||||
|                     db.KpDatabase.Name = e.NewValue.ToString(); | ||||
|  | ||||
|                     SaveDb save = new SaveDb(Activity, App.Kp2a, App.Kp2a.CurrentDb, new ActionOnFinish(Activity, (success, message, activity) => | ||||
|                     { | ||||
|                         if (!success) | ||||
|                         { | ||||
|                             db.KpDatabase.Name = previousName; | ||||
|                             db.KpDatabase.NameChanged = previousNameChanged; | ||||
|                             Toast.MakeText(activity, message, ToastLength.Long).Show(); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             // Name is reflected in notification, so update it | ||||
|                             App.Kp2a.UpdateOngoingNotification(); | ||||
|                         } | ||||
|                     })); | ||||
|                     ProgressTask pt = new ProgressTask(App.Kp2a, Activity, save); | ||||
|                     pt.Run(); | ||||
|                 }; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void PrepareDefaultUsername(Database db) | ||||
|         { | ||||
|             Preference defaultUser = FindPreference(GetString(Resource.String.default_username_key)); | ||||
|             if (!db.DatabaseFormat.HasDefaultUsername) | ||||
|             { | ||||
|                 ((PreferenceScreen) FindPreference(GetString(Resource.String.db_key))).RemovePreference(defaultUser); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 defaultUser.Enabled = db.CanWrite; | ||||
|                 ((EditTextPreference) defaultUser).EditText.Text = db.KpDatabase.DefaultUserName; | ||||
|                 ((EditTextPreference) defaultUser).Text = db.KpDatabase.DefaultUserName; | ||||
|                 defaultUser.PreferenceChange += (sender, e) => | ||||
|                 { | ||||
|                     DateTime previousUsernameChanged = db.KpDatabase.DefaultUserNameChanged; | ||||
|                     String previousUsername = db.KpDatabase.DefaultUserName; | ||||
|                     db.KpDatabase.DefaultUserName = e.NewValue.ToString(); | ||||
|  | ||||
|                     SaveDb save = new SaveDb(Activity, App.Kp2a, App.Kp2a.CurrentDb, new ActionOnFinish(Activity, (success, message, activity) => | ||||
|                     { | ||||
|                         if (!success) | ||||
|                         { | ||||
|                             db.KpDatabase.DefaultUserName = previousUsername; | ||||
|                             db.KpDatabase.DefaultUserNameChanged = previousUsernameChanged; | ||||
|                             Toast.MakeText(activity, message, ToastLength.Long).Show(); | ||||
|                         } | ||||
|                     })); | ||||
|                     ProgressTask pt = new ProgressTask(App.Kp2a, Activity, save); | ||||
|                     pt.Run(); | ||||
|                 }; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         public void PrepareSeparateNotificationsPreference() | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 //depending on Android version, we offer to show a combined notification (with action buttons) (since API level 16) | ||||
|                 Preference separateNotificationsPref = FindPreference(Activity.GetString(Resource.String.ShowSeparateNotifications_key)); | ||||
|                 var passwordAccessScreen = ((PreferenceScreen)FindPreference(Activity.GetString(Resource.String.password_access_prefs_key))); | ||||
|                 if ((int)Build.VERSION.SdkInt < 16) | ||||
|                 { | ||||
|                     passwordAccessScreen.RemovePreference(separateNotificationsPref); | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
| 				Kp2aLog.LogUnexpectedError(ex); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void OnUseOfflineCacheChanged(object sender, Preference.PreferenceChangeEventArgs e) | ||||
|         { | ||||
|             if (!(bool)e.NewValue) | ||||
|             { | ||||
|                 AlertDialog.Builder builder = new AlertDialog.Builder(Activity); | ||||
|                 builder.SetTitle(GetString(Resource.String.ClearOfflineCache_title)); | ||||
|  | ||||
|                 builder.SetMessage(GetString(Resource.String.ClearOfflineCache_question)); | ||||
|  | ||||
|                 builder.SetPositiveButton(App.Kp2a.GetResourceString(UiStringKey.yes), (o, args) => | ||||
|                 { | ||||
|                     try | ||||
|                     { | ||||
|                         App.Kp2a.ClearOfflineCache(); | ||||
|                     } | ||||
|                     catch (Exception ex) | ||||
|                     { | ||||
| 						Kp2aLog.LogUnexpectedError(ex); | ||||
|                         Toast.MakeText(LocaleManager.LocalizedAppContext, ex.Message, ToastLength.Long).Show(); | ||||
|                     } | ||||
|                 } | ||||
|                     ); | ||||
|  | ||||
|                 builder.SetNegativeButton(App.Kp2a.GetResourceString(UiStringKey.no), (o, args) => | ||||
|                 { | ||||
| 	                ((CheckBoxPreference) e.Preference).Checked = true; | ||||
|                 } | ||||
|                 ); | ||||
|                 builder.SetCancelable(false); | ||||
|                 Dialog dialog = builder.Create(); | ||||
|                 dialog.Show(); | ||||
|  | ||||
|  | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void UpdateImportKeyfilePref() | ||||
|         { | ||||
|             var prefs = PreferenceManager.GetDefaultSharedPreferences(Activity); | ||||
|             var rememberKeyfile = prefs.GetBoolean(GetString(Resource.String.keyfile_key), Resources.GetBoolean(Resource.Boolean.keyfile_default)); | ||||
|  | ||||
|             Preference importKeyfile = FindPreference("import_keyfile_prefs"); | ||||
|             Preference exportKeyfile = FindPreference("export_keyfile_prefs"); | ||||
|             importKeyfile.Summary = ""; | ||||
|  | ||||
|             if (!rememberKeyfile) | ||||
|             { | ||||
|                 importKeyfile.Summary = GetString(Resource.String.KeyfileMoveRequiresRememberKeyfile); | ||||
|                 importKeyfile.Enabled = false; | ||||
|                 exportKeyfile.Enabled = false; | ||||
|                 return; | ||||
|             } | ||||
|             CompositeKey masterKey = App.Kp2a.CurrentDb.KpDatabase.MasterKey; | ||||
|             if (masterKey.ContainsType(typeof(KcpKeyFile))) | ||||
|             { | ||||
|                 IOConnectionInfo iocKeyfile = ((KcpKeyFile)masterKey.GetUserKey(typeof(KcpKeyFile))).Ioc; | ||||
|                 if (iocKeyfile.IsLocalFile() && IoUtil.IsInInternalDirectory(iocKeyfile.Path, Activity)) | ||||
|                 { | ||||
|                     importKeyfile.Enabled = false; | ||||
|                     exportKeyfile.Enabled = true; | ||||
|                     exportKeyfile.PreferenceClick += (sender, args) => { ExportKeyfileFromInternalFolder(); }; | ||||
|                     importKeyfile.Summary = GetString(Resource.String.FileIsInInternalDirectory); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     exportKeyfile.Enabled = false; | ||||
|                     importKeyfile.Enabled = true; | ||||
|                     importKeyfile.PreferenceClick += (sender, args) => { MoveKeyfileToInternalFolder(); }; | ||||
|                 } | ||||
|  | ||||
|  | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 exportKeyfile.Enabled = false; | ||||
|                 importKeyfile.Enabled = false; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|  | ||||
|  | ||||
|         private void ExportKeyfileFromInternalFolder() | ||||
|         { | ||||
|             StartActivity(new Intent(Activity.ApplicationContext, typeof(ExportKeyfileActivity))); | ||||
|              | ||||
|         } | ||||
|  | ||||
|         private void MoveKeyfileToInternalFolder() | ||||
|         { | ||||
|             Func<Action> copyAndReturnPostExecute = () => | ||||
|             { | ||||
|                 try | ||||
|                 { | ||||
|                     CompositeKey masterKey = App.Kp2a.CurrentDb.KpDatabase.MasterKey; | ||||
|                     var sourceIoc = ((KcpKeyFile)masterKey.GetUserKey(typeof(KcpKeyFile))).Ioc; | ||||
|                     var newIoc = IoUtil.ImportFileToInternalDirectory(sourceIoc, Activity, App.Kp2a); | ||||
|                     ((KcpKeyFile)masterKey.GetUserKey(typeof(KcpKeyFile))).ResetIoc(newIoc); | ||||
|                     var keyfileString = IOConnectionInfo.SerializeToString(newIoc); | ||||
|                     App.Kp2a.StoreOpenedFileAsRecent(App.Kp2a.CurrentDb.Ioc, keyfileString, false); | ||||
|                     return () => | ||||
|                     { | ||||
|                         UpdateImportKeyfilePref(); | ||||
|                         var builder = new AlertDialog.Builder(Activity); | ||||
|                         builder | ||||
|                             .SetMessage(Resource.String.KeyfileMoved); | ||||
|                         builder.SetPositiveButton(Android.Resource.String.Ok, (sender, args) => { }); | ||||
|                         builder.Show(); | ||||
|  | ||||
|                     }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|                 } | ||||
|                 catch (Exception e) | ||||
|                 { | ||||
|                     return () => | ||||
|                     { | ||||
|                         Toast.MakeText(Activity, App.Kp2a.GetResourceString(UiStringKey.ErrorOcurred) + " " + e.Message, ToastLength.Long).Show(); | ||||
|                     }; | ||||
|                 } | ||||
|  | ||||
|  | ||||
|  | ||||
|             }; | ||||
|  | ||||
|             new SimpleLoadingDialog(Activity, GetString(Resource.String.CopyingFile), false, | ||||
|                                   copyAndReturnPostExecute | ||||
|                 ).Execute(); | ||||
|  | ||||
|         } | ||||
|         private void UpdateImportDbPref() | ||||
|         { | ||||
|             //Import db/key file preferences: | ||||
|             Preference importDb = FindPreference("import_db_prefs"); | ||||
|             bool isLocalOrContent = | ||||
|                 App.Kp2a.CurrentDb.Ioc.IsLocalFile() || App.Kp2a.CurrentDb.Ioc.Path.StartsWith("content://"); | ||||
|             if (!isLocalOrContent) | ||||
|             { | ||||
|                 importDb.Summary = GetString(Resource.String.OnlyAvailableForLocalFiles); | ||||
|                 importDb.Enabled = false; | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 if (IoUtil.IsInInternalDirectory(App.Kp2a.CurrentDb.Ioc.Path, Activity)) | ||||
|                 { | ||||
|                     importDb.Summary = GetString(Resource.String.FileIsInInternalDirectory); | ||||
|                     importDb.Enabled = false; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     importDb.Enabled = true; | ||||
|                     importDb.PreferenceClick += delegate { MoveDbToInternalFolder(); }; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void MoveDbToInternalFolder() | ||||
|         { | ||||
|             Func<Action> copyAndReturnPostExecute = () => | ||||
|             { | ||||
|                 try | ||||
|                 { | ||||
|                     var sourceIoc = App.Kp2a.CurrentDb.Ioc; | ||||
|                     var newIoc = IoUtil.ImportFileToInternalDirectory(sourceIoc, Activity, App.Kp2a); | ||||
|                     return () => | ||||
|                     { | ||||
|                         var builder = new AlertDialog.Builder(Activity); | ||||
|                         builder | ||||
|                             .SetMessage(Resource.String.DatabaseFileMoved); | ||||
|                         builder.SetPositiveButton(Android.Resource.String.Ok, (sender, args) => | ||||
|                         { | ||||
|                             var key = App.Kp2a.CurrentDb.KpDatabase.MasterKey; | ||||
|                             App.Kp2a.CloseDatabase(App.Kp2a.CurrentDb); | ||||
|                             PasswordActivity.Launch(Activity, newIoc, key, new ActivityLaunchModeSimple(), false); | ||||
|  | ||||
|                         }); | ||||
|                         builder.Show(); | ||||
|  | ||||
|                     }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|                 } | ||||
|                 catch (Exception e) | ||||
|                 { | ||||
|                     return () => | ||||
|                     { | ||||
|                         Toast.MakeText(Activity, App.Kp2a.GetResourceString(UiStringKey.ErrorOcurred) + " " + e.Message, ToastLength.Long).Show(); | ||||
|                     }; | ||||
|                 } | ||||
|  | ||||
|  | ||||
|  | ||||
|             }; | ||||
|  | ||||
|             new SimpleLoadingDialog(Activity, GetString(Resource.String.CopyingFile), false, | ||||
|                                   copyAndReturnPostExecute | ||||
|                 ).Execute(); | ||||
|  | ||||
|         } | ||||
|  | ||||
| 		 | ||||
|          | ||||
|         private void SetAlgorithm(Database db, Preference algorithm) | ||||
|         { | ||||
|             algorithm.Summary = CipherPool.GlobalPool.GetCipher(db.KpDatabase.DataCipherUuid).DisplayName; | ||||
|         } | ||||
|  | ||||
|         public void PrepareNoDonatePreference(Context ctx, Preference preference) | ||||
|         { | ||||
|             ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(ctx); | ||||
|  | ||||
|             long usageCount = prefs.GetLong(ctx.GetString(Resource.String.UsageCount_key), 0); | ||||
|  | ||||
| #if DEBUG | ||||
|             preference.Enabled = (usageCount > 1); | ||||
| #else | ||||
| 			preference.Enabled = (usageCount > 50); | ||||
| #endif | ||||
|             preference.PreferenceChange += delegate(object sender, Preference.PreferenceChangeEventArgs args) | ||||
|             { | ||||
|                 if ((bool)args.NewValue) | ||||
|                 { | ||||
|                     new AlertDialog.Builder(ctx) | ||||
|                         .SetTitle(ctx.GetString(AppNames.AppNameResource)) | ||||
|                         .SetCancelable(false) | ||||
|                         .SetPositiveButton(Android.Resource.String.Ok, delegate(object o, DialogClickEventArgs eventArgs) | ||||
|                         { | ||||
|                             Util.GotoDonateUrl(ctx); | ||||
|                             ((Dialog)o).Dismiss(); | ||||
|                         }) | ||||
|                         .SetMessage(Resource.String.NoDonateOption_question) | ||||
|                         .Create().Show(); | ||||
|  | ||||
|                 } | ||||
|             }; | ||||
|  | ||||
|         } | ||||
|  | ||||
|          | ||||
|     } | ||||
|  | ||||
|     /// <summary> | ||||
|     /// <para> | ||||
| @@ -910,11 +65,11 @@ namespace keepass2android | ||||
|     /// </summary> | ||||
|     internal class AppLanguageManager | ||||
|     { | ||||
|         private readonly PreferenceFragment _fragment; | ||||
|         private readonly ListPreference _langPref; | ||||
|         private readonly PreferenceFragmentCompat _fragment; | ||||
|         private readonly AndroidX.Preference.ListPreference _langPref; | ||||
|         private readonly Dictionary<string, LanguageEntry> _langEntriesByCodeUnique; | ||||
|          | ||||
|         public AppLanguageManager(PreferenceFragment fragment, ListPreference langPref, HashSet<string> supportedLocales) | ||||
|         public AppLanguageManager(PreferenceFragmentCompat fragment, AndroidX.Preference.ListPreference langPref, HashSet<string> supportedLocales) | ||||
|         { | ||||
|             this._fragment = fragment; | ||||
|             this._langPref = langPref; | ||||
| @@ -923,7 +78,7 @@ namespace keepass2android | ||||
|             ConfigureLanguageList(); | ||||
|         } | ||||
|  | ||||
|         private static Dictionary<string, LanguageEntry> CreateCodeToEntryMapping(PreferenceFragment fragment, HashSet<string> supportedLocales) | ||||
|         private static Dictionary<string, LanguageEntry> CreateCodeToEntryMapping(PreferenceFragmentCompat fragment, HashSet<string> supportedLocales) | ||||
|         { | ||||
|             var localesByCode = new Dictionary<string, List<Java.Util.Locale>>(); | ||||
|             foreach (var loc in Java.Util.Locale.GetAvailableLocales()) | ||||
| @@ -973,7 +128,7 @@ namespace keepass2android | ||||
|                 return _fragment.GetString(Resource.String.SystemLanguage); | ||||
|         } | ||||
|  | ||||
|         private void AppLanguagePrefChange(object sender, Preference.PreferenceChangeEventArgs args) | ||||
|         private void AppLanguagePrefChange(object sender, AndroidX.Preference.Preference.PreferenceChangeEventArgs args) | ||||
|         { | ||||
|             string langCode = LanguageEntry.PrefCodeToLanguage((string)args.NewValue); | ||||
|             LocaleManager.Language = langCode; | ||||
| @@ -987,29 +142,42 @@ namespace keepass2android | ||||
|     /// <summary> | ||||
|     /// Activity to configure the application and database settings. The database must be unlocked, and this activity will close if it becomes locked. | ||||
|     /// </summary> | ||||
|     [Activity(Label = "@string/app_name", Theme = "@style/MyTheme", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)]			 | ||||
| 	public class DatabaseSettingsActivity : LockCloseActivity  | ||||
| 	{ | ||||
|  | ||||
| 		public DatabaseSettingsActivity() | ||||
| 		{ | ||||
| 			 | ||||
| 		} | ||||
|     [Activity(Label = "@string/app_name", Theme = "@style/MyTheme_ActionBar", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)] | ||||
|     public class DatabaseSettingsActivity : LockCloseActivity, PreferenceFragmentCompat.IOnPreferenceStartFragmentCallback | ||||
|     { | ||||
|  | ||||
| 		public static void Launch(Activity ctx) | ||||
| 		{ | ||||
| 			ctx.StartActivity(new Intent(ctx, typeof(DatabaseSettingsActivity))); | ||||
| 		} | ||||
|  | ||||
| 	    protected override void OnCreate(Bundle savedInstanceState) | ||||
| 	    { | ||||
| 	        base.OnCreate(savedInstanceState); | ||||
|             SetContentView(Resource.Layout.preference); | ||||
|         private ActivityDesign _design; | ||||
|  | ||||
|             SetSupportActionBar(FindViewById<AndroidX.AppCompat.Widget.Toolbar>(Resource.Id.mytoolbar)); | ||||
|         public DatabaseSettingsActivity() | ||||
|         { | ||||
|             _design = new ActivityDesign(this); | ||||
|             settingsFragmentManager = new SettingsFragmentManager(this); | ||||
|         } | ||||
|  | ||||
| 	    } | ||||
|         public static void Launch(Context ctx) | ||||
|         { | ||||
|             ctx.StartActivity(new Intent(ctx, typeof(AppSettingsActivity))); | ||||
|         } | ||||
|  | ||||
| 	} | ||||
|         protected override void OnCreate(Bundle savedInstanceState) | ||||
|         { | ||||
|             _design.ApplyTheme(); | ||||
|             base.OnCreate(savedInstanceState); | ||||
|  | ||||
|  | ||||
|         } | ||||
|  | ||||
|         public SettingsFragmentManager settingsFragmentManager; | ||||
|         public bool OnPreferenceStartFragment(PreferenceFragmentCompat caller, Preference pref) | ||||
|         { | ||||
|             return settingsFragmentManager.OnPreferenceStartFragment(caller, pref); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -7,11 +7,12 @@ using Android.Content; | ||||
| using Android.Content.Res; | ||||
| using Android.Graphics; | ||||
| using Android.Graphics.Drawables; | ||||
| using Android.Preferences; | ||||
| using AndroidX.Preference; | ||||
| using Android.Runtime; | ||||
| using Android.Util; | ||||
| using Android.Views; | ||||
| using Android.Widget; | ||||
| using Google.Android.Material.Dialog; | ||||
| using keepass2android_appSdkStyle; | ||||
|  | ||||
| namespace keepass2android | ||||
| @@ -127,6 +128,8 @@ namespace keepass2android | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         public Dialog Dialog { get; set; } | ||||
|  | ||||
|  | ||||
|         List<IconSet> _iconSets = null; | ||||
|         List<IconSet> IconSets | ||||
| @@ -183,12 +186,9 @@ namespace keepass2android | ||||
| 			 | ||||
|         } | ||||
|  | ||||
|  | ||||
|         protected override void OnPrepareDialogBuilder(AlertDialog.Builder builder) | ||||
|         protected override void OnClick() | ||||
|         { | ||||
|             _populatorTask.Wait(); | ||||
|             base.OnPrepareDialogBuilder(builder); | ||||
|  | ||||
|  | ||||
|             var iconListPreferenceAdapter = new IconListPreferenceScreenAdapter(this, Context); | ||||
|  | ||||
| @@ -202,13 +202,17 @@ namespace keepass2android | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             var builder = new MaterialAlertDialogBuilder(Context); | ||||
|  | ||||
|             builder.SetAdapter(iconListPreferenceAdapter, (sender, args) => { }); | ||||
|             builder.SetNeutralButton(Resource.String.IconSet_install, (sender, args) => | ||||
|             { | ||||
|                 Util.GotoUrl(Context, "market://search?q=keepass2android icon set"); | ||||
|             }); | ||||
|  | ||||
|             Dialog = builder.Create(); | ||||
|             Dialog.Show(); | ||||
|  | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -21,31 +21,106 @@ using Android.Content; | ||||
| using Android.OS; | ||||
| using Android.Views; | ||||
| using Android.Widget; | ||||
| using Android.Preferences; | ||||
|  | ||||
| using KeePassLib; | ||||
| using Android.Util; | ||||
| using AndroidX.Preference; | ||||
| using keepass2android_appSdkStyle; | ||||
| using KeePassLib.Cryptography.KeyDerivation; | ||||
| using Google.Android.Material.Dialog; | ||||
|  | ||||
| namespace keepass2android.settings | ||||
| { | ||||
| 	public abstract class KdfNumberParamPreference: DialogPreference { | ||||
| 	/* | ||||
| 	 * | ||||
| 	   public class KdfNumberDialogPreference : DialogPreference | ||||
| 	   { | ||||
| 	       private readonly Context _context; | ||||
| 	       public KdfNumberDialogPreference(Context context) : base(context) | ||||
| 	       { | ||||
| 	           _context = context; | ||||
| 	       } | ||||
| 	    | ||||
| 	       public KdfNumberDialogPreference(Context context, IAttributeSet attrs) : base(context, attrs) | ||||
| 	       { | ||||
| 	           _context = context; | ||||
| 	       } | ||||
| 	    | ||||
| 	       public KdfNumberDialogPreference(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) | ||||
| 	       { | ||||
| 	           _context = context; | ||||
| 	       } | ||||
| 	        | ||||
| 	       public override int DialogLayoutResource => Resource.Layout.activity_main; | ||||
| 	    | ||||
| 	   } | ||||
| 	    | ||||
|  | ||||
| 	 */ | ||||
| 	public abstract class KdfNumberDialogPreference : DialogPreference { | ||||
| 		 | ||||
| 		internal TextView edittext; | ||||
| 		 | ||||
| 		protected override View OnCreateDialogView() { | ||||
| 			View view =  base.OnCreateDialogView(); | ||||
| 			 | ||||
| 			edittext = (TextView) view.FindViewById(Resource.Id.rounds); | ||||
|         public KdfNumberDialogPreference(Context context) : base(context) | ||||
|         { | ||||
|              | ||||
|         } | ||||
|  | ||||
|         public KdfNumberDialogPreference(Context context, IAttributeSet attrs) : base(context, attrs) | ||||
|         { | ||||
|             | ||||
|         } | ||||
|  | ||||
| 			ulong numRounds = ParamValue; | ||||
| 			edittext.Text = numRounds.ToString(CultureInfo.InvariantCulture); | ||||
|         public KdfNumberDialogPreference(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) | ||||
|         { | ||||
|             | ||||
|         } | ||||
|  | ||||
| 			view.FindViewById<TextView>(Resource.Id.rounds_explaination).Text = ExplanationString; | ||||
|         public void ShowDialog(PreferenceFragmentCompat containingFragment) | ||||
|         { | ||||
|             var activity = containingFragment.Activity; | ||||
|             MaterialAlertDialogBuilder db = new MaterialAlertDialogBuilder(activity); | ||||
|  | ||||
| 			return view; | ||||
| 		} | ||||
|             View dialogView = activity.LayoutInflater.Inflate(Resource.Layout.database_kdf_settings, null); | ||||
|             var inputEditText = dialogView.FindViewById<TextView>(Resource.Id.rounds); | ||||
|              | ||||
|             inputEditText.Text = ParamValue.ToString(); | ||||
|  | ||||
|             db.SetView(dialogView); | ||||
|             db.SetTitle(Title); | ||||
|             db.SetPositiveButton(Android.Resource.String.Ok, (sender, args) => | ||||
|             { | ||||
|                 //store the old value for restoring in case of failure | ||||
|                 ulong paramValue; | ||||
|  | ||||
|                 String strRounds = inputEditText.Text; | ||||
|                 if (!(ulong.TryParse(strRounds, out paramValue))) | ||||
|                 { | ||||
|                     Toast.MakeText(Context, Resource.String.error_param_not_number, ToastLength.Long).Show(); | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 if (paramValue < 1) | ||||
|                 { | ||||
|                     paramValue = 1; | ||||
|                 } | ||||
|  | ||||
|                 ulong oldValue = ParamValue; | ||||
|  | ||||
|                 if (oldValue == paramValue) | ||||
|                 { | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 ParamValue = paramValue; | ||||
|  | ||||
|                 Handler handler = new Handler(); | ||||
|                 SaveDb save = new SaveDb((Activity)Context, App.Kp2a, App.Kp2a.CurrentDb, new AfterSave((Activity)Context, handler, oldValue, this)); | ||||
|                 ProgressTask pt = new ProgressTask(App.Kp2a, (Activity)Context, save); | ||||
|                 pt.Run(); | ||||
|             }); | ||||
|             db.SetNegativeButton(Android.Resource.String.Cancel, ((sender, args) => { })); | ||||
|  | ||||
|             db.Create().Show(); | ||||
|         } | ||||
|  | ||||
| 		public virtual string ExplanationString | ||||
| 		{ | ||||
| @@ -53,61 +128,17 @@ namespace keepass2android.settings | ||||
| 		} | ||||
|  | ||||
| 		public abstract ulong ParamValue { get; set; } | ||||
| 		public KdfNumberParamPreference(Context context, IAttributeSet attrs):base(context, attrs) { | ||||
| 		} | ||||
|  | ||||
| 		public KdfNumberParamPreference(Context context, IAttributeSet attrs, int defStyle) | ||||
| 			: base(context, attrs, defStyle) | ||||
| 		{ | ||||
| 		} | ||||
| 		 | ||||
| 		protected override void OnDialogClosed(bool positiveResult) { | ||||
| 			base.OnDialogClosed(positiveResult); | ||||
| 			 | ||||
| 			if ( positiveResult ) { | ||||
| 				ulong paramValue; | ||||
| 				 | ||||
| 				String strRounds = edittext.Text;  | ||||
| 				if (!(ulong.TryParse(strRounds,out paramValue))) | ||||
| 				{ | ||||
| 					Toast.MakeText(Context, Resource.String.error_param_not_number, ToastLength.Long).Show(); | ||||
| 					return; | ||||
| 				} | ||||
| 				 | ||||
| 				if ( paramValue < 1 ) { | ||||
| 					paramValue = 1; | ||||
| 				} | ||||
|  | ||||
| 				Database db = App.Kp2a.CurrentDb; | ||||
|  | ||||
| 				ulong oldValue = ParamValue; | ||||
|  | ||||
| 				if (oldValue == paramValue) | ||||
| 				{ | ||||
| 					return; | ||||
| 				} | ||||
|  | ||||
| 				ParamValue = paramValue; | ||||
|  | ||||
| 				Handler handler = new Handler(); | ||||
| 				SaveDb save = new SaveDb((Activity)Context, App.Kp2a, App.Kp2a.CurrentDb, new KdfNumberParamPreference.AfterSave((Activity)Context, handler, oldValue, this)); | ||||
| 				ProgressTask pt = new ProgressTask(App.Kp2a, (Activity)Context, save); | ||||
| 				pt.Run(); | ||||
| 				 | ||||
| 			} | ||||
| 			 | ||||
| 		} | ||||
| 		 | ||||
| 		private class AfterSave : OnFinish { | ||||
| 			private readonly ulong _oldRounds; | ||||
| 			private readonly ulong _oldParamValue; | ||||
| 			private readonly Context _ctx; | ||||
| 			private readonly KdfNumberParamPreference _pref; | ||||
| 			private readonly KdfNumberDialogPreference _pref; | ||||
| 			 | ||||
| 			public AfterSave(Activity ctx, Handler handler, ulong oldRounds, KdfNumberParamPreference pref):base(ctx, handler) { | ||||
| 			public AfterSave(Activity ctx, Handler handler, ulong oldParamValue, KdfNumberDialogPreference pref):base(ctx, handler) { | ||||
|  | ||||
| 				_pref = pref; | ||||
| 				_ctx = ctx; | ||||
| 				_oldRounds = oldRounds; | ||||
| 				_oldParamValue = oldParamValue; | ||||
| 			} | ||||
| 			 | ||||
| 			public override void Run() { | ||||
| @@ -119,8 +150,8 @@ namespace keepass2android.settings | ||||
| 				} else { | ||||
| 					DisplayMessage(_ctx); | ||||
|  | ||||
| 					App.Kp2a.CurrentDb.KpDatabase.KdfParameters.SetUInt64(AesKdf.ParamRounds, _oldRounds); | ||||
| 				} | ||||
| 					_pref.ParamValue = _oldParamValue; | ||||
|                 } | ||||
| 				 | ||||
| 				base.Run(); | ||||
| 			} | ||||
| @@ -132,7 +163,8 @@ namespace keepass2android.settings | ||||
| 	/// <summary> | ||||
| 	/// Represents the setting for the number of key transformation rounds. Changing this requires to save the database. | ||||
| 	/// </summary> | ||||
| 	public class RoundsPreference : KdfNumberParamPreference { | ||||
| 	public class RoundsPreference : KdfNumberDialogPreference | ||||
|     { | ||||
| 		private readonly Context _context; | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Philipp Crocoll
					Philipp Crocoll