mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Encapsulate template name
This commit is contained in:
@@ -11,9 +11,10 @@ import android.widget.TextView
|
||||
import com.kunzisoft.keepass.R
|
||||
import com.kunzisoft.keepass.database.element.Database
|
||||
import com.kunzisoft.keepass.database.element.template.Template
|
||||
import com.kunzisoft.keepass.database.element.template.TemplateField
|
||||
|
||||
|
||||
class TemplatesSelectorAdapter(context: Context,
|
||||
class TemplatesSelectorAdapter(private val context: Context,
|
||||
private val database: Database?,
|
||||
private var templates: List<Template>): BaseAdapter() {
|
||||
|
||||
@@ -44,7 +45,7 @@ class TemplatesSelectorAdapter(context: Context,
|
||||
holder.icon?.let { icon ->
|
||||
database?.iconDrawableFactory?.assignDatabaseIcon(icon, template.icon, mIconColor)
|
||||
}
|
||||
holder.name?.text = template.title
|
||||
holder.name?.text = TemplateField.getLocalizedName(context, template.title)
|
||||
|
||||
return templateView!!
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ object AutofillHelper {
|
||||
}
|
||||
}
|
||||
for (field in entryInfo.customFields) {
|
||||
if (field.name == TemplateField.LABEL_CARDHOLDER) {
|
||||
if (field.name == TemplateField.LABEL_HOLDER) {
|
||||
struct.ccNameId?.let { ccNameId ->
|
||||
builder.setValue(ccNameId, AutofillValue.forText(field.protectedValue.stringValue))
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ import kotlin.collections.ArrayList
|
||||
class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
|
||||
|
||||
private val urlAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_URL), TemplateAttributeType.INLINE)
|
||||
private val notesPlainAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_NOTES), TemplateAttributeType.MULTILINE)
|
||||
private val usernameAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_USERNAME), TemplateAttributeType.INLINE)
|
||||
private val cardholderAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_CARDHOLDER), TemplateAttributeType.INLINE)
|
||||
private val notesPlainAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_NOTES), TemplateAttributeType.MULTILINE)
|
||||
private val holderAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_HOLDER), TemplateAttributeType.INLINE)
|
||||
private val numberAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_NUMBER), TemplateAttributeType.INLINE)
|
||||
private val cvvAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_CVV), TemplateAttributeType.INLINE, true)
|
||||
private val pinAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_PIN), TemplateAttributeType.INLINE, true)
|
||||
@@ -25,7 +25,8 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
|
||||
private val publicKeyAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_PUBLIC_KEY), TemplateAttributeType.INLINE)
|
||||
private val privateKeyAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_PRIVATE_KEY), TemplateAttributeType.INLINE, true)
|
||||
private val seedAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_SEED), TemplateAttributeType.INLINE, true)
|
||||
private val bankAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_BANK), TemplateAttributeType.INLINE)
|
||||
private val bicAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_BIC), TemplateAttributeType.INLINE)
|
||||
private val ibanAttribute = TemplateAttribute(labelBuilder(TemplateField.LABEL_IBAN), TemplateAttributeType.INLINE)
|
||||
|
||||
val email: Template
|
||||
get() {
|
||||
@@ -97,7 +98,7 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
|
||||
add(numberAttribute)
|
||||
add(cvvAttribute)
|
||||
add(pinAttribute)
|
||||
add(cardholderAttribute)
|
||||
add(holderAttribute)
|
||||
add(expirationDateAttribute)
|
||||
})
|
||||
sections.add(mainSection)
|
||||
@@ -112,10 +113,13 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
|
||||
get() {
|
||||
val sections = ArrayList<TemplateSection>()
|
||||
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply {
|
||||
add(bankAttribute)
|
||||
add(nameAttribute)
|
||||
add(urlAttribute)
|
||||
add(usernameAttribute)
|
||||
add(passwordAttribute)
|
||||
add(holderAttribute)
|
||||
add(bicAttribute)
|
||||
add(ibanAttribute)
|
||||
})
|
||||
sections.add(mainSection)
|
||||
return Template(
|
||||
|
||||
@@ -16,8 +16,9 @@ object TemplateField {
|
||||
const val LABEL_EXPIRATION = "Expires"
|
||||
const val LABEL_NOTES = "Notes"
|
||||
|
||||
const val LABEL_DEBIT_CARD = "Debit Card"
|
||||
const val LABEL_CREDIT_CARD = "Credit Card"
|
||||
const val LABEL_CARDHOLDER = "Card holder"
|
||||
const val LABEL_HOLDER = "Holder"
|
||||
const val LABEL_NUMBER = "Number"
|
||||
const val LABEL_CVV = "CVV"
|
||||
const val LABEL_PIN = "PIN"
|
||||
@@ -29,12 +30,14 @@ object TemplateField {
|
||||
const val LABEL_EMAIL_ADDRESS = "E-mail address"
|
||||
const val LABEL_WIRELESS = "Wifi"
|
||||
const val LABEL_SSID = "SSID"
|
||||
const val LABEL_CRYPTOCURRENCY = "Crypto wallet"
|
||||
const val LABEL_CRYPTOCURRENCY = "Cryptocurrency wallet"
|
||||
const val LABEL_TOKEN = "Token"
|
||||
const val LABEL_PUBLIC_KEY = "Public key"
|
||||
const val LABEL_PRIVATE_KEY = "Private key"
|
||||
const val LABEL_SEED = "Seed"
|
||||
const val LABEL_BANK = "Bank"
|
||||
const val LABEL_BIC = "BIC"
|
||||
const val LABEL_IBAN = "IBAN"
|
||||
const val LABEL_SECURE_NOTE = "Secure Note"
|
||||
const val LABEL_MEMBERSHIP = "Membership"
|
||||
|
||||
@@ -66,11 +69,12 @@ object TemplateField {
|
||||
LABEL_EXPIRATION.equals(name, true) -> context.getString(R.string.entry_expires)
|
||||
LABEL_NOTES.equals(name, true) -> context.getString(R.string.entry_notes)
|
||||
|
||||
LABEL_CREDIT_CARD.equals(name, true) -> context.getString(R.string.credit_card)
|
||||
LABEL_CARDHOLDER.equals(name, true) -> context.getString(R.string.credit_card_cardholder)
|
||||
LABEL_NUMBER.equals(name, true) -> context.getString(R.string.credit_card_number)
|
||||
LABEL_CVV.equals(name, true) -> context.getString(R.string.credit_card_security_code)
|
||||
LABEL_PIN.equals(name, true) -> context.getString(R.string.credit_card_pin)
|
||||
LABEL_DEBIT_CARD.equals(name, true) -> context.getString(R.string.debit_credit_card)
|
||||
LABEL_CREDIT_CARD.equals(name, true) -> context.getString(R.string.debit_credit_card)
|
||||
LABEL_HOLDER.equals(name, true) -> context.getString(R.string.holder)
|
||||
LABEL_NUMBER.equals(name, true) -> context.getString(R.string.number)
|
||||
LABEL_CVV.equals(name, true) -> context.getString(R.string.card_verification_value)
|
||||
LABEL_PIN.equals(name, true) -> context.getString(R.string.personal_identification_number)
|
||||
LABEL_ID_CARD.equals(name, true) -> context.getString(R.string.id_card)
|
||||
LABEL_NAME.equals(name, true) -> context.getString(R.string.name)
|
||||
LABEL_PLACE_OF_ISSUE.equals(name, true) -> context.getString(R.string.place_of_issue)
|
||||
@@ -85,6 +89,8 @@ object TemplateField {
|
||||
LABEL_PRIVATE_KEY.equals(name, true) -> context.getString(R.string.private_key)
|
||||
LABEL_SEED.equals(name, true) -> context.getString(R.string.seed)
|
||||
LABEL_BANK.equals(name, true) -> context.getString(R.string.bank)
|
||||
LABEL_BIC.equals(name, true) -> context.getString(R.string.bank_identifier_code)
|
||||
LABEL_IBAN.equals(name, true) -> context.getString(R.string.international_bank_account_number)
|
||||
LABEL_SECURE_NOTE.equals(name, true) -> context.getString(R.string.secure_note)
|
||||
LABEL_MEMBERSHIP.equals(name, true) -> context.getString(R.string.membership)
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ class EntryInfo : NodeInfo {
|
||||
creditCard?.let { cc ->
|
||||
cc.cardholder?.let {
|
||||
val v = ProtectedString(false, it)
|
||||
addUniqueField(Field(TemplateField.LABEL_CARDHOLDER, v))
|
||||
addUniqueField(Field(TemplateField.LABEL_HOLDER, v))
|
||||
}
|
||||
cc.expiration?.let {
|
||||
expires = true
|
||||
|
||||
@@ -369,9 +369,9 @@
|
||||
<string name="otp_counter">Zähler</string>
|
||||
<string name="otp_digits">Stellen</string>
|
||||
<string name="otp_algorithm">Algorithmus</string>
|
||||
<string name="credit_card_cardholder">Karteninhaber</string>
|
||||
<string name="credit_card_number">Nummer</string>
|
||||
<string name="credit_card_security_code">Prüfnummer</string>
|
||||
<string name="holder">Karteninhaber</string>
|
||||
<string name="number">Nummer</string>
|
||||
<string name="card_verification_value">Prüfnummer</string>
|
||||
<string name="entry_otp">OTP</string>
|
||||
<string name="error_invalid_OTP">Ungültiges OTP-Geheimnis.</string>
|
||||
<string name="error_disallow_no_credentials">Mindestens eine Anmeldeinformation muss festgelegt sein.</string>
|
||||
|
||||
@@ -369,10 +369,10 @@
|
||||
<string name="otp_counter">Compteur</string>
|
||||
<string name="otp_digits">Chiffres</string>
|
||||
<string name="otp_algorithm">Algorithme</string>
|
||||
<string name="credit_card_cardholder">Titulaire de la carte</string>
|
||||
<string name="credit_card_number">Numéros</string>
|
||||
<string name="credit_card_security_code">CVV</string>
|
||||
<string name="credit_card_pin">PIN</string>
|
||||
<string name="holder">Titulaire</string>
|
||||
<string name="number">Numéros</string>
|
||||
<string name="card_verification_value">CVV</string>
|
||||
<string name="personal_identification_number">PIN</string>
|
||||
<string name="entry_otp">OTP</string>
|
||||
<string name="error_invalid_OTP">Secret OTP invalide.</string>
|
||||
<string name="error_disallow_no_credentials">Au moins un identifiant doit être défini.</string>
|
||||
|
||||
@@ -100,11 +100,11 @@
|
||||
<string name="otp_counter">Counter</string>
|
||||
<string name="otp_digits">Digits</string>
|
||||
<string name="otp_algorithm">Algorithm</string>
|
||||
<string name="credit_card">Credit Card</string>
|
||||
<string name="credit_card_cardholder">Cardholder</string>
|
||||
<string name="credit_card_number">Number</string>
|
||||
<string name="credit_card_security_code">CVV</string>
|
||||
<string name="credit_card_pin">PIN</string>
|
||||
<string name="debit_credit_card">Debit / Credit Card</string>
|
||||
<string name="holder">Holder</string>
|
||||
<string name="number">Number</string>
|
||||
<string name="card_verification_value">CVV</string>
|
||||
<string name="personal_identification_number">PIN</string>
|
||||
<string name="id_card">ID Card</string>
|
||||
<string name="name">Name</string>
|
||||
<string name="place_of_issue">Place of issue</string>
|
||||
@@ -119,6 +119,9 @@
|
||||
<string name="private_key">Private key</string>
|
||||
<string name="seed">Seed</string>
|
||||
<string name="bank">Bank</string>
|
||||
<string name="bank_name">Bank name</string>
|
||||
<string name="bank_identifier_code">SWIFT / BIC</string>
|
||||
<string name="international_bank_account_number">IBAN</string>
|
||||
<string name="secure_note">Secure Note</string>
|
||||
<string name="membership">Membership</string>
|
||||
<string name="standard">Standard</string>
|
||||
|
||||
Reference in New Issue
Block a user