diff options
-rw-r--r-- | res/drawable/regulatory_info.png | bin | 0 -> 159 bytes | |||
-rwxr-xr-x | res/layout/regulatory_info.xml | 19 | ||||
-rw-r--r-- | res/values/bools.xml | 3 | ||||
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | res/xml/device_info_settings.xml | 6 | ||||
-rw-r--r-- | src/com/android/settings/DeviceInfoSettings.java | 21 | ||||
-rw-r--r-- | src/com/android/settings/RegulatoryInfoFragment.java | 39 |
7 files changed, 82 insertions, 8 deletions
diff --git a/res/drawable/regulatory_info.png b/res/drawable/regulatory_info.png Binary files differnew file mode 100644 index 0000000..65de26c --- /dev/null +++ b/res/drawable/regulatory_info.png diff --git a/res/layout/regulatory_info.xml b/res/layout/regulatory_info.xml new file mode 100755 index 0000000..e4999a4 --- /dev/null +++ b/res/layout/regulatory_info.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<ImageView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:src="@drawable/regulatory_info"/> diff --git a/res/values/bools.xml b/res/values/bools.xml index 23bdf0d..ba402e5 100644 --- a/res/values/bools.xml +++ b/res/values/bools.xml @@ -32,4 +32,7 @@ <!-- Whether User management screen is available --> <bool name="enable_user_management">false</bool> + + <!-- Whether to show a preference item for regulatory information in About phone --> + <bool name="config_show_regulatory_info">false</bool> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 233963c..e08cdeb 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2237,6 +2237,8 @@ <string name="legal_information">Legal information</string> <!-- About phone settings screen, setting option name to see a list of contributors --> <string name="contributors_title">Contributors</string> + <!-- About phone settings screen, setting option name to show regulatory information [CHAR LIMIT=25] --> + <string name="regulatory_information">Regulatory information</string> <!-- Note: this may be replaced by a more-specific title of the activity that will get launched --> <skip /> <!-- About phone settings screen, setting option name to see copyright-related info --> <string name="copyright_title">Copyright</string> diff --git a/res/xml/device_info_settings.xml b/res/xml/device_info_settings.xml index 324deaa..4fabc9d 100644 --- a/res/xml/device_info_settings.xml +++ b/res/xml/device_info_settings.xml @@ -89,6 +89,10 @@ </PreferenceScreen> --> + <Preference android:key="regulatory_info" + android:title="@string/regulatory_information" + android:fragment="com.android.settings.RegulatoryInfoFragment"/> + <!-- Device hardware model --> <Preference android:key="device_model" style="?android:preferenceInformationStyle" @@ -106,7 +110,7 @@ style="?android:preferenceInformationStyle" android:title="@string/fcc_equipment_id" android:summary="@string/device_info_default"/> - + <!-- Device Baseband version --> <Preference android:key="baseband_version" style="?android:preferenceInformationStyle" 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); diff --git a/src/com/android/settings/RegulatoryInfoFragment.java b/src/com/android/settings/RegulatoryInfoFragment.java new file mode 100644 index 0000000..7ee13bf --- /dev/null +++ b/src/com/android/settings/RegulatoryInfoFragment.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings; + +import android.app.DialogFragment; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.android.settings.R; + +/** + * {@link DialogFragment} that displays regulatory information. + * "About phone" will show a preference that displays this fragment when + * clicked if R.bool.config_show_regulatory_info is true. + */ +public class RegulatoryInfoFragment extends DialogFragment { + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + return inflater.inflate(R.layout.regulatory_info, container, false); + } +} |