refactor and improve EntryEditActivity: Ensure that configuration changes are handled properly

This commit is contained in:
Philipp Crocoll
2025-05-27 15:26:00 +02:00
parent bf4035fcfe
commit 8a1890bc10
5 changed files with 458 additions and 372 deletions

View File

@@ -316,7 +316,7 @@ namespace keepass2android
if (resultCode == KeePass.ResultOkPasswordGenerator)
{
String generatedPassword = data.GetStringExtra("keepass2android.password.generated_password");
String generatedPassword = data.GetStringExtra(GeneratePasswordActivity.GeneratedPasswordKey);
FindViewById<TextView>(Resource.Id.entry_password).Text = generatedPassword;
FindViewById<TextView>(Resource.Id.entry_confpassword).Text = generatedPassword;
}

File diff suppressed because it is too large Load Diff

View File

@@ -62,7 +62,7 @@ namespace keepass2android
}
/// <summary>
/// Holds the state of the EntrryEditActivity. This is required to be able to keep a partially modified entry in memory
/// Holds the state of the EntryEditActivity. This is required to be able to keep a partially modified entry in memory
/// through the App variable. Serializing this state (especially the Entry/EntryInDatabase) can be a performance problem
/// when there are big attachements.
/// </summary>

View File

@@ -46,7 +46,9 @@ namespace keepass2android
#endif
{
private readonly int[] _buttonLengthButtonIds = new[] {Resource.Id.btn_length6,
public const string GeneratedPasswordKey = "keepass2android.password.generated_password";
private readonly int[] _buttonLengthButtonIds = new[] {Resource.Id.btn_length6,
Resource.Id.btn_length8,
Resource.Id.btn_length12,
Resource.Id.btn_length16,
@@ -259,7 +261,7 @@ namespace keepass2android
EditText password = (EditText) FindViewById(Resource.Id.password_edit);
Intent intent = new Intent();
intent.PutExtra("keepass2android.password.generated_password", password.Text);
intent.PutExtra(GeneratedPasswordKey, password.Text);
SetResult(KeePass.ResultOkPasswordGenerator, intent);

View File

@@ -75,6 +75,11 @@ android:layout_height="wrap_content">
android:layout_marginRight="0dip"
android:visibility="gone"
/>
<CheckBox
android:id="@+id/protection"
android:layout_width="0dip"
android:layout_height="0dip"
android:visibility="gone"/>
</LinearLayout>
</RelativeLayout>