Fix font in visibility

This commit is contained in:
J-Jamet
2021-06-14 21:22:37 +02:00
parent ad5e644362
commit 022777888c
2 changed files with 14 additions and 1 deletions

View File

@@ -42,6 +42,7 @@ import com.kunzisoft.keepass.model.EntryAttachmentState
import com.kunzisoft.keepass.model.EntryInfo import com.kunzisoft.keepass.model.EntryInfo
import com.kunzisoft.keepass.model.StreamDirection import com.kunzisoft.keepass.model.StreamDirection
import com.kunzisoft.keepass.otp.OtpElement import com.kunzisoft.keepass.otp.OtpElement
import com.kunzisoft.keepass.settings.PreferencesUtil
import com.kunzisoft.keepass.view.TemplateView import com.kunzisoft.keepass.view.TemplateView
import com.kunzisoft.keepass.view.collapse import com.kunzisoft.keepass.view.collapse
import com.kunzisoft.keepass.view.expand import com.kunzisoft.keepass.view.expand
@@ -226,7 +227,9 @@ class EntryEditFragment: DatabaseFragment(), SetOTPDialogFragment.CreateOtpListe
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
// TODO fontInVisibility = PreferencesUtil.fieldFontIsInVisibility(requireContext()) context?.let { context ->
templateView.setFontInVisibility(PreferencesUtil.fieldFontIsInVisibility(context))
}
} }
override fun onAttach(context: Context) { override fun onAttach(context: Context) {

View File

@@ -253,6 +253,10 @@ class TemplateView @JvmOverloads constructor(context: Context,
} }
} }
fun setFontInVisibility(fontInVisibility: Boolean) {
this.mFontInVisibility = fontInVisibility
}
fun getIcon(): IconImage { fun getIcon(): IconImage {
return mEntryInfo?.icon ?: IconImage() return mEntryInfo?.icon ?: IconImage()
} }
@@ -307,17 +311,21 @@ class TemplateView @JvmOverloads constructor(context: Context,
val titleView: EntryEditFieldView? = val titleView: EntryEditFieldView? =
findViewWithTag(FIELD_TITLE_TAG) findViewWithTag(FIELD_TITLE_TAG)
titleView?.value = entryInfo.title titleView?.value = entryInfo.title
titleView?.applyFontVisibility(mFontInVisibility)
val userNameView: EntryEditFieldView? = val userNameView: EntryEditFieldView? =
templateContainerView.findViewWithTag(FIELD_USERNAME_TAG) templateContainerView.findViewWithTag(FIELD_USERNAME_TAG)
userNameView?.value = entryInfo.username userNameView?.value = entryInfo.username
userNameView?.applyFontVisibility(mFontInVisibility)
val passwordView: EntryEditFieldView? = val passwordView: EntryEditFieldView? =
templateContainerView.findViewWithTag(FIELD_PASSWORD_TAG) templateContainerView.findViewWithTag(FIELD_PASSWORD_TAG)
passwordView?.value = entryInfo.password passwordView?.value = entryInfo.password
passwordView?.applyFontVisibility(mFontInVisibility)
val urlView: EntryEditFieldView? = templateContainerView.findViewWithTag(FIELD_URL_TAG) val urlView: EntryEditFieldView? = templateContainerView.findViewWithTag(FIELD_URL_TAG)
urlView?.value = entryInfo.url urlView?.value = entryInfo.url
urlView?.applyFontVisibility(mFontInVisibility)
val expirationView: DateTimeView? = val expirationView: DateTimeView? =
templateContainerView.findViewWithTag(FIELD_EXPIRES_TAG) templateContainerView.findViewWithTag(FIELD_EXPIRES_TAG)
@@ -327,6 +335,7 @@ class TemplateView @JvmOverloads constructor(context: Context,
val notesView: EntryEditFieldView? = val notesView: EntryEditFieldView? =
templateContainerView.findViewWithTag(FIELD_NOTES_TAG) templateContainerView.findViewWithTag(FIELD_NOTES_TAG)
notesView?.value = entryInfo.notes notesView?.value = entryInfo.notes
notesView?.applyFontVisibility(mFontInVisibility)
customFieldsContainerView.removeAllViews() customFieldsContainerView.removeAllViews()
entryInfo.customFields.forEach { customField -> entryInfo.customFields.forEach { customField ->
@@ -338,6 +347,7 @@ class TemplateView @JvmOverloads constructor(context: Context,
?.let { customView -> ?.let { customView ->
if (customView is EntryEditFieldView) { if (customView is EntryEditFieldView) {
customView.value = customField.protectedValue.stringValue customView.value = customField.protectedValue.stringValue
customView.applyFontVisibility(mFontInVisibility)
} else if (customView is DateTimeView) { } else if (customView is DateTimeView) {
try { try {
customView.dateTime = customView.dateTime =