[Android] [PATCH] Option to show videos as list in portrait
Jean-Baptiste Kempf
jb at videolan.org
Wed Nov 19 15:41:49 CET 2014
On 19 Nov, Geoffrey Métais wrote :
> ---
> 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>
> + <string name="force_list_portrait_summary">Videos will always be displayed in list mode instead of grid in portrait mode</string>
protrait?
> <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"
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);
none of this can NULL ?
> // 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);
> }
> }
> --
> 1.9.1
>
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android
--
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the Android
mailing list