mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2024-12-15 17:58:33 +01:00
allow drag selecting timezones and alarms
This commit is contained in:
parent
7ef63b76e4
commit
05eae929d1
@ -51,10 +51,12 @@ class AlarmFragment : Fragment(), ToggleAlarmInterface {
|
||||
alarms = context!!.dbHelper.getAlarms()
|
||||
val currAdapter = view.alarms_list.adapter
|
||||
if (currAdapter == null) {
|
||||
val alarmsAdapter = AlarmsAdapter(activity as SimpleActivity, alarms, this, view.alarms_list) {
|
||||
AlarmsAdapter(activity as SimpleActivity, alarms, this, view.alarms_list) {
|
||||
openEditAlarm(it as Alarm)
|
||||
}.apply {
|
||||
setupDragListener(true)
|
||||
view.alarms_list.adapter = this
|
||||
}
|
||||
view.alarms_list.adapter = alarmsAdapter
|
||||
} else {
|
||||
(currAdapter as AlarmsAdapter).updateItems(alarms)
|
||||
}
|
||||
|
@ -121,12 +121,14 @@ class ClockFragment : Fragment() {
|
||||
val timeZones = context!!.getAllTimeZonesModified().filter { selectedTimeZoneIDs.contains(it.id) } as ArrayList<MyTimeZone>
|
||||
val currAdapter = view.time_zones_list.adapter
|
||||
if (currAdapter == null) {
|
||||
val timeZonesAdapter = TimeZonesAdapter(activity as SimpleActivity, timeZones, view.time_zones_list) {
|
||||
TimeZonesAdapter(activity as SimpleActivity, timeZones, view.time_zones_list) {
|
||||
EditTimeZoneDialog(activity as SimpleActivity, it as MyTimeZone) {
|
||||
updateTimeZones()
|
||||
}
|
||||
}.apply {
|
||||
setupDragListener(true)
|
||||
view.time_zones_list.adapter = this
|
||||
}
|
||||
view.time_zones_list.adapter = timeZonesAdapter
|
||||
} else {
|
||||
(currAdapter as TimeZonesAdapter).updateItems(timeZones)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user