Skip to content

Commit

Permalink
Capture cast exception
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Jamet committed Sep 15, 2021
1 parent b809180 commit e9fc9cb
Showing 1 changed file with 35 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,22 +275,26 @@ abstract class TemplateAbstractView<
templateAttribute: TemplateAttribute,
entryInfoValue: String,
showEmptyFields: Boolean) {
var fieldView: TEntryFieldView? = findViewWithTag(fieldTag)
if (!showEmptyFields && entryInfoValue.isEmpty()) {
fieldView?.isFieldVisible = false
} else if (fieldView == null && entryInfoValue.isNotEmpty()) {
// Add new not referenced view if standard field not in template
fieldView = buildViewForNotReferencedField(
Field(templateAttribute.label,
ProtectedString(templateAttribute.protected, "")),
templateAttribute
) as? TEntryFieldView?
fieldView?.let {
addNotReferencedView(it as View)
try {
var fieldView: TEntryFieldView? = findViewWithTag(fieldTag)
if (!showEmptyFields && entryInfoValue.isEmpty()) {
fieldView?.isFieldVisible = false
} else if (fieldView == null && entryInfoValue.isNotEmpty()) {
// Add new not referenced view if standard field not in template
fieldView = buildViewForNotReferencedField(
Field(templateAttribute.label,
ProtectedString(templateAttribute.protected, "")),
templateAttribute
) as? TEntryFieldView?
fieldView?.let {
addNotReferencedView(it as View)
}
}
fieldView?.value = entryInfoValue
fieldView?.applyFontVisibility(mFontInVisibility)
} catch(e: Exception) {
Log.e(TAG, "Unable to populate entry field view", e)
}
fieldView?.value = entryInfoValue
fieldView?.applyFontVisibility(mFontInVisibility)
}

@Suppress("UNCHECKED_CAST")
Expand All @@ -299,22 +303,25 @@ abstract class TemplateAbstractView<
expires: Boolean,
expiryTime: DateInstant,
showEmptyFields: Boolean) {

var fieldView: TDateTimeView? = findViewWithTag(fieldTag)
if (!showEmptyFields && !expires) {
fieldView?.isFieldVisible = false
} else if (fieldView == null && expires) {
fieldView = buildViewForNotReferencedField(
Field(templateAttribute.label,
ProtectedString(templateAttribute.protected, "")),
templateAttribute
) as? TDateTimeView?
fieldView?.let {
addNotReferencedView(it as View)
try {
var fieldView: TDateTimeView? = findViewWithTag(fieldTag)
if (!showEmptyFields && !expires) {
fieldView?.isFieldVisible = false
} else if (fieldView == null && expires) {
fieldView = buildViewForNotReferencedField(
Field(templateAttribute.label,
ProtectedString(templateAttribute.protected, "")),
templateAttribute
) as? TDateTimeView?
fieldView?.let {
addNotReferencedView(it as View)
}
}
fieldView?.activation = expires
fieldView?.dateTime = expiryTime
} catch(e: Exception) {
Log.e(TAG, "Unable to populate date time view", e)
}
fieldView?.activation = expires
fieldView?.dateTime = expiryTime
}

/**
Expand Down

0 comments on commit e9fc9cb

Please sign in to comment.