|
|
|
@ -11,6 +11,9 @@ 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.util.NULL_TEXT |
|
|
|
|
|
|
|
import net.pokeranalytics.android.util.extensions.formatted |
|
|
|
|
|
|
|
import net.pokeranalytics.android.util.extensions.round |
|
|
|
import java.text.DateFormatSymbols |
|
|
|
import java.text.DateFormatSymbols |
|
|
|
import java.util.* |
|
|
|
import java.util.* |
|
|
|
|
|
|
|
|
|
|
|
@ -42,7 +45,7 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
val name: String = (data as RowRepresentable).getDisplayName() |
|
|
|
val name: String = (data as RowRepresentable).getDisplayName() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
open class StaticDataFilterElementRow(var row: RowRepresentable, var id: Int) : NumericFilterElementRow(id.toDouble()) { |
|
|
|
open class StaticDataFilterElementRow(val row: RowRepresentable, val id: Int) : NumericFilterElementRow(id.toDouble()) { |
|
|
|
|
|
|
|
|
|
|
|
override val resId: Int? = row.resId |
|
|
|
override val resId: Int? = row.resId |
|
|
|
val name: String = row.getDisplayName() |
|
|
|
val name: String = row.getDisplayName() |
|
|
|
@ -80,23 +83,32 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
object CurrentYear : BoolFilterElementRow() |
|
|
|
object CurrentYear : BoolFilterElementRow() |
|
|
|
object Weekday : BoolFilterElementRow() |
|
|
|
object Weekday : BoolFilterElementRow() |
|
|
|
object Weekend : BoolFilterElementRow() |
|
|
|
object Weekend : BoolFilterElementRow() |
|
|
|
|
|
|
|
object From : DateFilterElementRow() |
|
|
|
|
|
|
|
object To : DateFilterElementRow() |
|
|
|
|
|
|
|
|
|
|
|
// Data classes - holding value |
|
|
|
// Data classes - holding value |
|
|
|
object ResultMoreThan : AmountFilterElement(), MoreOperator |
|
|
|
object ResultMoreThan : AmountFilterElement(), MoreOperator |
|
|
|
|
|
|
|
|
|
|
|
object ResultLessThan : AmountFilterElement(), LessOperator |
|
|
|
object ResultLessThan : AmountFilterElement(), LessOperator |
|
|
|
object DurationMoreThan : DurationFilterElement(), MoreOperator |
|
|
|
object DurationMoreThan : DurationFilterElement(), MoreOperator |
|
|
|
object DurationLessThan : DurationFilterElement(), LessOperator |
|
|
|
object DurationLessThan : DurationFilterElement(), LessOperator |
|
|
|
object ReBuyMoreThan : AmountFilterElement(), MoreOperator |
|
|
|
object ReBuyMoreThan : AmountFilterElement(), MoreOperator |
|
|
|
object ReBuyLessThan : AmountFilterElement(), LessOperator |
|
|
|
object ReBuyLessThan : AmountFilterElement(), LessOperator |
|
|
|
|
|
|
|
|
|
|
|
data class Blind(var sb: Double? = null, var bb: Double? = null, var code: String? = null) : FilterElementRow() |
|
|
|
|
|
|
|
object From : DateFilterElementRow() |
|
|
|
|
|
|
|
object To : DateFilterElementRow() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data class Year(val year: Int) : SingleValueFilterElementRow(year) |
|
|
|
data class Year(val year: Int) : SingleValueFilterElementRow(year) |
|
|
|
data class Month(val month: Int) : SingleValueFilterElementRow(month) |
|
|
|
data class Month(val month: Int) : SingleValueFilterElementRow(month) |
|
|
|
data class Day(val day: Int) : SingleValueFilterElementRow(day) |
|
|
|
data class Day(val day: Int) : SingleValueFilterElementRow(day) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data class Blind(var sb: Double? = null, var bb: Double? = null, var code: String? = null) : FilterElementRow() { |
|
|
|
|
|
|
|
val name: String |
|
|
|
|
|
|
|
get() { |
|
|
|
|
|
|
|
val currencyCode = code ?: Currency.getInstance(Locale.getDefault()).currencyCode |
|
|
|
|
|
|
|
val currencySymbol = Currency.getInstance(currencyCode).symbol |
|
|
|
|
|
|
|
return if (sb == null) NULL_TEXT else "$currencySymbol ${sb?.formatted()}/${bb?.round()}" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//TODO: Refactor? |
|
|
|
//TODO: Refactor? |
|
|
|
data class PastDays(var lastDays: Int = 0) : SingleValueFilterElementRow(lastDays) { |
|
|
|
data class PastDays(var lastDays: Int = 0) : SingleValueFilterElementRow(lastDays) { |
|
|
|
override val intValue: Int |
|
|
|
override val intValue: Int |
|
|
|
@ -111,6 +123,7 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
return lastGames |
|
|
|
return lastGames |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
data class LastSessions(var lastSessions: Int) : SingleValueFilterElementRow(lastSessions) { |
|
|
|
data class LastSessions(var lastSessions: Int) : SingleValueFilterElementRow(lastSessions) { |
|
|
|
override val intValue: Int |
|
|
|
override val intValue: Int |
|
|
|
get() { |
|
|
|
get() { |
|
|
|
@ -167,9 +180,12 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
is DurationMoreThan -> QueryCondition.MORE_THAN_DURATION |
|
|
|
is DurationMoreThan -> QueryCondition.MORE_THAN_DURATION |
|
|
|
is DurationLessThan -> QueryCondition.LESS_THAN_DURATION |
|
|
|
is DurationLessThan -> QueryCondition.LESS_THAN_DURATION |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: Check the conditions |
|
|
|
//TODO: Check the conditions |
|
|
|
is LastGames -> QueryCondition.LAST_GAMES |
|
|
|
is LastGames -> QueryCondition.LAST_GAMES |
|
|
|
is LastSessions -> QueryCondition.LAST_SESSIONS |
|
|
|
is LastSessions -> QueryCondition.LAST_SESSIONS |
|
|
|
|
|
|
|
is ReBuyMoreThan -> QueryCondition.MIN_RE_BUY |
|
|
|
|
|
|
|
is ReBuyLessThan -> QueryCondition.MAX_RE_BUY |
|
|
|
|
|
|
|
|
|
|
|
else -> throw PokerAnalyticsException.UnknownQueryTypeForRow(this) |
|
|
|
else -> throw PokerAnalyticsException.UnknownQueryTypeForRow(this) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -206,9 +222,10 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
is Weekday -> R.string.week_days |
|
|
|
is Weekday -> R.string.week_days |
|
|
|
is Weekend -> R.string.weekend |
|
|
|
is Weekend -> R.string.weekend |
|
|
|
is PastDays -> R.string.period_in_days |
|
|
|
is PastDays -> R.string.period_in_days |
|
|
|
is Blind -> R.string.blinds |
|
|
|
|
|
|
|
is LastGames -> R.string.last_records |
|
|
|
is LastGames -> R.string.last_records |
|
|
|
is LastSessions -> R.string.last_sessions |
|
|
|
is LastSessions -> R.string.last_sessions |
|
|
|
|
|
|
|
is ReBuyMoreThan -> R.string.minimum |
|
|
|
|
|
|
|
is ReBuyLessThan -> R.string.maximum |
|
|
|
is MoreOperator -> R.string.more_than |
|
|
|
is MoreOperator -> R.string.more_than |
|
|
|
is LessOperator -> R.string.less_than |
|
|
|
is LessOperator -> R.string.less_than |
|
|
|
else -> null |
|
|
|
else -> null |
|
|
|
@ -254,20 +271,16 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
is ReBuyMoreThan -> { |
|
|
|
//TODO: Refactor that |
|
|
|
val reBuyMore: String? by map |
|
|
|
is AmountFilterElement -> { |
|
|
|
arrayListOf( |
|
|
|
val amount: String? by map |
|
|
|
RowRepresentableEditDescriptor(reBuyMore, R.string.maximum, inputType = InputType.TYPE_CLASS_NUMBER) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
is ReBuyLessThan -> { |
|
|
|
|
|
|
|
val reBuyLess: String? by map |
|
|
|
|
|
|
|
arrayListOf( |
|
|
|
arrayListOf( |
|
|
|
RowRepresentableEditDescriptor(reBuyLess, R.string.minimum, inputType = InputType.TYPE_CLASS_NUMBER) |
|
|
|
RowRepresentableEditDescriptor(amount, R.string.amount, inputType = InputType.TYPE_CLASS_NUMBER) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
is DurationFilterElement -> { val hours: String? by map |
|
|
|
is DurationFilterElement -> { |
|
|
|
|
|
|
|
val hours: String? by map |
|
|
|
val minutes: String? by map |
|
|
|
val minutes: String? by map |
|
|
|
arrayListOf( |
|
|
|
arrayListOf( |
|
|
|
RowRepresentableEditDescriptor(hours, R.string.hour, inputType = InputType.TYPE_CLASS_NUMBER), |
|
|
|
RowRepresentableEditDescriptor(hours, R.string.hour, inputType = InputType.TYPE_CLASS_NUMBER), |
|
|
|
@ -289,6 +302,7 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
} |
|
|
|
} |
|
|
|
is DataFilterElementRow -> this.name |
|
|
|
is DataFilterElementRow -> this.name |
|
|
|
is StaticDataFilterElementRow -> this.name |
|
|
|
is StaticDataFilterElementRow -> this.name |
|
|
|
|
|
|
|
is Blind -> this.name |
|
|
|
else -> super.getDisplayName() |
|
|
|
else -> super.getDisplayName() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|