Search in sources :

Example 1 with RingtonePreferenceData

use of james.alarmio.data.preference.RingtonePreferenceData 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;
}
Also used : BooleanPreferenceData(james.alarmio.data.preference.BooleanPreferenceData) ImageFilePreferenceData(james.alarmio.data.preference.ImageFilePreferenceData) ArrayList(java.util.ArrayList) DividerItemDecoration(androidx.recyclerview.widget.DividerItemDecoration) CustomPreferenceData(james.alarmio.data.preference.CustomPreferenceData) Attribouter(me.jfenn.attribouter.Attribouter) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TimeZonesPreferenceData(james.alarmio.data.preference.TimeZonesPreferenceData) GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) PreferenceAdapter(james.alarmio.adapters.PreferenceAdapter) TimePreferenceData(james.alarmio.data.preference.TimePreferenceData) RingtonePreferenceData(james.alarmio.data.preference.RingtonePreferenceData) ThemePreferenceData(james.alarmio.data.preference.ThemePreferenceData) Nullable(androidx.annotation.Nullable)

Aggregations

View (android.view.View)1 Nullable (androidx.annotation.Nullable)1 DividerItemDecoration (androidx.recyclerview.widget.DividerItemDecoration)1 GridLayoutManager (androidx.recyclerview.widget.GridLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 PreferenceAdapter (james.alarmio.adapters.PreferenceAdapter)1 BooleanPreferenceData (james.alarmio.data.preference.BooleanPreferenceData)1 CustomPreferenceData (james.alarmio.data.preference.CustomPreferenceData)1 ImageFilePreferenceData (james.alarmio.data.preference.ImageFilePreferenceData)1 RingtonePreferenceData (james.alarmio.data.preference.RingtonePreferenceData)1 ThemePreferenceData (james.alarmio.data.preference.ThemePreferenceData)1 TimePreferenceData (james.alarmio.data.preference.TimePreferenceData)1 TimeZonesPreferenceData (james.alarmio.data.preference.TimeZonesPreferenceData)1 ArrayList (java.util.ArrayList)1 Attribouter (me.jfenn.attribouter.Attribouter)1