Setting to hide UUID #757

This commit is contained in:
J-Jamet
2020-10-21 21:28:52 +02:00
parent 3aab37c0c0
commit 6a935a49ea
6 changed files with 23 additions and 1 deletions

View File

@@ -123,6 +123,12 @@ object PreferencesUtil {
context.resources.getBoolean(R.bool.hide_expired_entries_default))
}
fun showUUID(context: Context): Boolean {
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
return prefs.getBoolean(context.getString(R.string.show_uuid_key),
context.resources.getBoolean(R.bool.show_uuid_default))
}
/**
* Retrieve the text size in % (1 for 100%)
*/

View File

@@ -43,6 +43,7 @@ import com.kunzisoft.keepass.model.EntryAttachmentState
import com.kunzisoft.keepass.model.StreamDirection
import com.kunzisoft.keepass.otp.OtpElement
import com.kunzisoft.keepass.otp.OtpType
import com.kunzisoft.keepass.settings.PreferencesUtil
import java.util.*
@@ -78,6 +79,7 @@ class EntryContentsView @JvmOverloads constructor(context: Context,
private val historyListView: RecyclerView
private val historyAdapter = EntryHistoryAdapter(context)
private val uuidContainerView: View
private val uuidView: TextView
private val uuidReferenceView: TextView
@@ -126,6 +128,10 @@ class EntryContentsView @JvmOverloads constructor(context: Context,
adapter = historyAdapter
}
uuidContainerView = findViewById(R.id.entry_UUID_container)
uuidContainerView?.apply {
visibility = if (PreferencesUtil.showUUID(context)) View.VISIBLE else View.GONE
}
uuidView = findViewById(R.id.entry_UUID)
uuidReferenceView = findViewById(R.id.entry_UUID_reference)
}

View File

@@ -299,6 +299,7 @@
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/entry_UUID_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/card_view_margin"

View File

@@ -173,6 +173,8 @@
<bool name="monospace_font_fields_enable_default" translatable="false">true</bool>
<string name="hide_expired_entries_key" translatable="false">hide_expired_entries_key</string>
<bool name="hide_expired_entries_default" translatable="false">false</bool>
<string name="show_uuid_key" translatable="false">hide_expired_entries_key</string>
<bool name="show_uuid_default" translatable="false">false</bool>
<string name="enable_education_screens_key" translatable="false">enable_education_screens_key</string>
<bool name="enable_education_screens_default" translatable="false">true</bool>
<string name="reset_education_screens_key" translatable="false">relaunch_education_screens_key</string>

View File

@@ -520,4 +520,6 @@
<string name="icon_pack_choose_summary">Icon pack used in the app</string>
<string name="hide_expired_entries_title">Hide expired entries</string>
<string name="hide_expired_entries_summary">Expired entries are not shown</string>
<string name="show_uuid_title">Show UUID</string>
<string name="show_uuid_summary">Displays the UUID linked to an entry</string>
</resources>

View File

@@ -67,12 +67,17 @@
<PreferenceCategory
android:title="@string/other">
<SwitchPreference
android:key="@string/hide_expired_entries_key"
android:title="@string/hide_expired_entries_title"
android:summary="@string/hide_expired_entries_summary"
android:defaultValue="@bool/hide_expired_entries_default"/>
<SwitchPreference
android:key="@string/show_uuid_key"
android:title="@string/show_uuid_title"
android:summary="@string/show_uuid_summary"
android:defaultValue="@bool/show_uuid_default"/>
<SwitchPreference
android:key="@string/enable_education_screens_key"
android:title="@string/enable_education_screens_title"