|
|
|
@ -11,6 +11,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 java.text.DateFormatSymbols |
|
|
|
import java.util.* |
|
|
|
import java.util.* |
|
|
|
|
|
|
|
|
|
|
|
sealed class FilterElementRow : RowRepresentable { |
|
|
|
sealed class FilterElementRow : RowRepresentable { |
|
|
|
@ -28,6 +29,8 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
object Weekday : FilterElementRow() |
|
|
|
object Weekday : FilterElementRow() |
|
|
|
object Weekend : FilterElementRow() |
|
|
|
object Weekend : FilterElementRow() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
open class SingleValueFilterElementRow(val value: Int) : FilterElementRow() |
|
|
|
|
|
|
|
|
|
|
|
open class DataFilterElementRow(data: Manageable) : FilterElementRow() { |
|
|
|
open class DataFilterElementRow(data: Manageable) : FilterElementRow() { |
|
|
|
val id: String = data.id |
|
|
|
val id: String = data.id |
|
|
|
val name: String = (data as RowRepresentable).getDisplayName() |
|
|
|
val name: String = (data as RowRepresentable).getDisplayName() |
|
|
|
@ -47,7 +50,6 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
open class MoreFilterElementRow : QuantityFilterElementRow() |
|
|
|
open class MoreFilterElementRow : QuantityFilterElementRow() |
|
|
|
open class LessFilterElementRow : QuantityFilterElementRow() |
|
|
|
open class LessFilterElementRow : QuantityFilterElementRow() |
|
|
|
|
|
|
|
|
|
|
|
open class SingleValueFilterElementRow(val value: Int) : FilterElementRow() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data class Blind(var sb: Double? = null, var bb: Double? = null, var code: String? = null) : FilterElementRow() |
|
|
|
data class Blind(var sb: Double? = null, var bb: Double? = null, var code: String? = null) : FilterElementRow() |
|
|
|
data class From(var date: Date = Date()) : FilterElementRow() |
|
|
|
data class From(var date: Date = Date()) : FilterElementRow() |
|
|
|
@ -95,10 +97,7 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
is CurrentWeek -> QueryCondition.THIS_WEEK |
|
|
|
is CurrentWeek -> QueryCondition.THIS_WEEK |
|
|
|
is CurrentMonth -> QueryCondition.THIS_MONTH |
|
|
|
is CurrentMonth -> QueryCondition.THIS_MONTH |
|
|
|
is CurrentYear -> QueryCondition.THIS_YEAR |
|
|
|
is CurrentYear -> QueryCondition.THIS_YEAR |
|
|
|
/* |
|
|
|
is PastDays -> QueryCondition.PAST_DAYS |
|
|
|
is PastDays -> R.string.period_in_days |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
is Limit -> QueryCondition.LIMIT |
|
|
|
is Limit -> QueryCondition.LIMIT |
|
|
|
is TableSize -> QueryCondition.TABLE_SIZE |
|
|
|
is TableSize -> QueryCondition.TABLE_SIZE |
|
|
|
is Game -> QueryCondition.GAME |
|
|
|
is Game -> QueryCondition.GAME |
|
|
|
@ -118,6 +117,9 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
|
|
|
|
|
|
|
|
fun contains(filterConditions: List<FilterCondition>): Boolean { |
|
|
|
fun contains(filterConditions: List<FilterCondition>): Boolean { |
|
|
|
return when (this) { |
|
|
|
return when (this) { |
|
|
|
|
|
|
|
is SingleValueFilterElementRow -> filterConditions.any { |
|
|
|
|
|
|
|
it.values.contains(this.value) |
|
|
|
|
|
|
|
} |
|
|
|
is DataFilterElementRow -> filterConditions.any { |
|
|
|
is DataFilterElementRow -> filterConditions.any { |
|
|
|
it.ids.contains(this.id) |
|
|
|
it.ids.contains(this.id) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -146,9 +148,6 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
is Online -> R.string.online |
|
|
|
is Online -> R.string.online |
|
|
|
is Weekday -> R.string.week_days |
|
|
|
is Weekday -> R.string.week_days |
|
|
|
is Weekend -> R.string.weekend |
|
|
|
is Weekend -> R.string.weekend |
|
|
|
is Year -> R.string.year |
|
|
|
|
|
|
|
is Month -> R.string.month_of_the_year |
|
|
|
|
|
|
|
is Day -> R.string.day_of_the_week |
|
|
|
|
|
|
|
is PastDays -> R.string.period_in_days |
|
|
|
is PastDays -> R.string.period_in_days |
|
|
|
is Blind -> R.string.blinds |
|
|
|
is Blind -> R.string.blinds |
|
|
|
is MoreFilterElementRow -> R.string.more_than |
|
|
|
is MoreFilterElementRow -> R.string.more_than |
|
|
|
@ -190,6 +189,13 @@ sealed class FilterElementRow : RowRepresentable { |
|
|
|
|
|
|
|
|
|
|
|
override fun getDisplayName(): String { |
|
|
|
override fun getDisplayName(): String { |
|
|
|
return when (this) { |
|
|
|
return when (this) { |
|
|
|
|
|
|
|
is SingleValueFilterElementRow -> { |
|
|
|
|
|
|
|
when (this) { |
|
|
|
|
|
|
|
is Day -> DateFormatSymbols.getInstance(Locale.getDefault()).weekdays[this.value] |
|
|
|
|
|
|
|
is Month -> DateFormatSymbols.getInstance(Locale.getDefault()).months[this.value] |
|
|
|
|
|
|
|
else -> "${this.value}" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
is DataFilterElementRow -> this.name |
|
|
|
is DataFilterElementRow -> this.name |
|
|
|
is StaticDataFilterElementRow -> this.name |
|
|
|
is StaticDataFilterElementRow -> this.name |
|
|
|
else -> super.getDisplayName() |
|
|
|
else -> super.getDisplayName() |
|
|
|
|