mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 00:20:32 +00:00
Show "content not supported" if needed
This commit is contained in:
parent
2e771cd65a
commit
34468c16ad
@ -132,9 +132,7 @@ public class ChannelFragment extends BaseListInfoFragment<StreamInfoItem, Channe
|
|||||||
public void onViewCreated(@NonNull final View rootView, final Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull final View rootView, final Bundle savedInstanceState) {
|
||||||
super.onViewCreated(rootView, savedInstanceState);
|
super.onViewCreated(rootView, savedInstanceState);
|
||||||
channelBinding = FragmentChannelBinding.bind(rootView);
|
channelBinding = FragmentChannelBinding.bind(rootView);
|
||||||
if (channelContentNotSupported) {
|
showContentNotSupportedIfNeeded();
|
||||||
showContentNotSupported();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -532,12 +530,8 @@ public class ChannelFragment extends BaseListInfoFragment<StreamInfoItem, Channe
|
|||||||
channelContentNotSupported = false;
|
channelContentNotSupported = false;
|
||||||
for (final Throwable throwable : result.getErrors()) {
|
for (final Throwable throwable : result.getErrors()) {
|
||||||
if (throwable instanceof ContentNotSupportedException) {
|
if (throwable instanceof ContentNotSupportedException) {
|
||||||
/*
|
|
||||||
channelBinding might not be initialized when handleResult() is called
|
|
||||||
(e.g. after rotating the screen, https://github.com/TeamNewPipe/NewPipe/issues/6696)
|
|
||||||
showContentNotSupported() will be called later
|
|
||||||
*/
|
|
||||||
channelContentNotSupported = true;
|
channelContentNotSupported = true;
|
||||||
|
showContentNotSupportedIfNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,7 +563,13 @@ public class ChannelFragment extends BaseListInfoFragment<StreamInfoItem, Channe
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showContentNotSupported() {
|
private void showContentNotSupportedIfNeeded() {
|
||||||
|
// channelBinding might not be initialized when handleResult() is called
|
||||||
|
// (e.g. after rotating the screen, #6696)
|
||||||
|
if (!channelContentNotSupported || channelBinding == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
channelBinding.errorContentNotSupported.setVisibility(View.VISIBLE);
|
channelBinding.errorContentNotSupported.setVisibility(View.VISIBLE);
|
||||||
channelBinding.channelKaomoji.setText("(︶︹︺)");
|
channelBinding.channelKaomoji.setText("(︶︹︺)");
|
||||||
channelBinding.channelKaomoji.setTextSize(TypedValue.COMPLEX_UNIT_SP, 45f);
|
channelBinding.channelKaomoji.setTextSize(TypedValue.COMPLEX_UNIT_SP, 45f);
|
||||||
|
Loading…
Reference in New Issue
Block a user