use of android.support.v7.preference.PreferenceGroupAdapter in project materialistic by hidroh.
the class FontPreferenceTest method setUp.
@Before
public void setUp() {
controller = Robolectric.buildActivity(PreferencesActivity.class);
activity = controller.withIntent(new Intent().putExtra(PreferencesActivity.EXTRA_TITLE, R.string.display).putExtra(PreferencesActivity.EXTRA_PREFERENCES, R.xml.preferences_display)).create().postCreate(null).start().resume().visible().get();
RecyclerView list = (RecyclerView) activity.findViewById(R.id.list);
list.setLayoutManager(new LinearLayoutManager(activity));
RecyclerView.Adapter adapter = list.getAdapter();
int position = ShadowSupportPreferenceManager.getPreferencePosition((PreferenceGroupAdapter) adapter, FontPreference.class);
RecyclerView.ViewHolder holder = CustomShadows.customShadowOf(adapter).getViewHolder(position);
preferenceView = holder.itemView;
}
use of android.support.v7.preference.PreferenceGroupAdapter in project materialistic by hidroh.
the class FontSizePreferenceTest method setUp.
@Before
public void setUp() {
controller = Robolectric.buildActivity(PreferencesActivity.class);
activity = controller.withIntent(new Intent().putExtra(PreferencesActivity.EXTRA_TITLE, R.string.display).putExtra(PreferencesActivity.EXTRA_PREFERENCES, R.xml.preferences_display)).create().postCreate(null).start().resume().visible().get();
RecyclerView list = (RecyclerView) activity.findViewById(R.id.list);
list.setLayoutManager(new LinearLayoutManager(activity));
RecyclerView.Adapter adapter = list.getAdapter();
int position = ShadowSupportPreferenceManager.getPreferencePosition((PreferenceGroupAdapter) adapter, FontSizePreference.class);
RecyclerView.ViewHolder holder = CustomShadows.customShadowOf(adapter).getViewHolder(position);
preferenceView = holder.itemView;
}
use of android.support.v7.preference.PreferenceGroupAdapter in project materialistic by hidroh.
the class ThemePreferenceTest method setUp.
@Before
public void setUp() {
controller = Robolectric.buildActivity(PreferencesActivity.class);
activity = controller.withIntent(new Intent().putExtra(PreferencesActivity.EXTRA_TITLE, R.string.display).putExtra(PreferencesActivity.EXTRA_PREFERENCES, R.xml.preferences_display)).create().postCreate(null).start().resume().visible().get();
RecyclerView list = (RecyclerView) activity.findViewById(R.id.list);
list.setLayoutManager(new LinearLayoutManager(activity));
RecyclerView.Adapter adapter = list.getAdapter();
int position = ShadowSupportPreferenceManager.getPreferencePosition((PreferenceGroupAdapter) adapter, ThemePreference.class);
RecyclerView.ViewHolder holder = CustomShadows.customShadowOf(adapter).getViewHolder(position);
preferenceView = holder.itemView;
}
use of android.support.v7.preference.PreferenceGroupAdapter in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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;
}
use of android.support.v7.preference.PreferenceGroupAdapter in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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;
}
Aggregations