get layoutinflater directly from the activity at dialogs
This commit is contained in:
parent
4e781cf8d7
commit
ccea40c1bc
|
@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.dialogs
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.support.v7.app.AlertDialog
|
import android.support.v7.app.AlertDialog
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.widget.RadioGroup
|
import android.widget.RadioGroup
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
import com.simplemobiletools.calendar.extensions.config
|
import com.simplemobiletools.calendar.extensions.config
|
||||||
|
@ -17,7 +16,7 @@ class ChangeViewDialog(val activity: Activity, val callback: (newView: Int) -> U
|
||||||
val dialog: AlertDialog?
|
val dialog: AlertDialog?
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_views, null).dialog_radio_view.apply {
|
val view = activity.layoutInflater.inflate(R.layout.dialog_change_views, null).dialog_radio_view.apply {
|
||||||
check(getSavedItem())
|
check(getSavedItem())
|
||||||
setOnCheckedChangeListener(this@ChangeViewDialog)
|
setOnCheckedChangeListener(this@ChangeViewDialog)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.dialogs
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.support.v7.app.AlertDialog
|
import android.support.v7.app.AlertDialog
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
|
@ -13,7 +12,7 @@ import kotlinx.android.synthetic.main.dialog_custom_event_reminder.view.*
|
||||||
|
|
||||||
class CustomEventReminderDialog(val activity: Activity, val callback: (minutes: Int) -> Unit) : AlertDialog.Builder(activity) {
|
class CustomEventReminderDialog(val activity: Activity, val callback: (minutes: Int) -> Unit) : AlertDialog.Builder(activity) {
|
||||||
var dialog: AlertDialog
|
var dialog: AlertDialog
|
||||||
var view: ViewGroup = LayoutInflater.from(activity).inflate(R.layout.dialog_custom_event_reminder, null) as ViewGroup
|
var view = activity.layoutInflater.inflate(R.layout.dialog_custom_event_reminder, null) as ViewGroup
|
||||||
|
|
||||||
init {
|
init {
|
||||||
view.dialog_radio_view.check(R.id.dialog_radio_minutes)
|
view.dialog_radio_view.check(R.id.dialog_radio_minutes)
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.dialogs
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.support.v7.app.AlertDialog
|
import android.support.v7.app.AlertDialog
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
|
@ -13,7 +12,7 @@ import kotlinx.android.synthetic.main.dialog_custom_event_repeat_interval.view.*
|
||||||
|
|
||||||
class CustomEventRepeatIntervalDialog(val activity: Activity, val callback: (seconds: Int) -> Unit) : AlertDialog.Builder(activity) {
|
class CustomEventRepeatIntervalDialog(val activity: Activity, val callback: (seconds: Int) -> Unit) : AlertDialog.Builder(activity) {
|
||||||
var dialog: AlertDialog
|
var dialog: AlertDialog
|
||||||
var view: ViewGroup = LayoutInflater.from(activity).inflate(R.layout.dialog_custom_event_repeat_interval, null) as ViewGroup
|
var view = activity.layoutInflater.inflate(R.layout.dialog_custom_event_repeat_interval, null) as ViewGroup
|
||||||
|
|
||||||
init {
|
init {
|
||||||
view.dialog_radio_view.check(R.id.dialog_radio_days)
|
view.dialog_radio_view.check(R.id.dialog_radio_days)
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.dialogs
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.support.v7.app.AlertDialog
|
import android.support.v7.app.AlertDialog
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
import com.simplemobiletools.calendar.extensions.dbHelper
|
import com.simplemobiletools.calendar.extensions.dbHelper
|
||||||
|
@ -17,7 +16,7 @@ class DeleteEventDialog(val activity: Activity, eventIds: List<Int>, val callbac
|
||||||
val events = activity.dbHelper.getEventsWithIds(eventIds)
|
val events = activity.dbHelper.getEventsWithIds(eventIds)
|
||||||
val hasRepeatableEvent = events.any { it.repeatInterval > 0 }
|
val hasRepeatableEvent = events.any { it.repeatInterval > 0 }
|
||||||
|
|
||||||
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_delete_event, null).apply {
|
val view = activity.layoutInflater.inflate(R.layout.dialog_delete_event, null).apply {
|
||||||
delete_event_repeat_description.beVisibleIf(hasRepeatableEvent)
|
delete_event_repeat_description.beVisibleIf(hasRepeatableEvent)
|
||||||
delete_event_radio_view.beVisibleIf(hasRepeatableEvent)
|
delete_event_radio_view.beVisibleIf(hasRepeatableEvent)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.simplemobiletools.calendar.dialogs
|
package com.simplemobiletools.calendar.dialogs
|
||||||
|
|
||||||
import android.support.v7.app.AlertDialog
|
import android.support.v7.app.AlertDialog
|
||||||
import android.view.LayoutInflater
|
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
import com.simplemobiletools.calendar.activities.SimpleActivity
|
import com.simplemobiletools.calendar.activities.SimpleActivity
|
||||||
import com.simplemobiletools.calendar.adapters.FilterEventTypeAdapter
|
import com.simplemobiletools.calendar.adapters.FilterEventTypeAdapter
|
||||||
|
@ -15,7 +14,7 @@ import java.util.*
|
||||||
class FilterEventTypesDialog(val activity: SimpleActivity, val callback: () -> Unit) : AlertDialog.Builder(activity) {
|
class FilterEventTypesDialog(val activity: SimpleActivity, val callback: () -> Unit) : AlertDialog.Builder(activity) {
|
||||||
var dialog: AlertDialog
|
var dialog: AlertDialog
|
||||||
var eventTypes = ArrayList<EventType>()
|
var eventTypes = ArrayList<EventType>()
|
||||||
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_filter_event_types, null)
|
val view = activity.layoutInflater.inflate(R.layout.dialog_filter_event_types, null)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
activity.dbHelper.getEventTypes {
|
activity.dbHelper.getEventTypes {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.dialogs
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.support.v7.app.AlertDialog
|
import android.support.v7.app.AlertDialog
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
import com.simplemobiletools.calendar.extensions.config
|
import com.simplemobiletools.calendar.extensions.config
|
||||||
|
@ -20,7 +19,7 @@ class ImportEventsDialog(val activity: Activity, val path: String, val callback:
|
||||||
var currEventTypeId = DBHelper.REGULAR_EVENT_TYPE_ID
|
var currEventTypeId = DBHelper.REGULAR_EVENT_TYPE_ID
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val view = (LayoutInflater.from(activity).inflate(R.layout.dialog_import_events, null) as ViewGroup).apply {
|
val view = (activity.layoutInflater.inflate(R.layout.dialog_import_events, null) as ViewGroup).apply {
|
||||||
import_events_filename.text = activity.humanizePath(path)
|
import_events_filename.text = activity.humanizePath(path)
|
||||||
|
|
||||||
updateEventType(this)
|
updateEventType(this)
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.dialogs
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.support.v7.app.AlertDialog
|
import android.support.v7.app.AlertDialog
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
|
@ -23,7 +22,7 @@ class NewEventTypeDialog(val activity: Activity, var eventType: EventType? = nul
|
||||||
if (eventType == null)
|
if (eventType == null)
|
||||||
eventType = EventType(0, "", activity.config.primaryColor)
|
eventType = EventType(0, "", activity.config.primaryColor)
|
||||||
|
|
||||||
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_event_type, null).apply {
|
val view = activity.layoutInflater.inflate(R.layout.dialog_event_type, null).apply {
|
||||||
setupColor(type_color)
|
setupColor(type_color)
|
||||||
type_title.setText(eventType!!.title)
|
type_title.setText(eventType!!.title)
|
||||||
type_color.setOnClickListener {
|
type_color.setOnClickListener {
|
||||||
|
|
Loading…
Reference in New Issue