|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
package net.pokeranalytics.android.ui.view.rowrepresentable |
|
|
|
|
|
|
|
|
|
import android.content.Context |
|
|
|
|
import net.pokeranalytics.android.R |
|
|
|
|
import net.pokeranalytics.android.exceptions.PokerAnalyticsException |
|
|
|
|
import net.pokeranalytics.android.model.filter.QueryType |
|
|
|
|
@ -7,7 +8,6 @@ import net.pokeranalytics.android.model.interfaces.Manageable |
|
|
|
|
import net.pokeranalytics.android.model.realm.FilterElement |
|
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
|
import net.pokeranalytics.android.ui.view.RowViewType |
|
|
|
|
|
|
|
|
|
import java.util.* |
|
|
|
|
|
|
|
|
|
sealed class FilterElementRow : RowRepresentable { |
|
|
|
|
@ -30,6 +30,19 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
|
val name: String = (data as RowRepresentable).getDisplayName() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
open class StaticDataFilterElementRow(var row: RowRepresentable) : FilterElementRow() { |
|
|
|
|
|
|
|
|
|
override val resId: Int? = row.resId |
|
|
|
|
|
|
|
|
|
fun getDataDisplayName() : String { |
|
|
|
|
return row.getDisplayName() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun getDataLocalizedTitle(context: Context): String { |
|
|
|
|
return row.localizedTitle(context) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
open class SingleValueFilterElementRow(val value: Int) : FilterElementRow() |
|
|
|
|
|
|
|
|
|
data class Blind(var sb: Double? = null, var bb: Double? = null, var code: String? = null) : FilterElementRow() |
|
|
|
|
@ -39,8 +52,8 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
|
data class Month(val month: Int) : SingleValueFilterElementRow(month) |
|
|
|
|
data class Day(val day: Int) : SingleValueFilterElementRow(day) |
|
|
|
|
data class PastDays(var lastDays: Int = 0) : FilterElementRow() |
|
|
|
|
data class Limit(val limit : net.pokeranalytics.android.model.Limit) : FilterElementRow() |
|
|
|
|
data class TableSize(val tableSize : net.pokeranalytics.android.model.TableSize) : FilterElementRow() |
|
|
|
|
data class Limit(val limit: net.pokeranalytics.android.model.Limit) : StaticDataFilterElementRow(limit) |
|
|
|
|
data class TableSize(val tableSize: net.pokeranalytics.android.model.TableSize) : StaticDataFilterElementRow(tableSize) |
|
|
|
|
data class Bankroll(val bankroll: Manageable) : DataFilterElementRow(bankroll) |
|
|
|
|
data class Game(val game: Manageable) : DataFilterElementRow(game) |
|
|
|
|
data class Location(val location: Manageable) : DataFilterElementRow(location) |
|
|
|
|
@ -70,15 +83,17 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
|
is Weekday -> QueryType.WEEK_DAY |
|
|
|
|
is Weekend -> QueryType.WEEK_END |
|
|
|
|
|
|
|
|
|
/* is Today -> QueryType. |
|
|
|
|
/* |
|
|
|
|
is Today -> QueryType. |
|
|
|
|
is Yesterday -> R.string.yesterday |
|
|
|
|
is TodayAndYesterday -> R.string.yesterday_and_today |
|
|
|
|
is CurrentWeek -> R.string.current_week |
|
|
|
|
is CurrentMonth -> R.string.current_month |
|
|
|
|
is CurrentYear -> R.string.current_year |
|
|
|
|
is PastDays -> R.string.period_in_days |
|
|
|
|
is Limit -> R.string.limit |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
is Limit -> QueryType.LIMIT |
|
|
|
|
is TableSize -> QueryType.TABLE_SIZE |
|
|
|
|
is Game -> QueryType.GAME |
|
|
|
|
is Bankroll -> QueryType.BANKROLL |
|
|
|
|
@ -123,8 +138,6 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
|
is Month -> R.string.month_of_the_year |
|
|
|
|
is Day -> R.string.day_of_the_week |
|
|
|
|
is PastDays -> R.string.period_in_days |
|
|
|
|
is Limit -> R.string.limit |
|
|
|
|
is TableSize -> R.string.table_size |
|
|
|
|
is Blind -> TODO() |
|
|
|
|
is ResultMoreThan -> TODO() |
|
|
|
|
is ResultLessThan -> TODO() |
|
|
|
|
@ -135,7 +148,15 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
|
override fun getDisplayName(): String { |
|
|
|
|
return when (this) { |
|
|
|
|
is DataFilterElementRow -> this.name |
|
|
|
|
else -> return super.getDisplayName() |
|
|
|
|
is StaticDataFilterElementRow -> this.getDataDisplayName() |
|
|
|
|
else -> super.getDisplayName() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun localizedTitle(context: Context): String { |
|
|
|
|
return when (this) { |
|
|
|
|
is StaticDataFilterElementRow -> this.getDataLocalizedTitle(context) |
|
|
|
|
else -> super.localizedTitle(context) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|