diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupComposition.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupComposition.java index 719952ab2..10315606f 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupComposition.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupComposition.java @@ -3,12 +3,15 @@ package com.fsck.k9.activity.setup; import android.app.Activity; import android.content.Intent; import android.os.Bundle; +import android.view.MenuItem; import android.view.View; import android.widget.CompoundButton; import android.widget.CheckBox; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.RadioButton; + +import androidx.annotation.NonNull; import com.fsck.k9.Account; import com.fsck.k9.Preferences; import com.fsck.k9.ui.R; @@ -48,6 +51,10 @@ public class AccountSetupComposition extends K9Activity { setLayout(R.layout.account_setup_composition); setTitle(R.string.account_settings_composition_title); + if (getSupportActionBar() != null) { + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + } + /* * If we're being reloaded we override the original account with the one * we saved @@ -101,6 +108,16 @@ public class AccountSetupComposition extends K9Activity { } } + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if (item.getItemId() == android.R.id.home) { + onBackPressed(); + return true; + } + + return super.onOptionsItemSelected(item); + } + private void saveSettings() { mAccount.setEmail(mAccountEmail.getText().toString()); mAccount.setAlwaysBcc(mAccountAlwaysBcc.getText().toString()); diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupIncoming.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupIncoming.java index 16decb409..8cea8f712 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupIncoming.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupIncoming.java @@ -9,6 +9,7 @@ import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.text.method.DigitsKeyListener; +import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; @@ -117,6 +118,10 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener setLayout(R.layout.account_setup_incoming); setTitle(R.string.account_setup_incoming_title); + if (getSupportActionBar() != null) { + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + } + mUsernameView = findViewById(R.id.account_username); mPasswordView = findViewById(R.id.account_password); mClientCertificateSpinner = findViewById(R.id.account_client_certificate_spinner); @@ -563,6 +568,16 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener } } + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if (item.getItemId() == android.R.id.home) { + onBackPressed(); + return true; + } + + return super.onOptionsItemSelected(item); + } + protected void onNext() { try { ConnectionSecurity connectionSecurity = getSelectedSecurity(); diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupOutgoing.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupOutgoing.java index 8e64281ae..1173e71f6 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupOutgoing.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupOutgoing.java @@ -10,6 +10,7 @@ import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.text.method.DigitsKeyListener; +import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; @@ -99,6 +100,10 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, setLayout(R.layout.account_setup_outgoing); setTitle(R.string.account_setup_outgoing_title); + if (getSupportActionBar() != null) { + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + } + String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT); mAccount = Preferences.getPreferences(this).getAccount(accountUuid); @@ -348,6 +353,16 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, validateFields(); } + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if (item.getItemId() == android.R.id.home) { + onBackPressed(); + return true; + } + + return super.onOptionsItemSelected(item); + } + /** * Shows/hides password field */