Browse Source

Remove menuitem fields

pull/409/head
Alon Albert 7 years ago
parent
commit
61ddff9da4
  1. 14
      app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java

14
app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java

@ -85,8 +85,6 @@ public class SearchActivity extends AppCompatActivity {
private List<SearchSetting> searchSites; private List<SearchSetting> searchSites;
private SearchSetting lastUsedSite; private SearchSetting lastUsedSite;
private String lastUsedQuery; private String lastUsedQuery;
private MenuItem sortByAdded;
private MenuItem sortBySeeders;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -179,8 +177,8 @@ public class SearchActivity extends AppCompatActivity {
searchView.setIconifiedByDefault(false); searchView.setIconifiedByDefault(false);
MenuItemCompat.setActionView(item, searchView); MenuItemCompat.setActionView(item, searchView);
searchMenu = item; searchMenu = item;
sortBySeeders = menu.findItem(R.id.action_sort_seeders); final MenuItem sortBySeeders = menu.findItem(R.id.action_sort_seeders);
sortByAdded = menu.findItem(R.id.action_sort_added); final MenuItem sortByAdded = menu.findItem(R.id.action_sort_added);
final SearchSortOrder sortOrder = applicationSettings.getLastUsedSearchSortOrder(); final SearchSortOrder sortOrder = applicationSettings.getLastUsedSearchSortOrder();
if (sortOrder == SearchSortOrder.BySeeders) { if (sortOrder == SearchSortOrder.BySeeders) {
sortBySeeders.setChecked(true); sortBySeeders.setChecked(true);
@ -326,20 +324,20 @@ public class SearchActivity extends AppCompatActivity {
@OptionsItem(R.id.action_sort_added) @OptionsItem(R.id.action_sort_added)
protected void sortByDateAdded() { protected void sortByDateAdded() {
if (sortByAdded.isChecked()) { if (applicationSettings.getLastUsedSearchSortOrder() == SearchSortOrder.Combined) {
return; return;
} }
sortByAdded.setChecked(true); invalidateOptionsMenu();
applicationSettings.setLastUsedSearchSortOrder(SearchSortOrder.Combined); applicationSettings.setLastUsedSearchSortOrder(SearchSortOrder.Combined);
refreshSearch(); refreshSearch();
} }
@OptionsItem(R.id.action_sort_seeders) @OptionsItem(R.id.action_sort_seeders)
protected void sortBySeeders() { protected void sortBySeeders() {
if (sortBySeeders.isChecked()) { if (applicationSettings.getLastUsedSearchSortOrder() == SearchSortOrder.BySeeders) {
return; return;
} }
sortBySeeders.setChecked(true); invalidateOptionsMenu();
applicationSettings.setLastUsedSearchSortOrder(SearchSortOrder.BySeeders); applicationSettings.setLastUsedSearchSortOrder(SearchSortOrder.BySeeders);
refreshSearch(); refreshSearch();
} }

Loading…
Cancel
Save