Ignore subscription filter when suggesting tags (#6453)
I have the following setup: * A tag 'Done' with fully listened podcasts * The subscription filter "counter greater 0" * The subscription counter "downloaded episodes" This way all done podcasts aren't visible in the drawer. When I want to tag another podcast as done, 'Done' isn't auto-completed. With this change all tags will be auto-completed.
This commit is contained in:
parent
e2bbc3ef17
commit
aab19f3a5c
|
@ -31,6 +31,7 @@ import de.danoeh.antennapod.core.storage.DBReader;
|
|||
import de.danoeh.antennapod.core.storage.NavDrawerData;
|
||||
import de.danoeh.antennapod.databinding.SubscriptionSelectionActivityBinding;
|
||||
import de.danoeh.antennapod.model.feed.Feed;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
@ -142,7 +143,7 @@ public class SelectSubscriptionActivity extends AppCompatActivity {
|
|||
}
|
||||
disposable = Observable.fromCallable(
|
||||
() -> {
|
||||
NavDrawerData data = DBReader.getNavDrawerData();
|
||||
NavDrawerData data = DBReader.getNavDrawerData(UserPreferences.getSubscriptionsFilter());
|
||||
return getFeedItems(data.items, new ArrayList<>());
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
|
|
@ -7,11 +7,19 @@ import android.util.Log;
|
|||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.SimpleChipAdapter;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
|
@ -24,11 +32,6 @@ import io.reactivex.Observable;
|
|||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class TagSettingsDialog extends DialogFragment {
|
||||
public static final String TAG = "TagSettingsDialog";
|
||||
private static final String ARG_FEED_PREFERENCES = "feed_preferences";
|
||||
|
@ -107,7 +110,7 @@ public class TagSettingsDialog extends DialogFragment {
|
|||
private void loadTags() {
|
||||
Observable.fromCallable(
|
||||
() -> {
|
||||
NavDrawerData data = DBReader.getNavDrawerData();
|
||||
NavDrawerData data = DBReader.getNavDrawerData(null);
|
||||
List<NavDrawerData.DrawerItem> items = data.items;
|
||||
List<String> folders = new ArrayList<String>();
|
||||
for (NavDrawerData.DrawerItem item : items) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
@ -20,14 +21,26 @@ import androidx.core.util.Pair;
|
|||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.activity.PreferenceActivity;
|
||||
import de.danoeh.antennapod.adapter.NavListAdapter;
|
||||
import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
|
||||
import de.danoeh.antennapod.core.menuhandler.MenuItemUtils;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import de.danoeh.antennapod.core.storage.NavDrawerData;
|
||||
|
@ -40,22 +53,13 @@ import de.danoeh.antennapod.event.FeedListUpdateEvent;
|
|||
import de.danoeh.antennapod.event.QueueEvent;
|
||||
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
||||
import de.danoeh.antennapod.model.feed.Feed;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.ui.appstartintent.MainActivityStarter;
|
||||
import de.danoeh.antennapod.ui.home.HomeFragment;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class NavDrawerFragment extends Fragment implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
@VisibleForTesting
|
||||
|
@ -369,7 +373,7 @@ public class NavDrawerFragment extends Fragment implements SharedPreferences.OnS
|
|||
private void loadData() {
|
||||
disposable = Observable.fromCallable(
|
||||
() -> {
|
||||
NavDrawerData data = DBReader.getNavDrawerData();
|
||||
NavDrawerData data = DBReader.getNavDrawerData(UserPreferences.getSubscriptionsFilter());
|
||||
return new Pair<>(data, makeFlatDrawerData(data.items, 0));
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
|
|
@ -13,15 +13,26 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.google.android.material.appbar.MaterialToolbar;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.joanzapata.iconify.Iconify;
|
||||
import com.leinardi.android.speeddial.SpeedDialView;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.adapter.SubscriptionsRecyclerAdapter;
|
||||
|
@ -47,13 +58,6 @@ import io.reactivex.Observable;
|
|||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Fragment for displaying feed subscriptions
|
||||
|
@ -289,7 +293,7 @@ public class SubscriptionFragment extends Fragment
|
|||
emptyView.hide();
|
||||
disposable = Observable.fromCallable(
|
||||
() -> {
|
||||
NavDrawerData data = DBReader.getNavDrawerData();
|
||||
NavDrawerData data = DBReader.getNavDrawerData(UserPreferences.getSubscriptionsFilter());
|
||||
List<NavDrawerData.DrawerItem> items = data.items;
|
||||
for (NavDrawerData.DrawerItem item : items) {
|
||||
if (item.type == NavDrawerData.DrawerItem.Type.TAG
|
||||
|
|
|
@ -14,11 +14,21 @@ import android.view.LayoutInflater;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentContainerView;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.core.menuhandler.MenuItemUtils;
|
||||
|
@ -28,6 +38,7 @@ import de.danoeh.antennapod.databinding.HomeFragmentBinding;
|
|||
import de.danoeh.antennapod.event.FeedListUpdateEvent;
|
||||
import de.danoeh.antennapod.event.FeedUpdateRunningEvent;
|
||||
import de.danoeh.antennapod.fragment.SearchFragment;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.ui.home.sections.AllowNotificationsSection;
|
||||
import de.danoeh.antennapod.ui.home.sections.DownloadsSection;
|
||||
import de.danoeh.antennapod.ui.home.sections.EpisodesSurpriseSection;
|
||||
|
@ -39,13 +50,6 @@ import io.reactivex.Observable;
|
|||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Shows unread or recently published episodes
|
||||
|
@ -182,7 +186,8 @@ public class HomeFragment extends Fragment implements Toolbar.OnMenuItemClickLis
|
|||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
disposable = Observable.fromCallable(() -> DBReader.getNavDrawerData().items.size())
|
||||
disposable = Observable.fromCallable(() ->
|
||||
DBReader.getNavDrawerData(UserPreferences.getSubscriptionsFilter()).items.size())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(numSubscriptions -> {
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package de.danoeh.antennapod.core.storage;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.collection.ArrayMap;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -14,6 +15,11 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import de.danoeh.antennapod.core.util.LongList;
|
||||
import de.danoeh.antennapod.core.util.comparator.DownloadStatusComparator;
|
||||
import de.danoeh.antennapod.core.util.comparator.FeedItemPubdateComparator;
|
||||
import de.danoeh.antennapod.core.util.comparator.PlaybackCompletionDateComparator;
|
||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.model.feed.Chapter;
|
||||
import de.danoeh.antennapod.model.feed.Feed;
|
||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||
|
@ -22,19 +28,14 @@ import de.danoeh.antennapod.model.feed.FeedMedia;
|
|||
import de.danoeh.antennapod.model.feed.FeedPreferences;
|
||||
import de.danoeh.antennapod.model.feed.SortOrder;
|
||||
import de.danoeh.antennapod.model.feed.SubscriptionsFilter;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.storage.database.PodDBAdapter;
|
||||
import de.danoeh.antennapod.storage.database.mapper.DownloadStatusCursorMapper;
|
||||
import de.danoeh.antennapod.storage.database.mapper.ChapterCursorMapper;
|
||||
import de.danoeh.antennapod.storage.database.mapper.DownloadStatusCursorMapper;
|
||||
import de.danoeh.antennapod.storage.database.mapper.FeedCursorMapper;
|
||||
import de.danoeh.antennapod.storage.database.mapper.FeedItemCursorMapper;
|
||||
import de.danoeh.antennapod.storage.database.mapper.FeedMediaCursorMapper;
|
||||
import de.danoeh.antennapod.storage.database.mapper.FeedPreferencesCursorMapper;
|
||||
import de.danoeh.antennapod.core.util.LongList;
|
||||
import de.danoeh.antennapod.core.util.comparator.DownloadStatusComparator;
|
||||
import de.danoeh.antennapod.core.util.comparator.FeedItemPubdateComparator;
|
||||
import de.danoeh.antennapod.core.util.comparator.PlaybackCompletionDateComparator;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
|
||||
/**
|
||||
* Provides methods for reading data from the AntennaPod database.
|
||||
|
@ -811,14 +812,17 @@ public final class DBReader {
|
|||
* items.
|
||||
*/
|
||||
@NonNull
|
||||
public static NavDrawerData getNavDrawerData() {
|
||||
public static NavDrawerData getNavDrawerData(@Nullable SubscriptionsFilter subscriptionsFilter) {
|
||||
Log.d(TAG, "getNavDrawerData() called with: " + "");
|
||||
PodDBAdapter adapter = PodDBAdapter.getInstance();
|
||||
adapter.open();
|
||||
|
||||
final Map<Long, Integer> feedCounters = adapter.getFeedCounters(UserPreferences.getFeedCounterSetting());
|
||||
SubscriptionsFilter subscriptionsFilter = UserPreferences.getSubscriptionsFilter();
|
||||
List<Feed> feeds = subscriptionsFilter.filter(getFeedList(adapter), feedCounters);
|
||||
List<Feed> feeds = getFeedList(adapter);
|
||||
|
||||
if (subscriptionsFilter != null) {
|
||||
feeds = subscriptionsFilter.filter(feeds, feedCounters);
|
||||
}
|
||||
|
||||
Comparator<Feed> comparator;
|
||||
int feedOrder = UserPreferences.getFeedOrder();
|
||||
|
|
|
@ -330,7 +330,7 @@ public class DbReaderTest {
|
|||
final int numFeeds = 10;
|
||||
final int numItems = 10;
|
||||
DbTestUtils.saveFeedlist(numFeeds, numItems, true);
|
||||
NavDrawerData navDrawerData = DBReader.getNavDrawerData();
|
||||
NavDrawerData navDrawerData = DBReader.getNavDrawerData(UserPreferences.getSubscriptionsFilter());
|
||||
assertEquals(numFeeds, navDrawerData.items.size());
|
||||
assertEquals(0, navDrawerData.numNewItems);
|
||||
assertEquals(0, navDrawerData.queueSize);
|
||||
|
@ -359,7 +359,7 @@ public class DbReaderTest {
|
|||
|
||||
adapter.close();
|
||||
|
||||
NavDrawerData navDrawerData = DBReader.getNavDrawerData();
|
||||
NavDrawerData navDrawerData = DBReader.getNavDrawerData(UserPreferences.getSubscriptionsFilter());
|
||||
assertEquals(numFeeds, navDrawerData.items.size());
|
||||
assertEquals(numNew, navDrawerData.numNewItems);
|
||||
assertEquals(numQueue, navDrawerData.queueSize);
|
||||
|
|
Loading…
Reference in New Issue