Added change password extra button

This commit is contained in:
M66B 2022-11-08 18:39:31 +01:00
parent 6289f4026f
commit 37ced1c42f
4 changed files with 46 additions and 3 deletions

View File

@ -151,8 +151,9 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
static final int REQUEST_STILL = 9;
static final int REQUEST_SELECT_IDENTITY = 10;
static final int REQUEST_EDIT_SIGNATURE = 11;
static final int REQUEST_DELETE_ACCOUNT = 12;
static final int REQUEST_IMPORT_PROVIDERS = 13;
static final int REQUEST_CHANGE_PASSWORD = 12;
static final int REQUEST_DELETE_ACCOUNT = 13;
static final int REQUEST_IMPORT_PROVIDERS = 14;
static final int PI_MISC = 1;

View File

@ -125,6 +125,7 @@ public class FragmentSetup extends FragmentBase {
private Button btnSignature;
private Button btnReorderAccounts;
private Button btnReorderFolders;
private Button btnPassword;
private Button btnDelete;
private Button btnApp;
private Button btnMore;
@ -209,6 +210,7 @@ public class FragmentSetup extends FragmentBase {
btnReorderAccounts = view.findViewById(R.id.btnReorderAccounts);
btnReorderFolders = view.findViewById(R.id.btnReorderFolders);
btnDelete = view.findViewById(R.id.btnDelete);
btnPassword = view.findViewById(R.id.btnPassword);
btnApp = view.findViewById(R.id.btnApp);
btnMore = view.findViewById(R.id.btnMore);
btnSupport = view.findViewById(R.id.btnSupport);
@ -689,6 +691,19 @@ public class FragmentSetup extends FragmentBase {
});
btnPassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle args = new Bundle();
args.putBoolean("all", true);
FragmentDialogSelectAccount fragment = new FragmentDialogSelectAccount();
fragment.setArguments(args);
fragment.setTargetFragment(FragmentSetup.this, ActivitySetup.REQUEST_CHANGE_PASSWORD);
fragment.show(getParentFragmentManager(), "setup:password");
}
});
btnDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -999,6 +1014,10 @@ public class FragmentSetup extends FragmentBase {
if (resultCode == RESULT_OK && data != null)
onEditIdentity(data.getExtras());
break;
case ActivitySetup.REQUEST_CHANGE_PASSWORD:
if (resultCode == RESULT_OK && data != null)
onChangePassword(data.getBundleExtra("args"));
break;
case ActivitySetup.REQUEST_DELETE_ACCOUNT:
if (resultCode == RESULT_OK && data != null)
onDeleteAccount(data.getBundleExtra("args"));
@ -1086,6 +1105,16 @@ public class FragmentSetup extends FragmentBase {
}.execute(this, args, "set:signature");
}
private void onChangePassword(Bundle args) {
long account = args.getLong("account");
int protocol = args.getInt("protocol");
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
lbm.sendBroadcast(
new Intent(ActivitySetup.ACTION_EDIT_ACCOUNT)
.putExtra("id", account)
.putExtra("protocol", protocol));
}
private void onDeleteAccount(Bundle args) {
long account = args.getLong("account");
String name = args.getString("name");

View File

@ -1001,6 +1001,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnReorderAccounts" />
<Button
android:id="@+id/btnPassword"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_vpn_key_24"
android:drawablePadding="6dp"
android:text="@string/title_change_password"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnReorderFolders" />
<Button
android:id="@+id/btnDelete"
style="?android:attr/buttonStyleSmall"
@ -1011,7 +1023,7 @@
android:drawablePadding="6dp"
android:text="@string/title_delete_account"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnReorderFolders" />
app:layout_constraintTop_toBottomOf="@id/btnPassword" />
<TextView
android:id="@+id/tvDeleteHint"

View File

@ -1070,6 +1070,7 @@
<string name="title_drafts_select">Sending emails requires a drafts folder to be selected in the account settings</string>
<string name="title_account_auth_update">Update authorization</string>
<string name="title_account_auth_password">Switch to password authentication</string>
<string name="title_change_password">Change password</string>
<string name="title_delete_account">Delete account</string>
<string name="title_account_delete">Delete this account permanently?</string>
<string name="title_identity_delete">Delete this identity permanently?</string>