Merge pull request #1549 from mfietz/issue/1219-ise-create-options-menu
Prevent IllegalStateException when fragment is detached
This commit is contained in:
commit
d487949a36
|
@ -190,6 +190,9 @@ public class AllEpisodesFragment extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
if(!isAdded()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
if (itemsLoaded) {
|
if (itemsLoaded) {
|
||||||
inflater.inflate(R.menu.new_episodes, menu);
|
inflater.inflate(R.menu.new_episodes, menu);
|
||||||
|
|
|
@ -111,6 +111,9 @@ public class DownloadLogFragment extends ListFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
if(!isAdded()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
if (itemsLoaded) {
|
if (itemsLoaded) {
|
||||||
MenuItem clearHistory = menu.add(Menu.NONE, R.id.clear_history_item, Menu.CATEGORY_CONTAINER, R.string.clear_history_label);
|
MenuItem clearHistory = menu.add(Menu.NONE, R.id.clear_history_item, Menu.CATEGORY_CONTAINER, R.string.clear_history_label);
|
||||||
|
|
|
@ -243,7 +243,7 @@ public class ItemFragment extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
if(item == null) {
|
if(!isAdded() || item == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
inflater.inflate(R.menu.feeditem_options, menu);
|
inflater.inflate(R.menu.feeditem_options, menu);
|
||||||
|
|
|
@ -194,6 +194,9 @@ public class ItemlistFragment extends ListFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
if(!isAdded()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
|
|
||||||
if (itemsLoaded) {
|
if (itemsLoaded) {
|
||||||
|
|
|
@ -148,6 +148,9 @@ public class PlaybackHistoryFragment extends ListFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
if(!isAdded()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
if (itemsLoaded) {
|
if (itemsLoaded) {
|
||||||
MenuItem clearHistory = menu.add(Menu.NONE, R.id.clear_history_item, Menu.CATEGORY_CONTAINER, R.string.clear_history_label);
|
MenuItem clearHistory = menu.add(Menu.NONE, R.id.clear_history_item, Menu.CATEGORY_CONTAINER, R.string.clear_history_label);
|
||||||
|
|
|
@ -235,6 +235,9 @@ public class QueueFragment extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
if(!isAdded()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
if (queue != null) {
|
if (queue != null) {
|
||||||
inflater.inflate(R.menu.queue, menu);
|
inflater.inflate(R.menu.queue, menu);
|
||||||
|
|
Loading…
Reference in New Issue