From 2422d65c06efc455dd6b8242a6c23821d31b5268 Mon Sep 17 00:00:00 2001 From: Aurelien Hubert Date: Tue, 9 Apr 2019 12:20:52 +0200 Subject: [PATCH] Clean code --- .../view/rowrepresentable/FilterSectionRow.kt | 101 ------------------ 1 file changed, 101 deletions(-) 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 f588a914..19f4ed1d 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 @@ -164,104 +164,3 @@ enum class FilterSectionRow(override val resId: Int?) : RowRepresentable { } } } - - -/* - - - /** - * Return the type of the selection - */ - fun getType(): Type { - return when (this) { - GAME, LIMIT_TYPE -> Type.MULTIPLE - FIXED_DATE, YEAR, WEEKDAYS_OR_WEEKEND, DAY_OF_WEEK, MONTH_OF_YEAR -> Type.MULTIPLE - else -> Type.SINGLE - } - } - - /** - * Returns the filter rows - */ - fun getFilterRows(realm: Realm): ArrayList { - val rows = ArrayList() - when (this) { - - // General - CASH_TOURNAMENT -> rows.addAll(arrayListOf(FilterRow.CASH_GAME, FilterRow.TOURNAMENT)) - LIVE_ONLINE -> rows.addAll(arrayListOf(FilterRow.LIVE, FilterRow.ONLINE)) - GAME -> { - val games = realm.copyFromRealm(LiveData.GAME.items(realm) as RealmResults) - rows.addAll(games) - } - LIMIT_TYPE -> rows.addAll(Limit.numericValues()) - TABLE_SIZE -> { - val sessions = realm.where().sort("tableSize").distinct("tableSize").findAll() - for (session in sessions) { - session.tableSize?.let { - rows.add(TableSize(it, RowViewType.TITLE_CHECK.ordinal)) - } - } - } - - // Date - DYNAMIC_DATE -> rows.addAll( - arrayListOf( - FilterRow.TODAY, FilterRow.YESTERDAY, FilterRow.TODAY_AND_YESTERDAY, FilterRow.CURRENT_WEEK, - FilterRow.CURRENT_MONTH, FilterRow.CURRENT_YEAR - ) - ) - FIXED_DATE -> { - rows.addAll(arrayListOf(FilterRow.FROM, FilterRow.TO)) - } - DURATION -> rows.addAll(arrayListOf(FilterRow.PAST_DAYS)) - YEAR -> { - - //TODO: Maybe move this code - - val calendar = Calendar.getInstance() - val sessions = realm.where().sort("endDate", Sort.DESCENDING).findAll() - val years = ArrayList() - - for (session in sessions) { - session.endDate?.let { - calendar.time = it - val year = calendar.get(Calendar.YEAR) - if (!years.contains(year)) { - years.add(year) - } - } - } - - for (year in years) { - rows.add(CustomizableRowRepresentable(customViewType = RowViewType.TITLE_CHECK, title = year.toString(), isSelectable = true)) - } - - } - WEEKDAYS_OR_WEEKEND -> rows.addAll(arrayListOf(FilterRow.WEEKDAYS, FilterRow.WEEKEND)) - DAY_OF_WEEK -> { - val dfs = DateFormatSymbols.getInstance(Locale.getDefault()) - for (day in dfs.weekdays) { - if (day.isNotEmpty()) { - rows.add(CustomizableRowRepresentable(customViewType = RowViewType.TITLE_CHECK, title = day, isSelectable = true)) - } - } - } - MONTH_OF_YEAR -> { - val dfs = DateFormatSymbols.getInstance(Locale.getDefault()) - for (month in dfs.months) { - if (month.isNotEmpty()) { - rows.add(CustomizableRowRepresentable(customViewType = RowViewType.TITLE_CHECK, title = month, isSelectable = true)) - } - } - } - - - else -> rows.addAll(arrayListOf()) - } - return rows - } - -} - - */ \ No newline at end of file