[Android] Prevent InflateException on pre-Lollipop devices

Geoffrey Métais git at videolan.org
Wed Jan 9 17:05:59 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jan  9 17:04:48 2019 +0100| [019383edf5dfb88e101ef72b5981e554effd7042] | committer: Geoffrey Métais

Prevent InflateException on pre-Lollipop devices

> https://code.videolan.org/videolan/vlc-android/commit/019383edf5dfb88e101ef72b5981e554effd7042
---

 vlc-android/res/layout-v21/mrl_panel.xml | 76 ++++++++++++++++++++++++++++++++
 vlc-android/res/layout/mrl_panel.xml     |  6 +--
 2 files changed, 78 insertions(+), 4 deletions(-)

diff --git a/vlc-android/res/layout-v21/mrl_panel.xml b/vlc-android/res/layout-v21/mrl_panel.xml
new file mode 100644
index 000000000..38279cc99
--- /dev/null
+++ b/vlc-android/res/layout-v21/mrl_panel.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:android="http://schemas.android.com/apk/res/android">
+    <data>
+        <variable name="viewmodel"
+            type="org.videolan.vlc.viewmodels.StreamsModel"/>
+    </data>
+
+    <androidx.core.widget.NestedScrollView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/mrl_root"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:background="?attr/background_default_darker"
+            android:layoutDirection="ltr"
+            android:padding="16dp"
+            android:minWidth="@dimen/mrl_panel_min_width">
+
+            <com.google.android.material.textfield.TextInputLayout
+                android:id="@+id/mrl_edit"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="4dip"
+                android:layout_marginEnd="4dp"
+                android:layout_marginRight="4dp"
+                app:layout_constraintEnd_toStartOf="@+id/play"
+                app:layout_constraintRight_toLeftOf="@+id/play"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent">
+
+                <!--android:paddingTop ==> Space between cursor and top hint-->
+                <!--android:paddingBottom ==> Space between cursor and bottom border-->
+                <com.google.android.material.textfield.TextInputEditText
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_alignParentTop="true"
+                    android:layout_marginRight="8dp"
+                    android:background="@drawable/edittext_bottom_border"
+                    android:hint="@string/open_mrl_dialog_msg"
+                    android:imeOptions="actionGo"
+                    android:inputType="textUri"
+                    android:maxLines="2"
+                    android:paddingTop="8dp"
+                    android:paddingBottom="4dp"
+                    android:text="@={viewmodel.observableSearchText}"
+                    android:textColor="?font_default"
+                    android:textCursorDrawable="@drawable/cursor_o" />
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <ImageView
+                android:id="@+id/play"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:contentDescription="@string/play_button"
+                android:scaleType="center"
+                android:src="@drawable/ic_send"
+                app:layout_constraintBottom_toBottomOf="@+id/mrl_edit"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintRight_toRightOf="parent"
+                app:layout_constraintTop_toTopOf="@+id/mrl_edit" />
+
+            <androidx.recyclerview.widget.RecyclerView
+                android:id="@+id/mrl_list"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="16dp"
+                android:background="?attr/background_default"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toBottomOf="@+id/mrl_edit" />
+        </androidx.constraintlayout.widget.ConstraintLayout>
+    </androidx.core.widget.NestedScrollView>
+</layout>
diff --git a/vlc-android/res/layout/mrl_panel.xml b/vlc-android/res/layout/mrl_panel.xml
index 38279cc99..ae2cabcd6 100644
--- a/vlc-android/res/layout/mrl_panel.xml
+++ b/vlc-android/res/layout/mrl_panel.xml
@@ -33,12 +33,11 @@
 
                 <!--android:paddingTop ==> Space between cursor and top hint-->
                 <!--android:paddingBottom ==> Space between cursor and bottom border-->
-                <com.google.android.material.textfield.TextInputEditText
+                <EditText
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_alignParentTop="true"
                     android:layout_marginRight="8dp"
-                    android:background="@drawable/edittext_bottom_border"
                     android:hint="@string/open_mrl_dialog_msg"
                     android:imeOptions="actionGo"
                     android:inputType="textUri"
@@ -46,8 +45,7 @@
                     android:paddingTop="8dp"
                     android:paddingBottom="4dp"
                     android:text="@={viewmodel.observableSearchText}"
-                    android:textColor="?font_default"
-                    android:textCursorDrawable="@drawable/cursor_o" />
+                    android:textColor="?font_default" />
             </com.google.android.material.textfield.TextInputLayout>
 
             <ImageView



More information about the Android mailing list