apply the generic dialog things to the dialog

This commit is contained in:
tibbi 2016-12-29 23:50:11 +01:00
parent 05967d3790
commit 392c269787
3 changed files with 14 additions and 14 deletions

View File

@ -1,30 +1,30 @@
package com.simplemobiletools.calendar.dialogs
import android.app.Activity
import android.app.AlertDialog
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.widget.RadioGroup
import com.simplemobiletools.calendar.R
import com.simplemobiletools.calendar.helpers.Config
import com.simplemobiletools.calendar.helpers.EVENTS_LIST_VIEW
import com.simplemobiletools.calendar.helpers.MONTHLY_VIEW
import com.simplemobiletools.calendar.helpers.YEARLY_VIEW
import com.simplemobiletools.commons.extensions.setupDialogStuff
import kotlinx.android.synthetic.main.dialog_change_views.view.*
class ChangeViewDialog(val activity: Activity, val callback: (newView: Int) -> Unit) : AlertDialog.Builder(activity), RadioGroup.OnCheckedChangeListener {
val dialog: AlertDialog?
init {
val view = activity.layoutInflater.inflate(R.layout.dialog_change_views, null)
view.dialog_radio_view.check(getSavedItem())
view.dialog_radio_view.setOnCheckedChangeListener(this)
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_views, null).dialog_radio_view.apply {
check(getSavedItem())
setOnCheckedChangeListener(this@ChangeViewDialog)
}
dialog = AlertDialog.Builder(activity)
.setTitle(R.string.change_view)
.setView(view)
.create()
dialog?.setCanceledOnTouchOutside(true)
dialog?.show()
.create().apply {
activity.setupDialogStuff(view, this, R.string.change_view)
}
}
override fun onCheckedChanged(group: RadioGroup?, checkedId: Int) {

View File

@ -170,6 +170,7 @@
android:inputType="number"
android:maxLength="10"
android:minEms="3"
android:textCursorDrawable="@null"
android:textSize="@dimen/day_text_size"/>
<com.simplemobiletools.commons.views.MyAppCompatSpinner

View File

@ -6,7 +6,7 @@
android:layout_height="wrap_content"
android:padding="@dimen/activity_margin">
<RadioButton
<com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/dialog_radio_monthly"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -14,7 +14,7 @@
android:paddingTop="@dimen/activity_margin"
android:text="@string/monthly_view"/>
<RadioButton
<com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/dialog_radio_yearly"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -22,8 +22,7 @@
android:paddingTop="@dimen/activity_margin"
android:text="@string/yearly_view"/>
<RadioButton
<com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/dialog_radio_events_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"