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) { override fun updateValue(value: Any?, row: RowRepresentable) {
when (row) { when (row) {
SimpleRow.NAME -> this.name = value as String? ?: "" 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 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.ui.view.RowViewType
import net.pokeranalytics.android.util.NULL_TEXT import net.pokeranalytics.android.util.NULL_TEXT
import net.pokeranalytics.android.util.extensions.toCurrency import net.pokeranalytics.android.util.extensions.toCurrency
import java.text.NumberFormat
import java.util.* import java.util.*
import java.util.Currency import java.util.Currency
@ -136,7 +137,7 @@ open class CustomFieldEntry : RealmObject(), NameManageable, RowRepresentable {
numericValue?.toCurrency(currency) ?: run { NULL_TEXT } numericValue?.toCurrency(currency) ?: run { NULL_TEXT }
} }
CustomField.Type.NUMBER.uniqueIdentifier -> { CustomField.Type.NUMBER.uniqueIdentifier -> {
numericValue?.toString() ?: run { NULL_TEXT } NumberFormat.getInstance().format(this.numericValue)
} }
else -> { else -> {
value value

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

Loading…
Cancel
Save