mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-13 15:02:05 +02:00
add an icon to file notes
This commit is contained in:
parent
0f67840897
commit
f75f460be5
@ -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"
|
||||
}
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,18 @@
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/open_note_item_radio_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/open_note_item_icon"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/open_note_item_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginEnd="@dimen/small_margin"
|
||||
android:layout_marginRight="@dimen/small_margin"
|
||||
android:padding="@dimen/small_margin"
|
||||
android:src="@drawable/ic_attach_file"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user