[Android] [PATCH] Option to show videos as list in portrait

Geoffrey Métais geoffrey.metais at gmail.com
Thu Nov 20 14:29:12 CET 2014


I also have:
    <string name="force_list_portrait">No grid in portrait mode</string>
    <string name="force_list_portrait_summary">Show videos in list instead
of grid in portrait mode</string>

On Wed, Nov 19, 2014 at 6:26 PM, Edward Wang <edward.c.wang at compdigitec.com>
wrote:

>
>
> Hello,
>
> Le 19 novembre 2014 06:23:53 HNP, "Geoffrey Métais" <
> geoffrey.metais at gmail.com> a écrit :
> >---
> >vlc-android/res/values/strings.xml                                | 2
> >++
> >vlc-android/res/xml/preferences.xml                               | 5
> >+++++
> >vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java | 8
> >++++++--
> > 3 files changed, 13 insertions(+), 2 deletions(-)
> >
> >diff --git a/vlc-android/res/values/strings.xml
> >b/vlc-android/res/values/strings.xml
> >index bf6e2d4..2b00dfe 100644
> >--- a/vlc-android/res/values/strings.xml
> >+++ b/vlc-android/res/values/strings.xml
> >@@ -236,6 +236,8 @@
> ><string name="enable_brightness_gesture_summary">Control brightness by
> >gesture during video playback</string>
> >     <string name="enable_jump_buttons">Enable jump buttons</string>
> ><string name="enable_jump_buttons_summary">Show backward and forward
> >buttons on the video interface</string>
> >+    <string name="force_list_portrait">Videos list in
> >protrait</string>
>
> Show videos as list in portrait
>
> >+    <string name="force_list_portrait_summary">Videos will always be
> >displayed in list mode instead of grid in portrait mode</string>
>
> Display videos as a list instead of a grid in portrait mode.
>
> >    <string name="audio_title_alignment">Audio title alignment</string>
> >     <string name="enable_headset_detection">Detect headset</string>
> ><string name="enable_headset_detection_summary">Pause on headset
> >removal; resume on headset insertion</string>
> >diff --git a/vlc-android/res/xml/preferences.xml
> >b/vlc-android/res/xml/preferences.xml
> >index 8ec773f..63adfef 100644
> >--- a/vlc-android/res/xml/preferences.xml
> >+++ b/vlc-android/res/xml/preferences.xml
> >@@ -48,6 +48,11 @@
> >             </PreferenceCategory>
> > <PreferenceCategory android:title="@string/interface_other_category" >
> >                 <CheckBoxPreference
> >+                    android:defaultValue="false"
> >+                    android:key="force_list_protrait"
> >+
> >android:summary="@string/force_list_portrait_summary"
> >+                    android:title="@string/force_list_portrait" />
> >+                <CheckBoxPreference
> >                     android:defaultValue="true"
> >                     android:key="enable_brightness_gesture"
> >            android:summary="@string/enable_brightness_gesture_summary"
> >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 5b450dc..ad0ffb2 100644
> >--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
> >+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
> >@@ -55,6 +55,7 @@ import android.os.Build;
> > import android.os.Bundle;
> > import android.os.Handler;
> > import android.os.Message;
> >+import android.preference.PreferenceManager;
> > import android.support.v4.app.FragmentActivity;
> > import android.support.v7.app.ActionBarActivity;
> > import android.util.DisplayMetrics;
> >@@ -211,8 +212,10 @@ public class VideoGridFragment extends
> >SherlockGridFragment implements ISortable
> >             Log.w(TAG, "Unable to setup the view");
> >             return;
> >         }
> >-
> >         Resources res = getResources();
> >+        boolean listMode = res.getBoolean(R.bool.list_mode);
> >+        listMode |= getResources().getConfiguration().orientation ==
> >Configuration.ORIENTATION_PORTRAIT &&
> >+
>
> >PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("force_list_protrait",
> >false);
> >         // Compute the left/right padding dynamically
> >         DisplayMetrics outMetrics = new DisplayMetrics();
>
> >getActivity().getWindowManager().getDefaultDisplay().getMetrics(outMetrics);
> >@@ -222,7 +225,7 @@ public class VideoGridFragment extends
> >SherlockGridFragment implements ISortable
> >                 sidePadding, mGridView.getPaddingBottom());
> >
> >         // Select between grid or list
> >-            if (!res.getBoolean(R.bool.list_mode)) {
> >+            if (!listMode) {
> >             mGridView.setNumColumns(GridView.AUTO_FIT);
> >             mGridView.setStretchMode(GRID_STRETCH_MODE);
>
> >mGridView.setColumnWidth(res.getDimensionPixelSize(R.dimen.grid_card_width));
> >@@ -231,6 +234,7 @@ public class VideoGridFragment extends
> >SherlockGridFragment implements ISortable
> >         } else {
> >             mGridView.setNumColumns(1);
> >             mGridView.setStretchMode(LIST_STRETCH_MODE);
> >+            mGridView.setVerticalSpacing(0);
> >             mVideoAdapter.setListMode(true);
> >         }
> >     }
>
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/android/attachments/20141120/a62053e7/attachment-0001.html>


More information about the Android mailing list