Replace ArrayList by mutableList

This commit is contained in:
J-Jamet
2021-07-02 19:25:30 +02:00
parent e95e7218f6
commit 8703684740
2 changed files with 21 additions and 19 deletions

View File

@@ -122,8 +122,8 @@ class Template : Parcelable {
val STANDARD: Template val STANDARD: Template
get() { get() {
val sections = ArrayList<TemplateSection>() val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply { val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(USERNAME_ATTRIBUTE) add(USERNAME_ATTRIBUTE)
add(PASSWORD_ATTRIBUTE) add(PASSWORD_ATTRIBUTE)
add(URL_ATTRIBUTE) add(URL_ATTRIBUTE)
@@ -140,8 +140,8 @@ class Template : Parcelable {
val CREATION: Template val CREATION: Template
get() { get() {
val sections = ArrayList<TemplateSection>() val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply { val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
// Dynamic part // Dynamic part
}) })
sections.add(mainSection) sections.add(mainSection)

View File

@@ -3,7 +3,6 @@ package com.kunzisoft.keepass.database.element.template
import com.kunzisoft.keepass.database.element.icon.IconImage import com.kunzisoft.keepass.database.element.icon.IconImage
import com.kunzisoft.keepass.database.element.icon.IconImageStandard import com.kunzisoft.keepass.database.element.icon.IconImageStandard
import java.util.* import java.util.*
import kotlin.collections.ArrayList
class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) { class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
@@ -30,8 +29,8 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val email: Template val email: Template
get() { get() {
val sections = ArrayList<TemplateSection>() val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply { val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(emailAddressAttribute) add(emailAddressAttribute)
add(urlAttribute) add(urlAttribute)
add(passwordAttribute) add(passwordAttribute)
@@ -46,8 +45,8 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val wifi: Template val wifi: Template
get() { get() {
val sections = ArrayList<TemplateSection>() val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply { val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(ssidAttribute) add(ssidAttribute)
add(passwordAttribute) add(passwordAttribute)
}) })
@@ -61,8 +60,8 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val notes: Template val notes: Template
get() { get() {
val sections = ArrayList<TemplateSection>() val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply { val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(notesPlainAttribute) add(notesPlainAttribute)
}) })
sections.add(mainSection) sections.add(mainSection)
@@ -75,8 +74,8 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val idCard: Template val idCard: Template
get() { get() {
val sections = ArrayList<TemplateSection>() val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply { val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(numberAttribute) add(numberAttribute)
add(nameAttribute) add(nameAttribute)
add(placeOfIssueAttribute) add(placeOfIssueAttribute)
@@ -93,8 +92,8 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val creditCard: Template val creditCard: Template
get() { get() {
val sections = ArrayList<TemplateSection>() val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply { val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(numberAttribute) add(numberAttribute)
add(cvvAttribute) add(cvvAttribute)
add(pinAttribute) add(pinAttribute)
@@ -111,17 +110,20 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val bank: Template val bank: Template
get() { get() {
val sections = ArrayList<TemplateSection>() val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply { val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(nameAttribute) add(nameAttribute)
add(urlAttribute) add(urlAttribute)
add(usernameAttribute) add(usernameAttribute)
add(passwordAttribute) add(passwordAttribute)
})
val ibanSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(holderAttribute) add(holderAttribute)
add(bicAttribute) add(bicAttribute)
add(ibanAttribute) add(ibanAttribute)
}) })
sections.add(mainSection) sections.add(mainSection)
sections.add(ibanSection)
return Template( return Template(
UUID.randomUUID(), UUID.randomUUID(),
TemplateField.LABEL_BANK, TemplateField.LABEL_BANK,
@@ -131,8 +133,8 @@ class TemplateBuilder(labelBuilder: (plainLabel: String) -> String) {
val cryptocurrency: Template val cryptocurrency: Template
get() { get() {
val sections = ArrayList<TemplateSection>() val sections = mutableListOf<TemplateSection>()
val mainSection = TemplateSection(ArrayList<TemplateAttribute>().apply { val mainSection = TemplateSection(mutableListOf<TemplateAttribute>().apply {
add(tokenAttribute) add(tokenAttribute)
add(publicKeyAttribute) add(publicKeyAttribute)
add(privateKeyAttribute) add(privateKeyAttribute)