mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix custom data parcelable #1236
This commit is contained in:
@@ -41,6 +41,8 @@ class EntryFragment: DatabaseFragment() {
|
||||
private lateinit var attachmentsListView: RecyclerView
|
||||
private var attachmentsAdapter: EntryAttachmentsItemsAdapter? = null
|
||||
|
||||
private lateinit var customDataView: TextView
|
||||
|
||||
private lateinit var uuidContainerView: View
|
||||
private lateinit var uuidReferenceView: TextView
|
||||
|
||||
@@ -83,6 +85,9 @@ class EntryFragment: DatabaseFragment() {
|
||||
creationDateView = view.findViewById(R.id.entry_created)
|
||||
modificationDateView = view.findViewById(R.id.entry_modified)
|
||||
|
||||
// TODO Custom data
|
||||
// customDataView = view.findViewById(R.id.entry_custom_data)
|
||||
|
||||
uuidContainerView = view.findViewById(R.id.entry_UUID_container)
|
||||
uuidContainerView.apply {
|
||||
visibility = if (PreferencesUtil.showUUID(context)) View.VISIBLE else View.GONE
|
||||
@@ -154,11 +159,14 @@ class EntryFragment: DatabaseFragment() {
|
||||
assignAttachments(entryInfo?.attachments ?: listOf())
|
||||
|
||||
// Assign dates
|
||||
assignCreationDate(entryInfo?.creationTime)
|
||||
assignModificationDate(entryInfo?.lastModificationTime)
|
||||
creationDateView.text = entryInfo?.creationTime?.getDateTimeString(resources)
|
||||
modificationDateView.text = entryInfo?.lastModificationTime?.getDateTimeString(resources)
|
||||
|
||||
// TODO Custom data
|
||||
// customDataView.text = entryInfo?.customData?.toString()
|
||||
|
||||
// Assign special data
|
||||
assignUUID(entryInfo?.id)
|
||||
uuidReferenceView.text = UuidUtil.toHexString(entryInfo?.id)
|
||||
}
|
||||
|
||||
private fun showClipboardDialog() {
|
||||
@@ -189,18 +197,6 @@ class EntryFragment: DatabaseFragment() {
|
||||
templateView.reload()
|
||||
}
|
||||
|
||||
private fun assignCreationDate(date: DateInstant?) {
|
||||
creationDateView.text = date?.getDateTimeString(resources)
|
||||
}
|
||||
|
||||
private fun assignModificationDate(date: DateInstant?) {
|
||||
modificationDateView.text = date?.getDateTimeString(resources)
|
||||
}
|
||||
|
||||
private fun assignUUID(uuid: UUID?) {
|
||||
uuidReferenceView.text = UuidUtil.toHexString(uuid)
|
||||
}
|
||||
|
||||
/* -------------
|
||||
* Attachments
|
||||
* -------------
|
||||
|
||||
@@ -36,7 +36,10 @@ class CustomData : Parcelable {
|
||||
}
|
||||
|
||||
constructor(parcel: Parcel) {
|
||||
ParcelableUtil.readStringParcelableMap(parcel, CustomDataItem::class.java)
|
||||
mCustomDataItems.clear()
|
||||
mCustomDataItems.putAll(ParcelableUtil
|
||||
.readStringParcelableMap(parcel, CustomDataItem::class.java)
|
||||
)
|
||||
}
|
||||
|
||||
fun get(key: String): CustomDataItem? {
|
||||
@@ -65,6 +68,10 @@ class CustomData : Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return mCustomDataItems.toString()
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
ParcelableUtil.writeStringParcelableMap(parcel, flags, mCustomDataItems)
|
||||
}
|
||||
|
||||
@@ -21,6 +21,10 @@ class CustomDataItem : Parcelable {
|
||||
this.lastModificationTime = lastModificationTime
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return value
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(key)
|
||||
parcel.writeString(value)
|
||||
|
||||
@@ -109,6 +109,32 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- TODO Custom data
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/entry_custom_data_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="?attr/cardViewStyle">
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="@dimen/card_view_padding"
|
||||
android:orientation="vertical">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/entry_custom_data_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/custom_data"
|
||||
style="@style/KeepassDXStyle.TextAppearance.LabelTextStyle" />
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/entry_custom_data"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/KeepassDXStyle.TextAppearance.TextNode" />
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
-->
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/entry_UUID_container"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
<string name="entry_not_found">Could not find entry data.</string>
|
||||
<string name="entry_password">Password</string>
|
||||
<string name="tags">Tags</string>
|
||||
<string name="custom_data">Custom data</string>
|
||||
<string name="save">Save</string>
|
||||
<string name="entry_title">Title</string>
|
||||
<string name="entry_setup_otp">Set up one-time password</string>
|
||||
|
||||
Reference in New Issue
Block a user