Refactor FilterProvider for reuse

pull/1012/head
Alex Baker 6 years ago
parent efa663f444
commit 864bc73a8c

@ -1,49 +0,0 @@
/*
* Copyright (c) 2012 Todoroo Inc
*
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.timers;
import android.content.Context;
import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.QueryTemplate;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task;
import javax.inject.Inject;
import org.jetbrains.annotations.Nullable;
import org.tasks.R;
import org.tasks.injection.ForApplication;
/**
* Exposes "working on" filter to the NavigationDrawerFragment
*
* @author Tim Su <tim@todoroo.com>
*/
public final class TimerFilterExposer {
private final TaskDao taskDao;
private final Context context;
@Inject
public TimerFilterExposer(@ForApplication Context context, TaskDao taskDao) {
this.context = context;
this.taskDao = taskDao;
}
static Filter createFilter(Context context) {
Filter filter =
new Filter(
context.getString(R.string.TFE_workingOn),
new QueryTemplate()
.where(Criterion.and(Task.TIMER_START.gt(0), Task.DELETION_DATE.eq(0))));
filter.icon = R.drawable.ic_outline_timer_24px;
return filter;
}
public @Nullable Filter getFilters() {
return taskDao.activeTimers() == 0 ? null : createFilter(context);
}
}

@ -13,6 +13,8 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.QueryTemplate;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.dao.TaskDao;
@ -86,7 +88,7 @@ public class TimerPlugin {
if (count == 0) { if (count == 0) {
notificationManager.cancel(Constants.NOTIFICATION_TIMER); notificationManager.cancel(Constants.NOTIFICATION_TIMER);
} else { } else {
Filter filter = TimerFilterExposer.createFilter(context); Filter filter = createFilter(context);
Intent notifyIntent = TaskIntents.getTaskListIntent(context, filter); Intent notifyIntent = TaskIntents.getTaskListIntent(context, filter);
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); notifyIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent pendingIntent =
@ -109,4 +111,14 @@ public class TimerPlugin {
notificationManager.notify(Constants.NOTIFICATION_TIMER, builder, false, false, false); notificationManager.notify(Constants.NOTIFICATION_TIMER, builder, false, false, false);
} }
} }
public static Filter createFilter(Context context) {
Filter filter =
new Filter(
context.getString(R.string.TFE_workingOn),
new QueryTemplate()
.where(Criterion.and(Task.TIMER_START.gt(0), Task.DELETION_DATE.eq(0))));
filter.icon = R.drawable.ic_outline_timer_24px;
return filter;
}
} }

@ -120,7 +120,7 @@ public class FilterSelectionActivity extends InjectingAppCompatActivity {
private void refresh() { private void refresh() {
disposables.add( disposables.add(
Single.fromCallable(() -> filterProvider.getItems(false)) Single.fromCallable(() -> filterProvider.getFilterPickerItems())
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(items -> filterAdapter.setData(items, selected))); .subscribe(items -> filterAdapter.setData(items, selected)));

@ -4,6 +4,7 @@ import androidx.lifecycle.LiveData
import androidx.room.* import androidx.room.*
import io.reactivex.Single import io.reactivex.Single
import org.tasks.filters.LocationFilters import org.tasks.filters.LocationFilters
import org.tasks.time.DateTimeUtils.currentTimeMillis
@Dao @Dao
interface LocationDao { interface LocationDao {
@ -107,5 +108,5 @@ interface LocationDao {
+ " LEFT JOIN tasks ON geofences.task = tasks._id AND tasks.completed = 0 AND tasks.deleted = 0 AND tasks.hideUntil < :now" + " LEFT JOIN tasks ON geofences.task = tasks._id AND tasks.completed = 0 AND tasks.deleted = 0 AND tasks.hideUntil < :now"
+ " GROUP BY places.uid" + " GROUP BY places.uid"
+ " ORDER BY name COLLATE NOCASE ASC") + " ORDER BY name COLLATE NOCASE ASC")
fun getPlaceFilters(now: Long): List<LocationFilters> fun getPlaceFilters(now: Long = currentTimeMillis()): List<LocationFilters>
} }

@ -8,6 +8,7 @@ import com.todoroo.astrid.helper.UUIDHelper
import org.tasks.db.DbUtils import org.tasks.db.DbUtils
import org.tasks.filters.AlphanumComparator import org.tasks.filters.AlphanumComparator
import org.tasks.filters.TagFilters import org.tasks.filters.TagFilters
import org.tasks.time.DateTimeUtils.currentTimeMillis
import java.util.* import java.util.*
import kotlin.collections.HashSet import kotlin.collections.HashSet
@ -146,5 +147,5 @@ abstract class TagDataDao {
+ " LEFT JOIN tasks ON tags.task = tasks._id AND tasks.deleted = 0 AND tasks.completed = 0 AND tasks.hideUntil < :now" + " LEFT JOIN tasks ON tags.task = tasks._id AND tasks.deleted = 0 AND tasks.completed = 0 AND tasks.hideUntil < :now"
+ " WHERE tagdata.name IS NOT NULL AND tagdata.name != ''" + " WHERE tagdata.name IS NOT NULL AND tagdata.name != ''"
+ " GROUP BY tagdata.remoteId") + " GROUP BY tagdata.remoteId")
abstract fun getTagFilters(now: Long): List<TagFilters> abstract fun getTagFilters(now: Long = currentTimeMillis()): List<TagFilters>
} }

@ -3,15 +3,13 @@ package org.tasks.filters
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import com.todoroo.andlib.utility.AndroidUtilities import com.todoroo.andlib.utility.AndroidUtilities
import com.todoroo.andlib.utility.DateUtilities
import com.todoroo.astrid.api.CustomFilter import com.todoroo.astrid.api.CustomFilter
import com.todoroo.astrid.api.Filter
import com.todoroo.astrid.api.FilterListItem import com.todoroo.astrid.api.FilterListItem
import com.todoroo.astrid.core.BuiltInFilterExposer import com.todoroo.astrid.core.BuiltInFilterExposer
import com.todoroo.astrid.timers.TimerFilterExposer import com.todoroo.astrid.dao.TaskDao
import com.todoroo.astrid.timers.TimerPlugin
import org.tasks.BuildConfig import org.tasks.BuildConfig
import org.tasks.R import org.tasks.R
import org.tasks.Strings
import org.tasks.activities.GoogleTaskListSettingsActivity import org.tasks.activities.GoogleTaskListSettingsActivity
import org.tasks.activities.TagSettingsActivity import org.tasks.activities.TagSettingsActivity
import org.tasks.billing.Inventory import org.tasks.billing.Inventory
@ -25,14 +23,13 @@ import org.tasks.preferences.HelpAndFeedback
import org.tasks.preferences.MainPreferences import org.tasks.preferences.MainPreferences
import org.tasks.preferences.Preferences import org.tasks.preferences.Preferences
import org.tasks.ui.NavigationDrawerFragment import org.tasks.ui.NavigationDrawerFragment
import java.util.*
import javax.inject.Inject import javax.inject.Inject
class FilterProvider @Inject constructor( class FilterProvider @Inject constructor(
@param:ForApplication private val context: Context, @param:ForApplication private val context: Context,
private val inventory: Inventory, private val inventory: Inventory,
private val builtInFilterExposer: BuiltInFilterExposer, private val builtInFilterExposer: BuiltInFilterExposer,
private val timerFilterExposer: TimerFilterExposer, private val taskDao: TaskDao,
private val filterDao: FilterDao, private val filterDao: FilterDao,
private val tagDataDao: TagDataDao, private val tagDataDao: TagDataDao,
private val googleTaskListDao: GoogleTaskListDao, private val googleTaskListDao: GoogleTaskListDao,
@ -43,255 +40,203 @@ class FilterProvider @Inject constructor(
val listPickerItems: List<FilterListItem> val listPickerItems: List<FilterListItem>
get() { get() {
AndroidUtilities.assertNotMainThread() AndroidUtilities.assertNotMainThread()
val items: MutableList<FilterListItem> = ArrayList() return googleTaskFilters(false).plus(caldavFilters(false))
for ((account, value) in googleTaskFilters) {
items.addAll(
getSubmenu(
account.account,
!Strings.isNullOrEmpty(account.error),
value,
true,
account.isCollapsed,
SubheaderType.GOOGLE_TASKS,
account.id))
} }
for ((account, value) in caldavFilters) {
items.addAll( val navDrawerItems: List<FilterListItem>
getSubmenu( get() {
account.name, AndroidUtilities.assertNotMainThread()
!Strings.isNullOrEmpty(account.error), return arrayListOf(builtInFilterExposer.myTasksFilter)
value, .plus(getAllFilters(true))
true, .plus(navDrawerFooter)
account.isCollapsed,
SubheaderType.CALDAV,
account.id))
} }
return items
val filterPickerItems: List<FilterListItem>
get() {
AndroidUtilities.assertNotMainThread()
return arrayListOf(builtInFilterExposer.myTasksFilter)
.plus(getAllFilters(false))
} }
private fun addFilters(items: MutableList<FilterListItem>, navigationDrawer: Boolean) { private fun addFilters(showCreate: Boolean): List<FilterListItem> =
if (!preferences.getBoolean(R.string.p_filters_enabled, true)) { if (!preferences.getBoolean(R.string.p_filters_enabled, true)) {
return emptyList()
} } else {
items.addAll(getSubmenu(R.string.filters, R.string.p_collapse_filters) { filters }) val collapsed = preferences.getBoolean(R.string.p_collapse_filters, false)
if (navigationDrawer && !preferences.getBoolean(R.string.p_collapse_filters, false)) { listOf(
items.add( NavigationDrawerSubheader(
context.getString(R.string.filters),
false,
collapsed,
SubheaderType.PREFERENCE,
R.string.p_collapse_filters.toLong()))
.apply { if (collapsed) return this }
.plus(builtInFilterExposer.filters)
.plusIf(taskDao.activeTimers() > 0) { TimerPlugin.createFilter(context) }
.plus(filterDao.getFilters().map(::CustomFilter).sortedWith(AlphanumComparator.FILTER))
.plusIf(showCreate) {
NavigationDrawerAction( NavigationDrawerAction(
context.getString(R.string.add_filter), context.getString(R.string.add_filter),
R.drawable.ic_outline_add_24px, R.drawable.ic_outline_add_24px,
NavigationDrawerFragment.REQUEST_NEW_FILTER)) NavigationDrawerFragment.REQUEST_NEW_FILTER)
} }
} }
private fun addTags(items: MutableList<FilterListItem>, navigationDrawer: Boolean) { private fun addTags(showCreate: Boolean): List<FilterListItem> =
if (!preferences.getBoolean(R.string.p_tags_enabled, true)) { if (!preferences.getBoolean(R.string.p_tags_enabled, true)) {
return emptyList()
} } else {
val collapsed = preferences.getBoolean(R.string.p_collapse_tags, false) val collapsed = preferences.getBoolean(R.string.p_collapse_tags, false)
var filters = if (collapsed) emptyList() else tagDataDao.getTagFilters(DateUtilities.now()) listOf(
if (preferences.getBoolean(R.string.p_tags_hide_unused, false)) { NavigationDrawerSubheader(
filters = filters.filter { it.count > 0 }
}
val tags = filters.map(TagFilters::toTagFilter).sortedWith(AlphanumComparator.FILTER)
items.addAll(
getSubmenu(
context.getString(R.string.tags), context.getString(R.string.tags),
false, false,
tags,
false,
collapsed, collapsed,
SubheaderType.PREFERENCE, SubheaderType.PREFERENCE,
R.string.p_collapse_tags.toLong())) R.string.p_collapse_tags.toLong()))
if (navigationDrawer && !collapsed) { .apply { if (collapsed) return this }
items.add( .plus(tagDataDao.getTagFilters()
.filterIf(preferences.getBoolean(R.string.p_tags_hide_unused, false)) {
it.count > 0
}
.map(TagFilters::toTagFilter)
.sortedWith(AlphanumComparator.FILTER))
.plusIf(showCreate) {
NavigationDrawerAction( NavigationDrawerAction(
context.getString(R.string.new_tag), context.getString(R.string.new_tag),
R.drawable.ic_outline_add_24px, R.drawable.ic_outline_add_24px,
Intent(context, TagSettingsActivity::class.java), Intent(context, TagSettingsActivity::class.java),
NavigationDrawerFragment.REQUEST_NEW_LIST)) NavigationDrawerFragment.REQUEST_NEW_LIST)
} }
} }
private fun addPlaces(items: MutableList<FilterListItem>, navigationDrawer: Boolean) { private fun addPlaces(showCreate: Boolean): List<FilterListItem> =
if (!preferences.getBoolean(R.string.p_places_enabled, true)) { if (!preferences.getBoolean(R.string.p_places_enabled, true)) {
return emptyList()
} } else {
val collapsed = preferences.getBoolean(R.string.p_collapse_locations, false) val collapsed = preferences.getBoolean(R.string.p_collapse_locations, false)
var filters = if (collapsed) emptyList() else locationDao.getPlaceFilters(DateUtilities.now()) listOf(
if (preferences.getBoolean(R.string.p_places_hide_unused, false)) { NavigationDrawerSubheader(
filters = filters.filter { it.count > 0 }
}
items.addAll(
getSubmenu(
context.getString(R.string.places), context.getString(R.string.places),
false, false,
filters.map(LocationFilters::toLocationFilter),
false,
collapsed, collapsed,
SubheaderType.PREFERENCE, SubheaderType.PREFERENCE,
R.string.p_collapse_locations.toLong())) R.string.p_collapse_locations.toLong()))
if (navigationDrawer && !collapsed) { .apply { if (collapsed) return this }
items.add( .plus(locationDao.getPlaceFilters()
.filterIf(preferences.getBoolean(R.string.p_places_hide_unused, false)) {
it.count > 0
}
.map(LocationFilters::toLocationFilter)
.sortedWith(AlphanumComparator.FILTER))
.plusIf(showCreate) {
NavigationDrawerAction( NavigationDrawerAction(
context.getString(R.string.add_place), context.getString(R.string.add_place),
R.drawable.ic_outline_add_24px, R.drawable.ic_outline_add_24px,
Intent(context, LocationPickerActivity::class.java), Intent(context, LocationPickerActivity::class.java),
NavigationDrawerFragment.REQUEST_NEW_PLACE)) NavigationDrawerFragment.REQUEST_NEW_PLACE)
} }
} }
fun getItems(navigationDrawer: Boolean): List<FilterListItem> { private fun getAllFilters(showCreate: Boolean): List<FilterListItem> =
AndroidUtilities.assertNotMainThread() addFilters(showCreate)
val items: MutableList<FilterListItem> = ArrayList() .plus(addTags(showCreate))
items.add(builtInFilterExposer.myTasksFilter) .plus(addPlaces(showCreate))
addFilters(items, navigationDrawer) .plus(googleTaskFilters(showCreate))
addTags(items, navigationDrawer) .plus(caldavFilters(showCreate))
addPlaces(items, navigationDrawer)
for ((account, value) in googleTaskFilters) { private val navDrawerFooter: List<FilterListItem>
items.addAll( get() = listOf(NavigationDrawerSeparator())
getSubmenu( .plusIf(BuildConfig.FLAVOR == "generic") {
account.account,
!Strings.isNullOrEmpty(account.error),
value,
!navigationDrawer,
account.isCollapsed,
SubheaderType.GOOGLE_TASKS,
account.id))
if (navigationDrawer && !account.isCollapsed) {
items.add(
NavigationDrawerAction(
context.getString(R.string.new_list),
R.drawable.ic_outline_add_24px,
Intent(context, GoogleTaskListSettingsActivity::class.java)
.putExtra(GoogleTaskListSettingsActivity.EXTRA_ACCOUNT, account),
NavigationDrawerFragment.REQUEST_NEW_LIST))
}
}
for ((account, value) in caldavFilters) {
if (account.accountType == TYPE_LOCAL && !preferences.getBoolean(R.string.p_lists_enabled, true)) {
continue
}
items.addAll(
getSubmenu(
account.name,
!Strings.isNullOrEmpty(account.error),
value,
!navigationDrawer,
account.isCollapsed,
SubheaderType.CALDAV,
account.id))
if (navigationDrawer && !account.isCollapsed) {
items.add(
NavigationDrawerAction(
context.getString(R.string.new_list),
R.drawable.ic_outline_add_24px,
Intent(context, account.listSettingsClass())
.putExtra(BaseCaldavCalendarSettingsActivity.EXTRA_CALDAV_ACCOUNT, account),
NavigationDrawerFragment.REQUEST_NEW_LIST))
}
}
if (navigationDrawer) {
items.add(NavigationDrawerSeparator())
@Suppress("ConstantConditionIf")
if (BuildConfig.FLAVOR == "generic") {
items.add(
NavigationDrawerAction( NavigationDrawerAction(
context.getString(R.string.TLA_menu_donate), context.getString(R.string.TLA_menu_donate),
R.drawable.ic_outline_attach_money_24px, R.drawable.ic_outline_attach_money_24px,
NavigationDrawerFragment.REQUEST_DONATE)) NavigationDrawerFragment.REQUEST_DONATE)
} else if (!inventory.hasPro()) { }
items.add( .plusIf(!inventory.hasPro()) {
NavigationDrawerAction( NavigationDrawerAction(
context.getString(R.string.name_your_price), context.getString(R.string.name_your_price),
R.drawable.ic_outline_attach_money_24px, R.drawable.ic_outline_attach_money_24px,
NavigationDrawerFragment.REQUEST_PURCHASE)) NavigationDrawerFragment.REQUEST_PURCHASE)
} }
items.add( .plus(NavigationDrawerAction(
NavigationDrawerAction(
context.getString(R.string.TLA_menu_settings), context.getString(R.string.TLA_menu_settings),
R.drawable.ic_outline_settings_24px, R.drawable.ic_outline_settings_24px,
Intent(context, MainPreferences::class.java), Intent(context, MainPreferences::class.java),
NavigationDrawerFragment.REQUEST_SETTINGS)) NavigationDrawerFragment.REQUEST_SETTINGS))
items.add( .plus(NavigationDrawerAction(
NavigationDrawerAction(
context.getString(R.string.help_and_feedback), context.getString(R.string.help_and_feedback),
R.drawable.ic_outline_help_outline_24px, R.drawable.ic_outline_help_outline_24px,
Intent(context, HelpAndFeedback::class.java), Intent(context, HelpAndFeedback::class.java),
0)) 0))
}
return items
}
private val filters: List<Filter> private fun googleTaskFilters(showCreate: Boolean = true): List<FilterListItem> =
get() {
val filters = ArrayList(builtInFilterExposer.filters)
val filter = timerFilterExposer.filters
if (filter != null) {
filters.add(filter)
}
filters.addAll(filterDao.getFilters()
.map(::CustomFilter)
.sortedWith(AlphanumComparator.FILTER))
return filters
}
private val googleTaskFilters: Set<Map.Entry<GoogleTaskAccount, List<Filter>>>
get() {
val accounts = googleTaskListDao.getAccounts()
val filters = LinkedHashMap<GoogleTaskAccount, List<Filter>>()
for (account in accounts) {
filters[account] = if (account.isCollapsed) {
emptyList()
} else {
googleTaskListDao googleTaskListDao
.getGoogleTaskFilters(account.account!!) .getAccounts()
.flatMap {
listOf(
NavigationDrawerSubheader(
it.account,
it.error?.isNotBlank() ?: false,
it.isCollapsed,
SubheaderType.GOOGLE_TASKS,
it.id))
.plusAllIf(!it.isCollapsed) {
googleTaskListDao
.getGoogleTaskFilters(it.account!!)
.map(GoogleTaskFilters::toGtasksFilter) .map(GoogleTaskFilters::toGtasksFilter)
.sortedWith(AlphanumComparator.FILTER) .sortedWith(AlphanumComparator.FILTER)
} }
.plusIf(showCreate && !it.isCollapsed) {
NavigationDrawerAction(
context.getString(R.string.new_list),
R.drawable.ic_outline_add_24px,
Intent(context, GoogleTaskListSettingsActivity::class.java)
.putExtra(GoogleTaskListSettingsActivity.EXTRA_ACCOUNT, it),
NavigationDrawerFragment.REQUEST_NEW_LIST)
} }
return filters.entries
} }
private val caldavFilters: Set<Map.Entry<CaldavAccount, List<Filter>>> private fun caldavFilters(showCreate: Boolean = true): List<FilterListItem> =
get() { caldavDao.getAccounts()
val accounts = caldavDao.getAccounts().ifEmpty { .ifEmpty { listOf(caldavDao.setupLocalAccount(context)) }
listOf(caldavDao.setupLocalAccount(context)) .filter { it.accountType != TYPE_LOCAL || preferences.getBoolean(R.string.p_lists_enabled, true) }
} .flatMap {
val filters = LinkedHashMap<CaldavAccount, List<Filter>>() listOf(
for (account in accounts) { NavigationDrawerSubheader(
if (account.accountType == TYPE_LOCAL) { if (it.accountType == TYPE_LOCAL) {
account.name = context.getString(R.string.lists) context.getString(R.string.lists)
}
filters[account] = if (account.isCollapsed) {
emptyList()
} else { } else {
it.name
},
it.error?.isNotBlank() ?: false,
it.isCollapsed,
SubheaderType.CALDAV,
it.id))
.plusAllIf(!it.isCollapsed) {
caldavDao caldavDao
.getCaldavFilters(account.uuid!!) .getCaldavFilters(it.uuid!!)
.map(CaldavFilters::toCaldavFilter) .map(CaldavFilters::toCaldavFilter)
.sortedWith(AlphanumComparator.FILTER) .sortedWith(AlphanumComparator.FILTER)
} }
.plusIf(showCreate && !it.isCollapsed) {
NavigationDrawerAction(
context.getString(R.string.new_list),
R.drawable.ic_outline_add_24px,
Intent(context, it.listSettingsClass())
.putExtra(BaseCaldavCalendarSettingsActivity.EXTRA_CALDAV_ACCOUNT, it),
NavigationDrawerFragment.REQUEST_NEW_LIST)
} }
return filters.entries
} }
private fun getSubmenu(title: Int, prefId: Int, getFilters: () -> List<Filter>): List<FilterListItem> { companion object {
val collapsed = preferences.getBoolean(prefId, false) private fun <T> Collection<T>.plusAllIf(predicate: Boolean, item: () -> Iterable<T>): List<T> =
val subheader = NavigationDrawerSubheader(context.getString(title), false, collapsed, SubheaderType.PREFERENCE, prefId.toLong()) plus(if (predicate) item.invoke() else emptyList())
return listOf(subheader).plus(if (collapsed) emptyList() else getFilters.invoke())
}
private fun getSubmenu( private fun <T> Collection<T>.plusIf(predicate: Boolean, item: () -> T): List<T> =
title: String?, if (predicate) plus(item.invoke()) else this.toList()
error: Boolean,
filters: List<Filter>, private fun <T> Iterable<T>.filterIf(predicate: Boolean, predicate2: (T) -> Boolean): List<T> =
hideIfEmpty: Boolean, if (predicate) filter(predicate2) else this.toList()
collapsed: Boolean,
type: SubheaderType,
id: Long): List<FilterListItem> {
return if (hideIfEmpty && filters.isEmpty() && !collapsed) {
listOf()
} else {
listOf(NavigationDrawerSubheader(title, error, collapsed, type, id)).plus(filters)
}
} }
} }

@ -152,7 +152,7 @@ class NavigationDrawerFragment : InjectingFragment() {
} }
private fun updateFilters() = private fun updateFilters() =
Single.fromCallable { filterProvider.getItems(true) } Single.fromCallable { filterProvider.navDrawerItems }
.map { items: List<FilterListItem> -> refreshFilterCount(items) } .map { items: List<FilterListItem> -> refreshFilterCount(items) }
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())

Loading…
Cancel
Save