get layoutinflater directly from the activity at dialogs

This commit is contained in:
tibbi 2017-04-02 11:53:48 +02:00
parent 4e781cf8d7
commit ccea40c1bc
7 changed files with 7 additions and 14 deletions

View file

@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.dialogs
import android.app.Activity
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.widget.RadioGroup
import com.simplemobiletools.calendar.R
import com.simplemobiletools.calendar.extensions.config
@ -17,7 +16,7 @@ class ChangeViewDialog(val activity: Activity, val callback: (newView: Int) -> U
val dialog: AlertDialog?
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())
setOnCheckedChangeListener(this@ChangeViewDialog)
}

View file

@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.dialogs
import android.app.Activity
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.ViewGroup
import android.view.WindowManager
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) {
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 {
view.dialog_radio_view.check(R.id.dialog_radio_minutes)

View file

@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.dialogs
import android.app.Activity
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.ViewGroup
import android.view.WindowManager
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) {
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 {
view.dialog_radio_view.check(R.id.dialog_radio_days)

View file

@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.dialogs
import android.app.Activity
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.ViewGroup
import com.simplemobiletools.calendar.R
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 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_radio_view.beVisibleIf(hasRepeatableEvent)
}

View file

@ -1,7 +1,6 @@
package com.simplemobiletools.calendar.dialogs
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import com.simplemobiletools.calendar.R
import com.simplemobiletools.calendar.activities.SimpleActivity
import com.simplemobiletools.calendar.adapters.FilterEventTypeAdapter
@ -15,7 +14,7 @@ import java.util.*
class FilterEventTypesDialog(val activity: SimpleActivity, val callback: () -> Unit) : AlertDialog.Builder(activity) {
var dialog: AlertDialog
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 {
activity.dbHelper.getEventTypes {

View file

@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.dialogs
import android.app.Activity
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.ViewGroup
import com.simplemobiletools.calendar.R
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
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)
updateEventType(this)

View file

@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.dialogs
import android.app.Activity
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.WindowManager
import android.widget.ImageView
import com.simplemobiletools.calendar.R
@ -23,7 +22,7 @@ class NewEventTypeDialog(val activity: Activity, var eventType: EventType? = nul
if (eventType == null)
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)
type_title.setText(eventType!!.title)
type_color.setOnClickListener {