diff --git a/app/build.gradle b/app/build.gradle index f6445b22..eae2212c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.13.7' + compile 'com.simplemobiletools:commons:2.15.0' compile 'com.facebook.stetho:stetho:1.4.1' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenNoteDialog.kt b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenNoteDialog.kt index 6b33f780..2b76cc9d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenNoteDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenNoteDialog.kt @@ -5,7 +5,6 @@ import android.graphics.PorterDuff import android.graphics.PorterDuffColorFilter import android.support.v7.app.AlertDialog import android.view.ViewGroup -import android.widget.LinearLayout import android.widget.RadioGroup import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.setupDialogStuff @@ -13,17 +12,14 @@ import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.notes.R import com.simplemobiletools.notes.extensions.config import com.simplemobiletools.notes.helpers.DBHelper +import kotlinx.android.synthetic.main.dialog_open_note.view.* import kotlinx.android.synthetic.main.open_note_item.view.* class OpenNoteDialog(val activity: Activity, val callback: (checkedId: Int) -> Unit) { lateinit var dialog: AlertDialog init { - val view = LinearLayout(activity).apply { - orientation = LinearLayout.VERTICAL - layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) - } - + val view = activity.layoutInflater.inflate(R.layout.dialog_open_note, null) val textColor = activity.config.textColor val notes = DBHelper.newInstance(activity).getNotes() notes.forEach { @@ -46,7 +42,7 @@ class OpenNoteDialog(val activity: Activity, val callback: (checkedId: Int) -> U activity.toast(note.path) } } - view.addView(this, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)) + view.dialog_open_note_linear.addView(this, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)) } } diff --git a/app/src/main/res/layout/dialog_open_note.xml b/app/src/main/res/layout/dialog_open_note.xml new file mode 100644 index 00000000..30eed432 --- /dev/null +++ b/app/src/main/res/layout/dialog_open_note.xml @@ -0,0 +1,14 @@ + + + + + +