mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix orientation change during entry edit
This commit is contained in:
@@ -181,7 +181,9 @@ class EntryEditActivity : LockingHideActivity(),
|
||||
password = newEntry.password
|
||||
notes = newEntry.notes
|
||||
for (entry in newEntry.customFields.entries) {
|
||||
addNewCustomField(entry.key, entry.value)
|
||||
post {
|
||||
addNewCustomField(entry.key, entry.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,6 +195,7 @@ class EntryEditActivity : LockingHideActivity(),
|
||||
newEntry.apply {
|
||||
// Build info from view
|
||||
entryEditContentsView?.let { entryView ->
|
||||
removeAllFields()
|
||||
title = entryView.title
|
||||
username = entryView.username
|
||||
url = entryView.url
|
||||
@@ -226,8 +229,6 @@ class EntryEditActivity : LockingHideActivity(),
|
||||
*/
|
||||
private fun addNewCustomField() {
|
||||
entryEditContentsView?.addNewCustomField()
|
||||
// Scroll bottom
|
||||
scrollView?.post { scrollView?.fullScroll(ScrollView.FOCUS_DOWN) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -241,6 +241,10 @@ class EntryVersioned : NodeVersioned, PwEntryInterface<GroupVersioned> {
|
||||
return pwEntryV4?.allowCustomFields() ?: false
|
||||
}
|
||||
|
||||
fun removeAllFields() {
|
||||
pwEntryV4?.removeAllFields()
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an extra field to the list (standard or custom)
|
||||
* @param label Label of field, must be unique
|
||||
|
||||
@@ -264,6 +264,10 @@ class PwEntryV4 : PwEntry<PwGroupV4, PwEntryV4>, PwNodeV4Interface {
|
||||
return true
|
||||
}
|
||||
|
||||
fun removeAllFields() {
|
||||
fields.clear()
|
||||
}
|
||||
|
||||
fun addExtraField(label: String, value: ProtectedString) {
|
||||
fields[label] = value
|
||||
}
|
||||
|
||||
@@ -172,10 +172,9 @@ class EntryEditContentsView @JvmOverloads constructor(context: Context,
|
||||
val entryEditCustomField = EntryEditCustomField(context).apply {
|
||||
setData(name, value)
|
||||
setFontVisibility(fontInVisibility)
|
||||
requestFocus()
|
||||
}
|
||||
entryExtraFieldsContainer.post {
|
||||
entryExtraFieldsContainer.addView(entryEditCustomField)
|
||||
}
|
||||
entryExtraFieldsContainer.addView(entryEditCustomField)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user