diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/template/Template.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/template/Template.kt index 163da4fc1..52f47900b 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/template/Template.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/template/Template.kt @@ -120,7 +120,7 @@ class Template : Parcelable { val mainSection = TemplateSection(ArrayList().apply { add(TemplateAttribute(LABEL_USERNAME, TemplateAttributeType.INLINE)) add(TemplateAttribute(LABEL_PASSWORD, - TemplateAttributeType.INLINE, + TemplateAttributeType.SMALL_MULTILINE, true, "", TemplateAttributeAction.PASSWORD_GENERATION) diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/template/TemplateAttributeType.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/template/TemplateAttributeType.kt index 5d5ad6e81..c1c685ddb 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/template/TemplateAttributeType.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/template/TemplateAttributeType.kt @@ -20,6 +20,7 @@ package com.kunzisoft.keepass.database.element.template enum class TemplateAttributeType { INLINE, + SMALL_MULTILINE, MULTILINE, DATE, TIME, diff --git a/app/src/main/java/com/kunzisoft/keepass/view/EntryEditFieldView.kt b/app/src/main/java/com/kunzisoft/keepass/view/EntryEditFieldView.kt index 4a88f6181..a3737b834 100644 --- a/app/src/main/java/com/kunzisoft/keepass/view/EntryEditFieldView.kt +++ b/app/src/main/java/com/kunzisoft/keepass/view/EntryEditFieldView.kt @@ -1,6 +1,7 @@ package com.kunzisoft.keepass.view import android.content.Context +import android.text.InputType import android.text.method.PasswordTransformationMethod import android.util.AttributeSet import android.util.TypedValue @@ -123,11 +124,19 @@ class EntryEditFieldView @JvmOverloads constructor(context: Context, fun setType(valueType: TextType) { when (valueType) { TextType.NORMAL -> { - valueView.inputType = valueView.inputType or EditorInfo.TYPE_TEXT_VARIATION_NORMAL + valueView.inputType = valueView.inputType or + InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_NORMAL valueView.maxLines = 1 } + TextType.SMALL_MULTI_LINE -> { + valueView.inputType = valueView.inputType or + InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE + valueView.maxEms = 3 + valueView.maxLines = 3 + } TextType.MULTI_LINE -> { - valueView.inputType = valueView.inputType or EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE + valueView.inputType = valueView.inputType or + InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE valueView.maxEms = 40 valueView.maxLines = 40 } @@ -137,7 +146,7 @@ class EntryEditFieldView @JvmOverloads constructor(context: Context, fun setProtection(protection: Boolean, hiddenProtectedValue: Boolean) { if (protection) { labelView.endIconMode = TextInputLayout.END_ICON_PASSWORD_TOGGLE - valueView.inputType = valueView.inputType or EditorInfo.TYPE_TEXT_VARIATION_PASSWORD + valueView.inputType = valueView.inputType or InputType.TYPE_TEXT_VARIATION_PASSWORD labelView.editText?.transformationMethod = if (hiddenProtectedValue) PasswordTransformationMethod.getInstance() else @@ -155,6 +164,6 @@ class EntryEditFieldView @JvmOverloads constructor(context: Context, } enum class TextType { - NORMAL, MULTI_LINE + NORMAL, SMALL_MULTI_LINE, MULTI_LINE } } \ No newline at end of file diff --git a/app/src/main/java/com/kunzisoft/keepass/view/TemplateView.kt b/app/src/main/java/com/kunzisoft/keepass/view/TemplateView.kt index ae695383e..4162b7a03 100644 --- a/app/src/main/java/com/kunzisoft/keepass/view/TemplateView.kt +++ b/app/src/main/java/com/kunzisoft/keepass/view/TemplateView.kt @@ -153,7 +153,7 @@ class TemplateView @JvmOverloads constructor(context: Context, private fun buildViewForCustomField(field: Field): View? { val customFieldTemplateAttribute = TemplateAttribute( field.name, - TemplateAttributeType.INLINE, + TemplateAttributeType.MULTILINE, field.protectedValue.isProtected, field.protectedValue.stringValue, TemplateAttributeAction.CUSTOM_EDITION) @@ -166,6 +166,7 @@ class TemplateView @JvmOverloads constructor(context: Context, // Build main view depending on type val itemView: View? = when (templateAttribute.type) { TemplateAttributeType.INLINE, + TemplateAttributeType.SMALL_MULTILINE, TemplateAttributeType.MULTILINE -> { buildLinearTextView(templateAttribute, field) } @@ -197,6 +198,7 @@ class TemplateView @JvmOverloads constructor(context: Context, label = TemplateField.getLocalizedName(context, field.name) setProtection(field.protectedValue.isProtected, mHideProtectedValue) setType(when (templateAttribute.type) { + TemplateAttributeType.SMALL_MULTILINE -> EntryEditFieldView.TextType.SMALL_MULTI_LINE TemplateAttributeType.MULTILINE -> EntryEditFieldView.TextType.MULTI_LINE else -> EntryEditFieldView.TextType.NORMAL })