Skip to content

Commit 311175d

Browse files
authored
Merge pull request #660 from esensar/fix/659-open-note-locked
Hide text from locked notes
2 parents 24af1a9 + eec54e4 commit 311175d

File tree

4 files changed

+22
-34
lines changed

4 files changed

+22
-34
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/adapters/OpenNoteAdapter.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import com.google.gson.reflect.TypeToken
1212
import com.simplemobiletools.commons.activities.BaseSimpleActivity
1313
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
1414
import com.simplemobiletools.commons.extensions.beGoneIf
15+
import com.simplemobiletools.commons.extensions.beVisibleIf
1516
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
1617
import com.simplemobiletools.commons.extensions.isBlackAndWhiteTheme
1718
import com.simplemobiletools.commons.helpers.LOWER_ALPHA_INT
@@ -22,6 +23,7 @@ import com.simplemobiletools.notes.pro.extensions.config
2223
import com.simplemobiletools.notes.pro.models.ChecklistItem
2324
import com.simplemobiletools.notes.pro.models.Note
2425
import com.simplemobiletools.notes.pro.models.NoteType
26+
import kotlinx.android.synthetic.main.open_note_item.view.icon_lock
2527
import kotlinx.android.synthetic.main.open_note_item.view.open_note_item_holder
2628
import kotlinx.android.synthetic.main.open_note_item.view.open_note_item_text
2729
import kotlinx.android.synthetic.main.open_note_item.view.open_note_item_title
@@ -70,7 +72,9 @@ class OpenNoteAdapter(
7072
setTextColor(properPrimaryColor)
7173
}
7274
val formattedText = note.getFormattedValue(context)
73-
open_note_item_text.beGoneIf(formattedText.isNullOrBlank())
75+
open_note_item_text.beGoneIf(formattedText.isNullOrBlank() || note.isLocked())
76+
icon_lock.beVisibleIf(note.isLocked())
77+
icon_lock.setImageDrawable(activity.resources.getColoredDrawableWithColor(R.drawable.ic_lock_vector, properPrimaryColor))
7478
open_note_item_text.apply {
7579
text = formattedText
7680
setTextColor(textColor)

app/src/main/res/layout/open_new_note_item.xml

-31
This file was deleted.

app/src/main/res/layout/open_note_item.xml

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
44
android:id="@+id/open_note_item_holder"
55
android:layout_width="match_parent"
@@ -9,10 +9,22 @@
99
android:orientation="vertical"
1010
android:padding="@dimen/normal_margin">
1111

12+
<ImageView
13+
android:id="@+id/icon_lock"
14+
android:layout_width="match_parent"
15+
android:layout_height="@dimen/open_note_popup_lock_size"
16+
android:layout_below="@+id/open_note_item_title"
17+
android:importantForAccessibility="no"
18+
android:padding="@dimen/small_margin"
19+
android:src="@drawable/ic_lock_vector"
20+
android:visibility="gone" />
21+
1222
<com.simplemobiletools.commons.views.MyTextView
1323
android:id="@+id/open_note_item_title"
1424
android:layout_width="wrap_content"
1525
android:layout_height="wrap_content"
26+
android:layout_alignParentStart="true"
27+
android:layout_alignParentTop="true"
1628
android:ellipsize="end"
1729
android:lines="1"
1830
android:textSize="@dimen/big_text_size"
@@ -23,9 +35,11 @@
2335
android:id="@+id/open_note_item_text"
2436
android:layout_width="wrap_content"
2537
android:layout_height="wrap_content"
38+
android:layout_below="@+id/open_note_item_title"
39+
android:layout_alignParentStart="true"
2640
android:layout_marginTop="@dimen/medium_margin"
2741
android:ellipsize="end"
2842
android:maxHeight="@dimen/grid_note_item_max_height"
2943
tools:text="text" />
3044

31-
</LinearLayout>
45+
</RelativeLayout>

app/src/main/res/values/dimens.xml

+1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
<dimen name="max_open_note_popup_height">500dp</dimen>
66
<dimen name="min_open_note_popup_height">200dp</dimen>
77
<dimen name="open_note_popup_bottom_extra_padding">76dp</dimen>
8+
<dimen name="open_note_popup_lock_size">56dp</dimen>
89
</resources>

0 commit comments

Comments
 (0)