mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Show UUID in group
This commit is contained in:
@@ -23,6 +23,7 @@ import android.app.Dialog
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
@@ -30,6 +31,7 @@ import com.kunzisoft.keepass.R
|
||||
import com.kunzisoft.keepass.database.element.Database
|
||||
import com.kunzisoft.keepass.database.element.icon.IconImage
|
||||
import com.kunzisoft.keepass.model.GroupInfo
|
||||
import com.kunzisoft.keepass.settings.PreferencesUtil
|
||||
import com.kunzisoft.keepass.view.DateTimeFieldView
|
||||
|
||||
class GroupDialogFragment : DatabaseDialogFragment() {
|
||||
@@ -45,6 +47,8 @@ class GroupDialogFragment : DatabaseDialogFragment() {
|
||||
private lateinit var expirationView: DateTimeFieldView
|
||||
private lateinit var creationView: TextView
|
||||
private lateinit var modificationView: TextView
|
||||
private lateinit var uuidContainerView: ViewGroup
|
||||
private lateinit var uuidReferenceView: TextView
|
||||
|
||||
override fun onDatabaseRetrieved(database: Database?) {
|
||||
super.onDatabaseRetrieved(database)
|
||||
@@ -64,6 +68,8 @@ class GroupDialogFragment : DatabaseDialogFragment() {
|
||||
expirationView = root.findViewById(R.id.group_expiration)
|
||||
creationView = root.findViewById(R.id.group_created)
|
||||
modificationView = root.findViewById(R.id.group_modified)
|
||||
uuidContainerView = root.findViewById(R.id.group_UUID_container)
|
||||
uuidReferenceView = root.findViewById(R.id.group_UUID_reference)
|
||||
|
||||
// Retrieve the textColor to tint the icon
|
||||
val ta = activity.theme.obtainStyledAttributes(intArrayOf(R.attr.colorAccent))
|
||||
@@ -96,6 +102,15 @@ class GroupDialogFragment : DatabaseDialogFragment() {
|
||||
expirationView.dateTime = mGroupInfo.expiryTime
|
||||
creationView.text = mGroupInfo.creationTime.getDateTimeString(resources)
|
||||
modificationView.text = mGroupInfo.lastModificationTime.getDateTimeString(resources)
|
||||
val uuid = mGroupInfo.id
|
||||
if (uuid == null || uuid.isEmpty()) {
|
||||
uuidContainerView.visibility = View.GONE
|
||||
} else {
|
||||
uuidReferenceView.text = uuid
|
||||
uuidContainerView.apply {
|
||||
visibility = if (PreferencesUtil.showUUID(context)) View.VISIBLE else View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
val builder = AlertDialog.Builder(activity)
|
||||
builder.setView(root)
|
||||
|
||||
@@ -42,7 +42,6 @@ class EntryFragment: DatabaseFragment() {
|
||||
private var attachmentsAdapter: EntryAttachmentsItemsAdapter? = null
|
||||
|
||||
private lateinit var uuidContainerView: View
|
||||
private lateinit var uuidView: TextView
|
||||
private lateinit var uuidReferenceView: TextView
|
||||
|
||||
private var mClipboardHelper: ClipboardHelper? = null
|
||||
@@ -88,7 +87,6 @@ class EntryFragment: DatabaseFragment() {
|
||||
uuidContainerView.apply {
|
||||
visibility = if (PreferencesUtil.showUUID(context)) View.VISIBLE else View.GONE
|
||||
}
|
||||
uuidView = view.findViewById(R.id.entry_UUID)
|
||||
uuidReferenceView = view.findViewById(R.id.entry_UUID_reference)
|
||||
|
||||
mEntryViewModel.entryInfoHistory.observe(viewLifecycleOwner) { entryInfoHistory ->
|
||||
@@ -200,7 +198,6 @@ class EntryFragment: DatabaseFragment() {
|
||||
}
|
||||
|
||||
private fun assignUUID(uuid: UUID?) {
|
||||
uuidView.text = uuid?.toString()
|
||||
uuidReferenceView.text = UuidUtil.toHexString(uuid)
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.kunzisoft.keepass.database.element.node.*
|
||||
import com.kunzisoft.keepass.model.EntryInfo
|
||||
import com.kunzisoft.keepass.model.GroupInfo
|
||||
import com.kunzisoft.keepass.settings.PreferencesUtil
|
||||
import com.kunzisoft.keepass.utils.UuidUtil
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
@@ -453,6 +454,7 @@ class Group : Node, GroupVersionedInterface<Group, Entry> {
|
||||
|
||||
fun getGroupInfo(): GroupInfo {
|
||||
val groupInfo = GroupInfo()
|
||||
groupInfo.id = groupKDB?.nodeId ?.toString() ?: UuidUtil.toHexString(groupKDBX?.nodeId?.id)
|
||||
groupInfo.title = title
|
||||
groupInfo.icon = icon
|
||||
groupInfo.creationTime = creationTime
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.kunzisoft.keepass.database.element.icon.IconImageStandard.Companion.F
|
||||
|
||||
class GroupInfo : NodeInfo {
|
||||
|
||||
var id: String? = null
|
||||
var notes: String? = null
|
||||
|
||||
init {
|
||||
@@ -16,11 +17,13 @@ class GroupInfo : NodeInfo {
|
||||
constructor(): super()
|
||||
|
||||
constructor(parcel: Parcel): super(parcel) {
|
||||
id = parcel.readString()
|
||||
notes = parcel.readString()
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
super.writeToParcel(parcel, flags)
|
||||
parcel.writeString(id)
|
||||
parcel.writeString(notes)
|
||||
}
|
||||
|
||||
@@ -29,6 +32,7 @@ class GroupInfo : NodeInfo {
|
||||
if (other !is GroupInfo) return false
|
||||
if (!super.equals(other)) return false
|
||||
|
||||
if (id != other.id) return false
|
||||
if (notes != other.notes) return false
|
||||
|
||||
return true
|
||||
@@ -36,6 +40,7 @@ class GroupInfo : NodeInfo {
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = super.hashCode()
|
||||
result = 31 * result + (id?.hashCode() ?: 0)
|
||||
result = 31 * result + (notes?.hashCode() ?: 0)
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class TextFieldView @JvmOverloads constructor(context: Context,
|
||||
}
|
||||
private val valueView = AppCompatTextView(context).apply {
|
||||
setTextAppearance(context,
|
||||
R.style.KeepassDXStyle_TextAppearance_TextEntryItem)
|
||||
R.style.KeepassDXStyle_TextAppearance_TextNode)
|
||||
layoutParams = LayoutParams(
|
||||
LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.WRAP_CONTENT).also {
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
android:id="@+id/entry_created"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem" />
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode" />
|
||||
|
||||
<!-- Modified -->
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
@@ -90,7 +90,7 @@
|
||||
android:id="@+id/entry_modified"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem" />
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode" />
|
||||
|
||||
<!-- Accessed -->
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
@@ -127,16 +127,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/entry_UUID"
|
||||
style="@style/KeepassDXStyle.TextAppearance.LabelTextStyle" />
|
||||
<HorizontalScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/entry_UUID"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textIsSelectable="true"
|
||||
style="@style/KeepassDXStyle.TextAppearance.LabelTextStyle" />
|
||||
</HorizontalScrollView>
|
||||
<HorizontalScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@@ -145,7 +135,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textIsSelectable="true"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem" />
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode" />
|
||||
</HorizontalScrollView>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textMultiLine"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem" />
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode" />
|
||||
|
||||
<!-- Expiration -->
|
||||
<com.kunzisoft.keepass.view.DateTimeFieldView
|
||||
@@ -101,7 +101,7 @@
|
||||
android:id="@+id/group_created"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem" />
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode" />
|
||||
|
||||
<!-- Modified -->
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
@@ -114,7 +114,31 @@
|
||||
android:id="@+id/group_modified"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem" />
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode" />
|
||||
|
||||
<!-- UUID -->
|
||||
<LinearLayout
|
||||
android:id="@+id/group_UUID_container"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/group_UUID_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/entry_UUID"
|
||||
style="@style/KeepassDXStyle.TextAppearance.LabelTextStyle" />
|
||||
<HorizontalScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/group_UUID_reference"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textIsSelectable="true"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode" />
|
||||
</HorizontalScrollView>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/item_attachment_title"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toStartOf="@+id/item_attachment_size_container"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/entry_history_last_modified"
|
||||
tools:text = "Last Modified"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode"
|
||||
android:gravity="center"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -38,7 +38,7 @@
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/entry_history_title"
|
||||
tools:text = "Title"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode"
|
||||
android:maxLines="6"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
@@ -49,7 +49,7 @@
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/entry_history_username"
|
||||
tools:text = "Username"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode"
|
||||
android:maxLines="6"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
|
||||
@@ -26,6 +26,6 @@
|
||||
android:id="@+id/date_time_value"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem" />
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -20,7 +20,7 @@
|
||||
android:focusable="false"
|
||||
android:cursorVisible="false"
|
||||
android:focusableInTouchMode="false"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode"
|
||||
tools:text="2020-03-04 05:00" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
||||
@@ -481,7 +481,7 @@
|
||||
<item name="android:textSize">12sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
<style name="KeepassDXStyle.TextAppearance.TextEntryItem" parent="KeepassDXStyle.TextAppearance">
|
||||
<style name="KeepassDXStyle.TextAppearance.TextNode" parent="KeepassDXStyle.TextAppearance">
|
||||
<item name="android:layout_marginTop">4dp</item>
|
||||
<item name="android:layout_marginBottom">4dp</item>
|
||||
<item name="android:paddingLeft">8dp</item>
|
||||
|
||||
Reference in New Issue
Block a user