本文整理汇总了Java中android.support.v7.preference.PreferenceGroup.getPreference方法的典型用法代码示例。如果您正苦于以下问题:Java PreferenceGroup.getPreference方法的具体用法?Java PreferenceGroup.getPreference怎么用?Java PreferenceGroup.getPreference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.preference.PreferenceGroup
的用法示例。
在下文中一共展示了PreferenceGroup.getPreference方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
}
}
}
}
示例3: 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);
}
}
}
示例4: initPreferenceScreen
import android.support.v7.preference.PreferenceGroup; //导入方法依赖的package包/类
private void initPreferenceScreen(PreferenceGroup screen, SharedPreferences sharedPreferences) {
final int count = screen.getPreferenceCount();
for (int i = 0; i < count; i++) {
Preference preference = screen.getPreference(i);
if (preference instanceof PreferenceGroup) {
initPreferenceScreen((PreferenceGroup) preference, sharedPreferences);
} else {
handlePreferenceChange(preference, sharedPreferences, preference.getKey());
}
}
}