Fix #5983. Missing back button

Add back button in below activities:

* AccountSetupComposition (item "Composition defaults")
* AccountSetupOutgoing (item "Outgoing server")
* AccountSetupIncoming (item "Incoming server")
This commit is contained in:
Mihail Mitrofanov 2022-05-23 16:22:20 +02:00
parent e1ff582cac
commit 8fa9b7fbe6
3 changed files with 47 additions and 0 deletions

View file

@ -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());

View file

@ -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();

View file

@ -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
*/