Skip to content

Commit 66ec596

Browse files
james-renschTobiGr
andauthored
Update app/src/main/java/org/schabi/newpipe/fragments/list/videos/RelatedItemsFragment.java
Co-authored-by: Tobi <TobiGr@users.noreply.github.com>
1 parent 1996c11 commit 66ec596

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/list/videos/RelatedItemsFragment.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -179,29 +179,23 @@ protected ItemViewMode getItemViewMode() {
179179

180180
@Override
181181
protected void showInfoItemDialog(final StreamInfoItem item) {
182-
try {
183-
final Fragment parentFragment = getParentFragment();
184-
185-
// Try and attach the InfoItemDialog to the parent fragment of the RelatedItemsFragment
186-
// so that its context is not lost when the RelatedItemsFragment is reinitialized.
187-
if (parentFragment != null) {
182+
// Try and attach the InfoItemDialog to the parent fragment of the RelatedItemsFragment
183+
// so that its context is not lost when the RelatedItemsFragment is reinitialized,
184+
// e.g. when a new stream is loaded in a parent VideoDetailFragment.
185+
final Fragment parentFragment = getParentFragment();
186+
if (parentFragment != null) {
187+
try {
188188
new InfoItemDialog.Builder(
189189
parentFragment.getActivity(),
190190
parentFragment.getContext(),
191191
parentFragment,
192192
item
193193
).create().show();
194-
} else {
195-
new InfoItemDialog.Builder(
196-
getActivity(),
197-
getContext(),
198-
this,
199-
item)
200-
.create().show();
194+
} catch (final IllegalArgumentException e) {
195+
InfoItemDialog.Builder.reportErrorDuringInitialization(e, item);
201196
}
202-
203-
} catch (final IllegalArgumentException e) {
204-
InfoItemDialog.Builder.reportErrorDuringInitialization(e, item);
197+
} else {
198+
super.showInfoItemDialog(item);
205199
}
206200
}
207201

0 commit comments

Comments
 (0)