Search in sources :

Example 6 with PreferenceGroupAdapter

use of android.support.v7.preference.PreferenceGroupAdapter in project android_packages_apps_Settings by crdroidandroid.

the class SettingsPreferenceFragment method canUseListViewForHighLighting.

/**
 * Return a valid ListView position or -1 if none is found
 */
private int canUseListViewForHighLighting(String key) {
    if (getListView() == null) {
        return -1;
    }
    RecyclerView listView = getListView();
    RecyclerView.Adapter adapter = listView.getAdapter();
    if (adapter != null && adapter instanceof PreferenceGroupAdapter) {
        return findListPositionFromKey((PreferenceGroupAdapter) adapter, key);
    }
    return -1;
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) PreferenceGroupAdapter(android.support.v7.preference.PreferenceGroupAdapter)

Example 7 with PreferenceGroupAdapter

use of android.support.v7.preference.PreferenceGroupAdapter in project android_packages_apps_Settings by crdroidandroid.

the class SettingsPreferenceFragment method findListPositionFromKey.

private int findListPositionFromKey(PreferenceGroupAdapter adapter, String key) {
    final int count = adapter.getItemCount();
    for (int n = 0; n < count; n++) {
        final Preference preference = adapter.getItem(n);
        final String preferenceKey = preference.getKey();
        if (preferenceKey != null && preferenceKey.equals(key)) {
            return n;
        }
    }
    return -1;
}
Also used : CustomEditTextPreference(com.android.settingslib.CustomEditTextPreference) LayoutPreference(com.android.settings.applications.LayoutPreference) CustomDialogPreference(com.android.settingslib.CustomDialogPreference) Preference(android.support.v7.preference.Preference)

Example 8 with PreferenceGroupAdapter

use of android.support.v7.preference.PreferenceGroupAdapter in project android_packages_apps_Settings by SudaMod.

the class SettingsPreferenceFragment method canUseListViewForHighLighting.

/**
 * Return a valid ListView position or -1 if none is found
 */
private int canUseListViewForHighLighting(String key) {
    if (getListView() == null) {
        return -1;
    }
    RecyclerView listView = getListView();
    RecyclerView.Adapter adapter = listView.getAdapter();
    if (adapter != null && adapter instanceof PreferenceGroupAdapter) {
        return findListPositionFromKey((PreferenceGroupAdapter) adapter, key);
    }
    return -1;
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) PreferenceGroupAdapter(android.support.v7.preference.PreferenceGroupAdapter)

Example 9 with PreferenceGroupAdapter

use of android.support.v7.preference.PreferenceGroupAdapter in project android_packages_apps_Settings by SudaMod.

the class SettingsPreferenceFragment method findListPositionFromKey.

private int findListPositionFromKey(PreferenceGroupAdapter adapter, String key) {
    final int count = adapter.getItemCount();
    for (int n = 0; n < count; n++) {
        final Preference preference = adapter.getItem(n);
        final String preferenceKey = preference.getKey();
        if (preferenceKey != null && preferenceKey.equals(key)) {
            return n;
        }
    }
    return -1;
}
Also used : CustomEditTextPreference(com.android.settingslib.CustomEditTextPreference) LayoutPreference(com.android.settings.applications.LayoutPreference) CustomDialogPreference(com.android.settingslib.CustomDialogPreference) Preference(android.support.v7.preference.Preference)

Example 10 with PreferenceGroupAdapter

use of android.support.v7.preference.PreferenceGroupAdapter in project android_packages_apps_CMParts by LineageOS.

the class SettingsPreferenceFragment method canUseListViewForHighLighting.

/**
 * Return a valid ListView position or -1 if none is found
 */
private int canUseListViewForHighLighting(String key) {
    if (getListView() == null) {
        return -1;
    }
    RecyclerView listView = getListView();
    RecyclerView.Adapter adapter = listView.getAdapter();
    if (adapter != null && adapter instanceof PreferenceGroupAdapter) {
        return findListPositionFromKey((PreferenceGroupAdapter) adapter, key);
    }
    return -1;
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) PreferenceGroupAdapter(android.support.v7.preference.PreferenceGroupAdapter)

Aggregations

Preference (android.support.v7.preference.Preference)14 PreferenceGroupAdapter (android.support.v7.preference.PreferenceGroupAdapter)14 RecyclerView (android.support.v7.widget.RecyclerView)11 Intent (android.content.Intent)9 LayoutPreference (com.android.settings.applications.LayoutPreference)7 Bundle (android.os.Bundle)6 SmallTest (android.support.test.filters.SmallTest)6 AccessibilitySettings (com.android.settings.accessibility.AccessibilitySettings)6 CustomDialogPreference (com.android.settingslib.CustomDialogPreference)6 CustomEditTextPreference (com.android.settingslib.CustomEditTextPreference)6 Test (org.junit.Test)6 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3 PreferencesActivity (io.github.hidroh.materialistic.PreferencesActivity)3 Before (org.junit.Before)3 CustomDialogPreference (org.cyanogenmod.cmparts.widget.CustomDialogPreference)1 LayoutPreference (org.cyanogenmod.cmparts.widget.LayoutPreference)1