summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/DeviceInfoSettings.java
diff options
context:
space:
mode:
authorBrian Muramatsu <btmura@google.com>2012-09-17 23:09:35 -0700
committerBrian Muramatsu <btmura@google.com>2012-09-18 11:46:35 -0700
commita6dbaea2dacaaef7c91f89aae8d5f1ed7580b893 (patch)
treef592d5156743263014dad2eeec1850b005911693 /src/com/android/settings/DeviceInfoSettings.java
parent64c6ee20bae6cbf868ec4a0a3ffc7ce6fd10bdd6 (diff)
downloadpackages_apps_Settings-a6dbaea2dacaaef7c91f89aae8d5f1ed7580b893.zip
packages_apps_Settings-a6dbaea2dacaaef7c91f89aae8d5f1ed7580b893.tar.gz
packages_apps_Settings-a6dbaea2dacaaef7c91f89aae8d5f1ed7580b893.tar.bz2
Add optional regulatory info page
Bug 7081675 If R.bools.config_show_regulatory_info is true, then show a "Regulatory information" item on the "About phone" page. Show a DialogFragment displaying the regulatory_info drawable if the item is clicked. Add a 1x1 blank regulatory_info drawable for devices that won't show this. Change-Id: I5823d8969de038becf4911dce893dab5dbb23537
Diffstat (limited to 'src/com/android/settings/DeviceInfoSettings.java')
-rw-r--r--src/com/android/settings/DeviceInfoSettings.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 8254233..258ea64 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -49,6 +49,7 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
private static final String KEY_CONTAINER = "container";
private static final String KEY_TEAM = "team";
private static final String KEY_CONTRIBUTORS = "contributors";
+ private static final String KEY_REGULATORY_INFO = "regulatory_info";
private static final String KEY_TERMS = "terms";
private static final String KEY_LICENSE = "license";
private static final String KEY_COPYRIGHT = "copyright";
@@ -132,11 +133,12 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
// Read platform settings for additional system update setting
- boolean isUpdateSettingAvailable =
- getResources().getBoolean(R.bool.config_additional_system_update_setting_enable);
- if (isUpdateSettingAvailable == false) {
- getPreferenceScreen().removePreference(findPreference(KEY_UPDATE_SETTING));
- }
+ removePreferenceIfBoolFalse(KEY_UPDATE_SETTING,
+ R.bool.config_additional_system_update_setting_enable);
+
+ // Remove regulatory information if not enabled.
+ removePreferenceIfBoolFalse(KEY_REGULATORY_INFO,
+ R.bool.config_show_regulatory_info);
}
@Override
@@ -160,8 +162,7 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
private void removePreferenceIfPropertyMissing(PreferenceGroup preferenceGroup,
String preference, String property ) {
- if (SystemProperties.get(property).equals(""))
- {
+ if (SystemProperties.get(property).equals("")) {
// Property is missing so remove preference from group
try {
preferenceGroup.removePreference(findPreference(preference));
@@ -172,6 +173,12 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
}
}
+ private void removePreferenceIfBoolFalse(String preference, int resId) {
+ if (!getResources().getBoolean(resId)) {
+ getPreferenceScreen().removePreference(findPreference(preference));
+ }
+ }
+
private void setStringSummary(String preference, String value) {
try {
findPreference(preference).setSummary(value);