update data list adapter

dev_raz_wip
Razmig Sarkissian 7 years ago
parent 22d0459436
commit 5615854ec1
  1. 9
      app/src/main/java/net/pokeranalytics/android/model/realm/Bankroll.kt
  2. 27
      app/src/main/java/net/pokeranalytics/android/ui/adapter/components/DynamicRowInterface.kt
  3. 4
      app/src/main/java/net/pokeranalytics/android/ui/fragment/SettingsFragment.kt

@ -6,10 +6,11 @@ import io.realm.RealmObject
import io.realm.annotations.PrimaryKey import io.realm.annotations.PrimaryKey
import net.pokeranalytics.android.ui.adapter.components.DynamicRowInterface import net.pokeranalytics.android.ui.adapter.components.DynamicRowInterface
import net.pokeranalytics.android.ui.adapter.components.RowViewType import net.pokeranalytics.android.ui.adapter.components.RowViewType
import net.pokeranalytics.android.ui.fragment.components.BottomSheetType
import java.util.* import java.util.*
open class Bankroll(name: String = "") : RealmObject(), DynamicRowInterface { open class Bankroll(name: String = "") : RealmObject() {
@PrimaryKey @PrimaryKey
var id = UUID.randomUUID().toString() var id = UUID.randomUUID().toString()
@ -27,10 +28,4 @@ open class Bankroll(name: String = "") : RealmObject(), DynamicRowInterface {
var currency: Currency? = null var currency: Currency? = null
// @todo rate management // @todo rate management
override fun localizedTitle(context: Context): String {
return name
}
override var viewType: Int = RowViewType.TITLE.ordinal
} }

@ -2,8 +2,15 @@ package net.pokeranalytics.android.ui.adapter.components
import android.content.Context import android.content.Context
import net.pokeranalytics.android.R import net.pokeranalytics.android.R
import net.pokeranalytics.android.ui.fragment.components.BottomSheetType
interface DynamicRowInterface {
fun localizedTitle(context: Context): String
var viewType: Int
var bottomSheetType: BottomSheetType
}
class SectionRow(stringRes: Int) : DynamicRowInterface { class SectionRow(stringRes: Int) : DynamicRowInterface {
var stringRes: Int = stringRes var stringRes: Int = stringRes
@ -13,14 +20,7 @@ class SectionRow(stringRes: Int) : DynamicRowInterface {
} }
override var viewType: Int = 0 override var viewType: Int = 0
override var bottomSheetType: BottomSheetType = BottomSheetType.NONE
}
interface DynamicRowInterface {
fun localizedTitle(context: Context): String
var viewType: Int
} }
enum class SessionRow(val resId: Int) : DynamicRowInterface { enum class SessionRow(val resId: Int) : DynamicRowInterface {
@ -39,6 +39,14 @@ enum class SessionRow(val resId: Int) : DynamicRowInterface {
} }
} }
override var bottomSheetType: BottomSheetType = BottomSheetType.NONE
get() {
return when (this) {
BLINDS -> BottomSheetType.BLINDS
GAME -> BottomSheetType.GAME
DATE -> BottomSheetType.DATE
}
}
} }
enum class BankrollRow(val resId: Int) : DynamicRowInterface { enum class BankrollRow(val resId: Int) : DynamicRowInterface {
@ -51,7 +59,7 @@ enum class BankrollRow(val resId: Int) : DynamicRowInterface {
} }
override var viewType: Int = 1 override var viewType: Int = 1
override var bottomSheetType: BottomSheetType = BottomSheetType.NONE
} }
enum class DataObjectRowType(val resId: Int) : DynamicRowInterface { enum class DataObjectRowType(val resId: Int) : DynamicRowInterface {
@ -66,4 +74,5 @@ enum class DataObjectRowType(val resId: Int) : DynamicRowInterface {
} }
override var viewType: Int = RowViewType.TITLE.ordinal override var viewType: Int = RowViewType.TITLE.ordinal
override var bottomSheetType: BottomSheetType = BottomSheetType.NONE
} }

@ -40,12 +40,12 @@ class SettingsFragment : PokerAnalyticsFragment(), DynamicRowDelegate, DynamicRo
override fun adapterRows(): ArrayList<DynamicRowInterface> { override fun adapterRows(): ArrayList<DynamicRowInterface> {
val rows = ArrayList<DynamicRowInterface>() val rows = ArrayList<DynamicRowInterface>()
rows.addAll(BusinessObjectRowType.values()) rows.addAll(DataObjectRowType.values())
return rows return rows
} }
override fun onRowSelected(row: DynamicRowInterface) { override fun onRowSelected(row: DynamicRowInterface) {
val bottomSheetFragment = openBottomSheet(row) //val bottomSheetFragment = openBottomSheet(row)
} }
/** /**

Loading…
Cancel
Save