Added change password extra button

pull/210/head
M66B 3 years ago
parent 6289f4026f
commit 37ced1c42f

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

@ -125,6 +125,7 @@ public class FragmentSetup extends FragmentBase {
private Button btnSignature; private Button btnSignature;
private Button btnReorderAccounts; private Button btnReorderAccounts;
private Button btnReorderFolders; private Button btnReorderFolders;
private Button btnPassword;
private Button btnDelete; private Button btnDelete;
private Button btnApp; private Button btnApp;
private Button btnMore; private Button btnMore;
@ -209,6 +210,7 @@ public class FragmentSetup extends FragmentBase {
btnReorderAccounts = view.findViewById(R.id.btnReorderAccounts); btnReorderAccounts = view.findViewById(R.id.btnReorderAccounts);
btnReorderFolders = view.findViewById(R.id.btnReorderFolders); btnReorderFolders = view.findViewById(R.id.btnReorderFolders);
btnDelete = view.findViewById(R.id.btnDelete); btnDelete = view.findViewById(R.id.btnDelete);
btnPassword = view.findViewById(R.id.btnPassword);
btnApp = view.findViewById(R.id.btnApp); btnApp = view.findViewById(R.id.btnApp);
btnMore = view.findViewById(R.id.btnMore); btnMore = view.findViewById(R.id.btnMore);
btnSupport = view.findViewById(R.id.btnSupport); 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() { btnDelete.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -999,6 +1014,10 @@ public class FragmentSetup extends FragmentBase {
if (resultCode == RESULT_OK && data != null) if (resultCode == RESULT_OK && data != null)
onEditIdentity(data.getExtras()); onEditIdentity(data.getExtras());
break; break;
case ActivitySetup.REQUEST_CHANGE_PASSWORD:
if (resultCode == RESULT_OK && data != null)
onChangePassword(data.getBundleExtra("args"));
break;
case ActivitySetup.REQUEST_DELETE_ACCOUNT: case ActivitySetup.REQUEST_DELETE_ACCOUNT:
if (resultCode == RESULT_OK && data != null) if (resultCode == RESULT_OK && data != null)
onDeleteAccount(data.getBundleExtra("args")); onDeleteAccount(data.getBundleExtra("args"));
@ -1086,6 +1105,16 @@ public class FragmentSetup extends FragmentBase {
}.execute(this, args, "set:signature"); }.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) { private void onDeleteAccount(Bundle args) {
long account = args.getLong("account"); long account = args.getLong("account");
String name = args.getString("name"); String name = args.getString("name");

@ -1001,6 +1001,18 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnReorderAccounts" /> 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 <Button
android:id="@+id/btnDelete" android:id="@+id/btnDelete"
style="?android:attr/buttonStyleSmall" style="?android:attr/buttonStyleSmall"
@ -1011,7 +1023,7 @@
android:drawablePadding="6dp" android:drawablePadding="6dp"
android:text="@string/title_delete_account" android:text="@string/title_delete_account"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnReorderFolders" /> app:layout_constraintTop_toBottomOf="@id/btnPassword" />
<TextView <TextView
android:id="@+id/tvDeleteHint" android:id="@+id/tvDeleteHint"

@ -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_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_update">Update authorization</string>
<string name="title_account_auth_password">Switch to password authentication</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_delete_account">Delete account</string>
<string name="title_account_delete">Delete this account permanently?</string> <string name="title_account_delete">Delete this account permanently?</string>
<string name="title_identity_delete">Delete this identity permanently?</string> <string name="title_identity_delete">Delete this identity permanently?</string>

Loading…
Cancel
Save