diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/views/dialogs/OpenNoteDialog.kt b/app/src/main/kotlin/com/simplemobiletools/notes/views/dialogs/OpenNoteDialog.kt index e2ae96fd..e44c0423 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/views/dialogs/OpenNoteDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/views/dialogs/OpenNoteDialog.kt @@ -9,16 +9,15 @@ import com.simplemobiletools.notes.Config import com.simplemobiletools.notes.R import com.simplemobiletools.notes.databases.DBHelper -class OpenNoteDialog(val activity: Activity) : AlertDialog.Builder(activity), RadioGroup.OnCheckedChangeListener { +class OpenNoteDialog(val activity: Activity) : RadioGroup.OnCheckedChangeListener { val dialog: AlertDialog? init { - val config = Config.newInstance(context) + val config = Config.newInstance(activity) val view = activity.layoutInflater.inflate(R.layout.dialog_radio_group, null) as RadioGroup view.setOnCheckedChangeListener(this) - val db = DBHelper.newInstance(context) - val notes = db.notes + val notes = DBHelper.newInstance(activity).notes notes.forEach { val radioButton = activity.layoutInflater.inflate(R.layout.radio_button, null) as RadioButton radioButton.apply { @@ -34,7 +33,7 @@ class OpenNoteDialog(val activity: Activity) : AlertDialog.Builder(activity), Ra .setView(view) .create() - dialog?.show() + dialog!!.show() } override fun onCheckedChanged(group: RadioGroup, checkedId: Int) { diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/views/dialogs/WidgetNoteDialog.kt b/app/src/main/kotlin/com/simplemobiletools/notes/views/dialogs/WidgetNoteDialog.kt index cf20f893..f33f4bc6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/views/dialogs/WidgetNoteDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/views/dialogs/WidgetNoteDialog.kt @@ -9,16 +9,16 @@ import com.simplemobiletools.notes.Config import com.simplemobiletools.notes.R import com.simplemobiletools.notes.databases.DBHelper -class WidgetNoteDialog(val activity: Activity) : AlertDialog.Builder(activity), RadioGroup.OnCheckedChangeListener { +class WidgetNoteDialog(val activity: Activity) : RadioGroup.OnCheckedChangeListener { val dialog: AlertDialog? var mConfig: Config init { - mConfig = Config.newInstance(context) + mConfig = Config.newInstance(activity) val view = activity.layoutInflater.inflate(R.layout.dialog_radio_group, null) as RadioGroup view.setOnCheckedChangeListener(this) - val db = DBHelper.newInstance(context) + val db = DBHelper.newInstance(activity) val notes = db.notes notes.forEach { val radioButton = activity.layoutInflater.inflate(R.layout.radio_button, null) as RadioButton