diff --git a/app/src/main/java/net/pokeranalytics/android/ui/fragment/FilterDetailsFragment.kt b/app/src/main/java/net/pokeranalytics/android/ui/fragment/FilterDetailsFragment.kt index ad55f88b..84476e86 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/fragment/FilterDetailsFragment.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/fragment/FilterDetailsFragment.kt @@ -18,6 +18,7 @@ import net.pokeranalytics.android.ui.adapter.RowRepresentableAdapter import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate import net.pokeranalytics.android.ui.adapter.StaticRowRepresentableDataSource import net.pokeranalytics.android.ui.fragment.components.PokerAnalyticsFragment +import net.pokeranalytics.android.ui.fragment.components.bottomsheet.BottomSheetFragment import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.rowrepresentable.FilterCategoryRow @@ -60,24 +61,37 @@ open class FilterDetailsFragment : PokerAnalyticsFragment(), StaticRowRepresenta override fun onRowSelected(position: Int, row: RowRepresentable, fromAction: Boolean) { super.onRowSelected(position, row, fromAction) - val oldRows = ArrayList() - oldRows.addAll(rows) - if (selectedRows.contains(row)) { - selectedRows.remove(row) - } else { - if (row is FilterElementRow) { - row.sectionToExclude?.let { filterSectionToExclude -> - val excludedFilters = selectedRows.filter { - filterSectionToExclude.contains(it.filterSectionRow) - } - excludedFilters.forEach { - selectedRows.remove(it) - rowRepresentableAdapter.refreshRow(it) + Timber.d("Row: $row") + + when (row) { + is FilterElementRow.ResultMoreThan -> { + val data = row.editingDescriptors(mapOf("defaultValue" to "")) + BottomSheetFragment.create(fragmentManager, row, this, data, null) + } + else -> { + + val oldRows = ArrayList() + oldRows.addAll(rows) + if (selectedRows.contains(row)) { + selectedRows.remove(row) + } else { + if (row is FilterElementRow) { + row.sectionToExclude?.let { filterSectionToExclude -> + val excludedFilters = selectedRows.filter { + filterSectionToExclude.contains(it.filterSectionRow) + } + excludedFilters.forEach { + selectedRows.remove(it) + rowRepresentableAdapter.refreshRow(it) + } + } + selectedRows.add(row) } } - selectedRows.add(row) + } } + /* Timber.d("Row: $row") when (row) { @@ -103,6 +117,7 @@ open class FilterDetailsFragment : PokerAnalyticsFragment(), StaticRowRepresenta override fun onRowValueChanged(value: Any?, row: RowRepresentable) { super.onRowValueChanged(value, row) + Timber.d("onRowValueChanged: $row $value") selectedRows.add(row as FilterElementRow) rowRepresentableAdapter.refreshRow(row) } diff --git a/app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/FilterCategoryRow.kt b/app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/FilterCategoryRow.kt index 6dce883c..6cef6a31 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/FilterCategoryRow.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/FilterCategoryRow.kt @@ -45,6 +45,10 @@ enum class FilterCategoryRow(override val resId: Int?, override val viewType: In DAY_OF_WEEK, MONTH_OF_YEAR ) + TIME_FRAME -> arrayListOf( + SESSION_DURATION, + RANGE + ) BANKROLLS -> arrayListOf( BANKROLL ) @@ -74,7 +78,6 @@ enum class FilterCategoryRow(override val resId: Int?, override val viewType: In VALUE ) - TIME_FRAME -> arrayListOf() SESSION -> arrayListOf() TRANSACTION_TYPES -> arrayListOf() } diff --git a/app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/FilterElementRow.kt b/app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/FilterElementRow.kt index b3ece087..f84e3427 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/FilterElementRow.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/FilterElementRow.kt @@ -138,13 +138,21 @@ sealed class FilterElementRow : RowRepresentable { is Month -> R.string.month_of_the_year is Day -> R.string.day_of_the_week is PastDays -> R.string.period_in_days - is Blind -> TODO() - is ResultMoreThan -> TODO() - is ResultLessThan -> TODO() + is Blind -> R.string.blinds + is ResultMoreThan -> R.string.more_than + is ResultLessThan -> R.string.less_than else -> null } } + override val viewType: Int + get() { + return when (this) { + is ResultMoreThan -> RowViewType.TITLE_VALUE_CHECK.ordinal + else -> RowViewType.TITLE_CHECK.ordinal + } + } + override fun getDisplayName(): String { return when (this) { is DataFilterElementRow -> this.name @@ -160,8 +168,6 @@ sealed class FilterElementRow : RowRepresentable { } } - override val viewType: Int = RowViewType.TITLE_CHECK.ordinal - val sectionToExclude: List? get() { val excluded = arrayListOf() diff --git a/app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/FilterSectionRow.kt b/app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/FilterSectionRow.kt index b812bf4f..f588a914 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/FilterSectionRow.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/FilterSectionRow.kt @@ -8,6 +8,7 @@ import net.pokeranalytics.android.model.realm.Session import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.rowrepresentable.FilterElementRow.* +import java.util.* enum class FilterSectionRow(override val resId: Int?) : RowRepresentable { CASH_TOURNAMENT(net.pokeranalytics.android.R.string.cash_or_tournament), @@ -125,9 +126,8 @@ enum class FilterSectionRow(override val resId: Int?) : RowRepresentable { MULTI_PLAYER -> arrayListOf() - RANGE -> arrayListOf() - - SESSION_DURATION -> arrayListOf() + SESSION_DURATION -> arrayListOf(ResultMoreThan(0.0), ResultLessThan(0.0)) + RANGE -> arrayListOf(From(Date()), To(Date())) VALUE -> arrayListOf()