move text size getter in an extension

This commit is contained in:
tibbi
2016-11-21 20:59:22 +01:00
parent 2f46805271
commit 625ee1ac90
6 changed files with 24 additions and 30 deletions

View File

@ -10,7 +10,7 @@ import com.simplemobiletools.notes.R
import com.simplemobiletools.notes.databases.DBHelper
import kotlinx.android.synthetic.main.dialog_radio_group.view.*
class OpenNoteDialog(val activity: Activity) : RadioGroup.OnCheckedChangeListener {
class OpenNoteDialog(val activity: Activity, val callback: (checkedId: Int) -> Unit) : RadioGroup.OnCheckedChangeListener {
val dialog: AlertDialog?
init {
@ -39,11 +39,7 @@ class OpenNoteDialog(val activity: Activity) : RadioGroup.OnCheckedChangeListene
}
override fun onCheckedChanged(group: RadioGroup, checkedId: Int) {
(activity as OpenNoteListener).noteSelected(checkedId)
callback.invoke(checkedId)
dialog?.dismiss()
}
interface OpenNoteListener {
fun noteSelected(id: Int)
}
}