本文整理汇总了Java中android.support.v7.preference.PreferenceGroup类的典型用法代码示例。如果您正苦于以下问题:Java PreferenceGroup类的具体用法?Java PreferenceGroup怎么用?Java PreferenceGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PreferenceGroup类属于android.support.v7.preference包,在下文中一共展示了PreferenceGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPreferenceParent
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
protected PreferenceGroup getPreferenceParent(PreferenceGroup prefGroup, Preference pref) {
for (int i = 0; i < prefGroup.getPreferenceCount(); ++i) {
Preference prefChild = prefGroup.getPreference(i);
if (prefChild == pref) {
return prefGroup;
}
if (prefChild instanceof PreferenceGroup) {
PreferenceGroup childGroup = (PreferenceGroup) prefChild;
PreferenceGroup result = getPreferenceParent(childGroup, pref);
if (result != null) {
return result;
}
}
}
return null;
}
示例2: onCreate
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
@DexAppend
@Override
public void onCreate(Bundle icicle) {
try {
PreferenceGroup pg = (PreferenceGroup) findPreference(
FakeSignatureGlobalUI.DEBUG_APPLICATIONS_CATEGORY_KEY);
if (pg != null) {
TwoStatePreference p = createTwoStatePreference(pg.getContext());
p.setKey(FakeSignatureGlobalUI.SETTING_SECURE_KEY);
p.setTitle(FakeSignatureGlobalUI.SETTING_TITLE);
p.setSummary(FakeSignatureGlobalUI.SETTING_SUMMARY);
p.setPersistent(false);
mResetTwoStatePrefsAdd(p);
mAllPrefs.add(p);
//pg.setOrderingAsAdded(true);
pg.addPreference(p);
mAllowFakeSignatureGlobal = p;
} else {
Log.e("DevelopmentSettings_FakeSignatureGlobalUI", "cannot find 'applications' preference category");
}
} catch (Throwable t) {
Log.e("DevelopmentSettings_FakeSignatureGlobalUI", "onCreate exception", t);
}
}
示例3: addEditAccountAction
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
protected void addEditAccountAction(
final IGISApplication application,
final Account account,
PreferenceGroup actionCategory)
{
Preference preferenceEdit = new Preference(mStyledContext);
preferenceEdit.setTitle(R.string.edit_account);
preferenceEdit.setSummary(R.string.edit_account_summary);
String url = application.getAccountUrl(account);
String login = application.getAccountLogin(account);
Intent intent = new Intent(mStyledContext, NGWLoginActivity.class);
intent.putExtra(NGWLoginActivity.FOR_NEW_ACCOUNT, false);
intent.putExtra(NGWLoginActivity.ACCOUNT_URL_TEXT, url);
intent.putExtra(NGWLoginActivity.ACCOUNT_LOGIN_TEXT, login);
intent.putExtra(NGWLoginActivity.CHANGE_ACCOUNT_URL, false);
intent.putExtra(NGWLoginActivity.CHANGE_ACCOUNT_LOGIN, true);
preferenceEdit.setIntent(intent);
actionCategory.addPreference(preferenceEdit);
}
示例4: tintPrefIconsRecursive
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
private void tintPrefIconsRecursive(PreferenceGroup prefGroup, @ColorInt int iconColor) {
if (prefGroup != null) {
int prefCount = prefGroup.getPreferenceCount();
for (int i = 0; i < prefCount; i++) {
Preference pref = prefGroup.getPreference(i);
if (pref != null) {
pref.setIcon(_cu.tintDrawable(pref.getIcon(), iconColor));
if (pref instanceof PreferenceGroup) {
tintPrefIconsRecursive((PreferenceGroup) pref, iconColor);
}
}
}
}
}
示例5: removePreference
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
protected void removePreference(@Nullable Preference preference) {
if (preference == null) {
return;
}
PreferenceGroup parent = getPreferenceParent(getPreferenceScreen(), preference);
if (parent == null) {
return;
}
parent.removePreference(preference);
}
示例6: fillPreferences
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
protected void fillPreferences(PreferenceGroup screen)
{
if (mAction != null && mAction.equals(SettingsConstantsUI.ACTION_ACCOUNT)) {
addPreferencesFromResource(R.xml.preferences_ngid);
fillAccountPreferences(screen);
}
}
示例7: removeAdvancePreference
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
private void removeAdvancePreference(Preference preference) {
// these null checks are to fix a crash due to an NPE on 4.4.4
if (preference != null) {
PreferenceGroup group =
(PreferenceGroup) findPreference("pref_general");
if (group != null) {
group.removePreference(preference);
}
}
}
示例8: initSummary
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
private void initSummary(Preference preference) {
if (preference instanceof PreferenceGroup) {
PreferenceGroup preferenceGroup = (PreferenceGroup) preference;
for (int i = 0; i < preferenceGroup.getPreferenceCount(); i++) {
initSummary(preferenceGroup.getPreference(i));
}
}
else {
updatePreferenceSummary(preference);
}
}
示例9: initPrefsInfos
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
private void initPrefsInfos(Preference pref) {
if (pref instanceof PreferenceGroup) {
PreferenceGroup prefGroup = (PreferenceGroup) pref;
final int currentPreferenceCount = prefGroup.getPreferenceCount();
for (int i = 0; i < currentPreferenceCount; i++) {
initPrefsInfos(prefGroup.getPreference(i));
}
} else {
initClickedListenerIfNeeded(pref);
initFilterIfNeeded(pref);
updatePrefDefaultValue(pref);
updatePrefSummary(pref);
}
}
示例10: onCreatePreferences
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.preference_settings, rootKey);
mPreferenceScreen = (PreferenceScreen) findPreference("preference_screen");
initGeneral();
initUi();
mDevPreferenceGroup = (PreferenceGroup) findPreference("preference_group_dev");
if (!mPrefs.devOptionsOpened().getValue()) {
mPreferenceScreen.removePreference(mDevPreferenceGroup);
} else {
initDevOps();
}
initAbout();
}
示例11: PreferenceGroupAdapter
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
public PreferenceGroupAdapter(PreferenceGroup preferenceGroup) {
super(preferenceGroup);
try {
Field preferenceLayoutsField = android.support.v7.preference.PreferenceGroupAdapter.class.getDeclaredField("mPreferenceLayouts");
preferenceLayoutsField.setAccessible(true);
mPreferenceLayouts = (List) preferenceLayoutsField.get(this);
getReflectionFields();
} catch (Exception e) {
e.printStackTrace();
}
}
示例12: onActivityResult
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
/**
* Traverses a {@code PreferenceGroup} to notify all eligible preferences about the results
* of a returning activity.
*
* @param group The {@code PreferenceGroup} to traverse.
* @param requestCode The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from.
* @param resultCode The integer result code returned by the child activity through its setResult().
* @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
*/
protected void onActivityResult(PreferenceGroup group, int requestCode, int resultCode, Intent data) {
final int n = group.getPreferenceCount();
for (int i = 0; i < n; i++) {
Preference pref = group.getPreference(i);
if (pref instanceof PreferenceActivityResultListener) {
((PreferenceActivityResultListener) pref).onActivityResult(requestCode, resultCode, data);
}
if (pref instanceof PreferenceGroup) {
onActivityResult((PreferenceGroup) pref, requestCode, resultCode, data);
}
}
}
示例13: initSummary
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
private void initSummary(Preference p) {
if (p instanceof PreferenceGroup) {
PreferenceGroup pGrp = (PreferenceGroup) p;
for (int i = 0; i < pGrp.getPreferenceCount(); i++) {
initSummary(pGrp.getPreference(i));
}
} else {
updatePrefSummary(p);
}
}
示例14: initSummary
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
private void initSummary(Preference preference) {
if (preference instanceof PreferenceGroup) {
PreferenceGroup group = (PreferenceGroup) preference;
for (int i = 0; i < group.getPreferenceCount(); i++) {
initSummary(group.getPreference(i));
}
} else {
updatePrefSummary(preference);
}
}
示例15: fillPreferences
import android.support.v7.preference.PreferenceGroup; //导入依赖的package包/类
protected void fillPreferences(PreferenceGroup screen)
{
if (mAction != null && mAction.equals(SettingsConstantsUI.ACTION_ACCOUNT)) {
Account account = getArguments().getParcelable(NGWSettingsActivity.KEY_ACCOUNT);
fillAccountPreferences(screen, account);
}
}