diff --git a/app/build.gradle b/app/build.gradle index 6977452f..b8a00626 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.9.4' + compile 'com.simplemobiletools:commons:2.9.5' 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 157a9789..6b33f780 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenNoteDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/dialogs/OpenNoteDialog.kt @@ -1,11 +1,15 @@ package com.simplemobiletools.notes.dialogs import android.app.Activity +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 +import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.notes.R import com.simplemobiletools.notes.extensions.config import com.simplemobiletools.notes.helpers.DBHelper @@ -20,19 +24,28 @@ class OpenNoteDialog(val activity: Activity, val callback: (checkedId: Int) -> U layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) } + val textColor = activity.config.textColor val notes = DBHelper.newInstance(activity).getNotes() notes.forEach { activity.layoutInflater.inflate(R.layout.open_note_item, null).apply { + val note = it open_note_item_radio_button.apply { - text = it.title - isChecked = it.id == activity.config.currentNoteId - id = it.id + text = note.title + isChecked = note.id == activity.config.currentNoteId + id = note.id setOnClickListener { callback.invoke(id) dialog.dismiss() } } + open_note_item_icon.apply { + beVisibleIf(note.path.isNotEmpty()) + colorFilter = PorterDuffColorFilter(textColor, PorterDuff.Mode.SRC_IN) + setOnClickListener { + activity.toast(note.path) + } + } view.addView(this, RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)) } } diff --git a/app/src/main/res/layout/open_note_item.xml b/app/src/main/res/layout/open_note_item.xml index 2dcd6eb6..79264092 100644 --- a/app/src/main/res/layout/open_note_item.xml +++ b/app/src/main/res/layout/open_note_item.xml @@ -9,6 +9,18 @@ + android:layout_height="wrap_content" + android:layout_toLeftOf="@+id/open_note_item_icon"/> + +