From 26db6638d815cb1aef3b502a0c7e9a0e53a48073 Mon Sep 17 00:00:00 2001 From: plan3d Date: Mon, 31 May 2021 16:07:26 +0200 Subject: [PATCH 1/2] Issue #4407: Fixed localized titles if app language and system language are different --- .../java/com/fsck/k9/activity/setup/AccountSetupIncoming.java | 3 +++ .../main/java/com/fsck/k9/ui/onboarding/OnboardingActivity.kt | 1 + 2 files changed, 4 insertions(+) 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 8aab5883f..22dfe328b 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 @@ -121,6 +121,9 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setLayout(R.layout.account_setup_incoming); + // For some reason we need to set the title, see issue #4407 + setTitle(R.string.account_setup_incoming_title); + mUsernameView = findViewById(R.id.account_username); mPasswordView = findViewById(R.id.account_password); diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/onboarding/OnboardingActivity.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/onboarding/OnboardingActivity.kt index b1919fed9..3235ee7a5 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/onboarding/OnboardingActivity.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/onboarding/OnboardingActivity.kt @@ -16,6 +16,7 @@ class OnboardingActivity : K9Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setLayout(R.layout.activity_onboarding) + setTitle(R.string.account_setup_basics_title) initializeActionBar() } From bca8f2f30174623e3681a2b0474e688c013bfdb5 Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 1 Jun 2021 15:18:01 +0200 Subject: [PATCH 2/2] Explicitly set activity titles This is so cached activity titles aren't used when changing the app language. See https://proandroiddev.com/change-language-programmatically-at-runtime-on-android-5e6bc15c758 --- .../main/java/com/fsck/k9/activity/ChooseAccount.java | 9 +++++++++ .../main/java/com/fsck/k9/activity/ChooseIdentity.java | 1 + .../src/main/java/com/fsck/k9/activity/EditIdentity.kt | 1 + .../java/com/fsck/k9/activity/LauncherShortcuts.java | 1 + .../main/java/com/fsck/k9/activity/ManageIdentities.java | 1 + .../main/java/com/fsck/k9/activity/UpgradeDatabases.java | 1 + .../fsck/k9/activity/setup/AccountSetupAccountType.kt | 1 + .../com/fsck/k9/activity/setup/AccountSetupBasics.java | 1 + .../fsck/k9/activity/setup/AccountSetupComposition.java | 1 + .../com/fsck/k9/activity/setup/AccountSetupIncoming.java | 2 -- .../com/fsck/k9/activity/setup/AccountSetupNames.java | 2 ++ .../com/fsck/k9/activity/setup/AccountSetupOptions.java | 1 + .../com/fsck/k9/activity/setup/AccountSetupOutgoing.java | 1 + .../com/fsck/k9/ui/choosefolder/ChooseFolderActivity.kt | 1 + .../fsck/k9/ui/endtoend/AutocryptKeyTransferActivity.kt | 1 + .../fsck/k9/ui/managefolders/ManageFoldersActivity.kt | 1 + .../fsck/k9/ui/messagesource/MessageSourceActivity.kt | 1 + 17 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/ChooseAccount.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/ChooseAccount.java index 898f210f1..b6b202589 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/ChooseAccount.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/ChooseAccount.java @@ -1,13 +1,22 @@ package com.fsck.k9.activity; import android.content.Intent; +import android.os.Bundle; import com.fsck.k9.BaseAccount; +import com.fsck.k9.ui.R; + public class ChooseAccount extends AccountList { public static final String EXTRA_ACCOUNT_UUID = "com.fsck.k9.ChooseAccount_account_uuid"; + @Override + public void onCreate(Bundle icicle) { + super.onCreate(icicle); + setTitle(R.string.choose_account_title); + } + @Override protected void onAccountSelected(BaseAccount account) { Intent intent = new Intent(); diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/ChooseIdentity.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/ChooseIdentity.java index aa389b0da..df88e54f9 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/ChooseIdentity.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/ChooseIdentity.java @@ -30,6 +30,7 @@ public class ChooseIdentity extends K9ListActivity { requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setLayout(R.layout.list_content_simple); + setTitle(R.string.choose_identity_title); getListView().setTextFilterEnabled(true); getListView().setItemsCanFocus(false); diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/EditIdentity.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/EditIdentity.kt index 232fb9038..a7935fe22 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/EditIdentity.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/EditIdentity.kt @@ -30,6 +30,7 @@ class EditIdentity : K9Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setLayout(R.layout.edit_identity) + setTitle(R.string.edit_identity_title) supportActionBar!!.setDisplayHomeAsUpEnabled(true) identityIndex = intent.getIntExtra(EXTRA_IDENTITY_INDEX, -1) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/LauncherShortcuts.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/LauncherShortcuts.java index 82ea2d746..6f7a24ba4 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/LauncherShortcuts.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/LauncherShortcuts.java @@ -13,6 +13,7 @@ public class LauncherShortcuts extends AccountList { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); + setTitle(R.string.shortcuts_title); // finish() immediately if we aren't supposed to be here if (!Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())) { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/ManageIdentities.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/ManageIdentities.java index c54ac3e38..5e5b89804 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/ManageIdentities.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/ManageIdentities.java @@ -31,6 +31,7 @@ public class ManageIdentities extends ChooseIdentity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setTitle(R.string.manage_identities_title); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/UpgradeDatabases.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/UpgradeDatabases.java index 897137249..d3b53ac4e 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/UpgradeDatabases.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/UpgradeDatabases.java @@ -127,6 +127,7 @@ public class UpgradeDatabases extends K9Activity { */ private void initializeLayout() { setLayout(R.layout.upgrade_databases); + setTitle(R.string.upgrade_databases_title); mUpgradeText = findViewById(R.id.databaseUpgradeText); } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupAccountType.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupAccountType.kt index ae1e9accb..6c3b529c8 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupAccountType.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupAccountType.kt @@ -33,6 +33,7 @@ class AccountSetupAccountType : K9Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setLayout(R.layout.account_setup_account_type) + setTitle(R.string.account_setup_account_type_title) decodeArguments() diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.java index 1dc267f7c..ef22f680d 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.java @@ -75,6 +75,7 @@ public class AccountSetupBasics extends K9Activity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setLayout(R.layout.account_setup_basics); + setTitle(R.string.account_setup_basics_title); mEmailView = findViewById(R.id.account_email); mPasswordView = findViewById(R.id.account_password); mClientCertificateCheckBox = findViewById(R.id.account_client_certificate); 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 9becb7d77..056ce04e6 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 @@ -46,6 +46,7 @@ public class AccountSetupComposition extends K9Activity { mAccount = Preferences.getPreferences(this).getAccount(accountUuid); setLayout(R.layout.account_setup_composition); + setTitle(R.string.account_settings_composition_title); /* * If we're being reloaded we override the original account with the one 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 22dfe328b..b2cf079c9 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 @@ -121,10 +121,8 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setLayout(R.layout.account_setup_incoming); - // For some reason we need to set the title, see issue #4407 setTitle(R.string.account_setup_incoming_title); - mUsernameView = findViewById(R.id.account_username); mPasswordView = findViewById(R.id.account_password); mClientCertificateSpinner = findViewById(R.id.account_client_certificate_spinner); diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupNames.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupNames.java index 803cfd7da..f3240a0ce 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupNames.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupNames.java @@ -42,6 +42,8 @@ public class AccountSetupNames extends K9Activity implements OnClickListener { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setLayout(R.layout.account_setup_names); + setTitle(R.string.account_setup_names_title); + mDescription = findViewById(R.id.account_description); mName = findViewById(R.id.account_name); mDoneButton = findViewById(R.id.done); diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupOptions.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupOptions.java index 7f403c0b1..5e5d02bf6 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupOptions.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupOptions.java @@ -43,6 +43,7 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setLayout(R.layout.account_setup_options); + setTitle(R.string.account_setup_options_title); mCheckFrequencyView = findViewById(R.id.account_check_frequency); mDisplayCountView = findViewById(R.id.account_display_count); 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 e1c021243..63bc2ad3f 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 @@ -96,6 +96,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setLayout(R.layout.account_setup_outgoing); + setTitle(R.string.account_setup_outgoing_title); String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT); mAccount = Preferences.getPreferences(this).getAccount(accountUuid); diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/choosefolder/ChooseFolderActivity.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/choosefolder/ChooseFolderActivity.kt index 14b87ef97..74640c9fc 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/choosefolder/ChooseFolderActivity.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/choosefolder/ChooseFolderActivity.kt @@ -51,6 +51,7 @@ class ChooseFolderActivity : K9Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setLayout(R.layout.folder_list) + setTitle(R.string.choose_folder_title) if (!decodeArguments(savedInstanceState)) { finish() diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/endtoend/AutocryptKeyTransferActivity.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/endtoend/AutocryptKeyTransferActivity.kt index ee065d7ed..c98a0d353 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/endtoend/AutocryptKeyTransferActivity.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/endtoend/AutocryptKeyTransferActivity.kt @@ -38,6 +38,7 @@ class AutocryptKeyTransferActivity : K9Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setLayout(R.layout.crypto_key_transfer) + setTitle(R.string.ac_transfer_title) val accountUuid = intent.getStringExtra(EXTRA_ACCOUNT) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/managefolders/ManageFoldersActivity.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/managefolders/ManageFoldersActivity.kt index e648938b9..7ee374489 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/managefolders/ManageFoldersActivity.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/managefolders/ManageFoldersActivity.kt @@ -18,6 +18,7 @@ class ManageFoldersActivity : K9Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setLayout(R.layout.activity_manage_folders) + setTitle(R.string.folders_action) val accountUuid = intent.getStringExtra(EXTRA_ACCOUNT) ?: error("Missing Intent extra '$EXTRA_ACCOUNT'") diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagesource/MessageSourceActivity.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagesource/MessageSourceActivity.kt index d328b94dd..26d689671 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagesource/MessageSourceActivity.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagesource/MessageSourceActivity.kt @@ -16,6 +16,7 @@ class MessageSourceActivity : K9Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setLayout(R.layout.message_view_headers_activity) + setTitle(R.string.show_headers_action) supportActionBar!!.setDisplayHomeAsUpEnabled(true) if (savedInstanceState == null) {