本文整理匯總了Java中android.preference.PreferenceCategory類的典型用法代碼示例。如果您正苦於以下問題:Java PreferenceCategory類的具體用法?Java PreferenceCategory怎麽用?Java PreferenceCategory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PreferenceCategory類屬於android.preference包,在下文中一共展示了PreferenceCategory類的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: onCreate
import android.preference.PreferenceCategory; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_identities);
setHasOptionsMenu(true);
findPreference("add_identity").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent i = new Intent(getActivity(), AddSSHIdentityActivity.class);
startActivity(i);
return true;
}
});
listCategory = (PreferenceCategory) findPreference("list_identities");
}
示例4: 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);
}
}
}
}
示例5: 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());
}
}
示例6: 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;
}
});
}
示例7: getPreferenceList
import android.preference.PreferenceCategory; //導入依賴的package包/類
/**
* Gets the list of preferences in a PreferenceScreen
*
* @param p preference to add to the list
* @param list of preferences in the PreferenceScreen
* @return a list of all the preferences
*/
private ArrayList<Preference> getPreferenceList(Preference p, ArrayList<Preference> list) {
if (p instanceof PreferenceCategory || p instanceof PreferenceScreen) {
PreferenceGroup prefGroup = (PreferenceGroup) p;
final int prefCount = prefGroup.getPreferenceCount();
for (int i = 0; i < prefCount; i++) {
getPreferenceList(prefGroup.getPreference(i), list);
}
}
if (!(p instanceof PreferenceCategory)) {
list.add(p);
}
return list;
}
示例8: addCheckBox
import android.preference.PreferenceCategory; //導入依賴的package包/類
private CheckBoxPreference addCheckBox(String title, PreferenceCategory category, String key, Drawable icon, String onText, String offText, boolean defaultValue, Context context) {
CheckBoxPreference c = new CheckBoxPreference(context);
c.setTitle(title);
c.setKey(key);
if (null != icon) c.setIcon(icon);
if (offText.equals(null) || onText.equals(null)) {
if (offText.equals(null)) {
c.setSummary(onText);
} else if (onText.equals(null)) {
c.setSummary(offText);
}
} else {
c.setSummaryOn(onText);
c.setSummaryOff(offText);
}
c.setDefaultValue(defaultValue);
c.setChecked(KRFAM.sharedPreferences.getBoolean(key, defaultValue));
category.addPreference(c);
return c;
}
示例9: onCreate
import android.preference.PreferenceCategory; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_wireless_socket);
setHasOptionsMenu(true);
PreferenceScreen preferenceScreen = this.getPreferenceScreen();
PreferenceCategory preferenceCategory = new PreferenceCategory(preferenceScreen.getContext());
preferenceCategory.setTitle("Wireless sockets");
preferenceScreen.addPreference(preferenceCategory);
for (int index = 0; index < WirelessSocketService.getInstance().GetDataList().getSize(); index++) {
WirelessSocket wirelessSocket = WirelessSocketService.getInstance().GetDataList().getValue(index);
SwitchPreference preference = new SwitchPreference(preferenceScreen.getContext());
preference.setTitle(wirelessSocket.GetName());
preference.setKey(wirelessSocket.GetSettingsKey());
preference.setDefaultValue(false);
preferenceCategory.addPreference(preference);
bindPreferenceSummaryToValue(preference);
}
}
示例10: 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));
}
}
示例11: setupSimplePreferencesScreen
import android.preference.PreferenceCategory; //導入依賴的package包/類
/**
* Shows the simplified settings UI if the device configuration if the
* device configuration dictates that a simplified, single-pane UI should be
* shown.
*/
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}
// In the simplified UI, fragments are not used at all and we instead
// use the older PreferenceActivity APIs.
// Add 'general' preferences.
addPreferencesFromResource(R.xml.pref_general);
// Add 'notifications' preferences, and a corresponding header.
PreferenceCategory fakeHeader = new PreferenceCategory(this);
fakeHeader.setTitle(R.string.pref_header_notifications);
getPreferenceScreen().addPreference(fakeHeader);
addPreferencesFromResource(R.xml.pref_notification);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences to
// their values. When their values change, their summaries are updated
// to reflect the new value, per the Android Design guidelines.
bindPreferenceSummaryToValue(findPreference("display_name"));
bindPreferenceSummaryToValue(findPreference("display_image"));
bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
}
示例12: onCreate
import android.preference.PreferenceCategory; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
addPreferencesFromResource(R.xml.ota);
mRomInfo = (PreferenceScreen) getPreferenceScreen().findPreference(KEY_ROM_INFO);
mCheckUpdate = (PreferenceScreen) getPreferenceScreen().findPreference(KEY_CHECK_UPDATE);
mUpdateInterval = (ListPreference) getPreferenceScreen().findPreference(KEY_UPDATE_INTERVAL);
if (mUpdateInterval != null) {
mUpdateInterval.setOnPreferenceChangeListener(this);
}
mLinksCategory = (PreferenceCategory) getPreferenceScreen().findPreference(CATEGORY_LINKS);
}
示例13: 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);
}
}
示例14: onCreate
import android.preference.PreferenceCategory; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
PreferenceCategory category = new PreferenceCategory(getActivity());
category.setTitle("Libraries");
screen.addPreference(category);
CheckBoxPreference checkBoxPref = new CheckBoxPreference(getActivity());
checkBoxPref.setTitle("title");
checkBoxPref.setSummary("summary");
checkBoxPref.setChecked(true);
category.addPreference(checkBoxPref);
setPreferenceScreen(screen);
}
示例15: onCreate
import android.preference.PreferenceCategory; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
mPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
screen = (PreferenceScreen) findPreference("preferenceScreen");
category = (PreferenceCategory) findPreference("collection_category");
collectionMethod = findPreference("dex_collection_method");
showBridgeBattery = findPreference("showBridgeBattery");
watchcategory = (PreferenceCategory) findPreference("category");
bindPreferenceSummaryToValue(collectionMethod);
listenForChangeInSettings();
setCollectionPrefs();
}