[Android] Ensure PlaylistActivity view is set in main thread

Geoffrey Métais git at videolan.org
Wed Feb 28 10:40:00 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 28 09:36:06 2018 +0100| [fe19149b52ac549949501fe8be304df1b1fc02eb] | committer: Geoffrey Métais

Ensure PlaylistActivity view is set in main thread

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

 vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java b/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java
index 54c1c0b81..c03182ac3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java
@@ -118,8 +118,12 @@ public class PlaylistActivity extends AudioPlayerContainerActivity implements IE
                                     mBinding.fab.setVisibility(fabVisibility);
                             }
                         });
-                    } else
-                        fabFallback();
+                    } else VLCApplication.runOnMainThread(new Runnable() {
+                        @Override
+                        public void run() {
+                            fabFallback();
+                        }
+                    });
                 }
             });
         } else
@@ -130,7 +134,7 @@ public class PlaylistActivity extends AudioPlayerContainerActivity implements IE
     private void fabFallback() {
         mBinding.appbar.setExpanded(false);
         ViewCompat.setNestedScrollingEnabled(mBinding.songs, false);
-        CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) mBinding.fab.getLayoutParams();
+        final CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) mBinding.fab.getLayoutParams();
         lp.setAnchorId(R.id.container_list);
         lp.anchorGravity = Gravity.BOTTOM|Gravity.RIGHT|Gravity.END;
         lp.bottomMargin = getResources().getDimensionPixelSize(R.dimen.default_margin);



More information about the Android mailing list