diff options
author | Danesh M <daneshm90@gmail.com> | 2015-12-17 14:55:41 -0800 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2015-12-18 13:06:08 -0800 |
commit | efff5687c17538781e804af483df7d385e60010d (patch) | |
tree | 1c4975ab6ebb5afc27388ae8f0ab35c1bcc5e2ee | |
parent | f2b1fc1d46a5efe52e8627316cb07db213ae87a2 (diff) | |
download | packages_apps_Settings-efff5687c17538781e804af483df7d385e60010d.zip packages_apps_Settings-efff5687c17538781e804af483df7d385e60010d.tar.gz packages_apps_Settings-efff5687c17538781e804af483df7d385e60010d.tar.bz2 |
Settings : Add warning for lcd density
BACON-4492
Change-Id: I5f5f9d71b29bef61e39029334f62aa1df2ed48dc
-rw-r--r-- | res/values/cm_strings.xml | 1 | ||||
-rw-r--r-- | src/com/android/settings/DisplaySettings.java | 34 |
2 files changed, 29 insertions, 6 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 55721e7..8b99c6a 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -881,4 +881,5 @@ <string name="title_general">General</string> <string name="advanced">Advanced</string> <string name="link_volume_option_title">Link ringtone & notification volumes</string> + <string name="lcd_density_prompt_message">Some apps may not function at non-standard dpi.\n\nThis will restart your phone.</string> </resources> diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java index 9866253..399e1eb 100644 --- a/src/com/android/settings/DisplaySettings.java +++ b/src/com/android/settings/DisplaySettings.java @@ -17,6 +17,9 @@ package com.android.settings; import com.android.internal.logging.MetricsLogger; + +import android.app.AlertDialog; +import android.content.DialogInterface; import android.preference.CheckBoxPreference; import android.os.UserHandle; @@ -679,13 +682,12 @@ public class DisplaySettings extends SettingsPreferenceFragment implements } } if (KEY_LCD_DENSITY.equals(key)) { - try { - int value = Integer.parseInt((String) objValue); - writeLcdDensityPreference(preference.getContext(), value); - updateLcdDensityPreferenceDescription(value); - } catch (NumberFormatException e) { - Log.e(TAG, "could not persist display density setting", e); + String newValue = (String) objValue; + String oldValue = mLcdDensityPreference.getValue(); + if (!TextUtils.equals(newValue, oldValue)) { + showLcdConfirmationDialog((String) objValue); } + return false; } if (KEY_FONT_SIZE.equals(key)) { writeFontSizePreference(objValue); @@ -725,6 +727,26 @@ public class DisplaySettings extends SettingsPreferenceFragment implements return true; } + private void showLcdConfirmationDialog(final String lcdDensity) { + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + builder.setTitle(R.string.lcd_density); + builder.setMessage(R.string.lcd_density_prompt_message); + builder.setPositiveButton(R.string.print_restart, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + try { + int value = Integer.parseInt(lcdDensity); + writeLcdDensityPreference(getActivity(), value); + updateLcdDensityPreferenceDescription(value); + } catch (NumberFormatException e) { + Log.e(TAG, "could not persist display density setting", e); + } + } + }); + builder.setNegativeButton(android.R.string.cancel, null); + builder.show(); + } + @Override public boolean onPreferenceClick(Preference preference) { if (preference == mFontSizePref) { |