[Android] Ensure PlaylistActivity view is set in main thread

Geoffrey Métais git at videolan.org
Thu Mar 1 12:40:06 CET 2018


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

Ensure PlaylistActivity view is set in main thread

(cherry picked from commit fe19149b52ac549949501fe8be304df1b1fc02eb)

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

 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