From 04f887bc3a3ba72993340457fd983dedca097e35 Mon Sep 17 00:00:00 2001
From: Agnieszka C <85929121+Aga-C@users.noreply.github.com>
Date: Tue, 26 Dec 2023 10:20:25 +0100
Subject: [PATCH 1/3] Added file indicator to exported notes
---
.../org/fossify/notes/adapters/OpenNoteAdapter.kt | 9 +++++++++
app/src/main/res/layout/open_note_item.xml | 12 ++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/app/src/main/kotlin/org/fossify/notes/adapters/OpenNoteAdapter.kt b/app/src/main/kotlin/org/fossify/notes/adapters/OpenNoteAdapter.kt
index 8e166ba0..cd11b712 100644
--- a/app/src/main/kotlin/org/fossify/notes/adapters/OpenNoteAdapter.kt
+++ b/app/src/main/kotlin/org/fossify/notes/adapters/OpenNoteAdapter.kt
@@ -15,6 +15,8 @@ import org.fossify.commons.extensions.beGoneIf
import org.fossify.commons.extensions.beVisibleIf
import org.fossify.commons.extensions.getColoredDrawableWithColor
import org.fossify.commons.extensions.isBlackAndWhiteTheme
+import org.fossify.commons.extensions.applyColorFilter
+import org.fossify.commons.extensions.toast
import org.fossify.commons.helpers.LOWER_ALPHA_INT
import org.fossify.commons.helpers.SORT_BY_CUSTOM
import org.fossify.commons.views.MyRecyclerView
@@ -75,6 +77,13 @@ class OpenNoteAdapter(
text = formattedText
setTextColor(textColor)
}
+ openNoteItemIcon.apply {
+ beVisibleIf(note.path.isNotEmpty())
+ applyColorFilter(textColor)
+ setOnClickListener {
+ activity.toast(note.path)
+ }
+ }
}
}
diff --git a/app/src/main/res/layout/open_note_item.xml b/app/src/main/res/layout/open_note_item.xml
index e8d18e9b..4afddc90 100644
--- a/app/src/main/res/layout/open_note_item.xml
+++ b/app/src/main/res/layout/open_note_item.xml
@@ -19,12 +19,20 @@
android:src="@drawable/ic_lock_vector"
android:visibility="gone" />
-
+
+
Date: Wed, 3 Apr 2024 10:02:27 +0530
Subject: [PATCH 2/3] Format code
---
.../fossify/notes/adapters/OpenNoteAdapter.kt | 22 +++++++++++--------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/app/src/main/kotlin/org/fossify/notes/adapters/OpenNoteAdapter.kt b/app/src/main/kotlin/org/fossify/notes/adapters/OpenNoteAdapter.kt
index cd11b712..fe221a7c 100644
--- a/app/src/main/kotlin/org/fossify/notes/adapters/OpenNoteAdapter.kt
+++ b/app/src/main/kotlin/org/fossify/notes/adapters/OpenNoteAdapter.kt
@@ -11,12 +11,7 @@ import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import org.fossify.commons.activities.BaseSimpleActivity
import org.fossify.commons.adapters.MyRecyclerViewAdapter
-import org.fossify.commons.extensions.beGoneIf
-import org.fossify.commons.extensions.beVisibleIf
-import org.fossify.commons.extensions.getColoredDrawableWithColor
-import org.fossify.commons.extensions.isBlackAndWhiteTheme
-import org.fossify.commons.extensions.applyColorFilter
-import org.fossify.commons.extensions.toast
+import org.fossify.commons.extensions.*
import org.fossify.commons.helpers.LOWER_ALPHA_INT
import org.fossify.commons.helpers.SORT_BY_CUSTOM
import org.fossify.commons.views.MyRecyclerView
@@ -27,8 +22,10 @@ import org.fossify.notes.models.Note
import org.fossify.notes.models.NoteType
class OpenNoteAdapter(
- activity: BaseSimpleActivity, var items: List,
- recyclerView: MyRecyclerView, itemClick: (Any) -> Unit
+ activity: BaseSimpleActivity,
+ var items: List,
+ recyclerView: MyRecyclerView,
+ itemClick: (Any) -> Unit,
) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) {
override fun getActionMenuId() = 0
@@ -54,9 +51,10 @@ class OpenNoteAdapter(
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = items[position]
- holder.bindView(item, true, false) { itemView, layoutPosition ->
+ holder.bindView(item, allowSingleClick = true, allowLongClick = false) { itemView, _ ->
setupView(itemView, item)
}
+
bindViewHolder(holder)
}
@@ -69,6 +67,7 @@ class OpenNoteAdapter(
text = note.title
setTextColor(properPrimaryColor)
}
+
val formattedText = note.getFormattedValue(root.context)
openNoteItemText.beGoneIf(formattedText.isNullOrBlank() || note.isLocked())
iconLock.beVisibleIf(note.isLocked())
@@ -77,6 +76,7 @@ class OpenNoteAdapter(
text = formattedText
setTextColor(textColor)
}
+
openNoteItemIcon.apply {
beVisibleIf(note.path.isNotEmpty())
applyColorFilter(textColor)
@@ -96,11 +96,13 @@ class OpenNoteAdapter(
} else {
Color.BLACK
}
+
val cardBackground = if (context.config.isUsingSystemTheme) {
org.fossify.commons.R.drawable.dialog_you_background
} else {
org.fossify.commons.R.drawable.dialog_bg
}
+
background =
activity.resources.getColoredDrawableWithColor(cardBackground, cardBackgroundColor, LOWER_ALPHA_INT)
}
@@ -127,6 +129,7 @@ class OpenNoteAdapter(
it
}
}
+
val linePrefix = "• "
val stringifiedItems = items.joinToString(separator = System.lineSeparator()) {
"${linePrefix}${it.title}"
@@ -142,6 +145,7 @@ class OpenNoteAdapter(
currentPos += item.title.length
currentPos += System.lineSeparator().length
}
+
formattedText
}
}
From 3d3dc5a8797891247bd5a3f561141b74b5b2ce1f Mon Sep 17 00:00:00 2001
From: Naveen
Date: Wed, 3 Apr 2024 10:33:09 +0530
Subject: [PATCH 3/3] Make the export indicator more 'intelligible'
---
.../fossify/notes/adapters/OpenNoteAdapter.kt | 12 +++++++++-
app/src/main/res/layout/open_note_item.xml | 23 +++++++++++--------
app/src/main/res/values/strings.xml | 1 +
3 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/app/src/main/kotlin/org/fossify/notes/adapters/OpenNoteAdapter.kt b/app/src/main/kotlin/org/fossify/notes/adapters/OpenNoteAdapter.kt
index fe221a7c..20a410fd 100644
--- a/app/src/main/kotlin/org/fossify/notes/adapters/OpenNoteAdapter.kt
+++ b/app/src/main/kotlin/org/fossify/notes/adapters/OpenNoteAdapter.kt
@@ -14,7 +14,9 @@ import org.fossify.commons.adapters.MyRecyclerViewAdapter
import org.fossify.commons.extensions.*
import org.fossify.commons.helpers.LOWER_ALPHA_INT
import org.fossify.commons.helpers.SORT_BY_CUSTOM
+import org.fossify.commons.helpers.isOreoPlus
import org.fossify.commons.views.MyRecyclerView
+import org.fossify.notes.R
import org.fossify.notes.databinding.OpenNoteItemBinding
import org.fossify.notes.extensions.config
import org.fossify.notes.models.ChecklistItem
@@ -80,8 +82,16 @@ class OpenNoteAdapter(
openNoteItemIcon.apply {
beVisibleIf(note.path.isNotEmpty())
applyColorFilter(textColor)
+ if (isOreoPlus()) {
+ tooltipText = context.getString(R.string.this_note_is_linked)
+ }
+
setOnClickListener {
- activity.toast(note.path)
+ if (isOreoPlus()) {
+ performLongClick()
+ } else {
+ activity.toast(R.string.this_note_is_linked)
+ }
}
}
}
diff --git a/app/src/main/res/layout/open_note_item.xml b/app/src/main/res/layout/open_note_item.xml
index 4afddc90..efdfb24e 100644
--- a/app/src/main/res/layout/open_note_item.xml
+++ b/app/src/main/res/layout/open_note_item.xml
@@ -19,26 +19,31 @@
android:src="@drawable/ic_lock_vector"
android:visibility="gone" />
-
-
-
+
+
Note \"%s\" saved successfully
Note \"%s\" exported successfully
Only export the current file content\n(changing the note will not affect the file)
+ This note is linked with a local file.
Display save success messages