Update ActionBar title on language change

Fixes #1329
// FREEBIE
This commit is contained in:
Jake McGinty 2014-04-09 13:26:06 -07:00
parent 0dc6ec294b
commit 454673cd0c
6 changed files with 39 additions and 17 deletions

View File

@ -129,7 +129,6 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
setContentView(R.layout.group_create_activity); setContentView(R.layout.group_create_activity);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(R.string.GroupCreateActivity_actionbar_title);
selectedContacts = new HashSet<Recipient>(); selectedContacts = new HashSet<Recipient>();
initializeResources(); initializeResources();
@ -140,6 +139,7 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
super.onResume(); super.onResume();
dynamicTheme.onResume(this); dynamicTheme.onResume(this);
dynamicLanguage.onResume(this); dynamicLanguage.onResume(this);
getSupportActionBar().setTitle(R.string.GroupCreateActivity_actionbar_title);
if (!TextSecurePreferences.isPushRegistered(this)) { if (!TextSecurePreferences.isPushRegistered(this)) {
disableWhisperGroupUi(R.string.GroupCreateActivity_you_dont_support_push); disableWhisperGroupUi(R.string.GroupCreateActivity_you_dont_support_push);
} }

View File

@ -32,6 +32,7 @@ import org.thoughtcrime.securesms.recipients.RecipientFactory;
import org.thoughtcrime.securesms.recipients.RecipientFormattingException; import org.thoughtcrime.securesms.recipients.RecipientFormattingException;
import org.thoughtcrime.securesms.recipients.Recipients; import org.thoughtcrime.securesms.recipients.Recipients;
import org.thoughtcrime.securesms.util.DirectoryHelper; import org.thoughtcrime.securesms.util.DirectoryHelper;
import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.DynamicTheme; import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.NumberUtil; import org.thoughtcrime.securesms.util.NumberUtil;
import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.TextSecurePreferences;
@ -53,14 +54,16 @@ public class NewConversationActivity extends PassphraseRequiredSherlockFragmentA
private final static String TAG = "ContactSelectActivity"; private final static String TAG = "ContactSelectActivity";
public final static String MASTER_SECRET_EXTRA = "master_secret"; public final static String MASTER_SECRET_EXTRA = "master_secret";
private final DynamicTheme dynamicTheme = new DynamicTheme(); private final DynamicTheme dynamicTheme = new DynamicTheme ();
private MasterSecret masterSecret; private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
private MasterSecret masterSecret;
private PushContactSelectionListFragment contactsFragment; private PushContactSelectionListFragment contactsFragment;
@Override @Override
protected void onCreate(Bundle icicle) { protected void onCreate(Bundle icicle) {
dynamicTheme.onCreate(this); dynamicTheme.onCreate(this);
dynamicLanguage.onCreate(this);
super.onCreate(icicle); super.onCreate(icicle);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@ -73,6 +76,8 @@ public class NewConversationActivity extends PassphraseRequiredSherlockFragmentA
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
dynamicTheme.onResume(this); dynamicTheme.onResume(this);
dynamicLanguage.onResume(this);
getSupportActionBar().setTitle(R.string.AndroidManifest__select_contacts);
masterSecret = getIntent().getParcelableExtra(MASTER_SECRET_EXTRA); masterSecret = getIntent().getParcelableExtra(MASTER_SECRET_EXTRA);
} }

View File

@ -21,6 +21,7 @@ import android.os.Bundle;
import android.util.Log; import android.util.Log;
import org.thoughtcrime.securesms.util.DirectoryHelper; import org.thoughtcrime.securesms.util.DirectoryHelper;
import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.DynamicTheme; import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.TextSecurePreferences;
@ -43,13 +44,15 @@ public class PushContactSelectionActivity extends PassphraseRequiredSherlockFrag
private final static String TAG = "ContactSelectActivity"; private final static String TAG = "ContactSelectActivity";
public final static String PUSH_ONLY_EXTRA = "push_only"; public final static String PUSH_ONLY_EXTRA = "push_only";
private final DynamicTheme dynamicTheme = new DynamicTheme(); private final DynamicTheme dynamicTheme = new DynamicTheme ();
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
private PushContactSelectionListFragment contactsFragment; private PushContactSelectionListFragment contactsFragment;
@Override @Override
protected void onCreate(Bundle icicle) { protected void onCreate(Bundle icicle) {
dynamicTheme.onCreate(this); dynamicTheme.onCreate(this);
dynamicLanguage.onCreate(this);
super.onCreate(icicle); super.onCreate(icicle);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@ -62,6 +65,8 @@ public class PushContactSelectionActivity extends PassphraseRequiredSherlockFrag
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
dynamicTheme.onResume(this); dynamicTheme.onResume(this);
dynamicLanguage.onResume(this);
getSupportActionBar().setTitle(R.string.AndroidManifest__select_contacts);
} }
@Override @Override

View File

@ -21,15 +21,18 @@ import android.os.Bundle;
import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.DynamicTheme; import org.thoughtcrime.securesms.util.DynamicTheme;
public class ReviewIdentitiesActivity extends SherlockFragmentActivity { public class ReviewIdentitiesActivity extends SherlockFragmentActivity {
private final DynamicTheme dynamicTheme = new DynamicTheme(); private final DynamicTheme dynamicTheme = new DynamicTheme();
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
@Override @Override
public void onCreate(Bundle bundle) { public void onCreate(Bundle bundle) {
dynamicTheme.onCreate(this); dynamicTheme.onCreate(this);
dynamicLanguage.onCreate(this);
super.onCreate(bundle); super.onCreate(bundle);
setContentView(R.layout.review_identities); setContentView(R.layout.review_identities);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@ -39,12 +42,14 @@ public class ReviewIdentitiesActivity extends SherlockFragmentActivity {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
dynamicTheme.onResume(this); dynamicTheme.onResume(this);
dynamicLanguage.onResume(this);
getSupportActionBar().setTitle(R.string.AndroidManifest__manage_identity_keys);
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case android.R.id.home: finish(); return true; case android.R.id.home: finish(); return true;
} }
return false; return false;

View File

@ -18,25 +18,16 @@
package org.thoughtcrime.securesms; package org.thoughtcrime.securesms;
import android.content.Intent; import android.content.Intent;
import android.database.ContentObserver;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.provider.ContactsContract;
import android.util.Log;
import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ListView;
import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
import org.thoughtcrime.securesms.recipients.RecipientFactory;
import org.thoughtcrime.securesms.recipients.Recipients; import org.thoughtcrime.securesms.recipients.Recipients;
import org.thoughtcrime.securesms.service.DirectoryRefreshListener;
import org.thoughtcrime.securesms.util.ActionBarUtil;
import org.thoughtcrime.securesms.util.DynamicLanguage; import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.DynamicTheme; import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.MemoryCleaner; import org.thoughtcrime.securesms.util.MemoryCleaner;
@ -66,7 +57,6 @@ public class ShareActivity extends PassphraseRequiredSherlockFragmentActivity
super.onCreate(icicle); super.onCreate(icicle);
setContentView(R.layout.share_activity); setContentView(R.layout.share_activity);
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar(), R.string.ShareActivity_share_with);
initializeResources(); initializeResources();
} }
@ -81,6 +71,7 @@ public class ShareActivity extends PassphraseRequiredSherlockFragmentActivity
super.onResume(); super.onResume();
dynamicTheme.onResume(this); dynamicTheme.onResume(this);
dynamicLanguage.onResume(this); dynamicLanguage.onResume(this);
getSupportActionBar().setTitle(R.string.ShareActivity_share_with);
} }
@Override @Override

View File

@ -23,6 +23,8 @@ import android.widget.Toast;
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil; import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.MemoryCleaner; import org.thoughtcrime.securesms.util.MemoryCleaner;
import org.whispersystems.textsecure.crypto.IdentityKey; import org.whispersystems.textsecure.crypto.IdentityKey;
import org.whispersystems.textsecure.crypto.MasterSecret; import org.whispersystems.textsecure.crypto.MasterSecret;
@ -37,7 +39,7 @@ import org.whispersystems.textsecure.storage.Session;
*/ */
public class VerifyIdentityActivity extends KeyScanningActivity { public class VerifyIdentityActivity extends KeyScanningActivity {
private Recipient recipient; private Recipient recipient;
private MasterSecret masterSecret; private MasterSecret masterSecret;
private TextView localIdentityFingerprint; private TextView localIdentityFingerprint;
@ -45,8 +47,13 @@ public class VerifyIdentityActivity extends KeyScanningActivity {
private int keyType; private int keyType;
private final DynamicTheme dynamicTheme = new DynamicTheme ();
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
@Override @Override
public void onCreate(Bundle state) { public void onCreate(Bundle state) {
dynamicTheme.onCreate(this);
dynamicLanguage.onCreate(this);
super.onCreate(state); super.onCreate(state);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.verify_identity_activity); setContentView(R.layout.verify_identity_activity);
@ -55,6 +62,15 @@ public class VerifyIdentityActivity extends KeyScanningActivity {
initializeFingerprints(); initializeFingerprints();
} }
@Override
public void onResume() {
super.onResume();
dynamicTheme.onResume(this);
dynamicLanguage.onResume(this);
getSupportActionBar().setTitle(R.string.AndroidManifest__verify_identity);
}
@Override @Override
protected void onDestroy() { protected void onDestroy() {
MemoryCleaner.clean(masterSecret); MemoryCleaner.clean(masterSecret);