当前位置: 首页>>代码示例>>Java>>正文


Java PreferenceCategory类代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:22,代码来源:SoundSettings.java

示例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);
        }
    });
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:24,代码来源:SoundSettings.java

示例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");
}
 
开发者ID:SapuSeven,项目名称:NotiCap,代码行数:18,代码来源:SettingsActivity.java

示例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);
            }
        }
    }
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:18,代码来源:SettingsFragment.java

示例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());
    }
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:21,代码来源:PreferencesFragment.java

示例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;
        }
    });
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:23,代码来源:PreferencesFragment.java

示例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;
}
 
开发者ID:Nxt3,项目名称:IO_Classic_WatchFace,代码行数:25,代码来源:SettingsFragment.java

示例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;
}
 
开发者ID:iebb,项目名称:Kasumi,代码行数:21,代码来源:AppPreferences.java

示例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);
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-AndroidApplication,代码行数:27,代码来源:SettingsActivity.java

示例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));
    }
}
 
开发者ID:monthlypub,项目名称:SmingZZick_App,代码行数:19,代码来源:SmingSettingFragment.java

示例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"));
}
 
开发者ID:eduyayo,项目名称:gamesboard,代码行数:30,代码来源:SettingsActivity.java

示例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);
}
 
开发者ID:DroidThug,项目名称:VulcanOTA,代码行数:18,代码来源:SlimOTAFragment.java

示例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);
	}

}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:18,代码来源:SettingsFragment.java

示例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);
}
 
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:19,代码来源:SettingsActivity.java

示例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();
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:17,代码来源:NWPreferences.java


注:本文中的android.preference.PreferenceCategory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。