|
|
|
|
@ -140,6 +140,17 @@ sealed class QueryCondition : RowRepresentable { |
|
|
|
|
|
|
|
|
|
abstract var operator: Operator |
|
|
|
|
|
|
|
|
|
override fun getDisplayName(context: Context): String { |
|
|
|
|
this.resId?.let { |
|
|
|
|
return context.getString(it) |
|
|
|
|
} |
|
|
|
|
return baseId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
open fun getDisplayNameWithValues(context: Context): String { |
|
|
|
|
return getDisplayName(context) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
abstract class ListOfValues<T> : QueryCondition(), Comparable<ListOfValues<T>> where T : Comparable<T> { |
|
|
|
|
|
|
|
|
|
abstract var listOfValues: MutableList<T> |
|
|
|
|
@ -149,6 +160,10 @@ sealed class QueryCondition : RowRepresentable { |
|
|
|
|
return getDisplayName(context) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun getDisplayNameWithValues(context: Context): String { |
|
|
|
|
return this.getDisplayName(context, this.listOfValues) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun getDisplayName(context: Context, values: List<T>): String { |
|
|
|
|
val prefix = this.resId?.let { |
|
|
|
|
context.getString(it) + " " |
|
|
|
|
@ -176,28 +191,37 @@ sealed class QueryCondition : RowRepresentable { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
abstract class SingleValue<T>(value: T) : QueryCondition() where T : Comparable<T> { |
|
|
|
|
// override var listOfValues = mutableListOf<T>() |
|
|
|
|
|
|
|
|
|
var singleValue: T = value |
|
|
|
|
|
|
|
|
|
abstract fun labelForValue(value: T, context: Context): String |
|
|
|
|
|
|
|
|
|
override fun getDisplayName(context: Context): String { |
|
|
|
|
return getDisplayName(context, singleValue) |
|
|
|
|
return this.resId?.let { |
|
|
|
|
context.getString(it) |
|
|
|
|
} ?: "" |
|
|
|
|
// return getDisplayName(context, this.singleValue) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun getDisplayName(context: Context, value: T): String { |
|
|
|
|
override fun getDisplayNameWithValues(context: Context): String { |
|
|
|
|
return this.getDisplayName(context, this.singleValue) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
open fun getDisplayName(context: Context, value: T): String { |
|
|
|
|
val prefix = this.resId?.let { |
|
|
|
|
context.getString(it, value.toString()) // + " " |
|
|
|
|
context.getString(it) |
|
|
|
|
} ?: "" |
|
|
|
|
return prefix // + labelForValue(value, context) |
|
|
|
|
return prefix + labelForValue(value, context) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
abstract class ListOfDouble : ListOfValues<Double>() { |
|
|
|
|
|
|
|
|
|
open var sign: Int = 1 |
|
|
|
|
override var operator: Operator = Operator.ANY |
|
|
|
|
override var listOfValues = mutableListOf<Double>() |
|
|
|
|
|
|
|
|
|
override fun updateValueBy(filterCondition: FilterCondition) { |
|
|
|
|
super.updateValueBy(filterCondition) |
|
|
|
|
listOfValues = filterCondition.getValues() |
|
|
|
|
@ -261,13 +285,6 @@ sealed class QueryCondition : RowRepresentable { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun getDisplayName(context: Context): String { |
|
|
|
|
this.resId?.let { |
|
|
|
|
return context.getString(it) |
|
|
|
|
} |
|
|
|
|
return baseId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// override var filterSectionRow: FilterSectionRow = FilterSectionRow.CashOrTournament |
|
|
|
|
|
|
|
|
|
abstract class QueryDataCondition<T : NameManageable> : ListOfString() { |
|
|
|
|
@ -562,15 +579,9 @@ sealed class QueryCondition : RowRepresentable { |
|
|
|
|
override var operator = Operator.EQUALS |
|
|
|
|
override val viewType: Int = RowViewType.TITLE_VALUE_CHECK.ordinal |
|
|
|
|
|
|
|
|
|
// override fun labelForValue(value: Int, context: Context): String { |
|
|
|
|
// return value.toString() |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// override fun entityName(context: Context): String { |
|
|
|
|
// return this.resId?.let { |
|
|
|
|
// " " + context.getString(it) |
|
|
|
|
// } ?: "" |
|
|
|
|
// } |
|
|
|
|
override fun getDisplayNameWithValues(context: Context): String { |
|
|
|
|
return context.getString(R.string.period_in_days_with_value, this.singleValue.toString()) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class Duration(value: Int) : SingleInt(value) { |
|
|
|
|
@ -892,7 +903,6 @@ sealed class QueryCondition : RowRepresentable { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override val viewType: Int |
|
|
|
|
get() { |
|
|
|
|
return when (this) { |
|
|
|
|
|