Search in sources :

Example 1 with GBAlarmListAdapter

use of nodomain.freeyourgadget.gadgetbridge.adapter.GBAlarmListAdapter in project Gadgetbridge by Freeyourgadget.

the class ConfigureAlarms method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_configure_alarms);
    device = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE);
    Prefs prefs = GBApplication.getPrefs();
    preferencesAlarmListSet = prefs.getStringSet(PREF_MIBAND_ALARMS, new HashSet<String>());
    if (preferencesAlarmListSet.isEmpty()) {
        //initialize the preferences
        preferencesAlarmListSet = new HashSet<>(Arrays.asList(GBAlarm.DEFAULT_ALARMS));
        prefs.getPreferences().edit().putStringSet(PREF_MIBAND_ALARMS, preferencesAlarmListSet).apply();
    }
    mGBAlarmListAdapter = new GBAlarmListAdapter(this, preferencesAlarmListSet);
    ListView listView = (ListView) findViewById(R.id.alarm_list);
    listView.setAdapter(mGBAlarmListAdapter);
    updateAlarmsFromPrefs();
}
Also used : ListView(android.widget.ListView) GBAlarmListAdapter(nodomain.freeyourgadget.gadgetbridge.adapter.GBAlarmListAdapter) Prefs(nodomain.freeyourgadget.gadgetbridge.util.Prefs) HashSet(java.util.HashSet)

Aggregations

ListView (android.widget.ListView)1 HashSet (java.util.HashSet)1 GBAlarmListAdapter (nodomain.freeyourgadget.gadgetbridge.adapter.GBAlarmListAdapter)1 Prefs (nodomain.freeyourgadget.gadgetbridge.util.Prefs)1