Hide tab layout view pager on error

This commit is contained in:
Stypox 2021-02-14 13:40:17 +01:00
parent 1e5dc01825
commit 138513d790
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 13 additions and 18 deletions

View File

@ -33,7 +33,6 @@ import android.widget.FrameLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import androidx.annotation.AttrRes; import androidx.annotation.AttrRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
@ -1329,13 +1328,21 @@ public final class VideoDetailFragment
@Override @Override
public void showError(final String message, final boolean showRetryButton) { public void showError(final String message, final boolean showRetryButton) {
showError(message, showRetryButton, R.drawable.not_available_monkey); super.showError(message, showRetryButton);
setErrorImage(R.drawable.not_available_monkey);
if (binding.relatedStreamsLayout != null) { // hide related streams for tablets
binding.relatedStreamsLayout.setVisibility(View.INVISIBLE);
}
// hide comments / related streams / description tabs
binding.viewPager.setVisibility(View.GONE);
binding.tabLayout.setVisibility(View.GONE);
} }
protected void showError(final String message, final boolean showRetryButton, private void hideAgeRestrictedContent() {
@DrawableRes final int imageError) { showError(getString(R.string.restricted_video,
super.showError(message, showRetryButton); getString(R.string.show_age_restricted_content_title)), false);
setErrorImage(imageError);
} }
private void setupBroadcastReceiver() { private void setupBroadcastReceiver() {
@ -1560,18 +1567,6 @@ public final class VideoDetailFragment
noVideoStreams ? R.drawable.ic_headset_shadow : R.drawable.ic_play_arrow_shadow); noVideoStreams ? R.drawable.ic_headset_shadow : R.drawable.ic_play_arrow_shadow);
} }
private void hideAgeRestrictedContent() {
showError(getString(R.string.restricted_video,
getString(R.string.show_age_restricted_content_title)), false);
if (binding.relatedStreamsLayout != null) { // tablet
binding.relatedStreamsLayout.setVisibility(View.INVISIBLE);
}
binding.viewPager.setVisibility(View.GONE);
binding.tabLayout.setVisibility(View.GONE);
}
private void displayUploaderAsSubChannel(final StreamInfo info) { private void displayUploaderAsSubChannel(final StreamInfo info) {
binding.detailSubChannelTextView.setText(info.getUploaderName()); binding.detailSubChannelTextView.setText(info.getUploaderName());
binding.detailSubChannelTextView.setVisibility(View.VISIBLE); binding.detailSubChannelTextView.setVisibility(View.VISIBLE);