Moved options menu handling to child classes
This commit is contained in:
parent
862e86850f
commit
32937a842d
|
@ -112,6 +112,7 @@ public class AllEpisodesFragment extends EpisodesListFragment {
|
|||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
menu.findItem(R.id.filter_items).setVisible(true);
|
||||
menu.findItem(R.id.mark_all_read_item).setVisible(!episodes.isEmpty());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -197,19 +197,6 @@ public abstract class EpisodesListFragment extends Fragment {
|
|||
isUpdatingFeeds = MenuItemUtils.updateRefreshMenuItem(menu, R.id.refresh_item, updateRefreshMenuItemChecker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
MenuItem markAllRead = menu.findItem(R.id.mark_all_read_item);
|
||||
if (markAllRead != null) {
|
||||
markAllRead.setVisible(!showOnlyNewEpisodes() && !episodes.isEmpty());
|
||||
}
|
||||
MenuItem removeAllNewFlags = menu.findItem(R.id.remove_all_new_flags_item);
|
||||
if (removeAllNewFlags != null) {
|
||||
removeAllNewFlags.setVisible(showOnlyNewEpisodes() && !episodes.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (!super.onOptionsItemSelected(item)) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.support.v7.widget.RecyclerView;
|
|||
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
|
@ -40,6 +41,12 @@ public class NewEpisodesFragment extends EpisodesListFragment {
|
|||
return item.isNew();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
menu.findItem(R.id.remove_all_new_flags_item).setVisible(!episodes.isEmpty());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
android:title="@string/mark_all_read_label"
|
||||
android:menuCategory="container"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:visible="false"
|
||||
android:icon="?attr/navigation_accept"/>
|
||||
|
||||
<item
|
||||
|
@ -37,6 +38,7 @@
|
|||
android:title="@string/remove_all_new_flags_label"
|
||||
android:menuCategory="container"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:visible="false"
|
||||
android:icon="?attr/navigation_accept"/>
|
||||
|
||||
</menu>
|
||||
|
|
Loading…
Reference in New Issue