Fixes + custom field entry formatting

dev
Laurent 7 years ago
parent 90031fb621
commit df73f1ed65
  1. 2
      app/src/main/java/net/pokeranalytics/android/model/realm/CustomField.kt
  2. 3
      app/src/main/java/net/pokeranalytics/android/model/realm/CustomFieldEntry.kt
  3. 2
      app/src/main/java/net/pokeranalytics/android/ui/fragment/data/CustomFieldDataFragment.kt

@ -120,7 +120,7 @@ open class CustomField : RealmObject(), NameManageable, StaticRowRepresentableDa
override fun updateValue(value: Any?, row: RowRepresentable) {
when (row) {
SimpleRow.NAME -> this.name = value as String? ?: ""
CustomFieldRow.TYPE -> this.type = (value as Type?)?.ordinal ?: Type.LIST.ordinal
CustomFieldRow.TYPE -> this.type = (value as Type?)?.uniqueIdentifier ?: Type.LIST.uniqueIdentifier
CustomFieldRow.COPY_ON_DUPLICATE -> this.duplicateValue = value as Boolean? ?: false
}
}

@ -20,6 +20,7 @@ import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor
import net.pokeranalytics.android.ui.view.RowViewType
import net.pokeranalytics.android.util.NULL_TEXT
import net.pokeranalytics.android.util.extensions.toCurrency
import java.text.NumberFormat
import java.util.*
import java.util.Currency
@ -136,7 +137,7 @@ open class CustomFieldEntry : RealmObject(), NameManageable, RowRepresentable {
numericValue?.toCurrency(currency) ?: run { NULL_TEXT }
}
CustomField.Type.NUMBER.uniqueIdentifier -> {
numericValue?.toString() ?: run { NULL_TEXT }
NumberFormat.getInstance().format(this.numericValue)
}
else -> {
value

@ -265,7 +265,7 @@ class CustomFieldDataFragment : EditableDataFragment(), StaticRowRepresentableDa
* Update UI
*/
private fun updateUI() {
if (customField.type == CustomField.Type.LIST.ordinal) {
if (customField.type == CustomField.Type.LIST.uniqueIdentifier) {
bottomBar.animate().translationY(0f.px)
.setInterpolator(FastOutSlowInInterpolator())
.start()

Loading…
Cancel
Save