Merge pull request #1324 from mcginty/actionbar-cleanup

use normal means to set actionbar icon
This commit is contained in:
Moxie Marlinspike 2014-04-10 17:57:53 -07:00
commit ef77dc9d6d
17 changed files with 48 additions and 115 deletions

View File

@ -21,6 +21,8 @@
parent="@style/Widget.Sherlock.ActionBar"> parent="@style/Widget.Sherlock.ActionBar">
<item name="android:background">#ff111111</item> <item name="android:background">#ff111111</item>
<item name="background">#ff111111</item> <item name="background">#ff111111</item>
<item name="android:icon">@drawable/actionbar_icon_holo_dark</item>
<item name="icon">@drawable/actionbar_icon_holo_dark</item>
</style> </style>
<style name="TextSecure.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title"> <style name="TextSecure.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
@ -37,6 +39,8 @@
<item name="titleTextStyle">@style/TextSecure.TitleTextStyle</item> <item name="titleTextStyle">@style/TextSecure.TitleTextStyle</item>
<item name="android:subtitleTextStyle">@style/TextSecure.SubtitleTextStyle</item> <item name="android:subtitleTextStyle">@style/TextSecure.SubtitleTextStyle</item>
<item name="subtitleTextStyle">@style/TextSecure.SubtitleTextStyle</item> <item name="subtitleTextStyle">@style/TextSecure.SubtitleTextStyle</item>
<item name="android:icon">@drawable/actionbar_icon_holo_light</item>
<item name="icon">@drawable/actionbar_icon_holo_light</item>
</style> </style>
<style name="transparent_progress"> <style name="transparent_progress">

View File

@ -53,7 +53,6 @@ import org.thoughtcrime.securesms.contacts.ContactIdentityManager;
import org.thoughtcrime.securesms.crypto.MasterSecretUtil; import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
import org.thoughtcrime.securesms.push.PushServiceSocketFactory; import org.thoughtcrime.securesms.push.PushServiceSocketFactory;
import org.thoughtcrime.securesms.service.KeyCachingService; import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.util.ActionBarUtil;
import org.thoughtcrime.securesms.util.Dialogs; import org.thoughtcrime.securesms.util.Dialogs;
import org.thoughtcrime.securesms.util.DirectoryHelper; import org.thoughtcrime.securesms.util.DirectoryHelper;
import org.thoughtcrime.securesms.util.DynamicLanguage; import org.thoughtcrime.securesms.util.DynamicLanguage;
@ -101,7 +100,6 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
super.onCreate(icicle); super.onCreate(icicle);
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true); this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar());
addPreferencesFromResource(R.xml.preferences); addPreferencesFromResource(R.xml.preferences);

View File

@ -30,7 +30,6 @@ 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.util.ActionBarUtil;
import org.thoughtcrime.securesms.util.DynamicTheme; import org.thoughtcrime.securesms.util.DynamicTheme;
import java.util.ArrayList; import java.util.ArrayList;
@ -61,7 +60,6 @@ public class ContactSelectionActivity extends PassphraseRequiredSherlockFragment
super.onCreate(icicle); super.onCreate(icicle);
final ActionBar actionBar = this.getSupportActionBar(); final ActionBar actionBar = this.getSupportActionBar();
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar());
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true);

View File

@ -87,7 +87,6 @@ import org.thoughtcrime.securesms.sms.MessageSender;
import org.thoughtcrime.securesms.sms.OutgoingEncryptedMessage; import org.thoughtcrime.securesms.sms.OutgoingEncryptedMessage;
import org.thoughtcrime.securesms.sms.OutgoingEndSessionMessage; import org.thoughtcrime.securesms.sms.OutgoingEndSessionMessage;
import org.thoughtcrime.securesms.sms.OutgoingTextMessage; import org.thoughtcrime.securesms.sms.OutgoingTextMessage;
import org.thoughtcrime.securesms.util.ActionBarUtil;
import org.thoughtcrime.securesms.util.BitmapDecodingException; import org.thoughtcrime.securesms.util.BitmapDecodingException;
import org.thoughtcrime.securesms.util.BitmapUtil; import org.thoughtcrime.securesms.util.BitmapUtil;
import org.thoughtcrime.securesms.util.CharacterCalculator; import org.thoughtcrime.securesms.util.CharacterCalculator;
@ -181,7 +180,6 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
setContentView(R.layout.conversation_activity); setContentView(R.layout.conversation_activity);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar());
initializeReceivers(); initializeReceivers();
initializeResources(); initializeResources();

View File

@ -31,7 +31,6 @@ import org.thoughtcrime.securesms.recipients.RecipientFactory;
import org.thoughtcrime.securesms.recipients.Recipients; import org.thoughtcrime.securesms.recipients.Recipients;
import org.thoughtcrime.securesms.service.KeyCachingService; import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.service.SendReceiveService; import org.thoughtcrime.securesms.service.SendReceiveService;
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;
@ -64,7 +63,7 @@ public class ConversationListActivity extends PassphraseRequiredSherlockFragment
setContentView(R.layout.conversation_list_activity); setContentView(R.layout.conversation_list_activity);
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar(), R.string.app_name); getSupportActionBar().setTitle(R.string.app_name);
initializeNavigationDrawer(); initializeNavigationDrawer();
initializeSenderReceiverService(); initializeSenderReceiverService();

View File

@ -55,7 +55,6 @@ 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.sms.MessageSender; import org.thoughtcrime.securesms.sms.MessageSender;
import org.thoughtcrime.securesms.util.ActionBarUtil;
import org.thoughtcrime.securesms.util.BitmapUtil; import org.thoughtcrime.securesms.util.BitmapUtil;
import org.thoughtcrime.securesms.util.DynamicLanguage; import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.DynamicTheme; import org.thoughtcrime.securesms.util.DynamicTheme;
@ -130,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);
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar(), R.string.GroupCreateActivity_actionbar_title);
selectedContacts = new HashSet<Recipient>(); selectedContacts = new HashSet<Recipient>();
initializeResources(); initializeResources();
@ -141,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

@ -10,7 +10,6 @@ import android.support.v4.view.ViewPager;
import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
import org.thoughtcrime.securesms.util.ActionBarUtil;
import org.whispersystems.textsecure.crypto.MasterSecret; import org.whispersystems.textsecure.crypto.MasterSecret;
@ -25,7 +24,6 @@ public class ImportExportActivity extends PassphraseRequiredSherlockFragmentActi
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.import_export_activity); setContentView(R.layout.import_export_activity);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar());
initializeResources(); initializeResources();
initializeViewPager(); initializeViewPager();

View File

@ -1,7 +1,6 @@
package org.thoughtcrime.securesms; package org.thoughtcrime.securesms;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.text.ClipboardManager; import android.text.ClipboardManager;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.AsyncTask; import android.os.AsyncTask;
@ -19,24 +18,10 @@ import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
import com.google.thoughtcrimegson.Gson; import com.google.thoughtcrimegson.Gson;
import com.google.thoughtcrimegson.JsonIOException; import com.google.thoughtcrimegson.JsonIOException;
import com.google.thoughtcrimegson.JsonParseException;
import com.google.thoughtcrimegson.JsonSyntaxException; import com.google.thoughtcrimegson.JsonSyntaxException;
import com.google.thoughtcrimegson.reflect.TypeToken; import com.google.thoughtcrimegson.reflect.TypeToken;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.thoughtcrime.securesms.util.ActionBarUtil;
import org.thoughtcrime.securesms.util.ProgressDialogAsyncTask; import org.thoughtcrime.securesms.util.ProgressDialogAsyncTask;
import org.thoughtcrime.securesms.util.Util;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
@ -45,12 +30,9 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -70,7 +52,6 @@ public class LogSubmitActivity extends SherlockActivity {
protected void onCreate(Bundle icicle) { protected void onCreate(Bundle icicle) {
super.onCreate(icicle); super.onCreate(icicle);
setContentView(R.layout.log_submit_activity); setContentView(R.layout.log_submit_activity);
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar());
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
initializeResources(); initializeResources();
} }

View File

@ -26,7 +26,6 @@ import android.widget.Toast;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
import org.thoughtcrime.securesms.mms.MmsDownloadHelper; import org.thoughtcrime.securesms.mms.MmsDownloadHelper;
import org.thoughtcrime.securesms.service.SendReceiveService; import org.thoughtcrime.securesms.service.SendReceiveService;
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;
@ -47,7 +46,6 @@ public class MmsPreferencesActivity extends PassphraseRequiredSherlockPreference
super.onCreate(icicle); super.onCreate(icicle);
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true); this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar());
initializePreferences(); initializePreferences();
masterSecret = getIntent().getParcelableExtra("master_secret"); masterSecret = getIntent().getParcelableExtra("master_secret");

View File

@ -20,7 +20,6 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import com.actionbarsherlock.app.ActionBar;
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;
@ -32,8 +31,8 @@ import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientFactory; 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.ActionBarUtil;
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;
@ -55,19 +54,19 @@ 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);
final ActionBar actionBar = this.getSupportActionBar(); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ActionBarUtil.initializeDefaultActionBar(this, actionBar);
actionBar.setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.new_conversation_activity); setContentView(R.layout.new_conversation_activity);
initializeResources(); initializeResources();
@ -77,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

@ -19,32 +19,17 @@ package org.thoughtcrime.securesms;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View;
import android.widget.Toast;
import org.thoughtcrime.securesms.components.SingleRecipientPanel;
import org.thoughtcrime.securesms.contacts.ContactAccessor;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.ThreadDatabase;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientFactory;
import org.thoughtcrime.securesms.recipients.RecipientFormattingException;
import org.thoughtcrime.securesms.recipients.Recipients;
import org.thoughtcrime.securesms.util.ActionBarUtil;
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.ProgressDialogAsyncTask;
import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.textsecure.crypto.MasterSecret;
import com.actionbarsherlock.app.ActionBar;
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 java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import static org.thoughtcrime.securesms.contacts.ContactAccessor.ContactData; import static org.thoughtcrime.securesms.contacts.ContactAccessor.ContactData;
@ -59,18 +44,18 @@ 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);
final ActionBar actionBar = this.getSupportActionBar(); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ActionBarUtil.initializeDefaultActionBar(this, actionBar);
actionBar.setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.push_contact_selection_activity); setContentView(R.layout.push_contact_selection_activity);
initializeResources(); initializeResources();
@ -80,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

@ -1,11 +1,9 @@
package org.thoughtcrime.securesms; package org.thoughtcrime.securesms;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
@ -17,7 +15,6 @@ import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity; import com.actionbarsherlock.app.SherlockActivity;
import com.google.android.gcm.GCMRegistrar; import com.google.android.gcm.GCMRegistrar;
import com.google.i18n.phonenumbers.AsYouTypeFormatter; import com.google.i18n.phonenumbers.AsYouTypeFormatter;
@ -25,7 +22,6 @@ import com.google.i18n.phonenumbers.NumberParseException;
import com.google.i18n.phonenumbers.PhoneNumberUtil; import com.google.i18n.phonenumbers.PhoneNumberUtil;
import com.google.i18n.phonenumbers.Phonenumber; import com.google.i18n.phonenumbers.Phonenumber;
import org.thoughtcrime.securesms.util.ActionBarUtil;
import org.whispersystems.textsecure.crypto.MasterSecret; import org.whispersystems.textsecure.crypto.MasterSecret;
import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.Dialogs; import org.thoughtcrime.securesms.util.Dialogs;
@ -58,7 +54,7 @@ public class RegistrationActivity extends SherlockActivity {
super.onCreate(icicle); super.onCreate(icicle);
setContentView(R.layout.registration_activity); setContentView(R.layout.registration_activity);
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar(), getString(R.string.RegistrationActivity_connect_with_textsecure)); getSupportActionBar().setTitle(getString(R.string.RegistrationActivity_connect_with_textsecure));
initializeResources(); initializeResources();
initializeSpinner(); initializeSpinner();

View File

@ -32,7 +32,6 @@ import com.actionbarsherlock.app.SherlockActivity;
import org.thoughtcrime.securesms.push.PushServiceSocketFactory; import org.thoughtcrime.securesms.push.PushServiceSocketFactory;
import org.thoughtcrime.securesms.service.RegistrationService; import org.thoughtcrime.securesms.service.RegistrationService;
import org.thoughtcrime.securesms.util.ActionBarUtil;
import org.thoughtcrime.securesms.util.Dialogs; import org.thoughtcrime.securesms.util.Dialogs;
import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.textsecure.crypto.MasterSecret; import org.whispersystems.textsecure.crypto.MasterSecret;
@ -93,7 +92,7 @@ public class RegistrationProgressActivity extends SherlockActivity {
@Override @Override
public void onCreate(Bundle bundle) { public void onCreate(Bundle bundle) {
super.onCreate(bundle); super.onCreate(bundle);
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar(), getString(R.string.RegistrationProgressActivity_verifying_number)); getSupportActionBar().setTitle(getString(R.string.RegistrationProgressActivity_verifying_number));
setContentView(R.layout.registration_progress_activity); setContentView(R.layout.registration_progress_activity);
initializeResources(); initializeResources();

View File

@ -21,32 +21,35 @@ 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.ActionBarUtil; 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);
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar());
} }
@Override @Override
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,7 +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.ActionBarUtil; 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;
@ -38,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;
@ -46,17 +47,30 @@ 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);
ActionBarUtil.initializeDefaultActionBar(this, getSupportActionBar());
setContentView(R.layout.verify_identity_activity); setContentView(R.layout.verify_identity_activity);
initializeResources(); initializeResources();
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);

View File

@ -1,31 +0,0 @@
package org.thoughtcrime.securesms.util;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.TypedValue;
import com.actionbarsherlock.app.ActionBar;
import org.thoughtcrime.securesms.R;
public class ActionBarUtil {
public static void initializeDefaultActionBar(final Context c, final ActionBar actionBar, final int titleResId) {
actionBar.setTitle(titleResId);
initializeDefaultActionBar(c, actionBar);
}
public static void initializeDefaultActionBar(final Context c, final ActionBar actionBar, final String title) {
actionBar.setTitle(title);
initializeDefaultActionBar(c, actionBar);
}
public static void initializeDefaultActionBar(final Context c, final ActionBar actionBar) {
TypedValue iconResValue = new TypedValue();
c.getTheme().resolveAttribute(R.attr.actionbar_icon, iconResValue, true);
int attributeResourceId = iconResValue.resourceId;
Drawable icon = c.getResources().getDrawable(attributeResourceId);
actionBar.setIcon(icon);
}
}