mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix title
This commit is contained in:
@@ -98,54 +98,61 @@ class TemplateView @JvmOverloads constructor(context: Context,
|
|||||||
customFieldsContainerView.removeAllViews()
|
customFieldsContainerView.removeAllViews()
|
||||||
mCustomFieldIds.clear()
|
mCustomFieldIds.clear()
|
||||||
|
|
||||||
findViewById<View?>(R.id.entry_edit_title)?.tag = FIELD_TITLE_TAG
|
mTemplate?.let { template ->
|
||||||
|
|
||||||
mTemplate?.sections?.forEach { templateSection ->
|
findViewById<EntryEditFieldView?>(R.id.entry_edit_title)?.apply {
|
||||||
|
tag = FIELD_TITLE_TAG
|
||||||
|
id = TemplateField.LABEL_TITLE.hashCode()
|
||||||
|
label = TemplateField.getLocalizedName(context, TemplateField.LABEL_TITLE)
|
||||||
|
}
|
||||||
|
|
||||||
val sectionView = SectionView(context, null, R.attr.cardViewStyle)
|
template.sections.forEach { templateSection ->
|
||||||
// Add build view to parent
|
|
||||||
templateContainerView.addView(sectionView)
|
|
||||||
|
|
||||||
// Build each attribute
|
val sectionView = SectionView(context, null, R.attr.cardViewStyle)
|
||||||
templateSection.attributes.forEach { templateAttribute ->
|
// Add build view to parent
|
||||||
val fieldTag: String
|
templateContainerView.addView(sectionView)
|
||||||
when {
|
|
||||||
templateAttribute.label.equals(TemplateField.LABEL_TITLE, true) -> {
|
// Build each attribute
|
||||||
throw Exception("title cannot be in template attribute")
|
templateSection.attributes.forEach { templateAttribute ->
|
||||||
}
|
val fieldTag: String
|
||||||
templateAttribute.label.equals(TemplateField.LABEL_USERNAME, true) -> {
|
when {
|
||||||
fieldTag = FIELD_USERNAME_TAG
|
templateAttribute.label.equals(TemplateField.LABEL_TITLE, true) -> {
|
||||||
}
|
throw Exception("title cannot be in template attribute")
|
||||||
templateAttribute.label.equals(TemplateField.LABEL_PASSWORD, true) -> {
|
}
|
||||||
fieldTag = FIELD_PASSWORD_TAG
|
templateAttribute.label.equals(TemplateField.LABEL_USERNAME, true) -> {
|
||||||
}
|
fieldTag = FIELD_USERNAME_TAG
|
||||||
templateAttribute.label.equals(TemplateField.LABEL_URL, true) -> {
|
}
|
||||||
fieldTag = FIELD_URL_TAG
|
templateAttribute.label.equals(TemplateField.LABEL_PASSWORD, true) -> {
|
||||||
}
|
fieldTag = FIELD_PASSWORD_TAG
|
||||||
templateAttribute.label.equals(
|
}
|
||||||
TemplateField.LABEL_EXPIRATION,
|
templateAttribute.label.equals(TemplateField.LABEL_URL, true) -> {
|
||||||
true
|
fieldTag = FIELD_URL_TAG
|
||||||
) -> {
|
}
|
||||||
fieldTag = FIELD_EXPIRES_TAG
|
templateAttribute.label.equals(
|
||||||
}
|
TemplateField.LABEL_EXPIRATION,
|
||||||
templateAttribute.label.equals(TemplateField.LABEL_NOTES, true) -> {
|
true
|
||||||
fieldTag = FIELD_NOTES_TAG
|
) -> {
|
||||||
}
|
fieldTag = FIELD_EXPIRES_TAG
|
||||||
else -> {
|
}
|
||||||
fieldTag = FIELD_CUSTOM_TAG
|
templateAttribute.label.equals(TemplateField.LABEL_NOTES, true) -> {
|
||||||
|
fieldTag = FIELD_NOTES_TAG
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
fieldTag = FIELD_CUSTOM_TAG
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val attributeView = buildViewForTemplateField(
|
||||||
|
templateAttribute,
|
||||||
|
Field(
|
||||||
|
templateAttribute.label,
|
||||||
|
ProtectedString(templateAttribute.protected, "")
|
||||||
|
),
|
||||||
|
fieldTag
|
||||||
|
)
|
||||||
|
// Add created view to this parent
|
||||||
|
sectionView.addView(attributeView)
|
||||||
}
|
}
|
||||||
|
|
||||||
val attributeView = buildViewForTemplateField(
|
|
||||||
templateAttribute,
|
|
||||||
Field(
|
|
||||||
templateAttribute.label,
|
|
||||||
ProtectedString(templateAttribute.protected, "")
|
|
||||||
),
|
|
||||||
fieldTag
|
|
||||||
)
|
|
||||||
// Add created view to this parent
|
|
||||||
sectionView.addView(attributeView)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user