use of james.alarmio.adapters.PreferenceAdapter in project Alarmio by TheAndroidMaster.
the class SettingsFragment method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_recycler, container, false);
recyclerView = v.findViewById(R.id.recycler);
recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 1));
recyclerView.addItemDecoration(new DividerItemDecoration(recyclerView.getContext(), DividerItemDecoration.VERTICAL));
preferenceAdapter = new PreferenceAdapter(new ArrayList<BasePreferenceData>(Arrays.asList(new ThemePreferenceData(), new ImageFilePreferenceData(PreferenceData.BACKGROUND_IMAGE, R.string.title_background_image), new BooleanPreferenceData(PreferenceData.RINGING_BACKGROUND_IMAGE, R.string.title_ringing_background_image, R.string.desc_ringing_background_image), new TimeZonesPreferenceData(PreferenceData.TIME_ZONE_ENABLED, R.string.title_time_zones), new RingtonePreferenceData(PreferenceData.DEFAULT_ALARM_RINGTONE, R.string.title_default_alarm_ringtone), new RingtonePreferenceData(PreferenceData.DEFAULT_TIMER_RINGTONE, R.string.title_default_timer_ringtone), new BooleanPreferenceData(PreferenceData.SLEEP_REMINDER, R.string.title_sleep_reminder, R.string.desc_sleep_reminder), new TimePreferenceData(PreferenceData.SLEEP_REMINDER_TIME, R.string.title_sleep_reminder_time), new BooleanPreferenceData(PreferenceData.SLOW_WAKE_UP, R.string.title_slow_wake_up, R.string.desc_slow_wake_up), new TimePreferenceData(PreferenceData.SLOW_WAKE_UP_TIME, R.string.title_slow_wake_up_time), new CustomPreferenceData(R.string.title_about) {
@Override
public String getValueName(ViewHolder holder) {
return "";
}
@Override
public void onClick(ViewHolder holder) {
Attribouter attribouter = Attribouter.from(getContext());
int githubAuthKey = getResources().getIdentifier("githubAuthKey", "string", getContext().getPackageName());
if (githubAuthKey != 0)
attribouter = attribouter.withGitHubToken(getString(githubAuthKey));
attribouter.show();
}
})));
recyclerView.setAdapter(preferenceAdapter);
colorPrimarySubscription = Aesthetic.Companion.get().colorPrimary().subscribe(this);
textColorPrimarySubscription = Aesthetic.Companion.get().textColorPrimary().subscribe(this);
return v;
}
Aggregations