[Android] Improve context and player options

Geoffrey Métais git at videolan.org
Thu Nov 22 15:31:34 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Nov 22 15:31:11 2018 +0100| [6e6599009184a71313ff7b52172221a1024f05e0] | committer: Geoffrey Métais

Improve context and player options

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

 vlc-android/res/layout/context_item.xml                           | 4 ++--
 vlc-android/res/layout/contextual_sheet.xml                       | 4 ++--
 vlc-android/res/layout/player.xml                                 | 5 ++---
 vlc-android/res/layout/player_option_item.xml                     | 2 +-
 vlc-android/res/values/dimens.xml                                 | 2 +-
 vlc-android/res/values/strings.xml                                | 1 +
 vlc-android/res/values/styles.xml                                 | 2 +-
 vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt      | 8 ++++----
 .../src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt     | 2 +-
 9 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/vlc-android/res/layout/context_item.xml b/vlc-android/res/layout/context_item.xml
index c4f60e73e..5eb256ffd 100644
--- a/vlc-android/res/layout/context_item.xml
+++ b/vlc-android/res/layout/context_item.xml
@@ -10,8 +10,8 @@
         xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginTop="8dp"
-        android:layout_marginBottom="8dp"
+        android:layout_marginTop="@dimen/half_default_margin"
+        android:layout_marginBottom="@dimen/default_margin"
         android:focusable="true">
         <ImageView
             android:id="@+id/context_option_icon"
diff --git a/vlc-android/res/layout/contextual_sheet.xml b/vlc-android/res/layout/contextual_sheet.xml
index f36ef60ab..9650f7021 100644
--- a/vlc-android/res/layout/contextual_sheet.xml
+++ b/vlc-android/res/layout/contextual_sheet.xml
@@ -8,10 +8,10 @@
     <TextView
         android:id="@+id/ctx_title"
         android:layout_height="wrap_content"
-        android:layout_width="match_parent"
+        android:layout_width="wrap_content"
         style="@style/VLC.TextViewTitle"
         android:textColor="@color/orange800"
-        android:layout_margin="@dimen/default_margin"/>
+        android:layout_margin="@dimen/default_margin" />
     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/ctx_list"
         android:layout_height="wrap_content"
diff --git a/vlc-android/res/layout/player.xml b/vlc-android/res/layout/player.xml
index dc27d77d4..546184fd1 100644
--- a/vlc-android/res/layout/player.xml
+++ b/vlc-android/res/layout/player.xml
@@ -78,10 +78,9 @@
     <androidx.appcompat.widget.ViewStubCompat
         android:id="@+id/player_options_stub"
         android:layout_width="wrap_content"
-        android:layout_height="0dp"
+        android:layout_height="wrap_content"
         android:layout_alignParentEnd="true"
-        android:layout_alignParentTop="true"
-        android:layout_alignParentBottom="true"
+        android:layout_centerVertical="true"
         android:fitsSystemWindows="false"
         android:layout="@layout/player_options" />
 
diff --git a/vlc-android/res/layout/player_option_item.xml b/vlc-android/res/layout/player_option_item.xml
index d3b1517c5..cad7af1d9 100644
--- a/vlc-android/res/layout/player_option_item.xml
+++ b/vlc-android/res/layout/player_option_item.xml
@@ -10,7 +10,7 @@
         android:layout_width="@dimen/player_option_width"
         android:layout_height="wrap_content"
         android:focusable="true"
-        android:layout_margin="@dimen/half_default_margin">
+        android:layout_margin="@dimen/default_margin">
 
         <ImageView
             android:id="@+id/option_icon"
diff --git a/vlc-android/res/values/dimens.xml b/vlc-android/res/values/dimens.xml
index 7cb8a377e..845a50b44 100644
--- a/vlc-android/res/values/dimens.xml
+++ b/vlc-android/res/values/dimens.xml
@@ -84,5 +84,5 @@
     <!--Subtitle Downloader Dialog-->
     <dimen name="subs_dl_dialog_width">320dp</dimen>
     <dimen name="subs_dl_dialog_height">160dp</dimen>
-    <dimen name="player_option_width">256dp</dimen>
+    <dimen name="player_option_width">224dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 3567a5ddd..469f98266 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -658,4 +658,5 @@
     <string name="ctx_player_audio_track">Audio track</string>
     <string name="ctx_player_subs_track">Subtitles track</string>
     <string name="ctx_player_tracks_title">Media tracks</string>
+    <string name="ctx_pip_title">Pop-Up player</string>
 </resources>
diff --git a/vlc-android/res/values/styles.xml b/vlc-android/res/values/styles.xml
index 521ab7210..91b7bd1bf 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -308,7 +308,7 @@
     </style>
 
     <style name="VLC.CtxTitle" parent="VLC.TextView">
-        <item name="android:textSize">16sp</item>
+        <item name="android:textSize">18sp</item>
         <item name="android:textColor">?attr/list_title</item>
         <item name="android:maxLines">1</item>
         <item name="android:singleLine">true</item>
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt b/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
index b629bb76a..35fc5e9f9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
@@ -76,11 +76,11 @@ class ContextSheet : com.google.android.material.bottomsheet.BottomSheetDialogFr
         val flags = arguments?.getInt(CTX_FLAGS_KEY) ?: 0
         options = populateOptions(flags)
         AppScope.launch(Dispatchers.Main) {
-            dialog.window.setLayout(resources.getDimensionPixelSize(R.dimen.default_context_width), ViewGroup.LayoutParams.MATCH_PARENT)
-            val bottomSheet = (dialog as BottomSheetDialog).findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet)
-            bottomSheet?.let {
+            dialog.window?.setLayout(resources.getDimensionPixelSize(R.dimen.default_context_width), ViewGroup.LayoutParams.MATCH_PARENT)
+            (dialog as BottomSheetDialog).findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet)?.let {
                 val bsb = BottomSheetBehavior.from(it)
-                if (bsb.state == BottomSheetBehavior.STATE_COLLAPSED) bsb.state = BottomSheetBehavior.STATE_EXPANDED }
+                if (bsb.state == BottomSheetBehavior.STATE_COLLAPSED) bsb.state = BottomSheetBehavior.STATE_EXPANDED
+            }
         }
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt b/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
index 3fbc130fe..5e753f516 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
@@ -96,7 +96,7 @@ class PlayerOptionsDelegate(val activity: AppCompatActivity, val service: Playba
             options.add(PlayerOption(ID_SPU_DELAY, R.attr.ic_subtitledelay, res.getString(R.string.spu_delay)))
             options.add(PlayerOption(ID_AUDIO_DELAY, R.attr.ic_audiodelay, res.getString(R.string.audio_delay)))
             if (primary && (!tvUi || AndroidDevices.hasPiP) && !AndroidDevices.isDex(activity))
-                options.add(PlayerOption(ID_POPUP_VIDEO, R.attr.ic_popup_dim, res.getString(R.string.popup_playback_title)))
+                options.add(PlayerOption(ID_POPUP_VIDEO, R.attr.ic_popup_dim, res.getString(R.string.ctx_pip_title)))
             options.add(PlayerOption(ID_REPEAT, R.attr.ic_repeat, res.getString(R.string.repeat_title)))
             if (service.canShuffle()) options.add(PlayerOption(ID_SHUFFLE, R.attr.ic_shuffle, res.getString(R.string.shuffle_title)))
             options.add(PlayerOption(ID_ABREPEAT, R.attr.ic_abrepeat, res.getString(R.string.ab_repeat)))



More information about the Android mailing list