diff --git a/MediaServiceCore b/MediaServiceCore index 1efbd8291..0c536d214 160000 --- a/MediaServiceCore +++ b/MediaServiceCore @@ -1 +1 @@ -Subproject commit 1efbd829132e76b33ca8683a93dd68dbdc55b403 +Subproject commit 0c536d214107a3166cd96c8cd1ac461f75a6d4e4 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 2a82e9fdc..80bf80508 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 @@ -162,6 +162,10 @@ public class VideoStateController extends BasePlayerController { @Override public void onEngineError(int type, int rendererIndex, Throwable error) { + if (getPlayer() == null) { + return; + } + // Oops. Error happens while playing (network lost etc). if (getPlayer().getPositionMs() > 1_000) { saveState(); diff --git a/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/browse/video/MultiVideoGridFragment.java b/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/browse/video/MultiVideoGridFragment.java index ab771bebb..975e2a44b 100644 --- a/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/browse/video/MultiVideoGridFragment.java +++ b/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/browse/video/MultiVideoGridFragment.java @@ -122,9 +122,26 @@ public class MultiVideoGridFragment extends MultiGridFragment implements VideoSe public void update(VideoGroup group) { if (group.getPosition() == 0) { addSearchHeader(); + freeze1(true); updateGroup1(group); + freeze1(false); } else if (group.getPosition() == 1) { + 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 && getBrowseGrid2() != null && getBrowseGrid2().isComputingLayout()) { + return; + } + + // Smooth remove animation + if (action == VideoGroup.ACTION_REMOVE) { + updateGroup2(group); + return; + } + + freeze2(true); updateGroup2(group); + freeze2(false); } } @@ -240,12 +257,8 @@ public class MultiVideoGridFragment extends MultiGridFragment implements VideoSe return; } - freeze1(true); - mGridAdapter1.add(group); - freeze1(false); - restorePosition1(); } @@ -271,12 +284,8 @@ public class MultiVideoGridFragment extends MultiGridFragment implements VideoSe return; } - freeze2(true); - mGridAdapter2.add(group); - freeze2(false); - // TODO: Do we need to restore position on second group? //restorePosition2(); } 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 01cf9ddc2..f4c8f3716 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 @@ -204,6 +204,14 @@ public abstract class MultipleRowsFragment extends RowsSupportFragment implement return; } + int action = group.getAction(); + + // Smooth remove animation + if (action == VideoGroup.ACTION_REMOVE) { + updateInt(group); + return; + } + freeze(true); updateInt(group); diff --git a/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/browse/video/VideoGridFragment.java b/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/browse/video/VideoGridFragment.java index 9ffcdc3c7..dfa7c17c3 100644 --- a/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/browse/video/VideoGridFragment.java +++ b/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/browse/video/VideoGridFragment.java @@ -141,7 +141,7 @@ public class VideoGridFragment extends GridFragment implements VideoSection { 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 && getBrowseGrid() != null && getBrowseGrid().isComputingLayout()) { + if ((action == VideoGroup.ACTION_SYNC || action == VideoGroup.ACTION_REPLACE) && getBrowseGrid() != null && getBrowseGrid().isComputingLayout()) { return; }