|
|
|
|
@ -56,8 +56,6 @@ open class FilterDetailsFragment : RealmFragment(), RowRepresentableDelegate { |
|
|
|
|
override fun onBackPressed() { |
|
|
|
|
super.onBackPressed() |
|
|
|
|
saveData() |
|
|
|
|
// requireFragmentManager().popBackStackImmediate("f1", 0) |
|
|
|
|
// requireFragmentManager().popBackStackImmediate() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -94,9 +92,6 @@ open class FilterDetailsFragment : RealmFragment(), RowRepresentableDelegate { |
|
|
|
|
|
|
|
|
|
} ?: throw PAIllegalStateException("Missing bundle") |
|
|
|
|
|
|
|
|
|
//currentFilter = Filter.getFilterBydId(getRealm(), primaryKey) |
|
|
|
|
// currentFilter = FiltersFragment.currentFilter |
|
|
|
|
|
|
|
|
|
Timber.d(">> Filter = ${this.activityModel.currentFilter}") |
|
|
|
|
Timber.d("selectedRow = ${this.activityModel.selectedCategoryRow}") |
|
|
|
|
|
|
|
|
|
@ -132,9 +127,6 @@ open class FilterDetailsFragment : RealmFragment(), RowRepresentableDelegate { |
|
|
|
|
} |
|
|
|
|
is QueryCondition.SingleValue<*>, is QueryCondition.ListOfValues<*> -> { |
|
|
|
|
val valueAsString = (row as FilterItemRow).singleValue?.toString() |
|
|
|
|
// row.list.firstOrNull()?.let { |
|
|
|
|
// valueAsString = row.list.firstOrNull()?.toString() |
|
|
|
|
// } |
|
|
|
|
val data = row.editingDescriptors(mapOf("valueAsString" to valueAsString)) |
|
|
|
|
showBottomSheet(row, this, data, true) |
|
|
|
|
} |
|
|
|
|
@ -142,60 +134,6 @@ open class FilterDetailsFragment : RealmFragment(), RowRepresentableDelegate { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// when (row) { |
|
|
|
|
// is DateFilterItemRow -> { |
|
|
|
|
// when (val condition = row.rawCondition) { |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// is IntFilterItemRow -> { |
|
|
|
|
// when (val condition = row.rawCondition) { |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// is ValueListFilterItemRow<*> -> { |
|
|
|
|
// when (row.rawCondition) { |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// (row as? BaseFilterItemRow)?.let { filterItemRow -> |
|
|
|
|
// val rawCondition = filterItemRow.rawCondition |
|
|
|
|
// when (rawCondition) { |
|
|
|
|
// is QueryCondition.DateQuery -> DateTimePickerManager.create( |
|
|
|
|
// requireContext(), |
|
|
|
|
// row, |
|
|
|
|
// this, |
|
|
|
|
// filterItemRow.value, |
|
|
|
|
// onlyDate = !row.showTime, |
|
|
|
|
// onlyTime = row.showTime |
|
|
|
|
// ) |
|
|
|
|
// is QueryCondition.Duration -> { |
|
|
|
|
// val hours: String? = (row.minutes / 60).toString() |
|
|
|
|
// val minutes: String? = (row.minutes % 60).toString() |
|
|
|
|
//// row.minutes?.let { |
|
|
|
|
//// hours = if (it / 60 > 0) (it / 60).toString() else null |
|
|
|
|
//// minutes = if (it % 60 > 0) (it % 60).toString() else null |
|
|
|
|
//// } |
|
|
|
|
// val data = row.editingDescriptors(mapOf("hours" to hours, "minutes" to minutes)) |
|
|
|
|
// showBottomSheet(row, this, data, true) |
|
|
|
|
// } |
|
|
|
|
// is QueryCondition.ListOfValues<*> -> { |
|
|
|
|
// var valueAsString: String? = null |
|
|
|
|
// row.listOfValues.firstOrNull()?.let { |
|
|
|
|
// valueAsString = row.listOfValues.firstOrNull()?.toString() |
|
|
|
|
// } |
|
|
|
|
// val data = row.editingDescriptors(mapOf("valueAsString" to valueAsString)) |
|
|
|
|
// showBottomSheet(row, this, data, true) |
|
|
|
|
// } |
|
|
|
|
// else -> { } |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onRowValueChanged(value: Any?, row: RowRepresentable) { |
|
|
|
|
@ -246,33 +184,6 @@ open class FilterDetailsFragment : RealmFragment(), RowRepresentableDelegate { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// when (row) { |
|
|
|
|
// is QueryCondition.DateQuery -> { |
|
|
|
|
// if (value != null && value is Date) { |
|
|
|
|
// row.singleValue = value |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// is QueryCondition.Duration -> { |
|
|
|
|
// if (value is ArrayList<*>) { |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// is QueryCondition.SingleInt -> { |
|
|
|
|
// if (value != null && value is String) { |
|
|
|
|
// row.singleValue = value.toInt() |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// is QueryCondition.ListOfDouble -> row.listOfValues = arrayListOf<Double>().apply { |
|
|
|
|
// if (value != null && value is String) this.add(value.toDouble()) |
|
|
|
|
// } |
|
|
|
|
// is QueryCondition.ListOfInt -> row.listOfValues = arrayListOf<Int>().apply { |
|
|
|
|
// if (value != null && value is String) this.add(value.toInt()) |
|
|
|
|
// } |
|
|
|
|
// is QueryCondition.ListOfString -> row.listOfValues = arrayListOf<String>().apply { |
|
|
|
|
// if (value != null && value is String) this.add(value) |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// Remove the row before updating the selected rows list |
|
|
|
|
this.model.selectedRows.remove(row as FilterItemRow) |
|
|
|
|
updateRowsSelection(row, value == null) |
|
|
|
|
@ -286,8 +197,6 @@ open class FilterDetailsFragment : RealmFragment(), RowRepresentableDelegate { |
|
|
|
|
|
|
|
|
|
this.model.updateRowsSelection(this.rowRepresentableAdapter, row, forceDeselection) |
|
|
|
|
|
|
|
|
|
// println("list of selected rows : $selectedRows") |
|
|
|
|
|
|
|
|
|
// Update UI |
|
|
|
|
this.rowRepresentableAdapter.refreshRow(row) |
|
|
|
|
} |
|
|
|
|
|