Update app/src/main/java/org/schabi/newpipe/fragments/list/videos/RelatedItemsFragment.java
Co-authored-by: Tobi <TobiGr@users.noreply.github.com>
This commit is contained in:
parent
1996c1176c
commit
66ec596f67
|
@ -179,29 +179,23 @@ public class RelatedItemsFragment extends BaseListInfoFragment<InfoItem, Related
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showInfoItemDialog(final StreamInfoItem item) {
|
protected void showInfoItemDialog(final StreamInfoItem item) {
|
||||||
try {
|
// Try and attach the InfoItemDialog to the parent fragment of the RelatedItemsFragment
|
||||||
final Fragment parentFragment = getParentFragment();
|
// so that its context is not lost when the RelatedItemsFragment is reinitialized,
|
||||||
|
// e.g. when a new stream is loaded in a parent VideoDetailFragment.
|
||||||
// Try and attach the InfoItemDialog to the parent fragment of the RelatedItemsFragment
|
final Fragment parentFragment = getParentFragment();
|
||||||
// so that its context is not lost when the RelatedItemsFragment is reinitialized.
|
if (parentFragment != null) {
|
||||||
if (parentFragment != null) {
|
try {
|
||||||
new InfoItemDialog.Builder(
|
new InfoItemDialog.Builder(
|
||||||
parentFragment.getActivity(),
|
parentFragment.getActivity(),
|
||||||
parentFragment.getContext(),
|
parentFragment.getContext(),
|
||||||
parentFragment,
|
parentFragment,
|
||||||
item
|
item
|
||||||
).create().show();
|
).create().show();
|
||||||
} else {
|
} catch (final IllegalArgumentException e) {
|
||||||
new InfoItemDialog.Builder(
|
InfoItemDialog.Builder.reportErrorDuringInitialization(e, item);
|
||||||
getActivity(),
|
|
||||||
getContext(),
|
|
||||||
this,
|
|
||||||
item)
|
|
||||||
.create().show();
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
} catch (final IllegalArgumentException e) {
|
super.showInfoItemDialog(item);
|
||||||
InfoItemDialog.Builder.reportErrorDuringInitialization(e, item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue