fix filters
This commit is contained in:
parent
414abad05f
commit
26489b0f00
1 changed files with 7 additions and 1 deletions
|
@ -56,8 +56,10 @@ import java.io.InterruptedIOException;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@ -114,6 +116,7 @@ public class SearchFragment
|
||||||
@State
|
@State
|
||||||
protected boolean wasSearchFocused = false;
|
protected boolean wasSearchFocused = false;
|
||||||
|
|
||||||
|
private Map<Integer, String> menuItemToFilterName;
|
||||||
private StreamingService service;
|
private StreamingService service;
|
||||||
private String currentPageUrl;
|
private String currentPageUrl;
|
||||||
private String nextPageUrl;
|
private String nextPageUrl;
|
||||||
|
@ -357,10 +360,13 @@ public class SearchFragment
|
||||||
supportActionBar.setDisplayHomeAsUpEnabled(true);
|
supportActionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
menuItemToFilterName = new HashMap<>();
|
||||||
|
|
||||||
int itemId = 0;
|
int itemId = 0;
|
||||||
boolean isFirstItem = true;
|
boolean isFirstItem = true;
|
||||||
final Context c = getContext();
|
final Context c = getContext();
|
||||||
for(String filter : service.getSearchQIHFactory().getAvailableContentFilter()) {
|
for(String filter : service.getSearchQIHFactory().getAvailableContentFilter()) {
|
||||||
|
menuItemToFilterName.put(itemId, filter);
|
||||||
MenuItem item = menu.add(1,
|
MenuItem item = menu.add(1,
|
||||||
itemId++,
|
itemId++,
|
||||||
0,
|
0,
|
||||||
|
@ -379,7 +385,7 @@ public class SearchFragment
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
|
||||||
List<String> contentFilter = new ArrayList<>(1);
|
List<String> contentFilter = new ArrayList<>(1);
|
||||||
contentFilter.add(item.getTitle().toString());
|
contentFilter.add(menuItemToFilterName.get(item.getItemId()));
|
||||||
changeContentFilter(item, contentFilter);
|
changeContentFilter(item, contentFilter);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue