parent
54434ac955
commit
d054ab04c3
@ -0,0 +1,17 @@ |
|||||||
|
package net.pokeranalytics.android.model.realm.rows |
||||||
|
|
||||||
|
import android.content.Context |
||||||
|
import net.pokeranalytics.android.model.realm.Bankroll |
||||||
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
||||||
|
import net.pokeranalytics.android.ui.view.RowUpdatable |
||||||
|
import net.pokeranalytics.android.ui.view.rowrepresentable.BankrollPropertiesRow |
||||||
|
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow |
||||||
|
|
||||||
|
class BankrollRow(var bankroll: Bankroll) : RowRepresentable { |
||||||
|
|
||||||
|
override fun getDisplayName(context: Context): String { |
||||||
|
return this.bankroll.name |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,57 @@ |
|||||||
|
package net.pokeranalytics.android.model.realm.rows |
||||||
|
|
||||||
|
import android.content.Context |
||||||
|
import android.text.InputType |
||||||
|
import io.realm.RealmList |
||||||
|
import io.realm.annotations.Ignore |
||||||
|
import net.pokeranalytics.android.model.realm.CustomField |
||||||
|
import net.pokeranalytics.android.model.realm.CustomFieldEntry |
||||||
|
import net.pokeranalytics.android.ui.fragment.components.bottomsheet.BottomSheetType |
||||||
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
||||||
|
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor |
||||||
|
import net.pokeranalytics.android.ui.view.RowViewType |
||||||
|
|
||||||
|
class CustomFieldRow(var customField: CustomField) : RowRepresentable { |
||||||
|
|
||||||
|
@Ignore |
||||||
|
override var viewType: Int = RowViewType.TITLE_VALUE_ARROW.ordinal |
||||||
|
|
||||||
|
override fun localizedTitle(context: Context): String { |
||||||
|
return this.customField.name |
||||||
|
} |
||||||
|
|
||||||
|
override fun getDisplayName(context: Context): String { |
||||||
|
return this.customField.name |
||||||
|
} |
||||||
|
|
||||||
|
override val bottomSheetType: BottomSheetType |
||||||
|
get() { |
||||||
|
return when (this.customField.type) { |
||||||
|
CustomField.Type.LIST.uniqueIdentifier -> BottomSheetType.LIST_STATIC |
||||||
|
else -> BottomSheetType.NUMERIC_TEXT |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
override fun editingDescriptors(map: Map<String, Any?>): ArrayList<RowRepresentableEditDescriptor> { |
||||||
|
return when (this.customField.type) { |
||||||
|
CustomField.Type.LIST.uniqueIdentifier -> { |
||||||
|
val defaultValue: Any? by map |
||||||
|
val data: RealmList<CustomFieldEntry>? by map |
||||||
|
arrayListOf( |
||||||
|
RowRepresentableEditDescriptor(defaultValue, staticData = data) |
||||||
|
) |
||||||
|
} |
||||||
|
else -> { |
||||||
|
val defaultValue: Double? by map |
||||||
|
arrayListOf( |
||||||
|
RowRepresentableEditDescriptor( |
||||||
|
defaultValue, inputType = InputType.TYPE_CLASS_NUMBER |
||||||
|
or InputType.TYPE_NUMBER_FLAG_DECIMAL |
||||||
|
or InputType.TYPE_NUMBER_FLAG_SIGNED |
||||||
|
) |
||||||
|
) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue