[Android] Improve Playlist activity layout

Geoffrey Métais git at videolan.org
Thu Jan 17 16:36:58 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan 17 16:35:33 2019 +0100| [b88a8150fff6dab97e18fdfe711b18aa993feda9] | committer: Geoffrey Métais

Improve Playlist activity layout

top padding to tracks list, to prevent FAB overlapping 1st item context
menu buttons.
Nested scrollview make the FAB disappear on scroll

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

 vlc-android/res/layout/playlist_activity.xml               |  6 +++---
 vlc-android/res/values/dimens.xml                          |  4 ++--
 vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java | 13 +++----------
 3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/vlc-android/res/layout/playlist_activity.xml b/vlc-android/res/layout/playlist_activity.xml
index 5db9a9992..0cde47417 100644
--- a/vlc-android/res/layout/playlist_activity.xml
+++ b/vlc-android/res/layout/playlist_activity.xml
@@ -53,8 +53,7 @@
             </com.google.android.material.appbar.CollapsingToolbarLayout>
         </com.google.android.material.appbar.AppBarLayout>
 
-        <FrameLayout
-            android:id="@+id/container_list"
+        <androidx.core.widget.NestedScrollView
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             vlc:layout_behavior="@string/appbar_scrolling_view_behavior"
@@ -66,12 +65,13 @@
                 android:layout_height="match_parent"
                 android:fastScrollEnabled="true"
                 android:layout_gravity="center_horizontal"
+                android:paddingTop="16dp"
                 android:paddingBottom="@dimen/listview_bottom_padding"
                 android:paddingLeft="10dp"
                 android:paddingRight="10dp"
                 style="@style/Theme.VLC.List"
                 android:background="?attr/background_default" />
-        </FrameLayout>
+        </androidx.core.widget.NestedScrollView>
 
         <com.google.android.material.floatingactionbutton.FloatingActionButton
             vlc:rippleColor="@color/orange50"
diff --git a/vlc-android/res/values/dimens.xml b/vlc-android/res/values/dimens.xml
index afa8b917d..b5c5763eb 100644
--- a/vlc-android/res/values/dimens.xml
+++ b/vlc-android/res/values/dimens.xml
@@ -3,8 +3,8 @@
     <dimen name="widget_margin">0dp</dimen>
     <dimen name="audio_browser_item_size">48dp</dimen>
     <dimen name="directory_browser_item_size">40dp</dimen>
-    <dimen name="listview_bottom_padding">10dp</dimen>
-    <dimen name="listview_side_padding">5dp</dimen>
+    <dimen name="listview_bottom_padding">8dp</dimen>
+    <dimen name="listview_side_padding">4dp</dimen>
     <dimen name="grid_card_thumb_width">160dp</dimen>
     <dimen name="grid_card_thumb_height">100dp</dimen>
     <dimen name="tv_grid_card_thumb_width">192dp</dimen>
diff --git a/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java b/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java
index 069361eec..9fc197503 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java
@@ -98,7 +98,7 @@ public class PlaylistActivity extends AudioPlayerContainerActivity implements IE
         mBinding = DataBindingUtil.setContentView(this, R.layout.playlist_activity);
 
         initAudioPlayerContainerActivity();
-        mFragmentContainer = findViewById(R.id.container_list);
+        mFragmentContainer = mBinding.songs;
         mOriginalBottomPadding = mFragmentContainer.getPaddingBottom();
         getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 
@@ -146,8 +146,7 @@ public class PlaylistActivity extends AudioPlayerContainerActivity implements IE
                     });
                 }
             });
-        } else
-            fabFallback();
+        } else fabFallback();
         mBinding.fab.setOnClickListener(this);
     }
 
@@ -155,7 +154,7 @@ public class PlaylistActivity extends AudioPlayerContainerActivity implements IE
         mBinding.appbar.setExpanded(false);
         ViewCompat.setNestedScrollingEnabled(mBinding.songs, false);
         final CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) mBinding.fab.getLayoutParams();
-        lp.setAnchorId(R.id.container_list);
+        lp.setAnchorId(R.id.songs);
         lp.anchorGravity = Gravity.BOTTOM|Gravity.RIGHT|Gravity.END;
         lp.bottomMargin = getResources().getDimensionPixelSize(R.dimen.default_margin);
         lp.setBehavior(new FloatingActionButtonBehavior(PlaylistActivity.this, null));
@@ -163,12 +162,6 @@ public class PlaylistActivity extends AudioPlayerContainerActivity implements IE
         mBinding.fab.setVisibility(View.VISIBLE);
     }
 
-    @Override
-    protected void onPostCreate(@Nullable Bundle savedInstanceState) {
-        mFragmentContainer = mBinding.songs;
-        super.onPostCreate(savedInstanceState);
-    }
-
     @Override
     protected void onStop() {
         super.onStop();



More information about the Android mailing list