Fix orientation change during entry edit

This commit is contained in:
J-Jamet
2019-09-23 17:40:53 +02:00
parent 9c9980bba6
commit f95b514b41
4 changed files with 14 additions and 6 deletions

View File

@@ -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) }
}
/**

View File

@@ -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

View File

@@ -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
}

View File

@@ -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)
}
/**