diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/playback/controllers/VideoStateController.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/playback/controllers/VideoStateController.java index cbb3439c3..542c13979 100644 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/playback/controllers/VideoStateController.java +++ b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/playback/controllers/VideoStateController.java @@ -263,6 +263,10 @@ public class VideoStateController extends BasePlayerController { @Override public void onSpeedClicked(boolean enabled) { + if (getVideo() == null) { + return; + } + float lastSpeed = getPlayerData().getSpeed(getVideo().channelId); if (Helpers.floatEquals(lastSpeed, 1.0f)) { lastSpeed = getPlayerData().getLastSpeed(); diff --git a/leanback-1.0.0/src/main/java/androidx/leanback/widget/GridLayoutManager.java b/leanback-1.0.0/src/main/java/androidx/leanback/widget/GridLayoutManager.java index 57e8f6e7f..74737dbe0 100644 --- a/leanback-1.0.0/src/main/java/androidx/leanback/widget/GridLayoutManager.java +++ b/leanback-1.0.0/src/main/java/androidx/leanback/widget/GridLayoutManager.java @@ -2328,10 +2328,11 @@ final class GridLayoutManager extends RecyclerView.LayoutManager { try { appendVisibleItems(); prependVisibleItems(); - } catch (IndexOutOfBoundsException | NullPointerException | IllegalArgumentException e) { + } catch (IndexOutOfBoundsException | NullPointerException | IllegalArgumentException | IllegalStateException e) { // IndexOutOfBoundsException: Invalid item position -1(-1). Item count:12 androidx.leanback.widget.VerticalGridView // NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams android.view.View.getLayoutParams()' // IllegalArgumentException: VideoCardPresenter$1 is not a direct child of HorizontalGridView + // IllegalStateException: Layout state should be one of 100 but it is 10 e.printStackTrace(); } // b/67370222: do not removeInvisibleViewsAtFront/End() in the loop, otherwise diff --git a/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/browse/video/MultipleRowsFragment.java b/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/browse/video/MultipleRowsFragment.java index f4c8f3716..bf0e6032c 100644 --- a/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/browse/video/MultipleRowsFragment.java +++ b/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/browse/video/MultipleRowsFragment.java @@ -172,7 +172,7 @@ public abstract class MultipleRowsFragment extends RowsSupportFragment implement int action = group.getAction(); // Attempt to fix: IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling - if (action == VideoGroup.ACTION_SYNC && getVerticalGridView() != null) { + if ((action == VideoGroup.ACTION_SYNC || action == VideoGroup.ACTION_REPLACE) && getVerticalGridView() != null) { int position = findPositionById(group.getId()); if (position != -1) { RecyclerView.ViewHolder viewHolder = getVerticalGridView().findViewHolderForAdapterPosition(position);