Filter list -> filter set

This commit is contained in:
Martin Fietz 2015-12-10 16:41:09 +01:00
parent c121600977
commit 0e12da7ec6
3 changed files with 7 additions and 5 deletions

View File

@ -12,10 +12,10 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
@ -116,7 +116,7 @@ public class FeedMenuHandler {
final String[] values = context.getResources().getStringArray(R.array.episode_hide_values);
final boolean[] checkedItems = new boolean[items.length];
final List<String> hidden = new ArrayList<String>(Arrays.asList(feed.getItemFilter().getValues()));
final Set<String> hidden = new HashSet<String>(Arrays.asList(feed.getItemFilter().getValues()));
Iterator<String> it = hidden.iterator();
while(it.hasNext()) {
// make sure we have no empty strings in the filter list

View File

@ -19,6 +19,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
@ -1008,7 +1009,7 @@ public class DBWriter {
* @param filterValues Values that represent properties to filter by
*/
public static Future<?> setFeedItemsFilter(final long feedId,
final List<String> filterValues) {
final Set<String> filterValues) {
Log.d(TAG, "setFeedItemsFilter() called with: " + "feedId = [" + feedId + "], filterValues = [" + filterValues + "]");
return dbExec.submit(() -> {
PodDBAdapter adapter = PodDBAdapter.getInstance();

View File

@ -16,6 +16,7 @@ import android.util.Log;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.event.ProgressEvent;
@ -407,7 +408,7 @@ public class PodDBAdapter {
db.update(TABLE_NAME_FEEDS, values, KEY_ID + "=?", new String[]{String.valueOf(prefs.getFeedID())});
}
public void setFeedItemFilter(long feedId, List<String> filterValues) {
public void setFeedItemFilter(long feedId, Set<String> filterValues) {
Log.d(TAG, "setFeedItemFilter() called with: " + "feedId = [" + feedId + "], " +
"filterValues = [" + TextUtils.join(",", filterValues) + "]");
ContentValues values = new ContentValues();