Hide text from locked notes

This closes #659
This commit is contained in:
Ensar Sarajčić 2023-08-03 10:49:10 +02:00
parent 24af1a908e
commit 037d8f0147
4 changed files with 22 additions and 34 deletions

View File

@ -12,6 +12,7 @@ import com.google.gson.reflect.TypeToken
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.extensions.beGoneIf
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
import com.simplemobiletools.commons.extensions.isBlackAndWhiteTheme
import com.simplemobiletools.commons.helpers.LOWER_ALPHA_INT
@ -22,6 +23,7 @@ import com.simplemobiletools.notes.pro.extensions.config
import com.simplemobiletools.notes.pro.models.ChecklistItem
import com.simplemobiletools.notes.pro.models.Note
import com.simplemobiletools.notes.pro.models.NoteType
import kotlinx.android.synthetic.main.open_note_item.view.icon_lock
import kotlinx.android.synthetic.main.open_note_item.view.open_note_item_holder
import kotlinx.android.synthetic.main.open_note_item.view.open_note_item_text
import kotlinx.android.synthetic.main.open_note_item.view.open_note_item_title
@ -70,7 +72,8 @@ class OpenNoteAdapter(
setTextColor(properPrimaryColor)
}
val formattedText = note.getFormattedValue(context)
open_note_item_text.beGoneIf(formattedText.isNullOrBlank())
open_note_item_text.beGoneIf(formattedText.isNullOrBlank() || note.isLocked())
icon_lock.beVisibleIf(note.isLocked())
open_note_item_text.apply {
text = formattedText
setTextColor(textColor)

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/open_new_note_item_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/medium_margin"
android:background="@drawable/widget_round_background"
android:orientation="vertical"
android:padding="@dimen/normal_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/open_new_note_item_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textSize="@dimen/big_text_size"
android:textStyle="bold"
android:layout_gravity="center"
android:textAlignment="center"
android:text="@string/create_new_note" />
<ImageView
android:id="@+id/open_new_note_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_plus_vector"
android:layout_gravity="center"
android:importantForAccessibility="no" />
</LinearLayout>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/open_note_item_holder"
android:layout_width="match_parent"
@ -9,10 +9,23 @@
android:orientation="vertical"
android:padding="@dimen/normal_margin">
<ImageView
android:id="@+id/icon_lock"
android:layout_width="match_parent"
android:layout_height="@dimen/open_note_popup_lock_size"
android:layout_below="@+id/open_note_item_title"
android:alpha="0.5"
android:importantForAccessibility="no"
android:scaleType="centerInside"
android:src="@drawable/ic_lock_vector"
android:visibility="gone" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/open_note_item_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:ellipsize="end"
android:lines="1"
android:textSize="@dimen/big_text_size"
@ -23,9 +36,11 @@
android:id="@+id/open_note_item_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/open_note_item_title"
android:layout_alignParentStart="true"
android:layout_marginTop="@dimen/medium_margin"
android:ellipsize="end"
android:maxHeight="@dimen/grid_note_item_max_height"
tools:text="text" />
</LinearLayout>
</RelativeLayout>

View File

@ -5,4 +5,5 @@
<dimen name="max_open_note_popup_height">500dp</dimen>
<dimen name="min_open_note_popup_height">200dp</dimen>
<dimen name="open_note_popup_bottom_extra_padding">76dp</dimen>
<dimen name="open_note_popup_lock_size">56dp</dimen>
</resources>