Name Refactoring

split
Laurent 5 years ago
parent 99d7fdfc8c
commit 54434ac955
  1. 16
      app/src/main/java/net/pokeranalytics/android/model/realm/Bankroll.kt
  2. 8
      app/src/main/java/net/pokeranalytics/android/model/realm/CustomField.kt
  3. 8
      app/src/main/java/net/pokeranalytics/android/model/realm/Game.kt
  4. 20
      app/src/main/java/net/pokeranalytics/android/model/realm/Player.kt
  5. 81
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt
  6. 14
      app/src/main/java/net/pokeranalytics/android/model/realm/Transaction.kt
  7. 8
      app/src/main/java/net/pokeranalytics/android/model/realm/TransactionType.kt
  8. 24
      app/src/main/java/net/pokeranalytics/android/model/utils/FavoriteSessionFinder.kt
  9. 52
      app/src/main/java/net/pokeranalytics/android/ui/fragment/SettingsFragment.kt
  10. 16
      app/src/main/java/net/pokeranalytics/android/ui/fragment/components/bottomsheet/BottomSheetFragment.kt
  11. 10
      app/src/main/java/net/pokeranalytics/android/ui/modules/bankroll/BankrollActivity.kt
  12. 12
      app/src/main/java/net/pokeranalytics/android/ui/modules/calendar/CalendarDetailsFragment.kt
  13. 54
      app/src/main/java/net/pokeranalytics/android/ui/modules/data/BankrollDataFragment.kt
  14. 10
      app/src/main/java/net/pokeranalytics/android/ui/modules/data/CustomFieldDataFragment.kt
  15. 8
      app/src/main/java/net/pokeranalytics/android/ui/modules/data/LocationDataFragment.kt
  16. 28
      app/src/main/java/net/pokeranalytics/android/ui/modules/data/PlayerDataFragment.kt
  17. 26
      app/src/main/java/net/pokeranalytics/android/ui/modules/data/TransactionDataFragment.kt
  18. 8
      app/src/main/java/net/pokeranalytics/android/ui/modules/data/TransactionTypeDataFragment.kt
  19. 54
      app/src/main/java/net/pokeranalytics/android/ui/modules/session/SessionFragment.kt
  20. 4
      app/src/main/java/net/pokeranalytics/android/ui/modules/session/SessionViewModel.kt
  21. 1
      app/src/main/java/net/pokeranalytics/android/ui/view/CalendarTabs.kt
  22. 6
      app/src/main/java/net/pokeranalytics/android/ui/view/RowViewType.kt
  23. 13
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/BankrollMainRow.kt
  24. 19
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/BankrollPropertiesRow.kt
  25. 4
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/CustomFieldPropertiesRow.kt
  26. 11
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/CustomizableRowRepresentable.kt
  27. 2
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/DualStatRow.kt
  28. 3
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/GamePropertiesRow.kt
  29. 3
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/GraphRow.kt
  30. 2
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/LocationPropertiesRow.kt
  31. 2
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/PlayerPropertiesRow.kt
  32. 1
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/ReportRow.kt
  33. 2
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/SessionPropertiesRow.kt
  34. 2
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/SettingsRow.kt
  35. 1
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/SimpleRow.kt
  36. 9
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/StatRow.kt
  37. 3
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/TransactionPropertiesRow.kt
  38. 5
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/TransactionTypePropertiesRow.kt
  39. 4
      app/src/main/java/net/pokeranalytics/android/ui/viewmodel/BottomSheetViewModel.kt

@ -14,8 +14,8 @@ import net.pokeranalytics.android.model.interfaces.Identifiable
import net.pokeranalytics.android.model.interfaces.NameManageable import net.pokeranalytics.android.model.interfaces.NameManageable
import net.pokeranalytics.android.model.interfaces.SaveValidityStatus import net.pokeranalytics.android.model.interfaces.SaveValidityStatus
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.rowrepresentable.BankrollRow import net.pokeranalytics.android.ui.view.rowrepresentable.BankrollPropertiesRow
import net.pokeranalytics.android.ui.view.rowrepresentable.SessionRow import net.pokeranalytics.android.ui.view.rowrepresentable.SessionPropertiesRow
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow
import net.pokeranalytics.android.util.Preferences import net.pokeranalytics.android.util.Preferences
import net.pokeranalytics.android.util.UserDefaults import net.pokeranalytics.android.util.UserDefaults
@ -26,8 +26,8 @@ enum class ResultCaptureType {
NET_RESULT; NET_RESULT;
companion object { companion object {
val buyinCashedOutFields = listOf(SessionRow.CASHED_OUT, SessionRow.BUY_IN, SessionRow.TIPS) val buyinCashedOutFields = listOf(SessionPropertiesRow.CASHED_OUT, SessionPropertiesRow.BUY_IN, SessionPropertiesRow.TIPS)
val netResultFields = listOf(SessionRow.NET_RESULT) val netResultFields = listOf(SessionPropertiesRow.NET_RESULT)
} }
val rowRepresentables: List<RowRepresentable> val rowRepresentables: List<RowRepresentable>
@ -73,17 +73,17 @@ open class Bankroll : RealmObject(), NameManageable, RowRepresentable {
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? ?: ""
BankrollRow.ONLINE -> { BankrollPropertiesRow.ONLINE -> {
this.live = if (value is Boolean) !value else false this.live = if (value is Boolean) !value else false
} }
BankrollRow.INITIAL_VALUE -> { BankrollPropertiesRow.INITIAL_VALUE -> {
this.initialValue = value as Double? ?: 0.0 this.initialValue = value as Double? ?: 0.0
} }
BankrollRow.CURRENCY -> { BankrollPropertiesRow.CURRENCY -> {
//TODO handle a use default currency option //TODO handle a use default currency option
this.currency?.code = value as String? this.currency?.code = value as String?
} }
BankrollRow.RATE -> { BankrollPropertiesRow.RATE -> {
this.currency?.rate = value as Double? this.currency?.rate = value as Double?
} }
} }

@ -19,7 +19,7 @@ import net.pokeranalytics.android.ui.fragment.components.bottomsheet.BottomSheet
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor 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.ui.view.rowrepresentable.CustomFieldRow import net.pokeranalytics.android.ui.view.rowrepresentable.CustomFieldPropertiesRow
import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow
import net.pokeranalytics.android.util.enumerations.IntIdentifiable import net.pokeranalytics.android.util.enumerations.IntIdentifiable
@ -145,8 +145,8 @@ 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?)?.uniqueIdentifier ?: Type.LIST.uniqueIdentifier CustomFieldPropertiesRow.TYPE -> this.type = (value as Type?)?.uniqueIdentifier ?: Type.LIST.uniqueIdentifier
CustomFieldRow.COPY_ON_DUPLICATE -> this.duplicateValue = value as Boolean? ?: false CustomFieldPropertiesRow.COPY_ON_DUPLICATE -> this.duplicateValue = value as Boolean? ?: false
} }
} }
@ -232,7 +232,7 @@ open class CustomField : RealmObject(), NameManageable, StaticRowRepresentableDa
private fun updatedRowRepresentationForCurrentState(): List<RowRepresentable> { private fun updatedRowRepresentationForCurrentState(): List<RowRepresentable> {
val rows = ArrayList<RowRepresentable>() val rows = ArrayList<RowRepresentable>()
rows.add(SimpleRow.NAME) rows.add(SimpleRow.NAME)
rows.add(CustomFieldRow.TYPE) rows.add(CustomFieldPropertiesRow.TYPE)
if (type == Type.LIST.uniqueIdentifier && entries.size >= 0) { if (type == Type.LIST.uniqueIdentifier && entries.size >= 0) {
if (entries.isNotEmpty()) { if (entries.isNotEmpty()) {

@ -15,7 +15,7 @@ import net.pokeranalytics.android.model.interfaces.SaveValidityStatus
import net.pokeranalytics.android.ui.adapter.StaticRowRepresentableDataSource import net.pokeranalytics.android.ui.adapter.StaticRowRepresentableDataSource
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor
import net.pokeranalytics.android.ui.view.rowrepresentable.GameRow import net.pokeranalytics.android.ui.view.rowrepresentable.GamePropertiesRow
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow
import net.pokeranalytics.android.util.NULL_TEXT import net.pokeranalytics.android.util.NULL_TEXT
import java.util.* import java.util.*
@ -71,7 +71,7 @@ open class Game : RealmObject(), NameManageable, StaticRowRepresentableDataSourc
): CharSequence { ): CharSequence {
return when (row) { return when (row) {
SimpleRow.NAME -> if (this.name.isNotEmpty()) this.name else NULL_TEXT SimpleRow.NAME -> if (this.name.isNotEmpty()) this.name else NULL_TEXT
GameRow.SHORT_NAME -> this.shortName ?: NULL_TEXT GamePropertiesRow.SHORT_NAME -> this.shortName ?: NULL_TEXT
else -> return super.charSequenceForRow(row, context, 0) else -> return super.charSequenceForRow(row, context, 0)
} }
} }
@ -79,7 +79,7 @@ open class Game : RealmObject(), NameManageable, StaticRowRepresentableDataSourc
override fun editDescriptors(row: RowRepresentable): List<RowRepresentableEditDescriptor>? { override fun editDescriptors(row: RowRepresentable): List<RowRepresentableEditDescriptor>? {
return when (row) { return when (row) {
SimpleRow.NAME -> row.editingDescriptors(mapOf("defaultValue" to this.name)) SimpleRow.NAME -> row.editingDescriptors(mapOf("defaultValue" to this.name))
GameRow.SHORT_NAME -> row.editingDescriptors(mapOf("defaultValue" to this.shortName)) GamePropertiesRow.SHORT_NAME -> row.editingDescriptors(mapOf("defaultValue" to this.shortName))
else -> null else -> null
} }
} }
@ -87,7 +87,7 @@ open class Game : RealmObject(), NameManageable, StaticRowRepresentableDataSourc
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? ?: ""
GameRow.SHORT_NAME -> this.shortName = value as String? ?: "" GamePropertiesRow.SHORT_NAME -> this.shortName = value as String? ?: ""
} }
} }

@ -14,7 +14,7 @@ import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor 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.ui.view.rowrepresentable.CustomizableRowRepresentable import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable
import net.pokeranalytics.android.ui.view.rowrepresentable.PlayerRow import net.pokeranalytics.android.ui.view.rowrepresentable.PlayerPropertiesRow
import net.pokeranalytics.android.ui.view.rowrepresentable.SeparatorRow import net.pokeranalytics.android.ui.view.rowrepresentable.SeparatorRow
import net.pokeranalytics.android.util.NULL_TEXT import net.pokeranalytics.android.util.NULL_TEXT
import net.pokeranalytics.android.util.RANDOM_PLAYER import net.pokeranalytics.android.util.RANDOM_PLAYER
@ -82,16 +82,16 @@ open class Player : RealmObject(), NameManageable, Savable, Deletable, StaticRow
tag: Int tag: Int
): CharSequence { ): CharSequence {
return when (row) { return when (row) {
PlayerRow.NAME -> if (this.name.isNotEmpty()) this.name else NULL_TEXT PlayerPropertiesRow.NAME -> if (this.name.isNotEmpty()) this.name else NULL_TEXT
else -> return super.charSequenceForRow(row, context, 0) else -> return super.charSequenceForRow(row, context, 0)
} }
} }
override fun updateValue(value: Any?, row: RowRepresentable) { override fun updateValue(value: Any?, row: RowRepresentable) {
when (row) { when (row) {
PlayerRow.NAME -> this.name = value as String? ?: "" PlayerPropertiesRow.NAME -> this.name = value as String? ?: ""
PlayerRow.SUMMARY -> this.summary = value as String? ?: "" PlayerPropertiesRow.SUMMARY -> this.summary = value as String? ?: ""
PlayerRow.IMAGE -> this.picture = value as String? ?: "" PlayerPropertiesRow.IMAGE -> this.picture = value as String? ?: ""
} }
} }
@ -100,9 +100,9 @@ open class Player : RealmObject(), NameManageable, Savable, Deletable, StaticRow
*/ */
private fun updatedRowRepresentationForCurrentState(): List<RowRepresentable> { private fun updatedRowRepresentationForCurrentState(): List<RowRepresentable> {
val rows = ArrayList<RowRepresentable>() val rows = ArrayList<RowRepresentable>()
rows.add(PlayerRow.IMAGE) rows.add(PlayerPropertiesRow.IMAGE)
rows.add(PlayerRow.NAME) rows.add(PlayerPropertiesRow.NAME)
rows.add(PlayerRow.SUMMARY) rows.add(PlayerPropertiesRow.SUMMARY)
if (comments.size > 0) { if (comments.size > 0) {
// Adds Comments section // Adds Comments section
@ -185,8 +185,8 @@ open class Player : RealmObject(), NameManageable, Savable, Deletable, StaticRow
override fun editDescriptors(row: RowRepresentable): List<RowRepresentableEditDescriptor>? { override fun editDescriptors(row: RowRepresentable): List<RowRepresentableEditDescriptor>? {
when (row) { when (row) {
PlayerRow.NAME -> return row.editingDescriptors(mapOf("defaultValue" to this.name)) PlayerPropertiesRow.NAME -> return row.editingDescriptors(mapOf("defaultValue" to this.name))
PlayerRow.SUMMARY -> return row.editingDescriptors(mapOf("defaultValue" to this.summary)) PlayerPropertiesRow.SUMMARY -> return row.editingDescriptors(mapOf("defaultValue" to this.summary))
} }
return null return null

@ -29,10 +29,9 @@ import net.pokeranalytics.android.model.realm.handhistory.HandHistory
import net.pokeranalytics.android.model.utils.CrashLogging import net.pokeranalytics.android.model.utils.CrashLogging
import net.pokeranalytics.android.model.utils.SessionSetManager import net.pokeranalytics.android.model.utils.SessionSetManager
import net.pokeranalytics.android.ui.adapter.UnmanagedRowRepresentableException import net.pokeranalytics.android.ui.adapter.UnmanagedRowRepresentableException
import net.pokeranalytics.android.ui.fragment.GraphFragment
import net.pokeranalytics.android.ui.graph.Graph import net.pokeranalytics.android.ui.graph.Graph
import net.pokeranalytics.android.ui.view.* import net.pokeranalytics.android.ui.view.*
import net.pokeranalytics.android.ui.view.rowrepresentable.SessionRow import net.pokeranalytics.android.ui.view.rowrepresentable.SessionPropertiesRow
import net.pokeranalytics.android.util.NULL_TEXT import net.pokeranalytics.android.util.NULL_TEXT
import net.pokeranalytics.android.util.TextFormat import net.pokeranalytics.android.util.TextFormat
import net.pokeranalytics.android.util.UserDefaults import net.pokeranalytics.android.util.UserDefaults
@ -708,8 +707,8 @@ open class Session : RealmObject(), Savable, Editable, RowRepresentable, Timed,
override fun updateValue(value: Any?, row: RowRepresentable) { override fun updateValue(value: Any?, row: RowRepresentable) {
when (row) { when (row) {
SessionRow.BANKROLL -> bankroll = value as Bankroll? SessionPropertiesRow.BANKROLL -> bankroll = value as Bankroll?
SessionRow.BLINDS -> if (value is ArrayList<*>) { SessionPropertiesRow.BLINDS -> if (value is ArrayList<*>) {
cgSmallBlind = try { cgSmallBlind = try {
(value[0] as String? ?: "0").toDouble() (value[0] as String? ?: "0").toDouble()
} catch (e: Exception) { } catch (e: Exception) {
@ -731,27 +730,27 @@ open class Session : RealmObject(), Savable, Editable, RowRepresentable, Timed,
cgSmallBlind = null cgSmallBlind = null
cgBigBlind = null cgBigBlind = null
} }
SessionRow.BREAK_TIME -> { SessionPropertiesRow.BREAK_TIME -> {
this.breakDuration = (value as Double? ?: 0.0).toLong() * 60 * 1000 this.breakDuration = (value as Double? ?: 0.0).toLong() * 60 * 1000
} }
SessionRow.BUY_IN -> { SessionPropertiesRow.BUY_IN -> {
val localResult = getOrCreateResult() val localResult = getOrCreateResult()
localResult.buyin = value as Double? localResult.buyin = value as Double?
// this.updateRowRepresentation() // this.updateRowRepresentation()
} }
SessionRow.CASHED_OUT, SessionRow.PRIZE -> { SessionPropertiesRow.CASHED_OUT, SessionPropertiesRow.PRIZE -> {
val localResult = getOrCreateResult() val localResult = getOrCreateResult()
localResult.cashout = value as Double? localResult.cashout = value as Double?
} }
SessionRow.NET_RESULT -> { SessionPropertiesRow.NET_RESULT -> {
val localResult = getOrCreateResult() val localResult = getOrCreateResult()
localResult.netResult = value as Double? localResult.netResult = value as Double?
} }
SessionRow.COMMENT -> comment = value as String? ?: "" SessionPropertiesRow.COMMENT -> comment = value as String? ?: ""
SessionRow.END_DATE -> if (value is Date?) { SessionPropertiesRow.END_DATE -> if (value is Date?) {
this.endDate = value this.endDate = value
} }
SessionRow.GAME -> { SessionPropertiesRow.GAME -> {
if (value is ArrayList<*>) { if (value is ArrayList<*>) {
limit = try { limit = try {
(value[0] as Int?) (value[0] as Int?)
@ -770,18 +769,18 @@ open class Session : RealmObject(), Savable, Editable, RowRepresentable, Timed,
game = null game = null
} }
} }
SessionRow.INITIAL_BUY_IN -> { SessionPropertiesRow.INITIAL_BUY_IN -> {
this.tournamentEntryFee = (value as Double?) this.tournamentEntryFee = (value as Double?)
} }
SessionRow.LOCATION -> location = value as Location? SessionPropertiesRow.LOCATION -> location = value as Location?
SessionRow.PLAYERS -> { SessionPropertiesRow.PLAYERS -> {
if (value is Double) { if (value is Double) {
this.tournamentNumberOfPlayers = value.toInt() this.tournamentNumberOfPlayers = value.toInt()
} else { } else {
this.tournamentNumberOfPlayers = null this.tournamentNumberOfPlayers = null
} }
} }
SessionRow.POSITION -> { SessionPropertiesRow.POSITION -> {
val localResult = if (result != null) result as Result else realm.createObject(Result::class.java) val localResult = if (result != null) result as Result else realm.createObject(Result::class.java)
if (value is Double) { if (value is Double) {
localResult.tournamentFinalPosition = value.toInt() localResult.tournamentFinalPosition = value.toInt()
@ -790,17 +789,17 @@ open class Session : RealmObject(), Savable, Editable, RowRepresentable, Timed,
} }
result = localResult result = localResult
} }
SessionRow.START_DATE -> if (value is Date) { SessionPropertiesRow.START_DATE -> if (value is Date) {
this.startDate = value this.startDate = value
} }
SessionRow.TABLE_SIZE -> tableSize = value as Int? SessionPropertiesRow.TABLE_SIZE -> tableSize = value as Int?
SessionRow.TIPS -> { SessionPropertiesRow.TIPS -> {
val localResult = getOrCreateResult() val localResult = getOrCreateResult()
localResult.tips = value as Double? localResult.tips = value as Double?
} }
SessionRow.TOURNAMENT_NAME -> tournamentName = value as TournamentName? SessionPropertiesRow.TOURNAMENT_NAME -> tournamentName = value as TournamentName?
SessionRow.TOURNAMENT_TYPE -> tournamentType = (value as TournamentType?)?.ordinal SessionPropertiesRow.TOURNAMENT_TYPE -> tournamentType = (value as TournamentType?)?.ordinal
SessionRow.TOURNAMENT_FEATURE -> { SessionPropertiesRow.TOURNAMENT_FEATURE -> {
value?.let { value?.let {
tournamentFeatures = RealmList() tournamentFeatures = RealmList()
@ -945,30 +944,30 @@ open class Session : RealmObject(), Savable, Editable, RowRepresentable, Timed,
fun charSequenceForRow(row: RowRepresentable, context: Context): String { fun charSequenceForRow(row: RowRepresentable, context: Context): String {
return when (row) { return when (row) {
SessionRow.BANKROLL -> bankroll?.name ?: NULL_TEXT SessionPropertiesRow.BANKROLL -> bankroll?.name ?: NULL_TEXT
SessionRow.BLINDS -> getFormattedBlinds() SessionPropertiesRow.BLINDS -> getFormattedBlinds()
SessionRow.BREAK_TIME -> if (this.breakDuration > 0.0) this.breakDuration.toMinutes() else NULL_TEXT SessionPropertiesRow.BREAK_TIME -> if (this.breakDuration > 0.0) this.breakDuration.toMinutes() else NULL_TEXT
SessionRow.BUY_IN -> this.result?.buyin?.toCurrency(currency) ?: NULL_TEXT SessionPropertiesRow.BUY_IN -> this.result?.buyin?.toCurrency(currency) ?: NULL_TEXT
SessionRow.CASHED_OUT, SessionRow.PRIZE -> this.result?.cashout?.toCurrency(currency) ?: NULL_TEXT SessionPropertiesRow.CASHED_OUT, SessionPropertiesRow.PRIZE -> this.result?.cashout?.toCurrency(currency) ?: NULL_TEXT
SessionRow.NET_RESULT -> this.result?.netResult?.toCurrency(currency) ?: NULL_TEXT SessionPropertiesRow.NET_RESULT -> this.result?.netResult?.toCurrency(currency) ?: NULL_TEXT
SessionRow.COMMENT -> if (this.comment.isNotEmpty()) this.comment else NULL_TEXT SessionPropertiesRow.COMMENT -> if (this.comment.isNotEmpty()) this.comment else NULL_TEXT
SessionRow.END_DATE -> this.endDate?.shortDateTime() ?: NULL_TEXT SessionPropertiesRow.END_DATE -> this.endDate?.shortDateTime() ?: NULL_TEXT
SessionRow.GAME -> getFormattedGame() SessionPropertiesRow.GAME -> getFormattedGame()
SessionRow.INITIAL_BUY_IN -> tournamentEntryFee?.toCurrency(currency) ?: NULL_TEXT SessionPropertiesRow.INITIAL_BUY_IN -> tournamentEntryFee?.toCurrency(currency) ?: NULL_TEXT
SessionRow.LOCATION -> location?.name ?: NULL_TEXT SessionPropertiesRow.LOCATION -> location?.name ?: NULL_TEXT
SessionRow.PLAYERS -> tournamentNumberOfPlayers?.toString() ?: NULL_TEXT SessionPropertiesRow.PLAYERS -> tournamentNumberOfPlayers?.toString() ?: NULL_TEXT
SessionRow.POSITION -> result?.tournamentFinalPosition?.toString() ?: NULL_TEXT SessionPropertiesRow.POSITION -> result?.tournamentFinalPosition?.toString() ?: NULL_TEXT
SessionRow.START_DATE -> this.startDate?.shortDateTime() ?: NULL_TEXT SessionPropertiesRow.START_DATE -> this.startDate?.shortDateTime() ?: NULL_TEXT
SessionRow.TABLE_SIZE -> this.tableSize?.let { TableSize(it).localizedTitle(context) } ?: NULL_TEXT SessionPropertiesRow.TABLE_SIZE -> this.tableSize?.let { TableSize(it).localizedTitle(context) } ?: NULL_TEXT
SessionRow.TIPS -> result?.tips?.toCurrency(currency) ?: NULL_TEXT SessionPropertiesRow.TIPS -> result?.tips?.toCurrency(currency) ?: NULL_TEXT
SessionRow.TOURNAMENT_TYPE -> { SessionPropertiesRow.TOURNAMENT_TYPE -> {
this.tournamentType?.let { this.tournamentType?.let {
TournamentType.values()[it].localizedTitle(context) TournamentType.values()[it].localizedTitle(context)
} ?: run { } ?: run {
NULL_TEXT NULL_TEXT
} }
} }
SessionRow.TOURNAMENT_FEATURE -> { SessionPropertiesRow.TOURNAMENT_FEATURE -> {
if (tournamentFeatures.size > 2) { if (tournamentFeatures.size > 2) {
"${tournamentFeatures.subList(0, 2).joinToString { "${tournamentFeatures.subList(0, 2).joinToString {
it.name it.name
@ -981,8 +980,8 @@ open class Session : RealmObject(), Savable, Editable, RowRepresentable, Timed,
NULL_TEXT NULL_TEXT
} }
} }
SessionRow.TOURNAMENT_NAME -> tournamentName?.name ?: NULL_TEXT SessionPropertiesRow.TOURNAMENT_NAME -> tournamentName?.name ?: NULL_TEXT
SessionRow.HANDS -> this.handHistories?.size.toString() SessionPropertiesRow.HANDS -> this.handHistories?.size.toString()
is CustomField -> { is CustomField -> {
customFieldEntries.find { it.customField?.id == row.id }?.let { customFieldEntry -> customFieldEntries.find { it.customField?.id == row.id }?.let { customFieldEntry ->
return customFieldEntry.getFormattedValue(currency) return customFieldEntry.getFormattedValue(currency)

@ -16,7 +16,7 @@ import net.pokeranalytics.android.ui.view.DefaultLegendValues
import net.pokeranalytics.android.ui.view.LegendContent import net.pokeranalytics.android.ui.view.LegendContent
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
import net.pokeranalytics.android.ui.view.rowrepresentable.TransactionRow import net.pokeranalytics.android.ui.view.rowrepresentable.TransactionPropertiesRow
import net.pokeranalytics.android.util.TextFormat import net.pokeranalytics.android.util.TextFormat
import net.pokeranalytics.android.util.extensions.findById import net.pokeranalytics.android.util.extensions.findById
import java.text.DateFormat import java.text.DateFormat
@ -43,7 +43,7 @@ open class Transaction : RealmObject(), Manageable, StaticRowRepresentableDataSo
val rowRepresentation: List<RowRepresentable> by lazy { val rowRepresentation: List<RowRepresentable> by lazy {
val rows = ArrayList<RowRepresentable>() val rows = ArrayList<RowRepresentable>()
rows.addAll(TransactionRow.values()) rows.addAll(TransactionPropertiesRow.values())
rows rows
} }
@ -102,11 +102,11 @@ open class Transaction : RealmObject(), Manageable, StaticRowRepresentableDataSo
override fun updateValue(value: Any?, row: RowRepresentable) { override fun updateValue(value: Any?, row: RowRepresentable) {
when (row) { when (row) {
TransactionRow.BANKROLL -> bankroll = value as Bankroll? TransactionPropertiesRow.BANKROLL -> bankroll = value as Bankroll?
TransactionRow.TYPE -> type = value as TransactionType? TransactionPropertiesRow.TYPE -> type = value as TransactionType?
TransactionRow.AMOUNT -> amount = if (value == null) 0.0 else (value as String).toDouble() TransactionPropertiesRow.AMOUNT -> amount = if (value == null) 0.0 else (value as String).toDouble()
TransactionRow.COMMENT -> comment = value as String? ?: "" TransactionPropertiesRow.COMMENT -> comment = value as String? ?: ""
TransactionRow.DATE -> date = value as Date? ?: Date() TransactionPropertiesRow.DATE -> date = value as Date? ?: Date()
} }
} }

@ -14,7 +14,7 @@ import net.pokeranalytics.android.ui.view.Localizable
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow
import net.pokeranalytics.android.ui.view.rowrepresentable.TransactionTypeRow import net.pokeranalytics.android.ui.view.rowrepresentable.TransactionTypePropertiesRow
import net.pokeranalytics.android.util.enumerations.IntIdentifiable import net.pokeranalytics.android.util.enumerations.IntIdentifiable
import net.pokeranalytics.android.util.enumerations.IntSearchable import net.pokeranalytics.android.util.enumerations.IntSearchable
import java.util.* import java.util.*
@ -56,7 +56,7 @@ open class TransactionType : RealmObject(), NameManageable, StaticRowRepresentab
val rowRepresentation: List<RowRepresentable> by lazy { val rowRepresentation: List<RowRepresentable> by lazy {
val rows = ArrayList<RowRepresentable>() val rows = ArrayList<RowRepresentable>()
rows.add(SimpleRow.NAME) rows.add(SimpleRow.NAME)
rows.addAll(TransactionTypeRow.values()) rows.addAll(TransactionTypePropertiesRow.values())
rows rows
} }
@ -131,7 +131,7 @@ open class TransactionType : RealmObject(), NameManageable, StaticRowRepresentab
override fun boolForRow(row: RowRepresentable): Boolean { override fun boolForRow(row: RowRepresentable): Boolean {
return when (row) { return when (row) {
TransactionTypeRow.TRANSACTION_ADDITIVE -> this.additive TransactionTypePropertiesRow.TRANSACTION_ADDITIVE -> this.additive
else -> super.boolForRow(row) else -> super.boolForRow(row)
} }
} }
@ -143,7 +143,7 @@ open class TransactionType : RealmObject(), NameManageable, StaticRowRepresentab
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? ?: ""
TransactionTypeRow.TRANSACTION_ADDITIVE -> this.additive = value as Boolean? ?: false TransactionTypePropertiesRow.TRANSACTION_ADDITIVE -> this.additive = value as Boolean? ?: false
} }
} }

@ -5,7 +5,7 @@ import io.realm.Realm
import io.realm.Sort import io.realm.Sort
import net.pokeranalytics.android.model.realm.Location import net.pokeranalytics.android.model.realm.Location
import net.pokeranalytics.android.model.realm.Session import net.pokeranalytics.android.model.realm.Session
import net.pokeranalytics.android.ui.view.rowrepresentable.SessionRow import net.pokeranalytics.android.ui.view.rowrepresentable.SessionPropertiesRow
/** /**
* Returns all significant parameters concatenated in a String * Returns all significant parameters concatenated in a String
@ -24,24 +24,24 @@ private fun Session.parameterRepresentation(context: Context): String {
/** /**
* Returns a list of fields used to determine which kind of session is favorite * Returns a list of fields used to determine which kind of session is favorite
*/ */
private fun Session.significantFields(): List<SessionRow> { private fun Session.significantFields(): List<SessionPropertiesRow> {
when (this.type) { when (this.type) {
Session.Type.TOURNAMENT.ordinal -> { Session.Type.TOURNAMENT.ordinal -> {
return listOf( return listOf(
SessionRow.GAME, SessionPropertiesRow.GAME,
SessionRow.INITIAL_BUY_IN, SessionPropertiesRow.INITIAL_BUY_IN,
SessionRow.BANKROLL, SessionPropertiesRow.BANKROLL,
SessionRow.TABLE_SIZE, SessionPropertiesRow.TABLE_SIZE,
SessionRow.TOURNAMENT_NAME, SessionPropertiesRow.TOURNAMENT_NAME,
SessionRow.TOURNAMENT_TYPE SessionPropertiesRow.TOURNAMENT_TYPE
) )
} }
Session.Type.CASH_GAME.ordinal -> { Session.Type.CASH_GAME.ordinal -> {
return listOf( return listOf(
SessionRow.GAME, SessionPropertiesRow.GAME,
SessionRow.BLINDS, SessionPropertiesRow.BLINDS,
SessionRow.BANKROLL, SessionPropertiesRow.BANKROLL,
SessionRow.TABLE_SIZE SessionPropertiesRow.TABLE_SIZE
) )
} }
} }

@ -34,7 +34,7 @@ import net.pokeranalytics.android.ui.fragment.components.RealmFragment
import net.pokeranalytics.android.ui.modules.bankroll.BankrollActivity import net.pokeranalytics.android.ui.modules.bankroll.BankrollActivity
import net.pokeranalytics.android.ui.modules.datalist.DataListActivity import net.pokeranalytics.android.ui.modules.datalist.DataListActivity
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.rowrepresentable.SettingRow import net.pokeranalytics.android.ui.view.rowrepresentable.SettingsRow
import net.pokeranalytics.android.util.* import net.pokeranalytics.android.util.*
import net.pokeranalytics.android.util.billing.AppGuard import net.pokeranalytics.android.util.billing.AppGuard
import net.pokeranalytics.android.util.billing.IAPProducts import net.pokeranalytics.android.util.billing.IAPProducts
@ -63,7 +63,7 @@ class SettingsFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRep
val rowRepresentation: List<RowRepresentable> by lazy { val rowRepresentation: List<RowRepresentable> by lazy {
val rows = ArrayList<RowRepresentable>() val rows = ArrayList<RowRepresentable>()
rows.addAll(SettingRow.getRows()) rows.addAll(SettingsRow.getRows())
rows rows
} }
@ -123,12 +123,12 @@ class SettingsFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRep
} }
} }
realm.close() realm.close()
settingsAdapterRow.refreshRow(SettingRow.CURRENCY) settingsAdapterRow.refreshRow(SettingsRow.CURRENCY)
} }
} }
} }
RequestCode.SUBSCRIPTION.value -> { RequestCode.SUBSCRIPTION.value -> {
settingsAdapterRow.refreshRow(SettingRow.SUBSCRIPTION) settingsAdapterRow.refreshRow(SettingsRow.SUBSCRIPTION)
} }
} }
} }
@ -143,39 +143,39 @@ class SettingsFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRep
tag: Int tag: Int
): CharSequence { ): CharSequence {
return when (row) { return when (row) {
SettingRow.SUBSCRIPTION -> AppGuard.subscriptionStatus(requireContext()) SettingsRow.SUBSCRIPTION -> AppGuard.subscriptionStatus(requireContext())
SettingRow.VERSION -> BuildConfig.VERSION_NAME + if (BuildConfig.DEBUG) " (${BuildConfig.VERSION_CODE}) DEBUG" else "" SettingsRow.VERSION -> BuildConfig.VERSION_NAME + if (BuildConfig.DEBUG) " (${BuildConfig.VERSION_CODE}) DEBUG" else ""
SettingRow.CURRENCY -> UserDefaults.currency.symbol SettingsRow.CURRENCY -> UserDefaults.currency.symbol
else -> "" else -> ""
} }
} }
override fun boolForRow(row: RowRepresentable): Boolean { override fun boolForRow(row: RowRepresentable): Boolean {
return when (row) { return when (row) {
SettingRow.STOP_NOTIFICATION -> Preferences.showStopNotifications(requireContext()) SettingsRow.STOP_NOTIFICATION -> Preferences.showStopNotifications(requireContext())
else -> false else -> false
} }
} }
override fun onRowSelected(position: Int, row: RowRepresentable, tag: Int) { override fun onRowSelected(position: Int, row: RowRepresentable, tag: Int) {
when (row) { when (row) {
SettingRow.BANKROLL_REPORT -> BankrollActivity.newInstance(requireContext()) SettingsRow.BANKROLL_REPORT -> BankrollActivity.newInstance(requireContext())
SettingRow.TOP_10 -> Top10Activity.newInstance(requireContext()) SettingsRow.TOP_10 -> Top10Activity.newInstance(requireContext())
SettingRow.PLAYERS -> DataListActivity.newInstance(requireContext(), LiveData.PLAYER.ordinal) SettingsRow.PLAYERS -> DataListActivity.newInstance(requireContext(), LiveData.PLAYER.ordinal)
SettingRow.SUBSCRIPTION -> { SettingsRow.SUBSCRIPTION -> {
if (!AppGuard.isProUser) { if (!AppGuard.isProUser) {
BillingActivity.newInstanceForResult(this, false) BillingActivity.newInstanceForResult(this, false)
} else { } else {
this.openPlayStoreAccount() this.openPlayStoreAccount()
} }
} }
SettingRow.RATE_APP -> showReviewManager() SettingsRow.RATE_APP -> showReviewManager()
SettingRow.CONTACT_US -> parentActivity?.openContactMail(R.string.contact) SettingsRow.CONTACT_US -> parentActivity?.openContactMail(R.string.contact)
SettingRow.BUG_REPORT -> parentActivity?.openContactMail(R.string.bug_report_subject, Realm.getDefaultInstance().path) SettingsRow.BUG_REPORT -> parentActivity?.openContactMail(R.string.bug_report_subject, Realm.getDefaultInstance().path)
SettingRow.CURRENCY -> CurrenciesActivity.newInstanceForResult(this@SettingsFragment, RequestCode.CURRENCY.value) SettingsRow.CURRENCY -> CurrenciesActivity.newInstanceForResult(this@SettingsFragment, RequestCode.CURRENCY.value)
SettingRow.EXPORT_CSV_SESSIONS -> this.sessionsCSVExport() SettingsRow.EXPORT_CSV_SESSIONS -> this.sessionsCSVExport()
SettingRow.EXPORT_CSV_TRANSACTIONS -> this.transactionsCSVExport() SettingsRow.EXPORT_CSV_TRANSACTIONS -> this.transactionsCSVExport()
SettingRow.FOLLOW_US -> { SettingsRow.FOLLOW_US -> {
when (position) { when (position) {
0 -> parentActivity?.openUrl(URL.BLOG.value) 0 -> parentActivity?.openUrl(URL.BLOG.value)
1 -> parentActivity?.openUrl(URL.INSTAGRAM.value) 1 -> parentActivity?.openUrl(URL.INSTAGRAM.value)
@ -183,11 +183,11 @@ class SettingsFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRep
3 -> parentActivity?.openUrl(URL.FACEBOOK.value) 3 -> parentActivity?.openUrl(URL.FACEBOOK.value)
} }
} }
SettingRow.POKER_RUMBLE -> parentActivity?.openUrl(URL.POKER_RUMBLE.value) SettingsRow.POKER_RUMBLE -> parentActivity?.openUrl(URL.POKER_RUMBLE.value)
SettingRow.DISCORD -> parentActivity?.openUrl(URL.DISCORD.value) SettingsRow.DISCORD -> parentActivity?.openUrl(URL.DISCORD.value)
SettingRow.PRIVACY_POLICY -> parentActivity?.openUrl(URL.PRIVACY_POLICY.value) SettingsRow.PRIVACY_POLICY -> parentActivity?.openUrl(URL.PRIVACY_POLICY.value)
SettingRow.TERMS_OF_USE -> parentActivity?.openUrl(URL.TERMS.value) SettingsRow.TERMS_OF_USE -> parentActivity?.openUrl(URL.TERMS.value)
SettingRow.GDPR -> openGDPRActivity() SettingsRow.GDPR -> openGDPRActivity()
} }
row.relatedResultsRepresentable?.let { row.relatedResultsRepresentable?.let {
@ -216,7 +216,7 @@ class SettingsFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRep
override fun onRowValueChanged(value: Any?, row: RowRepresentable) { override fun onRowValueChanged(value: Any?, row: RowRepresentable) {
when (row) { when (row) {
SettingRow.STOP_NOTIFICATION -> { SettingsRow.STOP_NOTIFICATION -> {
val show = value as Boolean val show = value as Boolean
if (!show) { if (!show) {
StopNotificationManager.stopAllStopNotifications(requireContext()) StopNotificationManager.stopAllStopNotifications(requireContext())
@ -322,7 +322,7 @@ class SettingsFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRep
} }
override fun purchaseDidSucceed(purchase: Purchase) { override fun purchaseDidSucceed(purchase: Purchase) {
this.settingsAdapterRow.refreshRow(SettingRow.SUBSCRIPTION) this.settingsAdapterRow.refreshRow(SettingsRow.SUBSCRIPTION)
} }
override fun noPurchaseRetrieved() { override fun noPurchaseRetrieved() {

@ -21,8 +21,8 @@ import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate
import net.pokeranalytics.android.ui.modules.data.EditableDataActivity import net.pokeranalytics.android.ui.modules.data.EditableDataActivity
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor
import net.pokeranalytics.android.ui.view.rowrepresentable.SessionRow import net.pokeranalytics.android.ui.view.rowrepresentable.SessionPropertiesRow
import net.pokeranalytics.android.ui.view.rowrepresentable.TransactionRow import net.pokeranalytics.android.ui.view.rowrepresentable.TransactionPropertiesRow
import net.pokeranalytics.android.ui.viewmodel.BottomSheetViewModel import net.pokeranalytics.android.ui.viewmodel.BottomSheetViewModel
import net.pokeranalytics.android.ui.viewmodel.BottomSheetViewModelFactory import net.pokeranalytics.android.ui.viewmodel.BottomSheetViewModelFactory
import java.util.* import java.util.*
@ -214,12 +214,12 @@ open class BottomSheetFragment : BottomSheetDialogFragment() {
bottomSheetToolbar.menu.findItem(R.id.actionAdd).setOnMenuItemClickListener { bottomSheetToolbar.menu.findItem(R.id.actionAdd).setOnMenuItemClickListener {
val liveData = when (row) { val liveData = when (row) {
SessionRow.GAME -> LiveData.GAME SessionPropertiesRow.GAME -> LiveData.GAME
SessionRow.BANKROLL, TransactionRow.BANKROLL -> LiveData.BANKROLL SessionPropertiesRow.BANKROLL, TransactionPropertiesRow.BANKROLL -> LiveData.BANKROLL
SessionRow.LOCATION -> LiveData.LOCATION SessionPropertiesRow.LOCATION -> LiveData.LOCATION
SessionRow.TOURNAMENT_NAME -> LiveData.TOURNAMENT_NAME SessionPropertiesRow.TOURNAMENT_NAME -> LiveData.TOURNAMENT_NAME
SessionRow.TOURNAMENT_FEATURE -> LiveData.TOURNAMENT_FEATURE SessionPropertiesRow.TOURNAMENT_FEATURE -> LiveData.TOURNAMENT_FEATURE
TransactionRow.TYPE -> LiveData.TRANSACTION_TYPE TransactionPropertiesRow.TYPE -> LiveData.TRANSACTION_TYPE
else -> throw PAIllegalStateException("row $it does not have an associated LiveData value") else -> throw PAIllegalStateException("row $it does not have an associated LiveData value")
} }

@ -4,18 +4,14 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import io.realm.RealmResults
import net.pokeranalytics.android.R import net.pokeranalytics.android.R
import net.pokeranalytics.android.model.realm.Bankroll
import net.pokeranalytics.android.model.realm.ComputableResult
import net.pokeranalytics.android.model.realm.Transaction
import net.pokeranalytics.android.ui.activity.components.BaseActivity import net.pokeranalytics.android.ui.activity.components.BaseActivity
class BankrollActivity : BaseActivity() { class BankrollActivity : BaseActivity() {
private lateinit var computableResults: RealmResults<ComputableResult> // private lateinit var computableResults: RealmResults<ComputableResult>
private lateinit var bankrolls: RealmResults<Bankroll> // private lateinit var bankrolls: RealmResults<Bankroll>
private lateinit var transactions: RealmResults<Transaction> // private lateinit var transactions: RealmResults<Transaction>
companion object { companion object {
fun newInstance(context: Context) { fun newInstance(context: Context) {

@ -32,7 +32,7 @@ import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable
import net.pokeranalytics.android.ui.view.rowrepresentable.GraphRow import net.pokeranalytics.android.ui.view.rowrepresentable.GraphRow
import net.pokeranalytics.android.ui.view.rowrepresentable.StatDoubleRow import net.pokeranalytics.android.ui.view.rowrepresentable.DualStatRow
import timber.log.Timber import timber.log.Timber
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
@ -202,8 +202,8 @@ class CalendarDetailsFragment : BaseFragment(), StaticRowRepresentableDataSource
rowRepresentables.clear() rowRepresentables.clear()
rowRepresentables.add(CustomizableRowRepresentable(RowViewType.HEADER_TITLE, resId = R.string.net_result)) rowRepresentables.add(CustomizableRowRepresentable(RowViewType.HEADER_TITLE, resId = R.string.net_result))
rowRepresentables.add(GraphRow(netResultDataSet, report = report, stat = Stat.NET_RESULT)) rowRepresentables.add(GraphRow(netResultDataSet, report = report, stat = Stat.NET_RESULT))
rowRepresentables.add(StatDoubleRow(it.computedStat(Stat.NET_RESULT), it.computedStat(Stat.HOURLY_RATE))) rowRepresentables.add(DualStatRow(it.computedStat(Stat.NET_RESULT), it.computedStat(Stat.HOURLY_RATE)))
rowRepresentables.add(StatDoubleRow(it.computedStat(Stat.LOCATIONS_PLAYED), it.computedStat(Stat.LONGEST_STREAKS))) rowRepresentables.add(DualStatRow(it.computedStat(Stat.LOCATIONS_PLAYED), it.computedStat(Stat.LONGEST_STREAKS)))
rowRepresentables.add(CustomizableRowRepresentable(RowViewType.HEADER_TITLE, resId = R.string.distribution)) rowRepresentables.add(CustomizableRowRepresentable(RowViewType.HEADER_TITLE, resId = R.string.distribution))
rowRepresentables.add( rowRepresentables.add(
GraphRow( GraphRow(
@ -213,11 +213,11 @@ class CalendarDetailsFragment : BaseFragment(), StaticRowRepresentableDataSource
stat = Stat.STANDARD_DEVIATION stat = Stat.STANDARD_DEVIATION
) )
) )
rowRepresentables.add(StatDoubleRow(it.computedStat(Stat.WIN_RATIO), it.computedStat(Stat.MAXIMUM_NETRESULT))) rowRepresentables.add(DualStatRow(it.computedStat(Stat.WIN_RATIO), it.computedStat(Stat.MAXIMUM_NETRESULT)))
rowRepresentables.add(CustomizableRowRepresentable(RowViewType.HEADER_TITLE, resId = R.string.volume)) rowRepresentables.add(CustomizableRowRepresentable(RowViewType.HEADER_TITLE, resId = R.string.volume))
rowRepresentables.add(GraphRow(durationDataSet, report = report, stat = Stat.HOURLY_DURATION)) rowRepresentables.add(GraphRow(durationDataSet, report = report, stat = Stat.HOURLY_DURATION))
rowRepresentables.add(StatDoubleRow(it.computedStat(Stat.HOURLY_DURATION), it.computedStat(Stat.AVERAGE_HOURLY_DURATION))) rowRepresentables.add(DualStatRow(it.computedStat(Stat.HOURLY_DURATION), it.computedStat(Stat.AVERAGE_HOURLY_DURATION)))
rowRepresentables.add(StatDoubleRow(it.computedStat(Stat.DAYS_PLAYED), it.computedStat(Stat.MAXIMUM_DURATION))) rowRepresentables.add(DualStatRow(it.computedStat(Stat.DAYS_PLAYED), it.computedStat(Stat.MAXIMUM_DURATION)))
} }
launch(Dispatchers.Main) { launch(Dispatchers.Main) {

@ -19,7 +19,7 @@ import net.pokeranalytics.android.ui.fragment.CurrenciesFragment
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor 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.ui.view.rowrepresentable.BankrollRow import net.pokeranalytics.android.ui.view.rowrepresentable.BankrollPropertiesRow
import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow
import net.pokeranalytics.android.ui.viewmodel.DataManagerViewModel import net.pokeranalytics.android.ui.viewmodel.DataManagerViewModel
@ -81,7 +81,7 @@ class BankrollDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
if (requestCode == RequestCode.CURRENCY.value && resultCode == RESULT_OK) { if (requestCode == RequestCode.CURRENCY.value && resultCode == RESULT_OK) {
data?.let { data?.let {
val currencyCode = it.getStringExtra(CurrenciesFragment.INTENT_CURRENCY_CODE) val currencyCode = it.getStringExtra(CurrenciesFragment.INTENT_CURRENCY_CODE)
onRowValueChanged(currencyCode, BankrollRow.CURRENCY) onRowValueChanged(currencyCode, BankrollPropertiesRow.CURRENCY)
if (shouldShowCurrencyRate) { if (shouldShowCurrencyRate) {
refreshRate() refreshRate()
} }
@ -129,8 +129,8 @@ class BankrollDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
override fun isSelected(position: Int, row: RowRepresentable, tag: Int): Boolean { override fun isSelected(position: Int, row: RowRepresentable, tag: Int): Boolean {
return when (row) { return when (row) {
BankrollRow.CAPTURE_BUYIN_CASHEDOUT -> this.bankrollModel.selectedCaptureType.value == ResultCaptureType.BUYIN_CASHEDOUT BankrollPropertiesRow.CAPTURE_BUYIN_CASHED_OUT -> this.bankrollModel.selectedCaptureType.value == ResultCaptureType.BUYIN_CASHEDOUT
BankrollRow.CAPTURE_NET_RESULT -> this.bankrollModel.selectedCaptureType.value == ResultCaptureType.NET_RESULT BankrollPropertiesRow.CAPTURE_NET_RESULT -> this.bankrollModel.selectedCaptureType.value == ResultCaptureType.NET_RESULT
else -> false else -> false
} }
} }
@ -138,21 +138,21 @@ class BankrollDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
override fun charSequenceForRow(row: RowRepresentable, context: Context, tag: Int): CharSequence { override fun charSequenceForRow(row: RowRepresentable, context: Context, tag: Int): CharSequence {
return when (row) { return when (row) {
SimpleRow.NAME -> if (bankroll.name.isNotEmpty()) bankroll.name else NULL_TEXT SimpleRow.NAME -> if (bankroll.name.isNotEmpty()) bankroll.name else NULL_TEXT
BankrollRow.CURRENCY -> { BankrollPropertiesRow.CURRENCY -> {
bankroll.currency?.code?.let { code -> bankroll.currency?.code?.let { code ->
Currency.getInstance(code).currencyCode Currency.getInstance(code).currencyCode
} ?: run { } ?: run {
NULL_TEXT NULL_TEXT
} }
} }
BankrollRow.INITIAL_VALUE -> { BankrollPropertiesRow.INITIAL_VALUE -> {
var c: Currency? = null var c: Currency? = null
this.bankroll.currency?.code?.let { this.bankroll.currency?.code?.let {
c = Currency.getInstance(it) c = Currency.getInstance(it)
} }
this.bankroll.initialValue.toCurrency(c) this.bankroll.initialValue.toCurrency(c)
} }
BankrollRow.RATE -> { BankrollPropertiesRow.RATE -> {
val rate = this.bankroll.currency?.rate ?: 1.0 val rate = this.bankroll.currency?.rate ?: 1.0
rate.toRate() rate.toRate()
} }
@ -162,8 +162,8 @@ class BankrollDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
override fun boolForRow(row: RowRepresentable): Boolean { override fun boolForRow(row: RowRepresentable): Boolean {
return when(row) { return when(row) {
BankrollRow.ONLINE -> !bankroll.live BankrollPropertiesRow.ONLINE -> !bankroll.live
BankrollRow.REFRESH_RATE -> isRefreshingRate BankrollPropertiesRow.REFRESH_RATE -> isRefreshingRate
else -> super.boolForRow(row) else -> super.boolForRow(row)
} }
} }
@ -171,10 +171,10 @@ class BankrollDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
override fun editDescriptors(row: RowRepresentable): List<RowRepresentableEditDescriptor>? { override fun editDescriptors(row: RowRepresentable): List<RowRepresentableEditDescriptor>? {
return when (row) { return when (row) {
SimpleRow.NAME -> row.editingDescriptors(mapOf("defaultValue" to this.bankroll.name)) SimpleRow.NAME -> row.editingDescriptors(mapOf("defaultValue" to this.bankroll.name))
BankrollRow.INITIAL_VALUE -> { BankrollPropertiesRow.INITIAL_VALUE -> {
row.editingDescriptors(mapOf("defaultValue" to this.bankroll.initialValue)) row.editingDescriptors(mapOf("defaultValue" to this.bankroll.initialValue))
} }
BankrollRow.RATE -> { BankrollPropertiesRow.RATE -> {
val rate = this.bankroll.currency?.rate val rate = this.bankroll.currency?.rate
row.editingDescriptors(mapOf("defaultValue" to rate)) row.editingDescriptors(mapOf("defaultValue" to rate))
} }
@ -184,12 +184,12 @@ class BankrollDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
override fun onRowSelected(position: Int, row: RowRepresentable, tag: Int) { override fun onRowSelected(position: Int, row: RowRepresentable, tag: Int) {
when (row) { when (row) {
BankrollRow.CURRENCY -> CurrenciesActivity.newInstanceForResult(this@BankrollDataFragment, BankrollPropertiesRow.CURRENCY -> CurrenciesActivity.newInstanceForResult(this@BankrollDataFragment,
RequestCode.CURRENCY.value RequestCode.CURRENCY.value
) )
BankrollRow.REFRESH_RATE -> refreshRate() BankrollPropertiesRow.REFRESH_RATE -> refreshRate()
BankrollRow.CAPTURE_BUYIN_CASHEDOUT -> this.bankrollModel.selectedCaptureType.value = ResultCaptureType.BUYIN_CASHEDOUT BankrollPropertiesRow.CAPTURE_BUYIN_CASHED_OUT -> this.bankrollModel.selectedCaptureType.value = ResultCaptureType.BUYIN_CASHEDOUT
BankrollRow.CAPTURE_NET_RESULT -> this.bankrollModel.selectedCaptureType.value = ResultCaptureType.NET_RESULT BankrollPropertiesRow.CAPTURE_NET_RESULT -> this.bankrollModel.selectedCaptureType.value = ResultCaptureType.NET_RESULT
else -> super.onRowSelected(position, row, tag) else -> super.onRowSelected(position, row, tag)
} }
} }
@ -198,11 +198,11 @@ class BankrollDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
super.onRowValueChanged(value, row) super.onRowValueChanged(value, row)
when (row) { when (row) {
BankrollRow.CURRENCY -> { // Clear the value when the currency has been updated BankrollPropertiesRow.CURRENCY -> { // Clear the value when the currency has been updated
this.lastRefreshRateCall = 0 this.lastRefreshRateCall = 0
this.rowRepresentableAdapter.notifyDataSetChanged() this.rowRepresentableAdapter.notifyDataSetChanged()
} }
BankrollRow.ONLINE -> { BankrollPropertiesRow.ONLINE -> {
when (value as? Boolean) { when (value as? Boolean) {
false -> this.bankrollModel.selectedCaptureType.value = ResultCaptureType.NET_RESULT false -> this.bankrollModel.selectedCaptureType.value = ResultCaptureType.NET_RESULT
else -> this.bankrollModel.selectedCaptureType.value = null else -> this.bankrollModel.selectedCaptureType.value = null
@ -220,19 +220,19 @@ class BankrollDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
rows.clear() rows.clear()
rows.add(SimpleRow.NAME) rows.add(SimpleRow.NAME)
rows.add(BankrollRow.ONLINE) rows.add(BankrollPropertiesRow.ONLINE)
rows.add(BankrollRow.INITIAL_VALUE) rows.add(BankrollPropertiesRow.INITIAL_VALUE)
rows.add(CustomizableRowRepresentable(customViewType = RowViewType.HEADER_TITLE, resId = R.string.currency)) rows.add(CustomizableRowRepresentable(customViewType = RowViewType.HEADER_TITLE, resId = R.string.currency))
rows.add(BankrollRow.CURRENCY) rows.add(BankrollPropertiesRow.CURRENCY)
if (this.shouldShowCurrencyRate) { if (this.shouldShowCurrencyRate) {
rows.add(BankrollRow.RATE) rows.add(BankrollPropertiesRow.RATE)
rows.add(BankrollRow.REFRESH_RATE) rows.add(BankrollPropertiesRow.REFRESH_RATE)
} }
if (!this.bankroll.live) { if (!this.bankroll.live) {
rows.add(CustomizableRowRepresentable(customViewType = RowViewType.HEADER_TITLE, resId = R.string.bankroll_capture_method)) rows.add(CustomizableRowRepresentable(customViewType = RowViewType.HEADER_TITLE, resId = R.string.bankroll_capture_method))
rows.add(BankrollRow.CAPTURE_NET_RESULT) rows.add(BankrollPropertiesRow.CAPTURE_NET_RESULT)
rows.add(BankrollRow.CAPTURE_BUYIN_CASHEDOUT) rows.add(BankrollPropertiesRow.CAPTURE_BUYIN_CASHED_OUT)
} }
} }
@ -266,13 +266,13 @@ class BankrollDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
val currenciesConverterValue = "${bankroll.currency?.code}_${defaultCurrency.currencyCode}" val currenciesConverterValue = "${bankroll.currency?.code}_${defaultCurrency.currencyCode}"
FreeConverterApi.currencyRate(currenciesConverterValue, requireContext()) { rate -> FreeConverterApi.currencyRate(currenciesConverterValue, requireContext()) { rate ->
onRowValueChanged(rate, BankrollRow.RATE) onRowValueChanged(rate, BankrollPropertiesRow.RATE)
isRefreshingRate = false isRefreshingRate = false
rowRepresentableAdapter.refreshRow(BankrollRow.REFRESH_RATE) rowRepresentableAdapter.refreshRow(BankrollPropertiesRow.REFRESH_RATE)
} }
this.isRefreshingRate = true this.isRefreshingRate = true
this.rowRepresentableAdapter.refreshRow(BankrollRow.REFRESH_RATE) this.rowRepresentableAdapter.refreshRow(BankrollPropertiesRow.REFRESH_RATE)
} }
override fun willSaveData() { override fun willSaveData() {

@ -20,7 +20,7 @@ import net.pokeranalytics.android.ui.extensions.px
import net.pokeranalytics.android.ui.extensions.showAlertDialog import net.pokeranalytics.android.ui.extensions.showAlertDialog
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor
import net.pokeranalytics.android.ui.view.rowrepresentable.CustomFieldRow import net.pokeranalytics.android.ui.view.rowrepresentable.CustomFieldPropertiesRow
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow
import net.pokeranalytics.android.util.NULL_TEXT import net.pokeranalytics.android.util.NULL_TEXT
import java.util.* import java.util.*
@ -82,7 +82,7 @@ class CustomFieldDataFragment : EditableDataFragment(), StaticRowRepresentableDa
) { ) {
super.onMoved(recyclerView, viewHolder, fromPos, target, toPos, x, y) super.onMoved(recyclerView, viewHolder, fromPos, target, toPos, x, y)
Collections.swap(customField.entries, fromPos - (CustomFieldRow.values().size + 1), toPos - (CustomFieldRow.values().size + 1)) Collections.swap(customField.entries, fromPos - (CustomFieldPropertiesRow.values().size + 1), toPos - (CustomFieldPropertiesRow.values().size + 1))
customField.entries.forEachIndexed { index, rowRepresentable -> customField.entries.forEachIndexed { index, rowRepresentable ->
val entry = rowRepresentable as CustomFieldEntry val entry = rowRepresentable as CustomFieldEntry
entry.order = index entry.order = index
@ -140,7 +140,7 @@ class CustomFieldDataFragment : EditableDataFragment(), StaticRowRepresentableDa
override fun boolForRow(row: RowRepresentable): Boolean { override fun boolForRow(row: RowRepresentable): Boolean {
return when (row) { return when (row) {
CustomFieldRow.COPY_ON_DUPLICATE -> customField.duplicateValue CustomFieldPropertiesRow.COPY_ON_DUPLICATE -> customField.duplicateValue
// CustomFieldRow.TYPE -> isUpdating // very weird // CustomFieldRow.TYPE -> isUpdating // very weird
else -> super.boolForRow(row) else -> super.boolForRow(row)
} }
@ -148,7 +148,7 @@ class CustomFieldDataFragment : EditableDataFragment(), StaticRowRepresentableDa
override fun intForRow(row: RowRepresentable): Int { override fun intForRow(row: RowRepresentable): Int {
return when (row) { return when (row) {
CustomFieldRow.TYPE -> customField.type CustomFieldPropertiesRow.TYPE -> customField.type
else -> super.intForRow(row) else -> super.intForRow(row)
} }
} }
@ -178,7 +178,7 @@ class CustomFieldDataFragment : EditableDataFragment(), StaticRowRepresentableDa
customField.updateRowRepresentation() customField.updateRowRepresentation()
rowRepresentableAdapter.notifyDataSetChanged() rowRepresentableAdapter.notifyDataSetChanged()
} }
CustomFieldRow.TYPE -> { CustomFieldPropertiesRow.TYPE -> {
customField.updateValue(value, row) customField.updateValue(value, row)
updateUI() updateUI()
rowRepresentableAdapter.notifyDataSetChanged() rowRepresentableAdapter.notifyDataSetChanged()

@ -12,7 +12,7 @@ import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor 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.ui.view.rowrepresentable.CustomizableRowRepresentable import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable
import net.pokeranalytics.android.ui.view.rowrepresentable.LocationRow import net.pokeranalytics.android.ui.view.rowrepresentable.LocationPropertiesRow
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow
import net.pokeranalytics.android.util.LocationManager import net.pokeranalytics.android.util.LocationManager
import net.pokeranalytics.android.util.NULL_TEXT import net.pokeranalytics.android.util.NULL_TEXT
@ -80,7 +80,7 @@ class LocationDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
override fun boolForRow(row: RowRepresentable): Boolean { override fun boolForRow(row: RowRepresentable): Boolean {
return when (row) { return when (row) {
LocationRow.LOCATION_PERMISSION_SWITCH -> return locationActivated LocationPropertiesRow.LOCATION_PERMISSION_SWITCH -> return locationActivated
else -> super.boolForRow(row) else -> super.boolForRow(row)
} }
} }
@ -104,7 +104,7 @@ class LocationDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
override fun onRowValueChanged(value: Any?, row: RowRepresentable) { override fun onRowValueChanged(value: Any?, row: RowRepresentable) {
when (row) { when (row) {
LocationRow.LOCATION_PERMISSION_SWITCH -> { LocationPropertiesRow.LOCATION_PERMISSION_SWITCH -> {
if (value is Boolean && value != locationActivated) { if (value is Boolean && value != locationActivated) {
rowPlaces.clear() rowPlaces.clear()
locationActivated = value locationActivated = value
@ -136,7 +136,7 @@ class LocationDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
private fun refreshRows() { private fun refreshRows() {
rows.clear() rows.clear()
rows.add(SimpleRow.NAME) rows.add(SimpleRow.NAME)
rows.add(LocationRow.LOCATION_PERMISSION_SWITCH) rows.add(LocationPropertiesRow.LOCATION_PERMISSION_SWITCH)
// Add info row to explain why we need the location permission // Add info row to explain why we need the location permission
rows.add(CustomizableRowRepresentable(customViewType = RowViewType.INFO, resId = R.string.location_when_in_use_usage_description)) rows.add(CustomizableRowRepresentable(customViewType = RowViewType.INFO, resId = R.string.location_when_in_use_usage_description))

@ -25,7 +25,7 @@ import net.pokeranalytics.android.ui.extensions.showAlertDialog
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor 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.ui.view.rowrepresentable.PlayerRow import net.pokeranalytics.android.ui.view.rowrepresentable.PlayerPropertiesRow
import net.pokeranalytics.android.util.NULL_TEXT import net.pokeranalytics.android.util.NULL_TEXT
import java.io.File import java.io.File
@ -61,7 +61,7 @@ class PlayerDataFragment : EditableDataFragment(), StaticRowRepresentableDataSou
if (requestCode == REQUEST_CODE_PICK_COLOR && resultCode == RESULT_OK && data?.hasExtra(ColorPickerActivity.INTENT_COLOR) == true) { if (requestCode == REQUEST_CODE_PICK_COLOR && resultCode == RESULT_OK && data?.hasExtra(ColorPickerActivity.INTENT_COLOR) == true) {
val color = data.getIntExtra(ColorPickerActivity.INTENT_COLOR, Color.TRANSPARENT) val color = data.getIntExtra(ColorPickerActivity.INTENT_COLOR, Color.TRANSPARENT)
player.color = if (color != Color.TRANSPARENT) color else null player.color = if (color != Color.TRANSPARENT) color else null
rowRepresentableAdapter.refreshRow(PlayerRow.IMAGE) rowRepresentableAdapter.refreshRow(PlayerPropertiesRow.IMAGE)
} }
} }
@ -84,7 +84,7 @@ class PlayerDataFragment : EditableDataFragment(), StaticRowRepresentableDataSou
player.updateRowRepresentation() player.updateRowRepresentation()
if (!deleteButtonShouldAppear) { if (!deleteButtonShouldAppear) {
onRowSelected(0, PlayerRow.NAME) onRowSelected(0, PlayerPropertiesRow.NAME)
} }
binding.addComment.setOnClickListener { binding.addComment.setOnClickListener {
@ -97,8 +97,8 @@ class PlayerDataFragment : EditableDataFragment(), StaticRowRepresentableDataSou
override fun getPhotos(files: ArrayList<File>) { override fun getPhotos(files: ArrayList<File>) {
super.getPhotos(files) super.getPhotos(files)
files.firstOrNull()?.let { picture -> files.firstOrNull()?.let { picture ->
player.updateValue(picture.absolutePath, PlayerRow.IMAGE) player.updateValue(picture.absolutePath, PlayerPropertiesRow.IMAGE)
rowRepresentableAdapter.refreshRow(PlayerRow.IMAGE) rowRepresentableAdapter.refreshRow(PlayerPropertiesRow.IMAGE)
} }
} }
@ -130,15 +130,15 @@ class PlayerDataFragment : EditableDataFragment(), StaticRowRepresentableDataSou
tag: Int tag: Int
): CharSequence { ): CharSequence {
return when (row) { return when (row) {
PlayerRow.NAME -> if (player.name.isNotEmpty()) player.name else NULL_TEXT PlayerPropertiesRow.NAME -> if (player.name.isNotEmpty()) player.name else NULL_TEXT
PlayerRow.SUMMARY -> if (player.summary.isNotEmpty()) player.summary else NULL_TEXT PlayerPropertiesRow.SUMMARY -> if (player.summary.isNotEmpty()) player.summary else NULL_TEXT
else -> super.charSequenceForRow(row, context, 0) else -> super.charSequenceForRow(row, context, 0)
} }
} }
override fun onRowSelected(position: Int, row: RowRepresentable, tag: Int) { override fun onRowSelected(position: Int, row: RowRepresentable, tag: Int) {
when (row) { when (row) {
PlayerRow.IMAGE -> openPictureDialog() PlayerPropertiesRow.IMAGE -> openPictureDialog()
is Comment -> { is Comment -> {
val data = arrayListOf(RowRepresentableEditDescriptor(row.content)) val data = arrayListOf(RowRepresentableEditDescriptor(row.content))
showBottomSheet(row, this, data, isClearable = false, isDeletable = true) showBottomSheet(row, this, data, isClearable = false, isDeletable = true)
@ -156,8 +156,8 @@ class PlayerDataFragment : EditableDataFragment(), StaticRowRepresentableDataSou
} }
else -> { else -> {
super.onRowValueChanged(value, row) super.onRowValueChanged(value, row)
if (row == PlayerRow.NAME) { if (row == PlayerPropertiesRow.NAME) {
rowRepresentableAdapter.refreshRow(PlayerRow.IMAGE) rowRepresentableAdapter.refreshRow(PlayerPropertiesRow.IMAGE)
} }
} }
@ -205,8 +205,8 @@ class PlayerDataFragment : EditableDataFragment(), StaticRowRepresentableDataSou
ColorPickerActivity.newInstanceForResult(this, REQUEST_CODE_PICK_COLOR) ColorPickerActivity.newInstanceForResult(this, REQUEST_CODE_PICK_COLOR)
} }
getString(R.string.remove_picture) -> { getString(R.string.remove_picture) -> {
player.updateValue(null, PlayerRow.IMAGE) player.updateValue(null, PlayerPropertiesRow.IMAGE)
rowRepresentableAdapter.refreshRow(PlayerRow.IMAGE) rowRepresentableAdapter.refreshRow(PlayerPropertiesRow.IMAGE)
} }
} }
} }
@ -220,8 +220,8 @@ class PlayerDataFragment : EditableDataFragment(), StaticRowRepresentableDataSou
override fun editDescriptors(row: RowRepresentable): List<RowRepresentableEditDescriptor>? { override fun editDescriptors(row: RowRepresentable): List<RowRepresentableEditDescriptor>? {
when (row) { when (row) {
PlayerRow.NAME -> return arrayListOf(RowRepresentableEditDescriptor(this.player.name, R.string.name)) PlayerPropertiesRow.NAME -> return arrayListOf(RowRepresentableEditDescriptor(this.player.name, R.string.name))
PlayerRow.SUMMARY -> return arrayListOf(RowRepresentableEditDescriptor(this.player.summary, R.string.summary)) PlayerPropertiesRow.SUMMARY -> return arrayListOf(RowRepresentableEditDescriptor(this.player.summary, R.string.summary))
} }
return null return null
} }

@ -15,7 +15,7 @@ import net.pokeranalytics.android.ui.adapter.StaticRowRepresentableDataSource
import net.pokeranalytics.android.ui.helpers.DateTimePickerManager import net.pokeranalytics.android.ui.helpers.DateTimePickerManager
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor
import net.pokeranalytics.android.ui.view.rowrepresentable.TransactionRow import net.pokeranalytics.android.ui.view.rowrepresentable.TransactionPropertiesRow
import net.pokeranalytics.android.util.NULL_TEXT import net.pokeranalytics.android.util.NULL_TEXT
import net.pokeranalytics.android.util.extensions.round import net.pokeranalytics.android.util.extensions.round
import net.pokeranalytics.android.util.extensions.shortDate import net.pokeranalytics.android.util.extensions.shortDate
@ -63,38 +63,38 @@ class TransactionDataFragment : EditableDataFragment(), StaticRowRepresentableDa
tag: Int tag: Int
): CharSequence { ): CharSequence {
return when (row) { return when (row) {
TransactionRow.BANKROLL -> this.transaction.bankroll?.name ?: NULL_TEXT TransactionPropertiesRow.BANKROLL -> this.transaction.bankroll?.name ?: NULL_TEXT
TransactionRow.TYPE -> this.transaction.type?.name ?: NULL_TEXT TransactionPropertiesRow.TYPE -> this.transaction.type?.name ?: NULL_TEXT
TransactionRow.AMOUNT -> if (this.transaction.amount != 0.0) abs(this.transaction.amount).round() else NULL_TEXT TransactionPropertiesRow.AMOUNT -> if (this.transaction.amount != 0.0) abs(this.transaction.amount).round() else NULL_TEXT
TransactionRow.COMMENT -> if (this.transaction.comment.isNotEmpty()) this.transaction.comment else NULL_TEXT TransactionPropertiesRow.COMMENT -> if (this.transaction.comment.isNotEmpty()) this.transaction.comment else NULL_TEXT
TransactionRow.DATE -> this.transaction.date.shortDate() TransactionPropertiesRow.DATE -> this.transaction.date.shortDate()
else -> super.charSequenceForRow(row, context, 0) else -> super.charSequenceForRow(row, context, 0)
} }
} }
override fun editDescriptors(row: RowRepresentable): List<RowRepresentableEditDescriptor>? { override fun editDescriptors(row: RowRepresentable): List<RowRepresentableEditDescriptor>? {
return when (row) { return when (row) {
TransactionRow.BANKROLL -> row.editingDescriptors( TransactionPropertiesRow.BANKROLL -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to this.transaction.bankroll, "defaultValue" to this.transaction.bankroll,
"data" to getRealm().sorted<Bankroll>() "data" to getRealm().sorted<Bankroll>()
) )
) )
TransactionRow.TYPE -> row.editingDescriptors( TransactionPropertiesRow.TYPE -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to this.transaction.type, "defaultValue" to this.transaction.type,
"data" to getRealm().sorted<TransactionType>() "data" to getRealm().sorted<TransactionType>()
) )
) )
TransactionRow.AMOUNT -> row.editingDescriptors(mapOf("defaultValue" to (if (this.transaction.amount != 0.0) abs(this.transaction.amount).round() else ""))) TransactionPropertiesRow.AMOUNT -> row.editingDescriptors(mapOf("defaultValue" to (if (this.transaction.amount != 0.0) abs(this.transaction.amount).round() else "")))
TransactionRow.COMMENT -> row.editingDescriptors(mapOf("defaultValue" to this.transaction.comment)) TransactionPropertiesRow.COMMENT -> row.editingDescriptors(mapOf("defaultValue" to this.transaction.comment))
else -> super.editDescriptors(row) else -> super.editDescriptors(row)
} }
} }
override fun onRowSelected(position: Int, row: RowRepresentable, tag: Int) { override fun onRowSelected(position: Int, row: RowRepresentable, tag: Int) {
when (row) { when (row) {
TransactionRow.DATE -> DateTimePickerManager.create( TransactionPropertiesRow.DATE -> DateTimePickerManager.create(
requireContext(), requireContext(),
row, row,
this, this,
@ -121,8 +121,8 @@ class TransactionDataFragment : EditableDataFragment(), StaticRowRepresentableDa
GlobalScope.launch(Dispatchers.Main) { GlobalScope.launch(Dispatchers.Main) {
delay(200) delay(200)
when (currentRow) { when (currentRow) {
TransactionRow.BANKROLL -> onRowSelected(0, TransactionRow.TYPE) TransactionPropertiesRow.BANKROLL -> onRowSelected(0, TransactionPropertiesRow.TYPE)
TransactionRow.TYPE -> onRowSelected(0, TransactionRow.AMOUNT) TransactionPropertiesRow.TYPE -> onRowSelected(0, TransactionPropertiesRow.AMOUNT)
// TransactionRow.AMOUNT -> onRowSelected(0, TransactionRow.DATE) // TransactionRow.AMOUNT -> onRowSelected(0, TransactionRow.DATE)
// TransactionRow.DATE -> onRowSelected(0, TransactionRow.COMMENT) // TransactionRow.DATE -> onRowSelected(0, TransactionRow.COMMENT)
} }

@ -7,7 +7,7 @@ import net.pokeranalytics.android.ui.adapter.RowRepresentableDataSource
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow
import net.pokeranalytics.android.ui.view.rowrepresentable.TransactionTypeRow import net.pokeranalytics.android.ui.view.rowrepresentable.TransactionTypePropertiesRow
class TransactionTypeDataFragment : EditableDataFragment(), RowRepresentableDataSource { class TransactionTypeDataFragment : EditableDataFragment(), RowRepresentableDataSource {
@ -47,7 +47,7 @@ class TransactionTypeDataFragment : EditableDataFragment(), RowRepresentableData
override fun boolForRow(row: RowRepresentable): Boolean { override fun boolForRow(row: RowRepresentable): Boolean {
return when (row) { return when (row) {
TransactionTypeRow.TRANSACTION_ADDITIVE -> this.transactionType.additive TransactionTypePropertiesRow.TRANSACTION_ADDITIVE -> this.transactionType.additive
else -> super.boolForRow(row) else -> super.boolForRow(row)
} }
} }
@ -61,7 +61,7 @@ class TransactionTypeDataFragment : EditableDataFragment(), RowRepresentableData
tag: Int tag: Int
): Boolean { ): Boolean {
return when (row) { return when (row) {
TransactionTypeRow.TRANSACTION_ADDITIVE -> { TransactionTypePropertiesRow.TRANSACTION_ADDITIVE -> {
return this.transactionType.isValidForDelete(getRealm()) return this.transactionType.isValidForDelete(getRealm())
} }
else -> super.isEnabled(row, 0) else -> super.isEnabled(row, 0)
@ -70,7 +70,7 @@ class TransactionTypeDataFragment : EditableDataFragment(), RowRepresentableData
override fun isSelectable(row: RowRepresentable): Boolean { override fun isSelectable(row: RowRepresentable): Boolean {
return when (row) { return when (row) {
TransactionTypeRow.TRANSACTION_ADDITIVE -> { TransactionTypePropertiesRow.TRANSACTION_ADDITIVE -> {
val realm = getRealm() val realm = getRealm()
val useCount = realm.where(Transaction::class.java) val useCount = realm.where(Transaction::class.java)
.equalTo("type.id", this.transactionType.id).count() .equalTo("type.id", this.transactionType.id).count()

@ -37,7 +37,7 @@ import net.pokeranalytics.android.ui.modules.data.EditableDataActivity
import net.pokeranalytics.android.ui.modules.datalist.DataListActivity import net.pokeranalytics.android.ui.modules.datalist.DataListActivity
import net.pokeranalytics.android.ui.modules.handhistory.HandHistoryActivity import net.pokeranalytics.android.ui.modules.handhistory.HandHistoryActivity
import net.pokeranalytics.android.ui.view.* import net.pokeranalytics.android.ui.view.*
import net.pokeranalytics.android.ui.view.rowrepresentable.SessionRow import net.pokeranalytics.android.ui.view.rowrepresentable.SessionPropertiesRow
import net.pokeranalytics.android.util.Preferences import net.pokeranalytics.android.util.Preferences
import net.pokeranalytics.android.util.extensions.* import net.pokeranalytics.android.util.extensions.*
import timber.log.Timber import timber.log.Timber
@ -226,8 +226,8 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr
val data = this.editDescriptors(row) val data = this.editDescriptors(row)
when (row) { when (row) {
SessionRow.START_DATE -> DateTimePickerManager.create(requireContext(), row, this, session.startDate) SessionPropertiesRow.START_DATE -> DateTimePickerManager.create(requireContext(), row, this, session.startDate)
SessionRow.END_DATE -> { SessionPropertiesRow.END_DATE -> {
if (session.startDate == null) { if (session.startDate == null) {
Toast.makeText(context, R.string.session_missing_start_date, Toast.LENGTH_SHORT).show() Toast.makeText(context, R.string.session_missing_start_date, Toast.LENGTH_SHORT).show()
@ -242,10 +242,10 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr
} }
} }
SessionRow.BANKROLL -> { SessionPropertiesRow.BANKROLL -> {
showBottomSheet(row, this, data, false, session.currency) showBottomSheet(row, this, data, false, session.currency)
} }
SessionRow.HANDS -> { SessionPropertiesRow.HANDS -> {
val hhIds = session.handHistories?.map { it.id }?.toTypedArray() val hhIds = session.handHistories?.map { it.id }?.toTypedArray()
DataListActivity.newInstance(this, LiveData.HAND_HISTORY, false, hhIds, false) DataListActivity.newInstance(this, LiveData.HAND_HISTORY, false, hhIds, false)
} }
@ -265,10 +265,10 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr
} }
this.sessionAdapter.refreshRow(row) this.sessionAdapter.refreshRow(row)
when (row) { when (row) {
SessionRow.CASHED_OUT, SessionRow.PRIZE, SessionRow.NET_RESULT, SessionPropertiesRow.CASHED_OUT, SessionPropertiesRow.PRIZE, SessionPropertiesRow.NET_RESULT,
SessionRow.BUY_IN, SessionRow.TIPS, SessionRow.START_DATE, SessionPropertiesRow.BUY_IN, SessionPropertiesRow.TIPS, SessionPropertiesRow.START_DATE,
SessionRow.END_DATE, SessionRow.BREAK_TIME -> updateSessionUI() SessionPropertiesRow.END_DATE, SessionPropertiesRow.BREAK_TIME -> updateSessionUI()
SessionRow.BANKROLL -> { SessionPropertiesRow.BANKROLL -> {
updateSessionUI() updateSessionUI()
updateMenuUI() // result capture method updateMenuUI() // result capture method
} }
@ -518,7 +518,7 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr
override fun actionIconForRow(row: RowRepresentable): Int? { override fun actionIconForRow(row: RowRepresentable): Int? {
return when (row) { return when (row) {
SessionRow.START_DATE, SessionRow.END_DATE -> { SessionPropertiesRow.START_DATE, SessionPropertiesRow.END_DATE -> {
R.drawable.ic_close R.drawable.ic_close
} }
else -> null else -> null
@ -529,92 +529,92 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr
val session = this.currentSession val session = this.currentSession
return when (row) { return when (row) {
SessionRow.BANKROLL -> row.editingDescriptors( SessionPropertiesRow.BANKROLL -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to session.bankroll, "defaultValue" to session.bankroll,
"data" to getRealm().sorted<Bankroll>() // LiveData.Bankroll.items(realm) "data" to getRealm().sorted<Bankroll>() // LiveData.Bankroll.items(realm)
) )
) )
SessionRow.GAME -> row.editingDescriptors( SessionPropertiesRow.GAME -> row.editingDescriptors(
mapOf( mapOf(
"limit" to session.limit, "limit" to session.limit,
"defaultValue" to session.game, "defaultValue" to session.game,
"data" to getRealm().sorted<Game>() //LiveData.Game.items(realm) "data" to getRealm().sorted<Game>() //LiveData.Game.items(realm)
) )
) )
SessionRow.LOCATION -> row.editingDescriptors( SessionPropertiesRow.LOCATION -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to session.location, "defaultValue" to session.location,
"data" to getRealm().sorted<Location>() // LiveData.Location.items(realm) "data" to getRealm().sorted<Location>() // LiveData.Location.items(realm)
) )
) )
SessionRow.TOURNAMENT_FEATURE -> row.editingDescriptors( SessionPropertiesRow.TOURNAMENT_FEATURE -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to session.tournamentFeatures, "defaultValue" to session.tournamentFeatures,
"data" to getRealm().sorted<TournamentFeature>() //LiveData.TournamentFeature.items(realm) "data" to getRealm().sorted<TournamentFeature>() //LiveData.TournamentFeature.items(realm)
) )
) )
SessionRow.TOURNAMENT_NAME -> row.editingDescriptors( SessionPropertiesRow.TOURNAMENT_NAME -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to session.tournamentName, "defaultValue" to session.tournamentName,
"data" to getRealm().sorted<TournamentName>() //LiveData.TournamentName.items(realm) "data" to getRealm().sorted<TournamentName>() //LiveData.TournamentName.items(realm)
) )
) )
SessionRow.TOURNAMENT_TYPE -> row.editingDescriptors( SessionPropertiesRow.TOURNAMENT_TYPE -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to session.tournamentType "defaultValue" to session.tournamentType
) )
) )
SessionRow.TABLE_SIZE -> row.editingDescriptors( SessionPropertiesRow.TABLE_SIZE -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to session.tableSize "defaultValue" to session.tableSize
) )
) )
SessionRow.BLINDS -> row.editingDescriptors( SessionPropertiesRow.BLINDS -> row.editingDescriptors(
mapOf( mapOf(
"sb" to session.cgSmallBlind?.round(), "sb" to session.cgSmallBlind?.round(),
"bb" to session.cgBigBlind?.round() "bb" to session.cgBigBlind?.round()
) )
) )
SessionRow.BUY_IN -> row.editingDescriptors( SessionPropertiesRow.BUY_IN -> row.editingDescriptors(
mapOf( mapOf(
"bb" to session.cgBigBlind, "bb" to session.cgBigBlind,
"fee" to session.tournamentEntryFee, "fee" to session.tournamentEntryFee,
"ratedBuyin" to session.result?.buyin "ratedBuyin" to session.result?.buyin
) )
) )
SessionRow.BREAK_TIME -> row.editingDescriptors(mapOf()) SessionPropertiesRow.BREAK_TIME -> row.editingDescriptors(mapOf())
SessionRow.CASHED_OUT, SessionRow.PRIZE -> row.editingDescriptors( SessionPropertiesRow.CASHED_OUT, SessionPropertiesRow.PRIZE -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to session.result?.cashout "defaultValue" to session.result?.cashout
) )
) )
SessionRow.NET_RESULT -> row.editingDescriptors( SessionPropertiesRow.NET_RESULT -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to session.result?.netResult "defaultValue" to session.result?.netResult
) )
) )
SessionRow.COMMENT -> row.editingDescriptors( SessionPropertiesRow.COMMENT -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to session.comment "defaultValue" to session.comment
) )
) )
SessionRow.INITIAL_BUY_IN -> row.editingDescriptors( SessionPropertiesRow.INITIAL_BUY_IN -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to session.tournamentEntryFee "defaultValue" to session.tournamentEntryFee
) )
) )
SessionRow.PLAYERS -> row.editingDescriptors( SessionPropertiesRow.PLAYERS -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to session.tournamentNumberOfPlayers "defaultValue" to session.tournamentNumberOfPlayers
) )
) )
SessionRow.POSITION -> row.editingDescriptors( SessionPropertiesRow.POSITION -> row.editingDescriptors(
mapOf( mapOf(
"defaultValue" to session.result?.tournamentFinalPosition "defaultValue" to session.result?.tournamentFinalPosition
) )
) )
SessionRow.TIPS -> row.editingDescriptors( SessionPropertiesRow.TIPS -> row.editingDescriptors(
mapOf( mapOf(
"sb" to session.cgSmallBlind?.round(), "sb" to session.cgSmallBlind?.round(),
"bb" to session.cgBigBlind?.round(), "bb" to session.cgBigBlind?.round(),

@ -15,7 +15,7 @@ import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable
import net.pokeranalytics.android.ui.view.rowrepresentable.SeparatorRow import net.pokeranalytics.android.ui.view.rowrepresentable.SeparatorRow
import net.pokeranalytics.android.ui.view.rowrepresentable.SessionRow import net.pokeranalytics.android.ui.view.rowrepresentable.SessionPropertiesRow
import net.pokeranalytics.android.util.extensions.sorted import net.pokeranalytics.android.util.extensions.sorted
import java.util.ArrayList import java.util.ArrayList
@ -100,7 +100,7 @@ class SessionViewModel : ViewModel() {
} }
// Rows // Rows
rows.addAll(SessionRow.getRows(session, this.resultCaptureType, context)) rows.addAll(SessionPropertiesRow.getRows(session, this.resultCaptureType, context))
// Add custom fields // Add custom fields
rows.add(SeparatorRow()) rows.add(SeparatorRow())

@ -2,7 +2,6 @@ package net.pokeranalytics.android.ui.view
import net.pokeranalytics.android.R import net.pokeranalytics.android.R
enum class CalendarTabs : Displayable { enum class CalendarTabs : Displayable {
NET_RESULTS, NET_RESULTS,
NET_HOURLY_RATE, NET_HOURLY_RATE,

@ -214,7 +214,7 @@ enum class RowViewType(private var layoutRes: Int) : ViewIdentifier {
BindableHolder { BindableHolder {
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) {
if (row is StatDoubleRow) { if (row is DualStatRow) {
// Stat 1 // Stat 1
itemView.findViewById<AppCompatTextView?>(R.id.stat1Name)?.let { view -> itemView.findViewById<AppCompatTextView?>(R.id.stat1Name)?.let { view ->
@ -363,7 +363,7 @@ enum class RowViewType(private var layoutRes: Int) : ViewIdentifier {
BindableHolder { BindableHolder {
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) {
if (row is CustomFieldRow) { if (row is CustomFieldPropertiesRow) {
itemView.findViewById<ChipGroup>(R.id.chipGroup)?.let { chipGroup -> itemView.findViewById<ChipGroup>(R.id.chipGroup)?.let { chipGroup ->
@ -561,7 +561,7 @@ enum class RowViewType(private var layoutRes: Int) : ViewIdentifier {
override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) {
itemView.findViewById<PlayerImageView?>(R.id.playerImageView)?.let { playerImageView -> itemView.findViewById<PlayerImageView?>(R.id.playerImageView)?.let { playerImageView ->
val listener = View.OnClickListener { val listener = View.OnClickListener {
adapter.delegate?.onRowSelected(position, PlayerRow.IMAGE) adapter.delegate?.onRowSelected(position, PlayerPropertiesRow.IMAGE)
} }
playerImageView.setPlayer(row as Player) playerImageView.setPlayer(row as Player)
playerImageView.setOnImageClickListener(listener) playerImageView.setOnImageClickListener(listener)

@ -1,5 +1,6 @@
package net.pokeranalytics.android.ui.view.rowrepresentable package net.pokeranalytics.android.ui.view.rowrepresentable
import android.content.Context
import net.pokeranalytics.android.ui.modules.bankroll.BankrollRowRepresentable import net.pokeranalytics.android.ui.modules.bankroll.BankrollRowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
@ -11,3 +12,15 @@ class BankrollMainRow :
override val viewType: Int = RowViewType.LEGEND_DEFAULT.ordinal override val viewType: Int = RowViewType.LEGEND_DEFAULT.ordinal
} }
class BankrollTotalRow(override var bankrollId: String?, var name: String) :
BankrollRowRepresentable {
override val viewType: Int = RowViewType.TITLE_VALUE_ARROW.ordinal
override fun localizedTitle(context: Context): String {
return name
}
}

@ -9,13 +9,13 @@ import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
enum class BankrollRow : RowRepresentable, DefaultEditDataSource { enum class BankrollPropertiesRow : RowRepresentable, DefaultEditDataSource {
ONLINE, ONLINE,
INITIAL_VALUE, INITIAL_VALUE,
CURRENCY, CURRENCY,
RATE, RATE,
REFRESH_RATE, REFRESH_RATE,
CAPTURE_BUYIN_CASHEDOUT, CAPTURE_BUYIN_CASHED_OUT,
CAPTURE_NET_RESULT; CAPTURE_NET_RESULT;
override val resId: Int? override val resId: Int?
@ -26,7 +26,7 @@ enum class BankrollRow : RowRepresentable, DefaultEditDataSource {
CURRENCY -> R.string.currency CURRENCY -> R.string.currency
RATE -> R.string.rate RATE -> R.string.rate
REFRESH_RATE -> R.string.refresh_rate REFRESH_RATE -> R.string.refresh_rate
CAPTURE_BUYIN_CASHEDOUT -> R.string.stack_buy_in CAPTURE_BUYIN_CASHED_OUT -> R.string.stack_buy_in
CAPTURE_NET_RESULT -> R.string.net_result_only CAPTURE_NET_RESULT -> R.string.net_result_only
} }
} }
@ -39,7 +39,7 @@ enum class BankrollRow : RowRepresentable, DefaultEditDataSource {
CURRENCY -> RowViewType.TITLE_VALUE_ARROW.ordinal CURRENCY -> RowViewType.TITLE_VALUE_ARROW.ordinal
RATE -> RowViewType.TITLE_VALUE.ordinal RATE -> RowViewType.TITLE_VALUE.ordinal
REFRESH_RATE -> RowViewType.ROW_BUTTON.ordinal REFRESH_RATE -> RowViewType.ROW_BUTTON.ordinal
CAPTURE_BUYIN_CASHEDOUT -> RowViewType.TITLE_CHECK.ordinal CAPTURE_BUYIN_CASHED_OUT -> RowViewType.TITLE_CHECK.ordinal
CAPTURE_NET_RESULT -> RowViewType.TITLE_CHECK.ordinal CAPTURE_NET_RESULT -> RowViewType.TITLE_CHECK.ordinal
} }
} }
@ -52,7 +52,7 @@ enum class BankrollRow : RowRepresentable, DefaultEditDataSource {
CURRENCY -> BottomSheetType.NONE CURRENCY -> BottomSheetType.NONE
RATE -> BottomSheetType.NUMERIC_TEXT RATE -> BottomSheetType.NUMERIC_TEXT
REFRESH_RATE -> BottomSheetType.NONE REFRESH_RATE -> BottomSheetType.NONE
CAPTURE_BUYIN_CASHEDOUT -> BottomSheetType.NONE CAPTURE_BUYIN_CASHED_OUT -> BottomSheetType.NONE
CAPTURE_NET_RESULT -> BottomSheetType.NONE CAPTURE_NET_RESULT -> BottomSheetType.NONE
} }
} }
@ -77,13 +77,4 @@ enum class BankrollRow : RowRepresentable, DefaultEditDataSource {
} }
} }
// val resultCaptureType: ResultCaptureType?
// get() {
// return when (this) {
// CAPTURE_NET_RESULT -> ResultCaptureType.NET_RESULT
// CAPTURE_BUYIN_CASHEDOUT -> ResultCaptureType.BUYIN_CASHEDOUT
// else -> null
// }
// }
} }

@ -7,7 +7,7 @@ import net.pokeranalytics.android.ui.view.DefaultEditDataSource
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
enum class CustomFieldRow : RowRepresentable, DefaultEditDataSource { enum class CustomFieldPropertiesRow : RowRepresentable, DefaultEditDataSource {
TYPE, TYPE,
COPY_ON_DUPLICATE; COPY_ON_DUPLICATE;
@ -50,7 +50,7 @@ enum class CustomFieldRow : RowRepresentable, DefaultEditDataSource {
type.isEnabled = if (!isUpdating) { type.isEnabled = if (!isUpdating) {
true true
} else { } else {
!(currentChoiceIndex == CustomFieldRow.TYPE.ordinal || type == CustomField.Type.LIST) !(currentChoiceIndex == CustomFieldPropertiesRow.TYPE.ordinal || type == CustomField.Type.LIST)
} }
} }
return list return list

@ -6,17 +6,6 @@ import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
import net.pokeranalytics.android.util.TextFormat import net.pokeranalytics.android.util.TextFormat
class BankrollTotalRow(override var bankrollId: String?, var name: String) :
BankrollRowRepresentable {
override val viewType: Int = RowViewType.TITLE_VALUE_ARROW.ordinal
override fun localizedTitle(context: Context): String {
return name
}
}
interface ViewIdentifier { interface ViewIdentifier {
val identifier: Int val identifier: Int
} }

@ -5,7 +5,7 @@ import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
class StatDoubleRow(var computedStat1: ComputedStat? = null, var computedStat2: ComputedStat? = null) : RowRepresentable { class DualStatRow(var computedStat1: ComputedStat? = null, var computedStat2: ComputedStat? = null) : RowRepresentable {
override val viewType: Int override val viewType: Int
get() = RowViewType.STATS_DOUBLE.ordinal get() = RowViewType.STATS_DOUBLE.ordinal

@ -6,7 +6,8 @@ import net.pokeranalytics.android.ui.view.DefaultEditDataSource
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
enum class GameRow : RowRepresentable, DefaultEditDataSource { enum class GamePropertiesRow : RowRepresentable, DefaultEditDataSource {
SHORT_NAME; SHORT_NAME;
override val resId: Int? override val resId: Int?

@ -8,8 +8,7 @@ import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
class BankrollGraphRow : GraphRow(null, null, null, null), class BankrollGraphRow : GraphRow(null, null, null, null), BankrollRowRepresentable {
BankrollRowRepresentable {
override var bankrollId: String? = null override var bankrollId: String? = null

@ -7,7 +7,7 @@ import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
enum class LocationRow : RowRepresentable, DefaultEditDataSource { enum class LocationPropertiesRow : RowRepresentable, DefaultEditDataSource {
LOCATION_PERMISSION_SWITCH, LOCATION_PERMISSION_SWITCH,
LOCATION_LOADER; LOCATION_LOADER;

@ -9,7 +9,7 @@ import net.pokeranalytics.android.ui.view.RowViewType
/** /**
* An enum managing the player rows * An enum managing the player rows
*/ */
enum class PlayerRow : RowRepresentable { enum class PlayerPropertiesRow : RowRepresentable {
IMAGE, IMAGE,
NAME, NAME,
SUMMARY; SUMMARY;

@ -18,7 +18,6 @@ enum class ReportRow : RowRepresentable {
TOURNAMENT_TYPES, TOURNAMENT_TYPES,
GAME; GAME;
companion object { companion object {
/** /**
* Return the report rows * Return the report rows

@ -16,7 +16,7 @@ import net.pokeranalytics.android.ui.view.RowViewType
import net.pokeranalytics.android.util.extensions.round import net.pokeranalytics.android.util.extensions.round
enum class SessionRow : RowRepresentable { enum class SessionPropertiesRow : RowRepresentable {
PRIZE, PRIZE,
CASHED_OUT, CASHED_OUT,

@ -7,7 +7,7 @@ import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
enum class SettingRow : RowRepresentable { enum class SettingsRow : RowRepresentable {
// More // More
BANKROLL_REPORT, BANKROLL_REPORT,

@ -8,6 +8,7 @@ import net.pokeranalytics.android.ui.view.RowViewType
enum class SimpleRow : RowRepresentable, DefaultEditDataSource { enum class SimpleRow : RowRepresentable, DefaultEditDataSource {
NAME; NAME;
override val resId: Int? = R.string.name override val resId: Int? = R.string.name

@ -7,11 +7,10 @@ import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
class StatRow(stat: Stat, computedStat: ComputedStat?, groupName: String = "", var title: String? = null) : RowRepresentable { class StatRow(var stat: Stat,
var computedStat: ComputedStat?,
var stat: Stat = stat var groupName: String = "",
var computedStat: ComputedStat? = computedStat var title: String? = null) : RowRepresentable {
var groupName: String = groupName
override val viewType: Int override val viewType: Int
get() = RowViewType.STATS.ordinal get() = RowViewType.STATS.ordinal

@ -10,7 +10,8 @@ import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
enum class TransactionRow : RowRepresentable, DefaultEditDataSource { enum class TransactionPropertiesRow : RowRepresentable, DefaultEditDataSource {
BANKROLL, BANKROLL,
TYPE, TYPE,
AMOUNT, AMOUNT,

@ -6,7 +6,8 @@ import net.pokeranalytics.android.ui.view.DefaultEditDataSource
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
enum class TransactionTypeRow : RowRepresentable, DefaultEditDataSource { enum class TransactionTypePropertiesRow : RowRepresentable, DefaultEditDataSource {
TRANSACTION_ADDITIVE; TRANSACTION_ADDITIVE;
override val resId: Int? override val resId: Int?
@ -30,6 +31,4 @@ enum class TransactionTypeRow : RowRepresentable, DefaultEditDataSource {
} }
} }
} }

@ -10,7 +10,7 @@ import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate
import net.pokeranalytics.android.ui.fragment.components.bottomsheet.BottomSheetType import net.pokeranalytics.android.ui.fragment.components.bottomsheet.BottomSheetType
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor
import net.pokeranalytics.android.ui.view.rowrepresentable.SessionRow import net.pokeranalytics.android.ui.view.rowrepresentable.SessionPropertiesRow
import java.util.* import java.util.*
class BottomSheetViewModelFactory(var row: RowRepresentable, var delegate: RowRepresentableDelegate): ViewModelProvider.Factory { class BottomSheetViewModelFactory(var row: RowRepresentable, var delegate: RowRepresentableDelegate): ViewModelProvider.Factory {
@ -105,7 +105,7 @@ class BottomSheetViewModel(var row: RowRepresentable) : ViewModel() {
throw RowRepresentableEditDescriptorException("RowRepresentableEditDescriptor inconsistency") throw RowRepresentableEditDescriptorException("RowRepresentableEditDescriptor inconsistency")
} }
this.isEditingBlinds = this.row == SessionRow.BLINDS this.isEditingBlinds = this.row == SessionPropertiesRow.BLINDS
this.stringValue = descriptors[0].defaultValue as? String this.stringValue = descriptors[0].defaultValue as? String
this.secondStringValue = descriptors[1].defaultValue as? String this.secondStringValue = descriptors[1].defaultValue as? String

Loading…
Cancel
Save