Fix wrong fragment receiving context menu event
This commit is contained in:
parent
160401ad13
commit
96fe0917e0
|
@ -168,10 +168,9 @@ public abstract class EpisodesListFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextItemSelected(@NonNull MenuItem item) {
|
public boolean onContextItemSelected(@NonNull MenuItem item) {
|
||||||
Log.d(TAG, "onContextItemSelected() called with: " + "item = [" + item + "]");
|
Log.d(TAG, "onContextItemSelected() called with: " + "item = [" + item + "]");
|
||||||
if (!getUserVisibleHint()) {
|
if (!getUserVisibleHint() || !isVisible() || !isMenuVisible()) {
|
||||||
return false;
|
// The method is called on all fragments in a ViewPager, so this needs to be ignored in invisible ones.
|
||||||
}
|
// Apparently, none of the visibility check method works reliably on its own, so we just use all.
|
||||||
if (!isVisible()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (item.getItemId() == R.id.share_item) {
|
if (item.getItemId() == R.id.share_item) {
|
||||||
|
|
Loading…
Reference in New Issue