[Android] [PATCH 1/3] layout: factorize player_overlay_header

Thomas Guillem thomas.guillem at gmail.com
Tue Sep 30 18:42:04 CEST 2014


---
 .../res/layout-land/player_remote_control.xml      | 44 +---------------------
 vlc-android/res/layout/player.xml                  | 36 +-----------------
 vlc-android/res/layout/player_overlay_header.xml   | 38 +++++++++++++++++++
 vlc-android/res/layout/player_remote_control.xml   | 42 +--------------------
 .../player_remote_control_overlay_header.xml       | 44 ++++++++++++++++++++++
 5 files changed, 86 insertions(+), 118 deletions(-)
 create mode 100644 vlc-android/res/layout/player_overlay_header.xml
 create mode 100644 vlc-android/res/layout/player_remote_control_overlay_header.xml

diff --git a/vlc-android/res/layout-land/player_remote_control.xml b/vlc-android/res/layout-land/player_remote_control.xml
index baacf5a..91a762c 100644
--- a/vlc-android/res/layout-land/player_remote_control.xml
+++ b/vlc-android/res/layout-land/player_remote_control.xml
@@ -63,47 +63,7 @@
             android:text="@string/please_wait"
             android:textSize="20sp" />
 
-        <LinearLayout
-            android:id="@+id/player_overlay_header"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_alignParentTop="true"
-            android:orientation="vertical"
-            android:paddingLeft="5dp"
-            android:paddingRight="5dp" >
-
-            <LinearLayout
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="right"
-                android:orientation="horizontal" >
-
-                <TextView
-                    android:id="@+id/player_overlay_battery"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_marginRight="5dp"
-                    android:text="bat"
-                    android:textColor="#ffffff"
-                    android:textSize="15sp" />
-
-                <TextView
-                    android:id="@+id/player_overlay_systime"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="time"
-                    android:textColor="#ffffff"
-                    android:textSize="15sp" />
-            </LinearLayout>
-
-            <TextView
-                android:id="@+id/player_overlay_title"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/title"
-                android:textColor="#ffffff"
-                android:textSize="30sp" />
-        </LinearLayout>
+        <include layout="@layout/player_remote_control_overlay_header" />
 
         <TextView
             android:id="@+id/player_overlay_info"
@@ -270,4 +230,4 @@
         </RelativeLayout>
     </RelativeLayout>
 
-</RelativeLayout>
\ No newline at end of file
+</RelativeLayout>
diff --git a/vlc-android/res/layout/player.xml b/vlc-android/res/layout/player.xml
index 2d4650d..0c279d3 100644
--- a/vlc-android/res/layout/player.xml
+++ b/vlc-android/res/layout/player.xml
@@ -79,41 +79,7 @@
             android:textSize="36sp"
             android:visibility="invisible" />
 
-        <LinearLayout
-            android:id="@+id/player_overlay_header"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_alignParentTop="true"
-            android:layout_gravity="top"
-            android:background="?attr/video_player_overlay"
-            android:paddingLeft="5dp"
-            android:paddingRight="5dp"
-            android:visibility="invisible" >
-
-            <TextView
-                android:id="@+id/player_overlay_title"
-                android:layout_width="0dp"
-                android:layout_height="fill_parent"
-                android:layout_weight="1"
-                android:text="@string/title"
-                android:textColor="#ffffff"
-                android:textSize="15sp" />
-
-            <TextView
-                android:id="@+id/player_overlay_battery"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginRight="5dp"
-                android:textColor="#ffffff"
-                android:textSize="15sp" />
-
-            <TextView
-                android:id="@+id/player_overlay_systime"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="#ffffff"
-                android:textSize="15sp" />
-        </LinearLayout>
+        <include layout="@layout/player_overlay_header" />
 
         <LinearLayout
             android:id="@+id/option_overlay"
diff --git a/vlc-android/res/layout/player_overlay_header.xml b/vlc-android/res/layout/player_overlay_header.xml
new file mode 100644
index 0000000..07a7327
--- /dev/null
+++ b/vlc-android/res/layout/player_overlay_header.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+    <LinearLayout
+        android:id="@+id/player_overlay_header"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:layout_gravity="top"
+        android:background="?attr/video_player_overlay"
+        android:paddingLeft="5dp"
+        android:paddingRight="5dp"
+        android:visibility="invisible" >
+
+        <TextView
+            android:id="@+id/player_overlay_title"
+            android:layout_width="0dp"
+            android:layout_height="fill_parent"
+            android:layout_weight="1"
+            android:text="@string/title"
+            android:textColor="#ffffff"
+            android:textSize="15sp" />
+
+        <TextView
+            android:id="@+id/player_overlay_battery"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginRight="5dp"
+            android:textColor="#ffffff"
+            android:textSize="15sp" />
+
+        <TextView
+            android:id="@+id/player_overlay_systime"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="#ffffff"
+            android:textSize="15sp" />
+    </LinearLayout>
+</merge>
diff --git a/vlc-android/res/layout/player_remote_control.xml b/vlc-android/res/layout/player_remote_control.xml
index e536949..95d0570 100644
--- a/vlc-android/res/layout/player_remote_control.xml
+++ b/vlc-android/res/layout/player_remote_control.xml
@@ -40,47 +40,7 @@
         android:background="@color/background_remote"
         android:fitsSystemWindows="true" >
 
-        <LinearLayout
-            android:id="@+id/player_overlay_header"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_alignParentTop="true"
-            android:orientation="vertical"
-            android:paddingLeft="5dp"
-            android:paddingRight="5dp" >
-
-            <LinearLayout
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="right"
-                android:orientation="horizontal" >
-
-                <TextView
-                    android:id="@+id/player_overlay_battery"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_marginRight="5dp"
-                    android:text="bat"
-                    android:textColor="#ffffff"
-                    android:textSize="15sp" />
-
-                <TextView
-                    android:id="@+id/player_overlay_systime"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="time"
-                    android:textColor="#ffffff"
-                    android:textSize="15sp" />
-            </LinearLayout>
-
-            <TextView
-                android:id="@+id/player_overlay_title"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/title"
-                android:textColor="#ffffff"
-                android:textSize="30sp" />
-        </LinearLayout>
+        <include layout="@layout/player_remote_control_overlay_header" />
 
         <TextView
             android:id="@+id/player_overlay_info"
diff --git a/vlc-android/res/layout/player_remote_control_overlay_header.xml b/vlc-android/res/layout/player_remote_control_overlay_header.xml
new file mode 100644
index 0000000..7d6fe48
--- /dev/null
+++ b/vlc-android/res/layout/player_remote_control_overlay_header.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+    <LinearLayout
+        android:id="@+id/player_overlay_header"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:orientation="vertical"
+        android:paddingLeft="5dp"
+        android:paddingRight="5dp" >
+
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="right"
+            android:orientation="horizontal" >
+
+            <TextView
+                android:id="@+id/player_overlay_battery"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="5dp"
+                android:text="bat"
+                android:textColor="#ffffff"
+                android:textSize="15sp" />
+
+            <TextView
+                android:id="@+id/player_overlay_systime"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="time"
+                android:textColor="#ffffff"
+                android:textSize="15sp" />
+        </LinearLayout>
+
+        <TextView
+            android:id="@+id/player_overlay_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/title"
+            android:textColor="#ffffff"
+            android:textSize="30sp" />
+    </LinearLayout>
+</merge>
-- 
2.1.0



More information about the Android mailing list