[Android] Revert "Remove ContentLinearLayout"
Geoffrey Métais
git at videolan.org
Thu Oct 29 18:06:16 CET 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Oct 29 18:06:01 2015 +0100| [bab4559dfe5bb8df02883aa6ce4101b1912dc4f5] | committer: Geoffrey Métais
Revert "Remove ContentLinearLayout"
This reverts commit bb2c49abad65b4ba8094f9098b5c8f3ae0967d22.
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=bab4559dfe5bb8df02883aa6ce4101b1912dc4f5
---
vlc-android/res/layout/main.xml | 4 +-
vlc-android/res/layout/secondary.xml | 4 +-
.../videolan/vlc/widget/ContentLinearLayout.java | 50 ++++++++++++++++++++
3 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/vlc-android/res/layout/main.xml b/vlc-android/res/layout/main.xml
index af82a5f..9235993 100644
--- a/vlc-android/res/layout/main.xml
+++ b/vlc-android/res/layout/main.xml
@@ -20,7 +20,7 @@
android:layout_height="match_parent"
vlc:overhangSize="60dp" >
- <LinearLayout
+ <org.videolan.vlc.widget.ContentLinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
@@ -68,7 +68,7 @@
android:layout_width="fill_parent"
android:layout_height="60dp"
android:visibility="gone" />
- </LinearLayout>
+ </org.videolan.vlc.widget.ContentLinearLayout>
<FrameLayout
android:id="@+id/audio_player"
diff --git a/vlc-android/res/layout/secondary.xml b/vlc-android/res/layout/secondary.xml
index daca0a5..98e1440 100644
--- a/vlc-android/res/layout/secondary.xml
+++ b/vlc-android/res/layout/secondary.xml
@@ -9,7 +9,7 @@
android:layout_height="match_parent"
vlc:overhangSize="60dp" >
- <LinearLayout
+ <org.videolan.vlc.widget.ContentLinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
@@ -30,7 +30,7 @@
android:layout_width="fill_parent"
android:layout_height="60dp"
android:visibility="gone" />
- </LinearLayout>
+ </org.videolan.vlc.widget.ContentLinearLayout>
<FrameLayout
android:id="@+id/audio_player"
diff --git a/vlc-android/src/org/videolan/vlc/widget/ContentLinearLayout.java b/vlc-android/src/org/videolan/vlc/widget/ContentLinearLayout.java
new file mode 100644
index 0000000..2c7b88d
--- /dev/null
+++ b/vlc-android/src/org/videolan/vlc/widget/ContentLinearLayout.java
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * ContentLinearLayout.java
+ *****************************************************************************
+ * Copyright © 2011-2014 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+package org.videolan.vlc.widget;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.widget.LinearLayout;
+
+import com.android.widget.SlidingPaneLayout;
+
+
+/**
+ * This class extends the linear layout class and override its onInterceptTouchEvent
+ * method to intercept the touch events that should not be handled by its children.
+ * This is necessary since else the layout children receive events even if the
+ * audio player is displayed just under the touch event position.
+ */
+public class ContentLinearLayout extends LinearLayout {
+
+ public ContentLinearLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public boolean onInterceptTouchEvent(MotionEvent ev) {
+ SlidingPaneLayout slidingPaneLayout = (SlidingPaneLayout)getParent();
+ if (slidingPaneLayout.isSecondChildUnder((int)ev.getX(), (int)ev.getY()))
+ return true;
+ else
+ return super.onInterceptTouchEvent(ev);
+ }
+}
More information about the Android
mailing list