|
|
|
|
@ -80,9 +80,7 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
MORE, |
|
|
|
|
LESS, |
|
|
|
|
EQUALS, |
|
|
|
|
BETWEEN, |
|
|
|
|
BETWEEN_RIGHT_EXCLUSIVE, |
|
|
|
|
BETWEEN_LEFT_EXCLUSIVE, |
|
|
|
|
TRUE, |
|
|
|
|
; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -111,7 +109,7 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
open var operator: Operator = Operator.ANY |
|
|
|
|
abstract var operator: Operator |
|
|
|
|
|
|
|
|
|
abstract class ListOfValues<T>: QueryCondition(), Comparable<ListOfValues<T>> where T:Comparable<T> { |
|
|
|
|
|
|
|
|
|
@ -138,29 +136,37 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
|
|
|
|
|
abstract class ListOfDouble: ListOfValues<Double>() { |
|
|
|
|
open var sign: Int = 1 |
|
|
|
|
|
|
|
|
|
override var operator: Operator = Operator.ANY |
|
|
|
|
override var listOfValues = arrayListOf(0.0) |
|
|
|
|
override fun updateValueBy(filterCondition: FilterCondition) { |
|
|
|
|
super.updateValueBy(filterCondition) |
|
|
|
|
listOfValues = filterCondition.getValues() |
|
|
|
|
} |
|
|
|
|
override fun labelForValue(value: Double, context: Context): String { |
|
|
|
|
return value.toCurrency(UserDefaults.currency) |
|
|
|
|
val prefix = this.resId?.let { |
|
|
|
|
context.getString(it)+" " |
|
|
|
|
} ?: "" |
|
|
|
|
return prefix+value.toCurrency(UserDefaults.currency) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
abstract class ListOfInt: ListOfValues<Int>() { |
|
|
|
|
override var operator: Operator = Operator.ANY |
|
|
|
|
override var listOfValues = arrayListOf(0) |
|
|
|
|
override fun updateValueBy(filterCondition: FilterCondition) { |
|
|
|
|
super.updateValueBy(filterCondition) |
|
|
|
|
listOfValues = filterCondition.getValues() |
|
|
|
|
} |
|
|
|
|
override fun labelForValue(value: Int, context: Context): String { |
|
|
|
|
return value.toString() |
|
|
|
|
val prefix = this.resId?.let { |
|
|
|
|
context.getString(it)+" " |
|
|
|
|
} ?: "" |
|
|
|
|
return prefix+value.toString() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
abstract class ListOfString: ListOfValues<String>() { |
|
|
|
|
override var operator: Operator = Operator.ANY |
|
|
|
|
override var listOfValues = ArrayList<String>() |
|
|
|
|
override fun labelForValue(value: String, context: Context): String { return value } |
|
|
|
|
override fun updateValueBy(filterCondition: FilterCondition) { |
|
|
|
|
@ -171,8 +177,12 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
|
|
|
|
|
abstract class SingleDate: SingleValue<Date>() { |
|
|
|
|
override fun labelForValue(value: Date, context: Context): String { |
|
|
|
|
return value.toString() |
|
|
|
|
val prefix = this.resId?.let { |
|
|
|
|
context.getString(it)+" " |
|
|
|
|
} ?: "" |
|
|
|
|
return prefix+value.toString() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override var listOfValues = ArrayList<Date>() |
|
|
|
|
|
|
|
|
|
override var singleValue: Date |
|
|
|
|
@ -190,8 +200,12 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
|
|
|
|
|
abstract class SingleInt: SingleValue<Int>() { |
|
|
|
|
override fun labelForValue(value: Int, context: Context): String { |
|
|
|
|
return value.toString() |
|
|
|
|
val prefix = this.resId?.let { |
|
|
|
|
context.getString(it)+" " |
|
|
|
|
} ?: "" |
|
|
|
|
return prefix+value.toString() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override var singleValue: Int |
|
|
|
|
get() { return listOfValues.firstOrNull() ?: 0 } |
|
|
|
|
set(value) { |
|
|
|
|
@ -205,7 +219,12 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun getDisplayName(context: Context): String { return baseId } |
|
|
|
|
override fun getDisplayName(context: Context): String { |
|
|
|
|
this.resId?.let { |
|
|
|
|
return context.getString(it) |
|
|
|
|
} |
|
|
|
|
return baseId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override var filterSectionRow: FilterSectionRow = FilterSectionRow.CASH_TOURNAMENT |
|
|
|
|
|
|
|
|
|
@ -250,21 +269,17 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
override val showTime: Boolean = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
object IsLive : QueryCondition() { |
|
|
|
|
override fun getDisplayName(context: Context): String { return "Live" } |
|
|
|
|
abstract class TrueQueryCondition: QueryCondition() { |
|
|
|
|
override var operator: Operator = Operator.TRUE |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
object IsCash : QueryCondition() { |
|
|
|
|
override fun getDisplayName(context: Context): String { return "Cash" } |
|
|
|
|
} |
|
|
|
|
object IsLive : TrueQueryCondition() |
|
|
|
|
|
|
|
|
|
object IsOnline : QueryCondition() { |
|
|
|
|
override fun getDisplayName(context: Context): String { return "Online" } |
|
|
|
|
} |
|
|
|
|
object IsCash : TrueQueryCondition() |
|
|
|
|
|
|
|
|
|
object IsTournament : QueryCondition() { |
|
|
|
|
override fun getDisplayName(context: Context): String { return "Tournament" } |
|
|
|
|
} |
|
|
|
|
object IsOnline : TrueQueryCondition() |
|
|
|
|
|
|
|
|
|
object IsTournament : TrueQueryCondition() |
|
|
|
|
|
|
|
|
|
class AnyBankroll(): QueryDataCondition<Bankroll>() { |
|
|
|
|
override var entity: Class<Bankroll> = Bankroll::class.java |
|
|
|
|
@ -336,8 +351,12 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
|
|
|
|
|
class AnyBlind: ListOfString() |
|
|
|
|
|
|
|
|
|
class LastGame: SingleInt() |
|
|
|
|
class LastSession: SingleInt() |
|
|
|
|
object Last: SingleInt() { |
|
|
|
|
override var operator = Operator.EQUALS |
|
|
|
|
override fun getDisplayName(context: Context): String { |
|
|
|
|
return "${context.getString(R.string.last_i_records)} $singleValue" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class NumberOfTable: ListOfInt() |
|
|
|
|
|
|
|
|
|
@ -356,6 +375,7 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
open class NetAmount: ListOfDouble() |
|
|
|
|
|
|
|
|
|
class NetAmountWon: NetAmount() |
|
|
|
|
class NetAmountLost: NetAmount() { override var sign: Int = -1 } |
|
|
|
|
|
|
|
|
|
@ -392,26 +412,31 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
object IsWeekDay: QueryCondition() |
|
|
|
|
object IsWeekEnd: QueryCondition() |
|
|
|
|
object IsToday: QueryCondition() |
|
|
|
|
object WasYesterday: QueryCondition() |
|
|
|
|
object WasTodayAndYesterday: QueryCondition() |
|
|
|
|
object DuringThisWeek: QueryCondition() |
|
|
|
|
object DuringThisMonth: QueryCondition() |
|
|
|
|
object DuringThisYear: QueryCondition() |
|
|
|
|
object IsWeekDay: TrueQueryCondition() |
|
|
|
|
object IsWeekEnd: TrueQueryCondition() |
|
|
|
|
object IsToday: TrueQueryCondition() |
|
|
|
|
object WasYesterday: TrueQueryCondition() |
|
|
|
|
object WasTodayAndYesterday: TrueQueryCondition() |
|
|
|
|
object DuringThisWeek: TrueQueryCondition() |
|
|
|
|
object DuringThisMonth: TrueQueryCondition() |
|
|
|
|
object DuringThisYear: TrueQueryCondition() |
|
|
|
|
|
|
|
|
|
class TournamentFee: ListOfDouble() { |
|
|
|
|
override fun labelForValue(value: Double, context: Context): String { |
|
|
|
|
return value.toCurrency(UserDefaults.currency) |
|
|
|
|
val prefix = this.resId?.let { |
|
|
|
|
context.getString(it)+" " |
|
|
|
|
} ?: "" |
|
|
|
|
return prefix+value.toCurrency(UserDefaults.currency) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class PastDay: SingleInt() { |
|
|
|
|
override var operator = Operator.EQUALS |
|
|
|
|
override val viewType: Int = RowViewType.TITLE_VALUE_CHECK.ordinal |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class Duration: SingleInt() { |
|
|
|
|
override var operator = Operator.EQUALS |
|
|
|
|
var minutes:Int |
|
|
|
|
get() { return singleValue } |
|
|
|
|
set(value) { listOfValues = arrayListOf(value) } |
|
|
|
|
@ -591,8 +616,6 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
get() { |
|
|
|
|
return when (this) { |
|
|
|
|
is PastDay -> RowViewType.TITLE_VALUE_CHECK.ordinal |
|
|
|
|
is LastGame -> RowViewType.TITLE_VALUE_CHECK.ordinal |
|
|
|
|
is LastSession -> RowViewType.TITLE_VALUE_CHECK.ordinal |
|
|
|
|
else -> { |
|
|
|
|
when (this.operator) { |
|
|
|
|
Operator.MORE -> RowViewType.TITLE_VALUE_CHECK.ordinal |
|
|
|
|
@ -607,8 +630,6 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
get() { |
|
|
|
|
return when (this) { |
|
|
|
|
is PastDay -> BottomSheetType.EDIT_TEXT |
|
|
|
|
is LastGame -> BottomSheetType.EDIT_TEXT |
|
|
|
|
is LastSession -> BottomSheetType.EDIT_TEXT |
|
|
|
|
else -> { |
|
|
|
|
when (this.operator) { |
|
|
|
|
Operator.MORE -> BottomSheetType.EDIT_TEXT |
|
|
|
|
@ -637,8 +658,6 @@ sealed class QueryCondition : FilterElementRow { |
|
|
|
|
is IsWeekDay -> R.string.week_days |
|
|
|
|
is IsWeekEnd -> R.string.weekend |
|
|
|
|
is PastDay -> R.string.period_in_days |
|
|
|
|
is LastGame -> R.string.last_records |
|
|
|
|
is LastSession -> R.string.last_sessions |
|
|
|
|
is NetAmountWon -> { |
|
|
|
|
when (this.operator) { |
|
|
|
|
Operator.MORE -> R.string.won_amount_more_than |
|
|
|
|
|