[Android] Shadow everywhere

Geoffrey Métais git at videolan.org
Wed Feb 25 17:00:32 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 25 16:48:41 2015 +0100| [1c860d4dac83b17abfec689c4b1b746ea48c6f5e] | committer: Geoffrey Métais

Shadow everywhere

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

 vlc-android/res/layout/directory_view.xml          |   33 ++++++++++------
 vlc-android/res/layout/history_list.xml            |   14 +++++--
 vlc-android/res/layout/mrl_panel.xml               |    7 +++-
 vlc-android/res/layout/network_browser.xml         |   40 ++++++++++++--------
 vlc-android/res/layout/video_grid.xml              |   12 ++++--
 .../videolan/vlc/gui/video/VideoGridFragment.java  |   12 +++---
 6 files changed, 78 insertions(+), 40 deletions(-)

diff --git a/vlc-android/res/layout/directory_view.xml b/vlc-android/res/layout/directory_view.xml
index 0a9aef0..6bd68b0 100644
--- a/vlc-android/res/layout/directory_view.xml
+++ b/vlc-android/res/layout/directory_view.xml
@@ -1,15 +1,26 @@
 <?xml version="1.0" encoding="utf-8"?>
-<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/swipeLayout"
+    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
-    <ListView
-        android:id="@android:id/list"
+    <android.support.v4.widget.SwipeRefreshLayout
+        android:id="@+id/swipeLayout"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:paddingBottom="@dimen/listview_bottom_padding"
-        android:clipToPadding="false"
-        android:divider="?attr/background_menu_divider"
-        android:dividerHeight="0.1dp" >
-    </ListView>
-</android.support.v4.widget.SwipeRefreshLayout>
+        android:layout_height="match_parent">
+
+        <ListView
+            android:id="@android:id/list"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:paddingBottom="@dimen/listview_bottom_padding"
+            android:clipToPadding="false"
+            android:divider="?attr/background_menu_divider"
+            android:dividerHeight="0.1dp" >
+        </ListView>
+    </android.support.v4.widget.SwipeRefreshLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="9dp"
+        android:layout_marginTop="6dp"
+        android:background="@drawable/bottom_shadow" />
+</FrameLayout>
\ No newline at end of file
diff --git a/vlc-android/res/layout/history_list.xml b/vlc-android/res/layout/history_list.xml
index e6aff9d..5ce67fa 100644
--- a/vlc-android/res/layout/history_list.xml
+++ b/vlc-android/res/layout/history_list.xml
@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical" >
+    android:layout_height="match_parent">
 
     <android.support.v4.widget.SwipeRefreshLayout
         android:id="@+id/swipeLayout"
@@ -13,6 +12,7 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:clipToPadding="false"
+            android:paddingTop="10dp"
             android:paddingBottom="@dimen/listview_bottom_padding"
             android:paddingLeft="20dp"
             android:paddingRight="20dp" />
@@ -26,4 +26,10 @@
             android:text="@string/nohistory"
             android:textSize="20sp" />
     </android.support.v4.widget.SwipeRefreshLayout>
-</LinearLayout>
\ No newline at end of file
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="9dp"
+        android:layout_marginTop="6dp"
+        android:background="@drawable/bottom_shadow" />
+</FrameLayout>
\ No newline at end of file
diff --git a/vlc-android/res/layout/mrl_panel.xml b/vlc-android/res/layout/mrl_panel.xml
index 8766b35..48ddd66 100644
--- a/vlc-android/res/layout/mrl_panel.xml
+++ b/vlc-android/res/layout/mrl_panel.xml
@@ -19,4 +19,9 @@
         android:layout_marginLeft="15dp"
         android:layout_below="@+id/mrl_edit"/>
 
-</RelativeLayout>
\ No newline at end of file
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="9dp"
+        android:layout_marginTop="6dp"
+        android:background="@drawable/bottom_shadow" />
+</RelativeLayout>
diff --git a/vlc-android/res/layout/network_browser.xml b/vlc-android/res/layout/network_browser.xml
index b767a28..66ff3d8 100644
--- a/vlc-android/res/layout/network_browser.xml
+++ b/vlc-android/res/layout/network_browser.xml
@@ -1,21 +1,31 @@
 <?xml version="1.0" encoding="utf-8"?>
-<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/swipeLayout"
+    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
-    <FrameLayout
+    <android.support.v4.widget.SwipeRefreshLayout
+        android:id="@+id/swipeLayout"
         android:layout_width="match_parent"
         android:layout_height="match_parent">
-        <android.support.v7.widget.RecyclerView
-            android:id="@+id/network_list"
+        <FrameLayout
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:visibility="gone"/>
-        <TextView
-            android:id="@+id/android:empty"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:gravity="center"
-            android:text="@string/network_connection_needed"/>
-    </FrameLayout>
-</android.support.v4.widget.SwipeRefreshLayout>
\ No newline at end of file
+            android:layout_height="match_parent">
+            <android.support.v7.widget.RecyclerView
+                android:id="@+id/network_list"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:visibility="gone"/>
+            <TextView
+                android:id="@+id/android:empty"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:gravity="center"
+                android:text="@string/network_connection_needed"/>
+        </FrameLayout>
+    </android.support.v4.widget.SwipeRefreshLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="9dp"
+        android:layout_marginTop="6dp"
+        android:background="@drawable/bottom_shadow" />
+</FrameLayout>
diff --git a/vlc-android/res/layout/video_grid.xml b/vlc-android/res/layout/video_grid.xml
index 4bd3836..fac121b 100644
--- a/vlc-android/res/layout/video_grid.xml
+++ b/vlc-android/res/layout/video_grid.xml
@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:paddingTop="20dip">
+    android:layout_height="match_parent">
 
     <android.support.v4.widget.SwipeRefreshLayout
                 android:id="@+id/swipeLayout"
@@ -12,7 +11,7 @@
             android:id="@id/android:list"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:paddingTop="10dip"
+            android:paddingTop="20dip"
             android:paddingBottom="10dip"
             android:clipToPadding="false"
             android:scrollbarStyle="outsideInset"
@@ -30,6 +29,7 @@
         android:id="@id/android:empty"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
+        android:paddingTop="20dip"
         android:orientation="vertical" >
 
         <TextView
@@ -95,4 +95,10 @@
         </LinearLayout>
     </LinearLayout>
 
+    <View
+        android:id="@+id/shadow"
+        android:layout_width="match_parent"
+        android:layout_height="9dp"
+        android:layout_marginTop="6dp"
+        android:background="@drawable/bottom_shadow" />
 </FrameLayout>
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 7c6571c..6b2d4ba 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -243,27 +243,27 @@ public class VideoGridFragment extends BrowserFragment implements ISortable, IVi
         // Compute the left/right padding dynamically
         DisplayMetrics outMetrics = new DisplayMetrics();
         getActivity().getWindowManager().getDefaultDisplay().getMetrics(outMetrics);
-        int sidePadding = (int) ((float)outMetrics.widthPixels / 100f * (float)Math.pow(outMetrics.density, 3) / 2f);
-        sidePadding = Math.max(0, Math.min(100, sidePadding));
-        mGridView.setPadding(sidePadding, mGridView.getPaddingTop(),
-                sidePadding, mGridView.getPaddingBottom());
+        int sidePadding;
 
         // Select between grid or list
         if (!listMode) {
+            sidePadding = (int) ((float)outMetrics.widthPixels / 100f * (float)Math.pow(outMetrics.density, 3) / 2f);
             mGridView.setNumColumns(GridView.AUTO_FIT);
             mGridView.setStretchMode(GRID_STRETCH_MODE);
             mGridView.setColumnWidth(res.getDimensionPixelSize(R.dimen.grid_card_width));
             mGridView.setVerticalSpacing(res.getDimensionPixelSize(R.dimen.grid_card_vertical_spacing));
             mVideoAdapter.setListMode(false);
         } else {
-            int padding = res.getDimensionPixelSize(R.dimen.listview_side_padding);
+            sidePadding = res.getDimensionPixelSize(R.dimen.listview_side_padding);
             mGridView.setNumColumns(1);
             mGridView.setStretchMode(LIST_STRETCH_MODE);
             mGridView.setVerticalSpacing(0);
             mGridView.setHorizontalSpacing(0);
-            mGridView.setPadding(padding,0,padding,0);
             mVideoAdapter.setListMode(true);
         }
+        sidePadding = Math.max(0, Math.min(100, sidePadding));
+        mGridView.setPadding(sidePadding, mGridView.getPaddingTop(),
+                sidePadding, mGridView.getPaddingBottom());
     }
 
     @Override



More information about the Android mailing list