Remove checks for opened drawer, now unneccessary
This commit is contained in:
parent
3bf2b109bb
commit
9c2f46e5e4
|
@ -46,7 +46,6 @@ import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
|||
import de.danoeh.antennapod.dialog.VariableSpeedDialog;
|
||||
import de.danoeh.antennapod.fragment.CoverFragment;
|
||||
import de.danoeh.antennapod.fragment.ItemDescriptionFragment;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
|
||||
import de.danoeh.antennapod.preferences.PreferenceController;
|
||||
|
||||
|
@ -413,26 +412,7 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
|
|||
butShowCover = (ImageButton) findViewById(R.id.butCover);
|
||||
txtvTitle = (TextView) findViewById(R.id.txtvTitle);
|
||||
|
||||
/*
|
||||
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close) {
|
||||
CharSequence currentTitle = getSupportActionBar().getTitle();
|
||||
|
||||
@Override
|
||||
public void onDrawerOpened(View drawerView) {
|
||||
super.onDrawerOpened(drawerView);
|
||||
currentTitle = getSupportActionBar().getTitle();
|
||||
getSupportActionBar().setTitle(R.string.app_name);
|
||||
supportInvalidateOptionsMenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawerClosed(View drawerView) {
|
||||
super.onDrawerClosed(drawerView);
|
||||
getSupportActionBar().setTitle(currentTitle);
|
||||
supportInvalidateOptionsMenu();
|
||||
}
|
||||
}; */
|
||||
|
||||
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close);
|
||||
drawerToggle.setDrawerIndicatorEnabled(false);
|
||||
drawerLayout.setDrawerListener(drawerToggle);
|
||||
|
||||
|
@ -638,20 +618,12 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
|
|||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (!MenuItemUtils.isActivityDrawerOpen(this)) {
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
if (!MenuItemUtils.isActivityDrawerOpen(this)) {
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
public interface AudioplayerContentFragment {
|
||||
|
|
|
@ -113,28 +113,11 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
|
|||
navList = (ListView) findViewById(R.id.nav_list);
|
||||
navDrawer = findViewById(R.id.nav_layout);
|
||||
|
||||
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close) {
|
||||
@Override
|
||||
public void onDrawerOpened(View drawerView) {
|
||||
super.onDrawerOpened(drawerView);
|
||||
//currentTitle = getSupportActionBar().getTitle();
|
||||
//getSupportActionBar().setTitle(drawerTitle);
|
||||
//supportInvalidateOptionsMenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawerClosed(View drawerView) {
|
||||
super.onDrawerClosed(drawerView);
|
||||
//getSupportActionBar().setTitle(currentTitle);
|
||||
//supportInvalidateOptionsMenu();
|
||||
}
|
||||
};
|
||||
|
||||
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close);
|
||||
if (savedInstanceState != null) {
|
||||
int backstackCount = savedInstanceState.getInt(SAVE_BACKSTACK_COUNT, 0);
|
||||
drawerToggle.setDrawerIndicatorEnabled(backstackCount == 0);
|
||||
}
|
||||
|
||||
drawerLayout.setDrawerListener(drawerToggle);
|
||||
|
||||
final FragmentManager fm = getSupportFragmentManager();
|
||||
|
|
|
@ -194,7 +194,7 @@ public class AllEpisodesFragment extends Fragment {
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
|
||||
if (itemsLoaded) {
|
||||
inflater.inflate(R.menu.new_episodes, menu);
|
||||
|
||||
final SearchView sv = new SearchView(getActivity());
|
||||
|
@ -220,7 +220,7 @@ public class AllEpisodesFragment extends Fragment {
|
|||
@Override
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
|
||||
if (itemsLoaded) {
|
||||
MenuItem menuItem = menu.findItem(R.id.mark_all_read_item);
|
||||
if (menuItem != null) {
|
||||
menuItem.setVisible(unreadItems != null && !unreadItems.isEmpty());
|
||||
|
|
|
@ -20,8 +20,6 @@ import de.danoeh.antennapod.core.feed.EventDistributor;
|
|||
import de.danoeh.antennapod.core.service.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
|
||||
|
||||
/**
|
||||
* Shows the download log
|
||||
|
@ -119,7 +117,7 @@ public class DownloadLogFragment extends ListFragment {
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
|
||||
if (itemsLoaded) {
|
||||
MenuItem clearHistory = menu.add(Menu.NONE, R.id.clear_history_item, Menu.CATEGORY_CONTAINER, R.string.clear_history_label);
|
||||
MenuItemCompat.setShowAsAction(clearHistory, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||
TypedArray drawables = getActivity().obtainStyledAttributes(new int[]{R.attr.content_discard});
|
||||
|
@ -131,8 +129,11 @@ public class DownloadLogFragment extends ListFragment {
|
|||
@Override
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
|
||||
menu.findItem(R.id.clear_history_item).setVisible(downloadLog != null && !downloadLog.isEmpty());
|
||||
if (itemsLoaded) {
|
||||
MenuItem menuItem = menu.findItem(R.id.clear_history_item);
|
||||
if(menuItem != null) {
|
||||
menuItem.setVisible(downloadLog != null && !downloadLog.isEmpty());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ public class ItemlistFragment extends ListFragment {
|
|||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
|
||||
if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
|
||||
if (itemsLoaded) {
|
||||
FeedMenuHandler.onCreateOptionsMenu(inflater, menu);
|
||||
|
||||
final SearchView sv = new SearchView(getActivity());
|
||||
|
@ -207,7 +207,7 @@ public class ItemlistFragment extends ListFragment {
|
|||
|
||||
@Override
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
|
||||
if (itemsLoaded) {
|
||||
FeedMenuHandler.onPrepareOptionsMenu(menu, feed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@ import de.danoeh.antennapod.core.service.download.Downloader;
|
|||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import de.danoeh.antennapod.core.util.LongList;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
||||
public class PlaybackHistoryFragment extends ListFragment {
|
||||
|
@ -141,7 +139,7 @@ public class PlaybackHistoryFragment extends ListFragment {
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
|
||||
if (itemsLoaded) {
|
||||
MenuItem clearHistory = menu.add(Menu.NONE, R.id.clear_history_item, Menu.CATEGORY_CONTAINER, R.string.clear_history_label);
|
||||
MenuItemCompat.setShowAsAction(clearHistory, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||
TypedArray drawables = getActivity().obtainStyledAttributes(new int[]{R.attr.content_discard});
|
||||
|
@ -153,7 +151,7 @@ public class PlaybackHistoryFragment extends ListFragment {
|
|||
@Override
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
|
||||
if (itemsLoaded) {
|
||||
MenuItem menuItem = menu.findItem(R.id.clear_history_item);
|
||||
if (menuItem != null) {
|
||||
menuItem.setVisible(playbackHistory != null && !playbackHistory.isEmpty());
|
||||
|
|
|
@ -202,7 +202,7 @@ public class QueueFragment extends Fragment {
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
|
||||
if (itemsLoaded) {
|
||||
inflater.inflate(R.menu.queue, menu);
|
||||
|
||||
final SearchView sv = new SearchView(getActivity());
|
||||
|
|
|
@ -25,8 +25,6 @@ import de.danoeh.antennapod.core.feed.FeedComponent;
|
|||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.SearchResult;
|
||||
import de.danoeh.antennapod.core.storage.FeedSearcher;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
|
||||
|
||||
/**
|
||||
* Performs a search operation on all feeds or one specific feed and displays the search result.
|
||||
|
@ -134,7 +132,7 @@ public class SearchFragment extends ListFragment {
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
|
||||
if (itemsLoaded) {
|
||||
MenuItem item = menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label);
|
||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||
final SearchView sv = new SearchView(getActivity());
|
||||
|
|
|
@ -6,8 +6,18 @@ import android.os.AsyncTask;
|
|||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
|
@ -19,9 +29,6 @@ import de.danoeh.antennapod.core.gpoddernet.GpodnetService;
|
|||
import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException;
|
||||
import de.danoeh.antennapod.core.gpoddernet.model.GpodnetPodcast;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Displays a list of GPodnetPodcast-Objects in a GridView
|
||||
|
@ -43,24 +50,22 @@ public abstract class PodcastListFragment extends Fragment {
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
if (!MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
|
||||
final android.support.v7.widget.SearchView sv = new android.support.v7.widget.SearchView(getActivity());
|
||||
MenuItemUtils.addSearchItem(menu, sv);
|
||||
sv.setQueryHint(getString(R.string.gpodnet_search_hint));
|
||||
sv.setOnQueryTextListener(new android.support.v7.widget.SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String s) {
|
||||
sv.clearFocus();
|
||||
((MainActivity) getActivity()).loadChildFragment(SearchListFragment.newInstance(s));
|
||||
return true;
|
||||
}
|
||||
final android.support.v7.widget.SearchView sv = new android.support.v7.widget.SearchView(getActivity());
|
||||
MenuItemUtils.addSearchItem(menu, sv);
|
||||
sv.setQueryHint(getString(R.string.gpodnet_search_hint));
|
||||
sv.setOnQueryTextListener(new android.support.v7.widget.SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String s) {
|
||||
sv.clearFocus();
|
||||
((MainActivity) getActivity()).loadChildFragment(SearchListFragment.newInstance(s));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String s) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public boolean onQueryTextChange(String s) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,7 +14,6 @@ import de.danoeh.antennapod.core.gpoddernet.GpodnetService;
|
|||
import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException;
|
||||
import de.danoeh.antennapod.core.gpoddernet.model.GpodnetPodcast;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
|
||||
|
||||
/**
|
||||
* Performs a search on the gpodder.net directory and displays the results.
|
||||
|
@ -46,24 +45,22 @@ public class SearchListFragment extends PodcastListFragment {
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
final SearchView sv = new SearchView(getActivity());
|
||||
if (!MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
|
||||
MenuItemUtils.addSearchItem(menu, sv);
|
||||
sv.setQueryHint(getString(R.string.gpodnet_search_hint));
|
||||
sv.setQuery(query, false);
|
||||
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String s) {
|
||||
sv.clearFocus();
|
||||
changeQuery(s);
|
||||
return true;
|
||||
}
|
||||
MenuItemUtils.addSearchItem(menu, sv);
|
||||
sv.setQueryHint(getString(R.string.gpodnet_search_hint));
|
||||
sv.setQuery(query, false);
|
||||
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String s) {
|
||||
sv.clearFocus();
|
||||
changeQuery(s);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String s) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public boolean onQueryTextChange(String s) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,6 @@ import de.danoeh.antennapod.core.gpoddernet.GpodnetService;
|
|||
import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException;
|
||||
import de.danoeh.antennapod.core.gpoddernet.model.GpodnetTag;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
|
||||
|
||||
public class TagListFragment extends ListFragment {
|
||||
private static final String TAG = "TagListFragment";
|
||||
|
@ -36,27 +35,25 @@ public class TagListFragment extends ListFragment {
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
if (!MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
|
||||
final SearchView sv = new SearchView(getActivity());
|
||||
MenuItemUtils.addSearchItem(menu, sv);
|
||||
sv.setQueryHint(getString(R.string.gpodnet_search_hint));
|
||||
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String s) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
sv.clearFocus();
|
||||
((MainActivity) activity).loadChildFragment(SearchListFragment.newInstance(s));
|
||||
}
|
||||
return true;
|
||||
final SearchView sv = new SearchView(getActivity());
|
||||
MenuItemUtils.addSearchItem(menu, sv);
|
||||
sv.setQueryHint(getString(R.string.gpodnet_search_hint));
|
||||
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String s) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
sv.clearFocus();
|
||||
((MainActivity) activity).loadChildFragment(SearchListFragment.newInstance(s));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String s) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public boolean onQueryTextChange(String s) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue