Merge "Add optional regulatory info page" into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a6c1b346ae
@@ -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);
|
||||
|
39
src/com/android/settings/RegulatoryInfoFragment.java
Normal file
39
src/com/android/settings/RegulatoryInfoFragment.java
Normal file
@@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user