Skip to content

Commit 037d8f0

Browse files
committed
Hide text from locked notes
This closes #659
1 parent 24af1a9 commit 037d8f0

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

Lines changed: 4 additions & 1 deletion
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,8 @@ 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())
7477
open_note_item_text.apply {
7578
text = formattedText
7679
setTextColor(textColor)

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

Lines changed: 0 additions & 31 deletions
This file was deleted.

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

Lines changed: 17 additions & 2 deletions
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,23 @@
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:alpha="0.5"
18+
android:importantForAccessibility="no"
19+
android:scaleType="centerInside"
20+
android:src="@drawable/ic_lock_vector"
21+
android:visibility="gone" />
22+
1223
<com.simplemobiletools.commons.views.MyTextView
1324
android:id="@+id/open_note_item_title"
1425
android:layout_width="wrap_content"
1526
android:layout_height="wrap_content"
27+
android:layout_alignParentStart="true"
28+
android:layout_alignParentTop="true"
1629
android:ellipsize="end"
1730
android:lines="1"
1831
android:textSize="@dimen/big_text_size"
@@ -23,9 +36,11 @@
2336
android:id="@+id/open_note_item_text"
2437
android:layout_width="wrap_content"
2538
android:layout_height="wrap_content"
39+
android:layout_below="@+id/open_note_item_title"
40+
android:layout_alignParentStart="true"
2641
android:layout_marginTop="@dimen/medium_margin"
2742
android:ellipsize="end"
2843
android:maxHeight="@dimen/grid_note_item_max_height"
2944
tools:text="text" />
3045

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

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

Lines changed: 1 addition & 0 deletions
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)