fix issue with filter display

feature/top10
Razmig Sarkissian 7 years ago
parent 058c0b0db6
commit ff3e4608d3
  1. 2
      app/src/main/java/net/pokeranalytics/android/model/Criteria.kt
  2. 16
      app/src/main/java/net/pokeranalytics/android/model/filter/QueryCondition.kt

@ -120,7 +120,7 @@ sealed class Criteria {
val objects = arrayListOf<S>()
values.forEach {
objects.add((S::class.java.newInstance()).apply {
intValues.add(it)
intValues = arrayListOf(it)
})
}
return objects

@ -45,12 +45,16 @@ inline fun <reified T : Filterable> List<QueryCondition>.queryWith(query: RealmQ
sealed class QueryCondition : FilterElementRow {
interface Valuable <T : ArrayList<T>> {
var values: ArrayList<T>?
}
interface asListOfDouble { var doubleValues : ArrayList<Double> }
interface asListOfBoolean { var booleanValues : ArrayList<Boolean> }
interface asListOfString { var stringValues : ArrayList<String> }
interface asDateValue {
var dateValue: Date
var showTime: Boolean
val showTime: Boolean
}
interface asListOfInt : asListOfDouble {
@ -61,13 +65,13 @@ sealed class QueryCondition : FilterElementRow {
interface asIntValue : asListOfInt {
var intValue: Int
get() { return intValues.first() }
get() { return intValues.firstOrNull() ?: 0 }
set(value) { intValues = arrayListOf(value) }
}
interface asDoubleValue : asListOfDouble {
var doubleValue : Double
get() { return doubleValues.first() }
get() { return doubleValues.firstOrNull() ?: 0.0 }
set(value) { doubleValues = arrayListOf(value) }
}
@ -183,7 +187,7 @@ sealed class QueryCondition : FilterElementRow {
get() {
if (intValues.size > 1) {
return "multiple"
} else {
} else if (intValues.size > 0) {
return Limit.values()[intValues.first()].longName
}
return "todo"
@ -255,11 +259,11 @@ sealed class QueryCondition : FilterElementRow {
// Dates
open class DateQuery: QueryCondition(), asDateValue {
override var dateValue: Date = Date()
override var showTime: Boolean = false
override val showTime: Boolean = false
}
open class TimeQuery: DateQuery() {
override var showTime: Boolean = true
override val showTime: Boolean = true
}
class STARTED_FROM_DATE: DateQuery()

Loading…
Cancel
Save