|
|
|
|
@ -38,14 +38,14 @@ open class FilterDetailsFragment : PokerAnalyticsFragment(), StaticRowRepresent |
|
|
|
|
|
|
|
|
|
lateinit var parentActivity: PokerAnalyticsActivity |
|
|
|
|
lateinit var rowRepresentableAdapter: RowRepresentableAdapter |
|
|
|
|
private lateinit var primaryKey: String |
|
|
|
|
private lateinit var filterCategoryRow: FilterCategoryRow |
|
|
|
|
|
|
|
|
|
private var currentFilter: Filter? = null |
|
|
|
|
private var rows: ArrayList<RowRepresentable> = ArrayList() |
|
|
|
|
private var rowsForFilterSubcategoryRow: HashMap<FilterSectionRow, ArrayList<RowRepresentable>> = HashMap() |
|
|
|
|
|
|
|
|
|
private var primaryKey: String? = null |
|
|
|
|
private var filterMenu: Menu? = null |
|
|
|
|
private var filterCategoryRow: FilterCategoryRow? = null |
|
|
|
|
private val selectedRows = ArrayList<QueryCondition>() |
|
|
|
|
private var isUpdating = false |
|
|
|
|
private var shouldOpenKeyboard = true |
|
|
|
|
@ -174,17 +174,14 @@ open class FilterDetailsFragment : PokerAnalyticsFragment(), StaticRowRepresent |
|
|
|
|
*/ |
|
|
|
|
private fun initData() { |
|
|
|
|
|
|
|
|
|
primaryKey?.let { |
|
|
|
|
currentFilter = Filter.getFilterBydId(getRealm(), it) |
|
|
|
|
} |
|
|
|
|
currentFilter = Filter.getFilterBydId(getRealm(), primaryKey) |
|
|
|
|
|
|
|
|
|
filterCategoryRow?.let { |
|
|
|
|
|
|
|
|
|
this.appBar.toolbar.title = it.localizedTitle(requireContext()) |
|
|
|
|
this.appBar.toolbar.title = filterCategoryRow.localizedTitle(requireContext()) |
|
|
|
|
|
|
|
|
|
this.rows.clear() |
|
|
|
|
this.rowsForFilterSubcategoryRow.clear() |
|
|
|
|
this.rows.addAll(it.filterElements) |
|
|
|
|
this.rows.addAll(filterCategoryRow.filterElements) |
|
|
|
|
|
|
|
|
|
this.rows.forEach { element -> |
|
|
|
|
if (element is QueryCondition && currentFilter?.contains(element) == true) { |
|
|
|
|
@ -196,7 +193,6 @@ open class FilterDetailsFragment : PokerAnalyticsFragment(), StaticRowRepresent |
|
|
|
|
this.rowRepresentableAdapter = RowRepresentableAdapter(this, this) |
|
|
|
|
this.recyclerView.adapter = rowRepresentableAdapter |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Update rows selection |
|
|
|
|
@ -238,6 +234,7 @@ open class FilterDetailsFragment : PokerAnalyticsFragment(), StaticRowRepresent |
|
|
|
|
|
|
|
|
|
val realm = getRealm() |
|
|
|
|
realm.beginTransaction() |
|
|
|
|
currentFilter?.remove(filterCategoryRow) |
|
|
|
|
currentFilter?.createOrUpdateFilterConditions(selectedRows) |
|
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|