本文整理匯總了Java中android.preference.PreferenceCategory.removePreference方法的典型用法代碼示例。如果您正苦於以下問題:Java PreferenceCategory.removePreference方法的具體用法?Java PreferenceCategory.removePreference怎麽用?Java PreferenceCategory.removePreference使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.preference.PreferenceCategory
的用法示例。
在下文中一共展示了PreferenceCategory.removePreference方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initIncreasingRing
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
private void initIncreasingRing(PreferenceCategory root) {
mIncreasingRing = (TwoStatePreference)
root.findPreference(CMSettings.System.INCREASING_RING);
mIncreasingRingVolume = (IncreasingRingVolumePreference)
root.findPreference(KEY_INCREASING_RING_VOLUME);
if (!mVoiceCapable) {
if (mIncreasingRing != null) {
root.removePreference(mIncreasingRing);
mIncreasingRing = null;
}
if (mIncreasingRingVolume != null) {
root.removePreference(mIncreasingRingVolume);
mIncreasingRingVolume = null;
}
} else {
if (mIncreasingRingVolume != null) {
mIncreasingRingVolume.setCallback(mIncreasingRingVolumeCallback);
}
}
}
示例2: initVibrateWhenRinging
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
private void initVibrateWhenRinging(PreferenceCategory root) {
mVibrateWhenRinging = (TwoStatePreference) root.findPreference(KEY_VIBRATE_WHEN_RINGING);
if (mVibrateWhenRinging == null) {
Log.i(TAG, "Preference not found: " + KEY_VIBRATE_WHEN_RINGING);
return;
}
if (!mVoiceCapable || !Utils.isUserOwner()) {
root.removePreference(mVibrateWhenRinging);
mVibrateWhenRinging = null;
return;
}
mVibrateWhenRinging.setPersistent(false);
updateVibrateWhenRinging();
mVibrateWhenRinging.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final boolean val = (Boolean) newValue;
return Settings.System.putInt(getContentResolver(),
Settings.System.VIBRATE_WHEN_RINGING,
val ? 1 : 0);
}
});
}
示例3: setupGaplessControlSettingsV14
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
private void setupGaplessControlSettingsV14() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
PreferenceCategory playbackControlSettings =
(PreferenceCategory) findPreference(Constants.PREFERENCES_KEY_PLAYBACK_CONTROL_SETTINGS);
CheckBoxPreference gaplessPlaybackEnabled =
(CheckBoxPreference) findPreference(Constants.PREFERENCES_KEY_GAPLESS_PLAYBACK);
if (gaplessPlaybackEnabled != null) {
gaplessPlaybackEnabled.setChecked(false);
gaplessPlaybackEnabled.setEnabled(false);
if (playbackControlSettings != null) {
playbackControlSettings.removePreference(gaplessPlaybackEnabled);
}
}
}
}
示例4: onCreate
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
useTorCheckPref = (CheckBoxPreference) findPreference(Preferences.PREF_USE_TOR);
enableProxyCheckPref = (CheckBoxPreference) findPreference(Preferences.PREF_ENABLE_PROXY);
updateAutoDownloadPref = findPreference(Preferences.PREF_AUTO_DOWNLOAD_INSTALL_UPDATES);
updatePrivilegedExtensionPref = findPreference(Preferences.PREF_UNINSTALL_PRIVILEGED_APP);
AppCompatListPreference languagePref = (AppCompatListPreference) findPreference(Preferences.PREF_LANGUAGE);
if (Build.VERSION.SDK_INT >= 24) {
PreferenceCategory category = (PreferenceCategory) findPreference("pref_category_display");
category.removePreference(languagePref);
} else {
Languages languages = Languages.get(getActivity());
languagePref.setDefaultValue(Languages.USE_SYSTEM_DEFAULT);
languagePref.setEntries(languages.getAllNames());
languagePref.setEntryValues(languages.getSupportedLocales());
}
}
示例5: initUpdatePrivilegedExtensionPreference
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
private void initUpdatePrivilegedExtensionPreference() {
if (Build.VERSION.SDK_INT > 19) {
// this will never work on newer Android versions, so hide it
PreferenceCategory other = (PreferenceCategory) findPreference("pref_category_other");
other.removePreference(updatePrivilegedExtensionPref);
return;
}
updatePrivilegedExtensionPref.setPersistent(false);
updatePrivilegedExtensionPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
// Open details of F-Droid Privileged
Intent intent = new Intent(getActivity(), AppDetails2.class);
intent.putExtra(AppDetails2.EXTRA_APPID,
PrivilegedInstaller.PRIVILEGED_EXTENSION_PACKAGE_NAME);
startActivity(intent);
return true;
}
});
}
示例6: onCreate
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
handler = new Handler();
getPreferenceManager().setSharedPreferencesName(com.monpub.sming.etc.Preference.NAME);
getPreferenceManager().setSharedPreferencesMode(Context.MODE_PRIVATE);
addPreferencesFromResource(R.xml.pref_sming);
preferenceCategory = (PreferenceCategory) findPreference("prefCategorySave");
preferenceStaticDisabled = findPreference("prefStaticDisabled");
if (Build.VERSION.SDK_INT < 21) {
preferenceCategory.removePreference(findPreference(SmingManager.PREF_KEY_SAVE_SCREENSHOT));
}
}
示例7: onCreate
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.preferences);
// Remove from standard preferences if the flag ONLY_INTERNAL_STORAGE is not true
if (!Config.ONLY_INTERNAL_STORAGE) {
PreferenceCategory mCategory = (PreferenceCategory) findPreference("security_options");
Preference mPref1 = findPreference("clean_cache");
Preference mPref2 = findPreference("clean_private_storage");
mCategory.removePreference(mPref1);
mCategory.removePreference(mPref2);
}
}
示例8: initBasicPart
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
private void initBasicPart(SharedPreferences sharedPreferences) {
// back to top.
MysplashListPreference backToTop = (MysplashListPreference) findPreference(getString(R.string.key_back_to_top));
String backToTopValue = sharedPreferences.getString(getString(R.string.key_back_to_top), "all");
String backToTopName = ValueUtils.getBackToTopName(getActivity(), backToTopValue);
backToTop.setSummary(getString(R.string.now) + " : " + backToTopName);
backToTop.setOnPreferenceChangeListener(this);
// language.
MysplashListPreference language = (MysplashListPreference) findPreference(getString(R.string.key_language));
String languageValue = sharedPreferences.getString(getString(R.string.key_language), "follow_system");
String languageName = ValueUtils.getLanguageName(getActivity(), languageValue);
language.setSummary(getString(R.string.now) + " : " + languageName);
language.setOnPreferenceChangeListener(this);
// Muzei.
MysplashPreference muzei = (MysplashPreference) findPreference("muzei_settings");
if (!MuzeiOptionManager.isInstalledMuzei(getActivity())) {
PreferenceCategory display = (PreferenceCategory) findPreference("basic");
display.removePreference(muzei);
}
}
示例9: initDisplayPart
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
private void initDisplayPart(SharedPreferences sharedPreferences) {
// saturation animation duration.
MysplashListPreference duration = (MysplashListPreference) findPreference(getString(R.string.key_saturation_animation_duration));
String durationValue = sharedPreferences.getString(getString(R.string.key_saturation_animation_duration), "2000");
String durationName = ValueUtils.getSaturationAnimationDurationName(getActivity(), durationValue);
duration.setSummary(getString(R.string.now) + " : " + durationName);
duration.setOnPreferenceChangeListener(this);
// grid list in port.
MysplashSwitchPreference gridPort = (MysplashSwitchPreference) findPreference(getString(R.string.key_grid_list_in_port));
gridPort.setOnPreferenceChangeListener(this);
if (!DisplayUtils.isTabletDevice(getActivity())) {
PreferenceCategory display = (PreferenceCategory) findPreference("display");
display.removePreference(gridPort);
}
// grid list in land.
MysplashSwitchPreference gridLand = (MysplashSwitchPreference) findPreference(getString(R.string.key_grid_list_in_land));
gridLand.setOnPreferenceChangeListener(this);
}
示例10: onCreate
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Accountant.getInstance(getActivity());
getActivity().setTitle(getString(R.string.media_settings));
addPreferencesFromResource(R.xml.media_preferences);
// Check whether to show the notification-ringer volume link setting.
AudioManager manager = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
RingerNotificationLink linkChecker = new RingerNotificationLink();
boolean isNotifRingLinked = linkChecker.apply(manager);
Preference link = findPreference("VolumePanel_linkNotifRinger");
link.setEnabled(!isNotifRingLinked);
if (isNotifRingLinked) {
PreferenceCategory category = (PreferenceCategory) findPreference("AudioMedia");
category.removePreference(link);
}
}
示例11: onCreate
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
Bundle args = getArguments();
if (!args.getBoolean(ARG_HILLSHADES_AVAILABLE, false)) {
PreferenceCategory category = (PreferenceCategory) findPreference("category_advanced");
Preference hillshadePref = findPreference("hillshades_transparency");
category.removePreference(hillshadePref);
}
Preference resetPref = findPreference("reset_advices");
resetPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
mFragmentHolder.popCurrent();
return false;
}
});
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
示例12: onCreate
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
//remove priority preference (not supported)
PreferenceCategory notificationCategory =
(PreferenceCategory) findPreference("pref_category_notification");
ListPreference priorityPreference =
(ListPreference) findPreference("pref_notification_priority");
notificationCategory.removePreference(priorityPreference);
}
}
示例13: onReceive
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
@Override
public void onReceive(Context context, Intent intent) {
final String packageName = intent.getStringExtra(OpenFitIntent.EXTRA_PACKAGE_NAME);
final String appName = intent.getStringExtra(OpenFitIntent.EXTRA_APP_NAME);
Log.d(LOG_TAG, "Recieved del application: "+appName+" : "+packageName);
appManager.delNotificationApp(packageName);
oPrefs.removeSet(packageName);
oPrefs.removeString(packageName);
PreferenceCategory category = (PreferenceCategory) findPreference("preference_category_apps");
Preference app = (Preference) findPreference(packageName);
category.removePreference(app);
// If no more preference in the category, restore the placeholder
if(category.getPreferenceCount() <= 0) {
category.addPreference(preference_apps_placeholder);
}
sendNotificationApplications();
}
示例14: initRingtones
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
private void initRingtones(PreferenceCategory root) {
DefaultRingtonePreference phoneRingtonePreference =
(DefaultRingtonePreference) root.findPreference(KEY_PHONE_RINGTONE);
if (mPhoneRingtonePreferences != null && !mVoiceCapable || !Utils.isUserOwner()) {
root.removePreference(phoneRingtonePreference);
mPhoneRingtonePreferences = null;
} else {
mPhoneRingtonePreferences = new ArrayList<DefaultRingtonePreference>();
TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(
Context.TELEPHONY_SERVICE);
if (telephonyManager.isMultiSimEnabled()){
root.removePreference(phoneRingtonePreference);
PreferenceCategory soundCategory = (PreferenceCategory) findPreference(KEY_SOUND);
for (int i = 0; i < TelephonyManager.getDefault().getSimCount(); i++) {
DefaultRingtonePreference ringtonePreference =
new DefaultRingtonePreference(mContext, null);
String title = getString(R.string.sim_ringtone_title, i + 1);
ringtonePreference.setTitle(title);
ringtonePreference.setSubId(i);
ringtonePreference.setOrder(0);
ringtonePreference.setRingtoneType(RingtoneManager.TYPE_RINGTONE);
soundCategory.addPreference(ringtonePreference);
mPhoneRingtonePreferences.add(ringtonePreference);
}
} else {
mPhoneRingtonePreferences.add(phoneRingtonePreference);
}
}
mNotificationRingtonePreference = root.findPreference(KEY_NOTIFICATION_RINGTONE);
}
示例15: onCreate
import android.preference.PreferenceCategory; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.about);
String flavor = BuildConfig.FLAVOR + "Images";
PreferenceCategory parent = (PreferenceCategory) findPreference("aboutDataSources");
for (String string : sImagePrefKeys) {
if (!string.equals(flavor)) {
Preference pref = findPreference(string);
parent.removePreference(pref);
}
}
}