diff --git a/src/keepass2android/PasswordActivity.cs b/src/keepass2android/PasswordActivity.cs index 170c5a6a..ad62a43d 100644 --- a/src/keepass2android/PasswordActivity.cs +++ b/src/keepass2android/PasswordActivity.cs @@ -52,6 +52,7 @@ namespace keepass2android private const String KeyServercredmode = "serverCredRememberMode"; private const String ViewIntent = "android.intent.action.VIEW"; + private const string _showpasswordKey = "ShowPassword"; private Task _loadDbTask; private IOConnectionInfo _ioConnection; @@ -199,6 +200,8 @@ namespace keepass2android protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); + if (savedInstanceState != null) + _showPassword = savedInstanceState.GetBoolean(_showpasswordKey, false); Intent i = Intent; String action = i.Action; @@ -305,17 +308,11 @@ namespace keepass2android }; */ ImageButton btnTogglePassword = (ImageButton)FindViewById(Resource.Id.toggle_password); - btnTogglePassword.Click += (sender, e) => { - _showPassword = !_showPassword; - TextView password = (TextView)FindViewById(Resource.Id.password); - if (_showPassword) + btnTogglePassword.Click += (sender, e) => { - password.InputType = InputTypes.ClassText | InputTypes.TextVariationVisiblePassword; - } else - { - password.InputType = InputTypes.ClassText | InputTypes.TextVariationPassword; - } - }; + _showPassword = !_showPassword; + MakePasswordMaskedOrVisible(); + }; @@ -339,6 +336,19 @@ namespace keepass2android RetrieveSettings(); } + private void MakePasswordMaskedOrVisible() + { + TextView password = (TextView) FindViewById(Resource.Id.password); + if (_showPassword) + { + password.InputType = InputTypes.ClassText | InputTypes.TextVariationVisiblePassword; + } + else + { + password.InputType = InputTypes.ClassText | InputTypes.TextVariationPassword; + } + } + private void SetNewDefaultFile() { //Don't allow the current file to be the default if we don't have stored credentials @@ -409,12 +419,15 @@ namespace keepass2android { base.OnSaveInstanceState(outState); AppTask.ToBundle(outState); + outState.PutBoolean(_showpasswordKey, _showPassword); } protected override void OnResume() { base.OnResume(); + MakePasswordMaskedOrVisible(); + // OnResume is run every time the activity comes to the foreground. This code should only run when the activity is started (OnStart), but must // be run in OnResume rather than OnStart so that it always occurrs after OnActivityResult (when re-creating a killed activity, OnStart occurs before OnActivityResult) if (_starting && !IsFinishing) //use !IsFinishing to make sure we're not starting another activity when we're already finishing (e.g. due to TaskComplete in OnActivityResult) diff --git a/src/keepass2android/Resources/values-de/strings.xml b/src/keepass2android/Resources/values-de/strings.xml index af47b6a4..28a281c1 100644 --- a/src/keepass2android/Resources/values-de/strings.xml +++ b/src/keepass2android/Resources/values-de/strings.xml @@ -24,7 +24,7 @@ Der Android Robot wird genutzt und wurde modifiziert basierend auf Arbeiten, die Klammern Um diese Funktion nutzen zu können, benötigen Sie den OI File Manager, den Sie über Google Play bzw. direkt von der Entwicklerwebsite herunterladen können. Aufgrund einiger Eigenheiten des Dateimanagers kann es bei der ersten Benutzung zu Einschränkungen kommen. Suchindex erzeugen… - Abbr. + Abbrechen Zwischenablage geleert. Zwischenablagesperre Zeiteinstellung der Zwischenablagesperre während sie inaktiv ist.