|
|
|
@ -12,9 +12,8 @@ import java.lang.Exception |
|
|
|
import java.util.* |
|
|
|
import java.util.* |
|
|
|
|
|
|
|
|
|
|
|
sealed class FilterElement : RowRepresentable { |
|
|
|
sealed class FilterElement : RowRepresentable { |
|
|
|
|
|
|
|
|
|
|
|
companion object { |
|
|
|
companion object { |
|
|
|
fun filterElementsFor(filterSection: FilterSectionDataSource) : List<FilterElement> { |
|
|
|
fun filterElementsFor(filterSection: FilterSection) : List<FilterElement> { |
|
|
|
return when (filterSection) { |
|
|
|
return when (filterSection) { |
|
|
|
CASH_TOURNAMENT -> arrayListOf(Cash, Tournament) |
|
|
|
CASH_TOURNAMENT -> arrayListOf(Cash, Tournament) |
|
|
|
LIVE_ONLINE -> arrayListOf(Live, Online) |
|
|
|
LIVE_ONLINE -> arrayListOf(Live, Online) |
|
|
|
@ -77,6 +76,10 @@ sealed class FilterElement : RowRepresentable { |
|
|
|
VALUE -> arrayListOf() |
|
|
|
VALUE -> arrayListOf() |
|
|
|
|
|
|
|
|
|
|
|
else -> throw Exception("unknown filtersection") //TODO create exception |
|
|
|
else -> throw Exception("unknown filtersection") //TODO create exception |
|
|
|
|
|
|
|
}.apply { |
|
|
|
|
|
|
|
this.forEach { |
|
|
|
|
|
|
|
it.filterSection = filterSection |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -91,10 +94,11 @@ sealed class FilterElement : RowRepresentable { |
|
|
|
object CurrentWeek : FilterElement() |
|
|
|
object CurrentWeek : FilterElement() |
|
|
|
object CurrentMonth : FilterElement() |
|
|
|
object CurrentMonth : FilterElement() |
|
|
|
object CurrentYear: FilterElement() |
|
|
|
object CurrentYear: FilterElement() |
|
|
|
data class From(var date: Date = Date()) : FilterElement() |
|
|
|
|
|
|
|
data class To(var date: Date = Date()) : FilterElement() |
|
|
|
|
|
|
|
object Weekday: FilterElement() |
|
|
|
object Weekday: FilterElement() |
|
|
|
object Weekend : FilterElement() |
|
|
|
object Weekend : FilterElement() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data class From(var date: Date = Date()) : FilterElement() |
|
|
|
|
|
|
|
data class To(var date: Date = Date()) : FilterElement() |
|
|
|
data class Year(val day: Int) : FilterElement() |
|
|
|
data class Year(val day: Int) : FilterElement() |
|
|
|
data class Month(val day: Int) : FilterElement() |
|
|
|
data class Month(val day: Int) : FilterElement() |
|
|
|
data class Day(val day: Int) : FilterElement() |
|
|
|
data class Day(val day: Int) : FilterElement() |
|
|
|
@ -107,7 +111,7 @@ sealed class FilterElement : RowRepresentable { |
|
|
|
data class TournamentName(val tournamentName: net.pokeranalytics.android.model.realm.TournamentName) : FilterElement() |
|
|
|
data class TournamentName(val tournamentName: net.pokeranalytics.android.model.realm.TournamentName) : FilterElement() |
|
|
|
data class TournamentFeature(val tournamentFeature: net.pokeranalytics.android.model.realm.TournamentFeature) : FilterElement() |
|
|
|
data class TournamentFeature(val tournamentFeature: net.pokeranalytics.android.model.realm.TournamentFeature) : FilterElement() |
|
|
|
|
|
|
|
|
|
|
|
var filterSection: FilterSectionDataSource? = null |
|
|
|
lateinit var filterSection: FilterSection |
|
|
|
|
|
|
|
|
|
|
|
val filterType : FilterType |
|
|
|
val filterType : FilterType |
|
|
|
get() { |
|
|
|
get() { |
|
|
|
@ -187,21 +191,16 @@ sealed class FilterElement : RowRepresentable { |
|
|
|
val sectionToExclude : List < FilterSectionDataSource > ? |
|
|
|
val sectionToExclude : List < FilterSectionDataSource > ? |
|
|
|
get() { |
|
|
|
get() { |
|
|
|
val excluded = arrayListOf<FilterSectionDataSource>() |
|
|
|
val excluded = arrayListOf<FilterSectionDataSource>() |
|
|
|
this.filterSection?.let { |
|
|
|
if (!this.filterSection.allowMultiSelection) { |
|
|
|
if (!it.allowMultiSelection) { |
|
|
|
excluded.add(this.filterSection) |
|
|
|
excluded.add(it) |
|
|
|
} |
|
|
|
} |
|
|
|
this.filterSection.exclusiveWith?.let { exclusives -> |
|
|
|
it.exclusiveWith?.let { exclusives -> |
|
|
|
excluded.addAll(exclusives) |
|
|
|
excluded.addAll(exclusives) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (excluded.size > 0) { |
|
|
|
|
|
|
|
return excluded |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} ?: run { |
|
|
|
|
|
|
|
return null |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (excluded.size > 0) { |
|
|
|
|
|
|
|
return excluded |
|
|
|
|
|
|
|
} |
|
|
|
return null |
|
|
|
return null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|