From af6f195af0bb200d1bb06ad11dac476e8dff0073 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Mon, 14 Jul 2014 19:13:16 -0700 Subject: 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 --- .../dialer/settings/DialerSettingsActivity.java | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/com/android/dialer/settings/DialerSettingsActivity.java (limited to 'src/com/android/dialer/settings') 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
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; + } +} -- cgit v1.2.3