[Android] Fix UI glitch with video grid animation

Geoffrey Métais git at videolan.org
Mon Dec 7 14:21:51 CET 2015


vlc-android | branch: 1.7.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Nov 27 18:03:48 2015 +0100| [fa928bbc3eca7388914db4bc8b059defbb46adbd] | committer: Jean-Baptiste Kempf

Fix UI glitch with video grid animation

(cherry picked from commit d3677154c9011a511ee6c2ea5fa6e775215c61a5)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> https://code.videolan.org/videolan/vlc-android/commit/fa928bbc3eca7388914db4bc8b059defbb46adbd
---

 vlc-android/src/org/videolan/vlc/gui/video/VideoGridAnimator.java | 1 +
 vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridAnimator.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridAnimator.java
index e8857ea..224aee5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridAnimator.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridAnimator.java
@@ -122,6 +122,7 @@ public class VideoGridAnimator {
                 isAnimating = false;
                 View v = mGridView.getChildAt(i);
                 setAlpha(1, v);
+                mGridView.setVisibility(View.VISIBLE);
                 v.startAnimation(animSet);
             }
         }
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 311ecaf..9a6ecd0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -180,6 +180,11 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
         mMediaLibrary.setBrowser(this);
         mMediaLibrary.addUpdateHandler(mHandler);
         final boolean refresh = mVideoAdapter.isEmpty();
+        // We don't animate while medialib is scanning. Because gridview is being populated.
+        // That would lead to graphical glitches
+        final boolean animate = mGroup == null && refresh && !mMediaLibrary.isWorking();
+        if (animate)
+            mGridView.setVisibility(View.INVISIBLE);
         if (refresh)
             updateList();
         else {
@@ -190,7 +195,7 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
         ArrayMap<String, Long> times = MediaDatabase.getInstance().getVideoTimes();
         mVideoAdapter.setTimes(times);
         updateViewMode();
-        if (mGroup == null && refresh)
+        if (animate)
             mAnimator.animate();
 
         /* Start the thumbnailer */



More information about the Android mailing list