Refactor edit fragment code

This commit is contained in:
J-Jamet
2020-09-15 20:16:40 +02:00
parent 23c8735568
commit 6e99b667af

View File

@@ -53,7 +53,6 @@ import org.joda.time.Instant
class EntryEditFragment: StylishFragment() {
private var fontInVisibility: Boolean = false
private lateinit var entryTitleLayoutView: TextInputLayout
private lateinit var entryTitleView: EditText
@@ -73,9 +72,11 @@ class EntryEditFragment: StylishFragment() {
private lateinit var attachmentsAdapter: EntryAttachmentsItemsAdapter
private var fontInVisibility: Boolean = false
private var iconColor: Int = 0
private var expiresInstant: DateInstant = DateInstant(Instant.now().plus(Duration.standardDays(30)).toDate())
var drawFactory: IconDrawableFactory? = null
var setOnDateClickListener: View.OnClickListener? = null
var setOnPasswordGeneratorClickListener: View.OnClickListener? = null
var setOnIconViewClickListener: View.OnClickListener? = null
@@ -180,7 +181,6 @@ class EntryEditFragment: StylishFragment() {
}
private fun populateViewsWithEntry() {
try {
// Set info in view
icon = mEntryInfo.icon
title = mEntryInfo.title
@@ -196,11 +196,9 @@ class EntryEditFragment: StylishFragment() {
assignAttachments(mEntryInfo.attachments, StreamDirection.UPLOAD) { attachment ->
setOnRemoveAttachment?.invoke(attachment)
}
} catch (e: Exception) {}
}
private fun populateEntryWithViews() {
try {
// Icon already populate
mEntryInfo.title = title
mEntryInfo.username = username
@@ -211,7 +209,6 @@ class EntryEditFragment: StylishFragment() {
mEntryInfo.notes = notes
mEntryInfo.customFields = getExtraFields()
mEntryInfo.attachments = getAttachments()
} catch (e: Exception) {}
}
var title: String
@@ -224,8 +221,6 @@ class EntryEditFragment: StylishFragment() {
entryTitleView.applyFontVisibility()
}
var drawFactory: IconDrawableFactory? = null
var icon: IconImage
get() {
return mEntryInfo.icon