diff options
author | DvTonder <david.vantonder@gmail.com> | 2012-12-16 10:27:16 -0500 |
---|---|---|
committer | DvTonder <david.vantonder@gmail.com> | 2012-12-17 09:15:09 -0500 |
commit | e92ca6f1663680db97e2b80267d6d17829985139 (patch) | |
tree | e9e8852da3ed27fcca29589f060519ee1385b96c /src | |
parent | 869590244456193f5558a60608838e7cc848964b (diff) | |
download | packages_apps_settings-e92ca6f1663680db97e2b80267d6d17829985139.zip packages_apps_settings-e92ca6f1663680db97e2b80267d6d17829985139.tar.gz packages_apps_settings-e92ca6f1663680db97e2b80267d6d17829985139.tar.bz2 |
Settings: Call Ring mode what Google calls it, not Silent mode (1 of 2)
Silent mode -> Ring mode cleanup
Change-Id: I4c0c182d59ebeb9e2372a24131506f1a111fe33f
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/SoundSettings.java | 40 | ||||
-rw-r--r-- | src/com/android/settings/cyanogenmod/PowerMenu.java | 16 | ||||
-rw-r--r-- | src/com/android/settings/profiles/ProfileConfig.java | 48 | ||||
-rw-r--r-- | src/com/android/settings/profiles/ProfileRingModePreference.java (renamed from src/com/android/settings/profiles/ProfileSilentModePreference.java) | 54 |
4 files changed, 79 insertions, 79 deletions
diff --git a/src/com/android/settings/SoundSettings.java b/src/com/android/settings/SoundSettings.java index 69385c1..d3cac7a 100644 --- a/src/com/android/settings/SoundSettings.java +++ b/src/com/android/settings/SoundSettings.java @@ -64,7 +64,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements private static final int FALLBACK_EMERGENCY_TONE_VALUE = 0; private static final String KEY_VOLUME_OVERLAY = "volume_overlay"; - private static final String KEY_SILENT_MODE = "silent_mode"; + private static final String KEY_RING_MODE = "ring_mode"; private static final String KEY_VIBRATE = "vibrate_when_ringing"; private static final String KEY_RING_VOLUME = "ring_volume"; private static final String KEY_INCREASING_RING = "increasing_ring"; @@ -85,9 +85,9 @@ public class SoundSettings extends SettingsPreferenceFragment implements private static final String KEY_QUIET_HOURS = "quiet_hours"; private static final String KEY_VOLBTN_MUSIC_CTRL = "volbtn_music_controls"; - private static final String SILENT_MODE_OFF = "off"; - private static final String SILENT_MODE_VIBRATE = "vibrate"; - private static final String SILENT_MODE_MUTE = "mute"; + private static final String RING_MODE_NORMAL = "normal"; + private static final String RING_MODE_VIBRATE = "vibrate"; + private static final String RING_MODE_MUTE = "mute"; private static final String[] NEED_VOICE_CAPABILITY = { KEY_RINGTONE, KEY_DTMF_TONE, KEY_CATEGORY_CALLS, @@ -99,7 +99,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements private CheckBoxPreference mVibrateWhenRinging; private ListPreference mVolumeOverlay; - private ListPreference mSilentMode; + private ListPreference mRingMode; private CheckBoxPreference mDtmfTone; private CheckBoxPreference mSoundEffects; private CheckBoxPreference mHapticFeedback; @@ -168,12 +168,12 @@ public class SoundSettings extends SettingsPreferenceFragment implements mVolumeOverlay.setValue(Integer.toString(volumeOverlay)); mVolumeOverlay.setSummary(mVolumeOverlay.getEntry()); - mSilentMode = (ListPreference) findPreference(KEY_SILENT_MODE); + mRingMode = (ListPreference) findPreference(KEY_RING_MODE); if (!getResources().getBoolean(R.bool.has_silent_mode)) { - getPreferenceScreen().removePreference(mSilentMode); + getPreferenceScreen().removePreference(mRingMode); findPreference(KEY_RING_VOLUME).setDependency(null); } else { - mSilentMode.setOnPreferenceChangeListener(this); + mRingMode.setOnPreferenceChangeListener(this); } mQuietHours = (PreferenceScreen) findPreference(KEY_QUIET_HOURS); @@ -294,27 +294,27 @@ public class SoundSettings extends SettingsPreferenceFragment implements getActivity().unregisterReceiver(mReceiver); } - private void setPhoneSilentSettingValue(String value) { + private void setPhoneRingModeValue(String value) { int ringerMode = AudioManager.RINGER_MODE_NORMAL; - if (value.equals(SILENT_MODE_MUTE)) { + if (value.equals(RING_MODE_MUTE)) { ringerMode = AudioManager.RINGER_MODE_SILENT; - } else if (value.equals(SILENT_MODE_VIBRATE)) { + } else if (value.equals(RING_MODE_VIBRATE)) { ringerMode = AudioManager.RINGER_MODE_VIBRATE; } mAudioManager.setRingerMode(ringerMode); } - private String getPhoneSilentModeSettingValue() { + private String getPhoneRingModeSettingValue() { switch (mAudioManager.getRingerMode()) { case AudioManager.RINGER_MODE_NORMAL: - return SILENT_MODE_OFF; + return RING_MODE_NORMAL; case AudioManager.RINGER_MODE_VIBRATE: - return SILENT_MODE_VIBRATE; + return RING_MODE_VIBRATE; case AudioManager.RINGER_MODE_SILENT: - return SILENT_MODE_MUTE; + return RING_MODE_MUTE; } // Shouldn't happen - return SILENT_MODE_OFF; + return RING_MODE_NORMAL; } // updateState in fact updates the UI to reflect the system state @@ -322,7 +322,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements if (getActivity() == null) return; ContentResolver resolver = getContentResolver(); - mSilentMode.setValue(getPhoneSilentModeSettingValue()); + mRingMode.setValue(getPhoneRingModeSettingValue()); if (Settings.System.getInt(resolver, Settings.System.QUIET_HOURS_ENABLED, 0) == 1) { mQuietHours.setSummary(getString(R.string.quiet_hours_active_from) + " " + @@ -333,7 +333,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements mQuietHours.setSummary(getString(R.string.quiet_hours_summary)); } - mSilentMode.setSummary(mSilentMode.getEntry()); + mRingMode.setSummary(mRingMode.getEntry()); } private void updateRingtoneName(int type, Preference preference, int msg) { @@ -451,8 +451,8 @@ public class SoundSettings extends SettingsPreferenceFragment implements } catch (NumberFormatException e) { Log.e(TAG, "could not persist emergency tone setting", e); } - } else if (preference == mSilentMode) { - setPhoneSilentSettingValue(objValue.toString()); + } else if (preference == mRingMode) { + setPhoneRingModeValue(objValue.toString()); } else if (preference == mVolumeOverlay) { final int value = Integer.valueOf((String) objValue); final int index = mVolumeOverlay.findIndexOfValue((String) objValue); diff --git a/src/com/android/settings/cyanogenmod/PowerMenu.java b/src/com/android/settings/cyanogenmod/PowerMenu.java index 9c7e048..9d956bc 100644 --- a/src/com/android/settings/cyanogenmod/PowerMenu.java +++ b/src/com/android/settings/cyanogenmod/PowerMenu.java @@ -36,7 +36,7 @@ public class PowerMenu extends SettingsPreferenceFragment { private static final String KEY_PROFILES = "power_menu_profiles"; private static final String KEY_AIRPLANE = "power_menu_airplane"; private static final String KEY_USER = "power_menu_user"; - private static final String KEY_SILENT = "power_menu_silent"; + private static final String KEY_SOUND = "power_menu_sound"; private CheckBoxPreference mRebootPref; private CheckBoxPreference mScreenshotPref; @@ -44,7 +44,7 @@ public class PowerMenu extends SettingsPreferenceFragment { private CheckBoxPreference mProfilesPref; private CheckBoxPreference mAirplanePref; private CheckBoxPreference mUserPref; - private CheckBoxPreference mSilentPref; + private CheckBoxPreference mSoundPref; @Override public void onCreate(Bundle savedInstanceState) { @@ -94,9 +94,9 @@ public class PowerMenu extends SettingsPreferenceFragment { Settings.System.POWER_MENU_USER_ENABLED, 0) == 1)); } - mSilentPref = (CheckBoxPreference) findPreference(KEY_SILENT); - mSilentPref.setChecked((Settings.System.getInt(getContentResolver(), - Settings.System.POWER_MENU_SILENT_ENABLED, 1) == 1)); + mSoundPref = (CheckBoxPreference) findPreference(KEY_SOUND); + mSoundPref.setChecked((Settings.System.getInt(getContentResolver(), + Settings.System.POWER_MENU_SOUND_ENABLED, 1) == 1)); } @@ -134,10 +134,10 @@ public class PowerMenu extends SettingsPreferenceFragment { Settings.System.putInt(getContentResolver(), Settings.System.POWER_MENU_USER_ENABLED, value ? 1 : 0); - } else if (preference == mSilentPref) { - value = mSilentPref.isChecked(); + } else if (preference == mSoundPref) { + value = mSoundPref.isChecked(); Settings.System.putInt(getContentResolver(), - Settings.System.POWER_MENU_SILENT_ENABLED, + Settings.System.POWER_MENU_SOUND_ENABLED, value ? 1 : 0); } else { return super.onPreferenceTreeClick(preferenceScreen, preference); diff --git a/src/com/android/settings/profiles/ProfileConfig.java b/src/com/android/settings/profiles/ProfileConfig.java index 6aa2bd3..f908fd4 100644 --- a/src/com/android/settings/profiles/ProfileConfig.java +++ b/src/com/android/settings/profiles/ProfileConfig.java @@ -25,7 +25,7 @@ import android.app.ConnectionSettings; import android.app.Profile; import android.app.ProfileGroup; import android.app.ProfileManager; -import android.app.SilentModeSettings; +import android.app.RingModeSettings; import android.app.StreamSettings; import android.content.Context; import android.content.DialogInterface; @@ -74,7 +74,7 @@ public class ProfileConfig extends SettingsPreferenceFragment private ArrayList<ConnectionItem> mConnections; - private SilentModeItem mSilentMode; + private RingModeItem mRingMode; private AirplaneModeItem mAirplaneMode; @@ -186,24 +186,24 @@ public class ProfileConfig extends SettingsPreferenceFragment PreferenceGroup systemPrefs = (PreferenceGroup) prefSet.findPreference("profile_system_settings"); if (systemPrefs != null) { systemPrefs.removeAll(); - // Silent mode preference - if (mSilentMode == null) { - mSilentMode = new SilentModeItem(); + // Ring mode preference + if (mRingMode == null) { + mRingMode = new RingModeItem(); } - SilentModeSettings sms = mProfile.getSilentMode(); - if (sms == null) { - sms = new SilentModeSettings(); - mProfile.setSilentMode(sms); + RingModeSettings rms = mProfile.getRingMode(); + if (rms == null) { + rms = new RingModeSettings(); + mProfile.setRingMode(rms); } - mSilentMode.mSettings = sms; - ProfileSilentModePreference smp = new ProfileSilentModePreference(getActivity()); - smp.setSilentModeItem(mSilentMode); - smp.setTitle(R.string.silent_mode_title); - smp.setPersistent(false); - smp.setSummary(getActivity()); - smp.setOnPreferenceChangeListener(this); - mSilentMode.mCheckbox = smp; - systemPrefs.addPreference(smp); + mRingMode.mSettings = rms; + ProfileRingModePreference rmp = new ProfileRingModePreference(getActivity()); + rmp.setRingModeItem(mRingMode); + rmp.setTitle(R.string.ring_mode_title); + rmp.setPersistent(false); + rmp.setSummary(getActivity()); + rmp.setOnPreferenceChangeListener(this); + mRingMode.mCheckbox = rmp; + systemPrefs.addPreference(rmp); // Airplane mode preference if (mAirplaneMode == null) { @@ -315,8 +315,8 @@ public class ProfileConfig extends SettingsPreferenceFragment connection.mSettings.setOverride((Boolean) newValue); } } - } else if (preference == mSilentMode.mCheckbox) { - mSilentMode.mSettings.setOverride((Boolean) newValue); + } else if (preference == mRingMode.mCheckbox) { + mRingMode.mSettings.setOverride((Boolean) newValue); } else if (preference == mAirplaneMode.mCheckbox) { mAirplaneMode.mSettings.setOverride((Boolean) newValue); } else if (preference == mNamePreference) { @@ -413,12 +413,12 @@ public class ProfileConfig extends SettingsPreferenceFragment } } - static class SilentModeItem { + static class RingModeItem { String mLabel; - SilentModeSettings mSettings; - ProfileSilentModePreference mCheckbox; + RingModeSettings mSettings; + ProfileRingModePreference mCheckbox; - public SilentModeItem() { + public RingModeItem() { // nothing to do } } diff --git a/src/com/android/settings/profiles/ProfileSilentModePreference.java b/src/com/android/settings/profiles/ProfileRingModePreference.java index 200bfdb..d471998 100644 --- a/src/com/android/settings/profiles/ProfileSilentModePreference.java +++ b/src/com/android/settings/profiles/ProfileRingModePreference.java @@ -30,16 +30,16 @@ import android.widget.LinearLayout; import com.android.settings.R; -public class ProfileSilentModePreference extends Preference implements +public class ProfileRingModePreference extends Preference implements CompoundButton.OnCheckedChangeListener, View.OnClickListener { private boolean mProtectFromCheckedChange = false; private CheckBox mCheckBox; - final static String TAG = "ProfileSilentModePreference"; + final static String TAG = "ProfileRingModePreference"; - private ProfileConfig.SilentModeItem mSilentModeItem; + private ProfileConfig.RingModeItem mRingModeItem; final static int defaultChoice = -1; @@ -50,7 +50,7 @@ public class ProfileSilentModePreference extends Preference implements * @param attrs * @param defStyle */ - public ProfileSilentModePreference(Context context, AttributeSet attrs, int defStyle) { + public ProfileRingModePreference(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } @@ -59,7 +59,7 @@ public class ProfileSilentModePreference extends Preference implements * @param context * @param attrs */ - public ProfileSilentModePreference(Context context, AttributeSet attrs) { + public ProfileRingModePreference(Context context, AttributeSet attrs) { super(context, attrs); init(); } @@ -67,7 +67,7 @@ public class ProfileSilentModePreference extends Preference implements /** * @param context */ - public ProfileSilentModePreference(Context context) { + public ProfileRingModePreference(Context context) { super(context); init(); } @@ -99,14 +99,14 @@ public class ProfileSilentModePreference extends Preference implements } public boolean isChecked() { - return mSilentModeItem != null && mSilentModeItem.mSettings.isOverride(); + return mRingModeItem != null && mRingModeItem.mSettings.isOverride(); } - public void setSilentModeItem(ProfileConfig.SilentModeItem silentModeItem) { - mSilentModeItem = silentModeItem; + public void setRingModeItem(ProfileConfig.RingModeItem ringModeItem) { + mRingModeItem = ringModeItem; if (mCheckBox != null) { - mCheckBox.setChecked(mSilentModeItem.mSettings.isOverride()); + mCheckBox.setChecked(mRingModeItem.mSettings.isOverride()); } } @@ -115,26 +115,26 @@ public class ProfileSilentModePreference extends Preference implements return; } - mSilentModeItem.mSettings.setOverride(isChecked); + mRingModeItem.mSettings.setOverride(isChecked); callChangeListener(isChecked); } - protected Dialog createSilentModeDialog() { + protected Dialog createRingModeDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); - final String[] silentModeValues = getContext().getResources().getStringArray(R.array.silent_mode_values); - String currentValue = mSilentModeItem.mSettings.getValue(); + final String[] ringModeValues = getContext().getResources().getStringArray(R.array.ring_mode_values); + String currentValue = mRingModeItem.mSettings.getValue(); if (currentValue != null) { - for (int i = 0; i < silentModeValues.length; i++) { - if (currentValue.equals(silentModeValues[i])) { + for (int i = 0; i < ringModeValues.length; i++) { + if (currentValue.equals(ringModeValues[i])) { currentChoice = i; break; } } } - builder.setTitle(R.string.silent_mode_title); - builder.setSingleChoiceItems(R.array.silent_mode_entries, currentChoice, new DialogInterface.OnClickListener() { + builder.setTitle(R.string.ring_mode_title); + builder.setSingleChoiceItems(R.array.ring_mode_entries, currentChoice, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { currentChoice = item; @@ -145,9 +145,9 @@ public class ProfileSilentModePreference extends Preference implements @Override public void onClick(DialogInterface dialog, int item) { if (currentChoice != defaultChoice) { - String value = silentModeValues[currentChoice]; - mSilentModeItem.mSettings.setValue(value); - setSummary(getContext().getResources().getStringArray(R.array.silent_mode_entries)[currentChoice]); + String value = ringModeValues[currentChoice]; + mRingModeItem.mSettings.setValue(value); + setSummary(getContext().getResources().getStringArray(R.array.ring_mode_entries)[currentChoice]); } } }); @@ -156,22 +156,22 @@ public class ProfileSilentModePreference extends Preference implements return builder.create(); } - public ProfileConfig.SilentModeItem getSilentModeItem() { - return mSilentModeItem; + public ProfileConfig.RingModeItem getRingModeItem() { + return mRingModeItem; } @Override public void onClick(android.view.View v) { if ((v != null) && (R.id.text_layout == v.getId())) { - createSilentModeDialog().show(); + createRingModeDialog().show(); } } public void setSummary(Context context) { - String[] entries = context.getResources().getStringArray(R.array.silent_mode_entries); - String[] values = context.getResources().getStringArray(R.array.silent_mode_values); + String[] entries = context.getResources().getStringArray(R.array.ring_mode_entries); + String[] values = context.getResources().getStringArray(R.array.ring_mode_values); int l = entries.length; - String value = mSilentModeItem.mSettings.getValue(); + String value = mRingModeItem.mSettings.getValue(); for (int i = 0; i < l; i++) { if (value.equals(values[i])) { setSummary(entries[i]); |