Conditionally remove settings that aren't required on the tablet.

Bug: 2985267

Changes not done : SD card related stuff, as we need some way still
to figure out if there is a real SD card in the device.

Change-Id: I21c41f18ebe6c050981918481a7f6d69f04b65d0
This commit is contained in:
Amith Yamasani
2010-09-11 14:17:31 -07:00
parent cc0e4db618
commit 60133dd036
7 changed files with 68 additions and 39 deletions

View File

@@ -18,7 +18,6 @@ package com.android.settings;
import android.app.Activity;
import android.app.Fragment;
import android.app.Fragment.InstantiationException;
import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
@@ -130,17 +129,12 @@ public class Settings extends Activity
}
private boolean showFragment(String fragmentClass, Bundle extras) {
try {
Fragment f = Fragment.instantiate(this, fragmentClass, extras);
if (f instanceof SettingsPreferenceFragment) {
((SettingsPreferenceFragment) f).setOnStateListener(this);
}
getFragmentManager().openTransaction().replace(R.id.prefs, f).commit();
return true;
} catch (InstantiationException exc) {
Log.d(TAG, "Couldn't instantiate fragment " + fragmentClass);
return false;
Fragment f = Fragment.instantiate(this, fragmentClass, extras);
if (f instanceof SettingsPreferenceFragment) {
((SettingsPreferenceFragment) f).setOnStateListener(this);
}
getFragmentManager().openTransaction().replace(R.id.prefs, f).commit();
return true;
}
private void addToBreadCrumbs(Fragment fragment) {
@@ -209,9 +203,6 @@ public class Settings extends Activity
PreferenceGroup parent = (PreferenceGroup) findPreference(KEY_PARENT);
Utils.updatePreferenceToSpecificActivityOrRemove(activity, parent,
KEY_SYNC_SETTINGS, 0);
Utils.updatePreferenceToSpecificActivityOrRemove(activity, parent,
KEY_SEARCH_SETTINGS, 0);
Preference dockSettings = parent.findPreference(KEY_DOCK_SETTINGS);
if (activity.getResources().getBoolean(R.bool.has_dock_settings) == false
&& dockSettings != null) {
@@ -222,6 +213,11 @@ public class Settings extends Activity
KEY_OPERATOR_SETTINGS);
Utils.updatePreferenceToSpecificActivityFromMetaDataOrRemove(activity, parent,
KEY_MANUFACTURER_SETTINGS);
Preference callSettings = parent.findPreference(KEY_CALL_SETTINGS);
if (!Utils.isVoiceCapable(activity) && callSettings != null) {
parent.removePreference(callSettings);
}
}
@Override