[Android] Fix UI glitch with video grid animation

Geoffrey Métais git at videolan.org
Fri Nov 27 18:04:24 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Nov 27 18:03:48 2015 +0100| [d3677154c9011a511ee6c2ea5fa6e775215c61a5] | committer: Geoffrey Métais

Fix UI glitch with video grid animation

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=d3677154c9011a511ee6c2ea5fa6e775215c61a5
---

 .../src/org/videolan/vlc/gui/video/VideoGridAnimator.java       |    1 +
 .../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 a3d85c4..8c2677e 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 e94f8e0..4425315 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