|
|
|
|
@ -25,6 +25,7 @@ import net.pokeranalytics.android.ui.view.RowViewType |
|
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.FilterCategoryRow |
|
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.FilterElementRow |
|
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.FilterSectionRow |
|
|
|
|
import net.pokeranalytics.android.util.NULL_TEXT |
|
|
|
|
import net.pokeranalytics.android.util.extensions.shortDate |
|
|
|
|
import net.pokeranalytics.android.util.extensions.toMinutes |
|
|
|
|
import timber.log.Timber |
|
|
|
|
@ -70,7 +71,11 @@ open class FilterDetailsFragment : PokerAnalyticsFragment(), StaticRowRepresenta |
|
|
|
|
when (row) { |
|
|
|
|
is FilterElementRow.From -> DateTimePickerManager.create(requireContext(), row, this, row.date, onlyDate = true) |
|
|
|
|
is FilterElementRow.To -> DateTimePickerManager.create(requireContext(), row, this, row.date, onlyDate = true) |
|
|
|
|
|
|
|
|
|
is FilterElementRow.PastDays -> { |
|
|
|
|
val pastDays = if (row.lastDays > 0) row.lastDays.toString() else "" |
|
|
|
|
val data = row.editingDescriptors(mapOf("pastDays" to pastDays)) |
|
|
|
|
BottomSheetFragment.create(fragmentManager, row, this, data, true) |
|
|
|
|
} |
|
|
|
|
is FilterElementRow.DurationMoreThan -> { |
|
|
|
|
val hours = if (row.minutes / 60 > 0) (row.minutes / 60).toString() else "" |
|
|
|
|
val minutes = if (row.minutes % 60 > 0) (row.minutes % 60).toString() else "" |
|
|
|
|
@ -121,6 +126,7 @@ open class FilterDetailsFragment : PokerAnalyticsFragment(), StaticRowRepresenta |
|
|
|
|
|
|
|
|
|
override fun stringForRow(row: RowRepresentable): String { |
|
|
|
|
return when (row) { |
|
|
|
|
is FilterElementRow.PastDays -> if (row.lastDays > 0) row.lastDays.toString() else NULL_TEXT |
|
|
|
|
is FilterElementRow.From -> row.date.shortDate() |
|
|
|
|
is FilterElementRow.To -> row.date.shortDate() |
|
|
|
|
is FilterElementRow.DurationMoreThan -> row.minutes.toMinutes(requireContext()) |
|
|
|
|
@ -139,6 +145,7 @@ open class FilterDetailsFragment : PokerAnalyticsFragment(), StaticRowRepresenta |
|
|
|
|
when (row) { |
|
|
|
|
is FilterElementRow.From -> row.date = if (value != null && value is Date) value else Date() |
|
|
|
|
is FilterElementRow.To -> row.date = if (value != null && value is Date) value else Date() |
|
|
|
|
is FilterElementRow.PastDays -> row.lastDays = if (value != null && value is String) value.toInt() else 0 |
|
|
|
|
is FilterElementRow.DurationMoreThan -> { |
|
|
|
|
if (value is ArrayList<*>) { |
|
|
|
|
val hours = try { |
|
|
|
|
@ -222,14 +229,7 @@ open class FilterDetailsFragment : PokerAnalyticsFragment(), StaticRowRepresenta |
|
|
|
|
|
|
|
|
|
this.rows.forEach { element -> |
|
|
|
|
if (element is FilterElementRow && currentFilter?.contains(element) == true) { |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
when (element) { |
|
|
|
|
is FilterElementRow.From -> element.date = currentFilter?.getValueForElement(element) as Date? ?: Date() |
|
|
|
|
is FilterElementRow.To -> element.date = currentFilter?.getValueForElement(element) as Date? ?: Date() |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
currentFilter?.setSavedValueForElement(element) |
|
|
|
|
this.selectedRows.add(element) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -246,7 +246,6 @@ open class FilterDetailsFragment : PokerAnalyticsFragment(), StaticRowRepresenta |
|
|
|
|
private fun saveData() { |
|
|
|
|
//TODO: Save currentFilter details data |
|
|
|
|
Timber.d("Save data for filter: ${currentFilter?.id}") |
|
|
|
|
|
|
|
|
|
selectedRows?.forEach { |
|
|
|
|
Timber.d("Selected rows: $it") |
|
|
|
|
} |
|
|
|
|
|