mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2024-12-25 07:50:56 +01:00
move some FilterEventTypesDialog things on a background thread
This commit is contained in:
parent
4f5a2de20e
commit
717f103b59
@ -10,13 +10,14 @@ import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import kotlinx.android.synthetic.main.dialog_filter_event_types.view.*
|
||||
|
||||
class FilterEventTypesDialog(val activity: SimpleActivity, val callback: () -> Unit) {
|
||||
var dialog: AlertDialog
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_filter_event_types, null)
|
||||
private lateinit var dialog: AlertDialog
|
||||
private val view = activity.layoutInflater.inflate(R.layout.dialog_filter_event_types, null)
|
||||
|
||||
init {
|
||||
val eventTypes = activity.dbHelper.getEventTypesSync()
|
||||
activity.dbHelper.getEventTypes {
|
||||
val displayEventTypes = activity.config.displayEventTypes
|
||||
view.filter_event_types_list.adapter = FilterEventTypeAdapter(activity, eventTypes, displayEventTypes)
|
||||
activity.runOnUiThread {
|
||||
view.filter_event_types_list.adapter = FilterEventTypeAdapter(activity, it, displayEventTypes)
|
||||
|
||||
dialog = AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok) { dialogInterface, i -> confirmEventTypes() }
|
||||
@ -25,6 +26,8 @@ class FilterEventTypesDialog(val activity: SimpleActivity, val callback: () -> U
|
||||
activity.setupDialogStuff(view, this, R.string.filter_events_by_type)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun confirmEventTypes() {
|
||||
val selectedItems = (view.filter_event_types_list.adapter as FilterEventTypeAdapter).getSelectedItemsSet()
|
||||
|
Loading…
Reference in New Issue
Block a user