mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
New icon to create extra field and fix focus
This commit is contained in:
@@ -297,9 +297,10 @@ class EntryEditActivity : LockingActivity(),
|
|||||||
if (expires)
|
if (expires)
|
||||||
expiresDate = newEntry.expiryTime
|
expiresDate = newEntry.expiryTime
|
||||||
notes = newEntry.notes
|
notes = newEntry.notes
|
||||||
for ((key, value) in newEntry.customFields) {
|
|
||||||
putCustomField(Field(key, value))
|
assignExtraFields(newEntry.customFields.mapTo(ArrayList()) {
|
||||||
}
|
Field(it.key, it.value)
|
||||||
|
})
|
||||||
assignAttachments(newEntry.getAttachments())
|
assignAttachments(newEntry.getAttachments())
|
||||||
onAttachmentDeleted { attachment, _ ->
|
onAttachmentDeleted { attachment, _ ->
|
||||||
newEntry.removeAttachment(attachment)
|
newEntry.removeAttachment(attachment)
|
||||||
@@ -355,16 +356,16 @@ class EntryEditActivity : LockingActivity(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun scrollToView(view: View?) {
|
private fun scrollToView(view: View?) {
|
||||||
view?.post {
|
view?.postDelayed({
|
||||||
view.requestFocus()
|
view.requestFocus()
|
||||||
scrollView?.post {
|
scrollView?.post {
|
||||||
scrollView?.smoothScrollTo(0, view.bottom)
|
scrollView?.smoothScrollTo(0, view.bottom)
|
||||||
}
|
}
|
||||||
}
|
}, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNewCustomFieldApproved(label: String, protection: Boolean) {
|
override fun onNewCustomFieldApproved(label: String, protection: Boolean) {
|
||||||
val customFieldView = entryEditContentsView?.putCustomField(
|
val customFieldView = entryEditContentsView?.putExtraField(
|
||||||
Field(label, ProtectedString(protection))
|
Field(label, ProtectedString(protection))
|
||||||
)
|
)
|
||||||
scrollToView(customFieldView)
|
scrollToView(customFieldView)
|
||||||
@@ -494,7 +495,7 @@ class EntryEditActivity : LockingActivity(),
|
|||||||
// Update the otp field with otpauth:// url
|
// Update the otp field with otpauth:// url
|
||||||
val otpField = OtpEntryFields.buildOtpField(otpElement,
|
val otpField = OtpEntryFields.buildOtpField(otpElement,
|
||||||
mEntry?.title, mEntry?.username)
|
mEntry?.title, mEntry?.username)
|
||||||
val otpCustomView = entryEditContentsView?.putCustomField(otpField)
|
val otpCustomView = entryEditContentsView?.putExtraField(otpField)
|
||||||
scrollToView(otpCustomView)
|
scrollToView(otpCustomView)
|
||||||
mEntry?.putExtraField(otpField.name, otpField.protectedValue)
|
mEntry?.putExtraField(otpField.name, otpField.protectedValue)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,9 +250,22 @@ class EntryEditContentsView @JvmOverloads constructor(context: Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a custom field or create a new one if doesn't exists
|
* Remove all children and add new views for each field
|
||||||
*/
|
*/
|
||||||
fun putCustomField(customField: Field)
|
fun assignExtraFields(fields: List<Field>) {
|
||||||
|
entryExtraFieldsContainer.removeAllViews()
|
||||||
|
fields.forEach { extraField ->
|
||||||
|
entryExtraFieldsContainer.addView(EntryEditExtraField(context).apply {
|
||||||
|
setFontVisibility(fontInVisibility)
|
||||||
|
customField = extraField
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update an extra field or create a new one if doesn't exists
|
||||||
|
*/
|
||||||
|
fun putExtraField(customField: Field)
|
||||||
: EntryEditExtraField {
|
: EntryEditExtraField {
|
||||||
var extraFieldView = getCustomFieldByLabel(customField.name)
|
var extraFieldView = getCustomFieldByLabel(customField.name)
|
||||||
// Create new view if not exists
|
// Create new view if not exists
|
||||||
@@ -260,9 +273,7 @@ class EntryEditContentsView @JvmOverloads constructor(context: Context,
|
|||||||
extraFieldView = EntryEditExtraField(context)
|
extraFieldView = EntryEditExtraField(context)
|
||||||
extraFieldView.setFontVisibility(fontInVisibility)
|
extraFieldView.setFontVisibility(fontInVisibility)
|
||||||
// No need animation because of scroll
|
// No need animation because of scroll
|
||||||
entryExtraFieldsContainer.apply {
|
entryExtraFieldsContainer.addView(extraFieldView)
|
||||||
addView(extraFieldView)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
extraFieldView.customField = customField
|
extraFieldView.customField = customField
|
||||||
return extraFieldView
|
return extraFieldView
|
||||||
|
|||||||
@@ -4,16 +4,10 @@
|
|||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24">
|
||||||
|
|
||||||
<group>
|
<group>
|
||||||
<path
|
<path
|
||||||
android:fillColor="#fffbfb"
|
android:fillColor="#fffbfb"
|
||||||
android:pathData="M 18 3 L 18 6 L 15 6 L 15 8 L 18 8 L 18 11 L 20 11 L 20 8 L 23 8 L 23 6 L 20 6 L
|
android:strokeWidth="4"
|
||||||
20 3 L 18 3 z M 4 6 C 2.8920005 6 2.0000002 6.8920005 2 8 L 2 18 C 1.9999998
|
android:pathData="M 4 5 L 4 7 L 20 7 L 20 5 L 4 5 z M 4 9 L 4 11 L 20 11 L 20 9 L 4 9 z M 4 17 L 4 19 L 20 19 L 20 17 L 4 17 z" />
|
||||||
19.108 2.8920005 20 4 20 L 18 20 C 19.108 20 19.999999 19.108 20 18 L 20 13 L 18
|
|
||||||
13 L 18 16.533203 C 17.999999 17.345736 17.345736 18 16.533203 18 L 5.4667969 18
|
|
||||||
C 4.6542635 18 3.9999998 17.345736 4 16.533203 L 4 9.4667969 C 4.0000002
|
|
||||||
8.6542635 4.6542635 8 5.4667969 8 L 13 8 L 13 6 L 4 6 z M 5 10 L 5 12 L 17 12 L
|
|
||||||
17 10 L 5 10 z M 5 14 L 5 16 L 17 16 L 17 14 L 5 14 z" />
|
|
||||||
</group>
|
</group>
|
||||||
</vector>
|
</vector>
|
||||||
@@ -28,8 +28,8 @@
|
|||||||
inkscape:pageopacity="0"
|
inkscape:pageopacity="0"
|
||||||
inkscape:pageshadow="2"
|
inkscape:pageshadow="2"
|
||||||
inkscape:zoom="16"
|
inkscape:zoom="16"
|
||||||
inkscape:cx="5.9715813"
|
inkscape:cx="23.528681"
|
||||||
inkscape:cy="15.414365"
|
inkscape:cy="13.907428"
|
||||||
inkscape:current-layer="g4770"
|
inkscape:current-layer="g4770"
|
||||||
showgrid="true"
|
showgrid="true"
|
||||||
inkscape:grid-bbox="true"
|
inkscape:grid-bbox="true"
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
<dc:format>image/svg+xml</dc:format>
|
<dc:format>image/svg+xml</dc:format>
|
||||||
<dc:type
|
<dc:type
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
<dc:title></dc:title>
|
<dc:title />
|
||||||
</cc:Work>
|
</cc:Work>
|
||||||
</rdf:RDF>
|
</rdf:RDF>
|
||||||
</metadata>
|
</metadata>
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
transform="matrix(-0.00397893,0,0,0.00397893,125.58386,23.674135)" />
|
transform="matrix(-0.00397893,0,0,0.00397893,125.58386,23.674135)" />
|
||||||
<path
|
<path
|
||||||
style="fill:#fffbfb;fill-opacity:1;stroke:none;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
style="fill:#fffbfb;fill-opacity:1;stroke:none;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||||
d="M 18 3 L 18 6 L 15 6 L 15 8 L 18 8 L 18 11 L 20 11 L 20 8 L 23 8 L 23 6 L 20 6 L 20 3 L 18 3 z M 4 6 C 2.8920005 6 2.0000002 6.8920005 2 8 L 2 18 C 1.9999998 19.108 2.8920005 20 4 20 L 18 20 C 19.108 20 19.999999 19.108 20 18 L 20 13 L 18 13 L 18 16.533203 C 17.999999 17.345736 17.345736 18 16.533203 18 L 5.4667969 18 C 4.6542635 18 3.9999998 17.345736 4 16.533203 L 4 9.4667969 C 4.0000002 8.6542635 4.6542635 8 5.4667969 8 L 13 8 L 13 6 L 4 6 z M 5 10 L 5 12 L 17 12 L 17 10 L 5 10 z M 5 14 L 5 16 L 17 16 L 17 14 L 5 14 z "
|
d="M 4 5 L 4 7 L 20 7 L 20 5 L 4 5 z M 4 9 L 4 11 L 20 11 L 20 9 L 4 9 z M 4 17 L 4 19 L 20 19 L 20 17 L 4 17 z "
|
||||||
transform="matrix(0.56249999,0,0,0.56249999,115.58498,22.498806)"
|
transform="matrix(0.56249999,0,0,0.56249999,115.58498,22.498806)"
|
||||||
id="rect899" />
|
id="rect899" />
|
||||||
</g>
|
</g>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 2.9 KiB |
Reference in New Issue
Block a user