diff options
author | Yorke Lee <yorkelee@google.com> | 2014-07-14 19:13:16 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-07-15 10:00:32 -0700 |
commit | af6f195af0bb200d1bb06ad11dac476e8dff0073 (patch) | |
tree | 916ce243afb2ab86524ae16491e5d451fc4a1fc5 /src | |
parent | 434dbcc2f581619f79a691e1a39c5e69003a9d16 (diff) |
Make ContactPreferences use SharedPreferences instead of System settings (5/5)
* Move constants that originally lived in the framework into ContactsCommon
* Use SharedPreferences instead of System settings to persist preferences
* Use a SharedPreferenceListener to monitor changes instead of a content observer
on system settings
* Move DisplayOrderPreference and SortOrderPreference into ContactsCommon so that
it can be used by Dialer
* Create base DialerSettingsActivity in Dialer, and make GoogleDialerSettingsActivity
extend it
Bug: 16153186
Change-Id: I27befcc3b038038830f72092b55a6fc8a6f85674
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 9 | ||||
-rw-r--r-- | src/com/android/dialer/settings/DialerSettingsActivity.java | 54 |
2 files changed, 57 insertions, 6 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 4965647e7..d08b38f44 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -81,6 +81,7 @@ import com.android.dialer.list.RegularSearchFragment; import com.android.dialer.list.SearchFragment; import com.android.dialer.list.SmartDialSearchFragment; import com.android.dialer.list.SpeedDialFragment; +import com.android.dialer.settings.DialerSettingsActivity; import com.android.dialer.util.DialerUtils; import com.android.dialer.widget.ActionBarController; import com.android.dialer.widget.SearchEditTextLayout; @@ -519,12 +520,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } protected void handleMenuSettings() { - openTelephonySetting(this); - } - - public static void openTelephonySetting(Activity activity) { - final Intent settingsIntent = getCallSettingsIntent(); - activity.startActivity(settingsIntent); + final Intent intent = new Intent(this, DialerSettingsActivity.class); + startActivity(intent); } @Override diff --git a/src/com/android/dialer/settings/DialerSettingsActivity.java b/src/com/android/dialer/settings/DialerSettingsActivity.java new file mode 100644 index 000000000..904be82b8 --- /dev/null +++ b/src/com/android/dialer/settings/DialerSettingsActivity.java @@ -0,0 +1,54 @@ +package com.android.dialer.settings; + +import android.content.SharedPreferences; +import android.os.Bundle; +import android.preference.PreferenceActivity; +import android.preference.PreferenceManager; +import android.preference.PreferenceActivity.Header; +import android.view.MenuItem; + +import com.android.contacts.common.preference.DisplayOptionsPreferenceFragment; +import com.android.dialer.DialtactsActivity; +import com.android.dialer.R; + +import java.util.List; + +public class DialerSettingsActivity extends PreferenceActivity { + + protected SharedPreferences mPreferences; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mPreferences = PreferenceManager.getDefaultSharedPreferences(this); + } + + @Override + public void onBuildHeaders(List<Header> target) { + final Header contactDisplayHeader = new Header(); + contactDisplayHeader.titleRes = R.string.settings_contact_display_options_title; + contactDisplayHeader.summaryRes = R.string.settings_contact_display_options_description; + contactDisplayHeader.fragment = DisplayOptionsPreferenceFragment.class.getName(); + target.add(contactDisplayHeader); + + final Header callSettingHeader = new Header(); + callSettingHeader.titleRes = R.string.call_settings_label; + callSettingHeader.summaryRes = R.string.call_settings_description; + callSettingHeader.intent = DialtactsActivity.getCallSettingsIntent(); + target.add(callSettingHeader); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == android.R.id.home) { + onBackPressed(); + return true; + } + return false; + } + + @Override + protected boolean isValidFragment(String fragmentName) { + return true; + } +} |