[Android] Audio player: hide the action bar when the player is fully shown

Adrien Maglo git at videolan.org
Wed Feb 19 09:23:52 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Wed Feb 19 09:23:28 2014 +0100| [32fde8e635da2fa08e4a1940df1927f91f75cc63] | committer: Adrien Maglo

Audio player: hide the action bar when the player is fully shown

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

 vlc-android/res/layout/main.xml                           |    5 +++++
 vlc-android/res/layout/sidebar.xml                        |    1 +
 vlc-android/res/values-v11/styles.xml                     |    1 +
 vlc-android/res/values/styles.xml                         |    2 ++
 vlc-android/src/org/videolan/vlc/gui/MainActivity.java    |   13 +++++++++----
 .../src/org/videolan/vlc/widget/SlidingPaneLayout.java    |    4 ++--
 6 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/vlc-android/res/layout/main.xml b/vlc-android/res/layout/main.xml
index 390fcc3..04ce3d6 100644
--- a/vlc-android/res/layout/main.xml
+++ b/vlc-android/res/layout/main.xml
@@ -11,6 +11,11 @@
         android:layout_height="fill_parent"
         android:orientation="vertical" >
 
+        <View
+            android:layout_width="fill_parent"
+            android:layout_height="?attr/actionBarSize"
+            android:background="@drawable/actionbar_background" />
+
         <FrameLayout
             android:id="@+id/fragment_placeholder"
             android:layout_width="fill_parent"
diff --git a/vlc-android/res/layout/sidebar.xml b/vlc-android/res/layout/sidebar.xml
index 5433fd8..1173017 100644
--- a/vlc-android/res/layout/sidebar.xml
+++ b/vlc-android/res/layout/sidebar.xml
@@ -5,6 +5,7 @@
     android:divider="?attr/background_menu_divider"
     android:dividerHeight="0.2dp"
     android:layout_width="208dp"
+    android:paddingTop="?attr/actionBarSize"
     android:cacheColorHint="#0000"
     android:fastScrollEnabled="true"
     android:background="?attr/background_menu">
diff --git a/vlc-android/res/values-v11/styles.xml b/vlc-android/res/values-v11/styles.xml
index b542e64..ef5deb3 100644
--- a/vlc-android/res/values-v11/styles.xml
+++ b/vlc-android/res/values-v11/styles.xml
@@ -3,6 +3,7 @@
     <style name="Theme.VLC" parent="Theme.Sherlock.Light">
         <item name="android:actionBarStyle">@style/ActionBar</item>
         <item name="actionBarStyle">@style/ActionBar</item>
+        <item name="android:windowActionBarOverlay">true</item>
         <item name="android:listViewStyle">@style/Theme.VLC.List</item>
         <item name="android:gridViewStyle">@style/Theme.VLC.List</item>
         <item name="android:expandableListViewStyle">@style/Theme.VLC.List</item>
diff --git a/vlc-android/res/values/styles.xml b/vlc-android/res/values/styles.xml
index b398ab9..c134642 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -11,6 +11,8 @@
     <style name="Theme.VLC" parent="Theme.Sherlock.Light">
         <item name="actionBarStyle">@style/ActionBar</item>
         <item name="android:actionBarStyle">@style/ActionBar</item>
+        <item name="android:windowActionBarOverlay">true</item>
+        <item name="windowActionBarOverlay">true</item>
         <item name="android:listViewStyle">@style/Theme.VLC.List</item>
         <item name="android:gridViewStyle">@style/Theme.VLC.List</item>
         <item name="android:expandableListViewStyle">@style/Theme.VLC.List</item>
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 5ebfd9c..51fc230 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -180,12 +180,11 @@ public class MainActivity extends SherlockFragmentActivity {
         requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
 
         // Set up the sliding menu
-        setContentView(R.layout.sliding_menu);
-        mMenu = (SlidingMenu) findViewById(R.id.sliding_menu);
+        mMenu = (SlidingMenu) LayoutInflater.from(this).inflate(R.layout.sliding_menu, null);
         changeMenuOffset();
 
         View v_main = LayoutInflater.from(this).inflate(R.layout.main, null);
-        mMenu.setContent(v_main);
+        setContentView(v_main);
 
         mSlidingPane = (SlidingPaneLayout) v_main.findViewById(R.id.pane);
         mSlidingPane.setPanelSlideListener(mPanelSlideListener);
@@ -196,6 +195,7 @@ public class MainActivity extends SherlockFragmentActivity {
         mSidebarAdapter = new SidebarAdapter();
         listView.setAdapter(mSidebarAdapter);
         mMenu.setMenu(sidebar);
+        mMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT, true);
 
         /* Initialize UI variables */
         mInfoLayout = v_main.findViewById(R.id.info_layout);
@@ -864,7 +864,12 @@ public class MainActivity extends SherlockFragmentActivity {
         = new SlidingPaneLayout.PanelSlideListener() {
 
             @Override
-            public void onPanelSlide(float slideOffset) {}
+            public void onPanelSlide(float slideOffset) {
+                if (slideOffset <= 0.1)
+                    getSupportActionBar().hide();
+                else
+                    getSupportActionBar().show();
+            }
 
             @Override
             public void onPanelOpened() {
diff --git a/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java b/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
index ecdd3e0..ec4fe7a 100644
--- a/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
+++ b/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
@@ -882,13 +882,13 @@ public class SlidingPaneLayout extends ViewGroup {
                     }
                 }
             }
-            else if (mPanelSlideListener != null)
-                    mPanelSlideListener.onPanelSlide(mSlideOffset);
         }
 
         @Override
         public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
             onPanelDragged(top);
+            if (mPanelSlideListener != null)
+                mPanelSlideListener.onPanelSlide(mSlideOffset);
             invalidate();
         }
 



More information about the Android mailing list