PasswordActivity.cs: show password is remembered during screen rotation.

German translation: fixed a string
This commit is contained in:
Philipp Crocoll 2013-08-31 13:58:00 +02:00
parent d83e8b09b5
commit 63baf77df3
2 changed files with 24 additions and 11 deletions

View File

@ -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<MemoryStream> _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)

View File

@ -24,7 +24,7 @@ Der Android Robot wird genutzt und wurde modifiziert basierend auf Arbeiten, die
<string name="brackets">Klammern</string>
<string name="browser_intall_text">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.</string>
<string name="building_search_idx">Suchindex erzeugen…</string>
<string name="cancel">Abbr.</string>
<string name="cancel">Abbrechen</string>
<string name="ClearClipboard">Zwischenablage geleert.</string>
<string name="clipboard_timeout">Zwischenablagesperre</string>
<string name="clipboard_timeout_summary">Zeiteinstellung der Zwischenablagesperre während sie inaktiv ist.</string>