Commit 36752a94 authored by Geoffrey Métais's avatar Geoffrey Métais

Workaround for support library crash

parent 0028bc3e
......@@ -5,7 +5,7 @@
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.DrawerLayout
<org.videolan.vlc.widget.HackyDrawerLayout
android:id="@+id/root_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
......@@ -81,7 +81,7 @@
<!-- The navigation drawer -->
<include layout="@layout/sidebar"/>
</android.support.v4.widget.DrawerLayout>
</org.videolan.vlc.widget.HackyDrawerLayout>
<include layout="@layout/toolbar"/>
</FrameLayout>
......@@ -41,7 +41,6 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBarDrawerToggle;
......@@ -53,7 +52,6 @@ import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
......@@ -69,7 +67,6 @@ import org.videolan.libvlc.LibVlcUtil;
import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.MediaDatabase;
import org.videolan.vlc.MediaLibrary;
import org.videolan.vlc.MediaWrapper;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.audio.AudioService;
......@@ -88,6 +85,7 @@ import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.VLCInstance;
import org.videolan.vlc.util.WeakHandler;
import org.videolan.vlc.widget.HackyDrawerLayout;
import org.videolan.vlc.widget.SlidingPaneLayout;
import java.util.Arrays;
......@@ -113,7 +111,7 @@ public class MainActivity extends ActionBarActivity implements OnItemClickListen
private AudioPlayer mAudioPlayer;
private AudioServiceController mAudioController;
private SlidingPaneLayout mSlidingPane;
private DrawerLayout mRootContainer;
private HackyDrawerLayout mRootContainer;
private ListView mListView;
private ActionBarDrawerToggle mDrawerToggle;
private View mSideMenu;
......@@ -219,7 +217,7 @@ public class MainActivity extends ActionBarActivity implements OnItemClickListen
mInfoProgress = (ProgressBar) findViewById(R.id.info_progress);
mInfoText = (TextView) findViewById(R.id.info_text);
mAudioPlayerFilling = findViewById(R.id.audio_player_filling);
mRootContainer = (DrawerLayout) findViewById(R.id.root_container);
mRootContainer = (HackyDrawerLayout) findViewById(R.id.root_container);
/* Set up the action bar */
prepareActionBar();
......@@ -954,7 +952,7 @@ public class MainActivity extends ActionBarActivity implements OnItemClickListen
if (resId != 0)
mSlidingPane.setShadowResource(resId);
mAudioPlayer.setHeaderVisibilities(false, false, true, true, true);
mRootContainer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
mRootContainer.setDrawerLockMode(HackyDrawerLayout.LOCK_MODE_UNLOCKED);
removeTipViewIfDisplayed();
mAudioPlayer.showAudioPlayerTips();
}
......@@ -962,13 +960,13 @@ public class MainActivity extends ActionBarActivity implements OnItemClickListen
@Override
public void onPanelOpenedEntirely() {
mSlidingPane.setShadowDrawable(null);
mRootContainer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
mRootContainer.setDrawerLockMode(HackyDrawerLayout.LOCK_MODE_UNLOCKED);
}
@Override
public void onPanelClosed() {
mAudioPlayer.setHeaderVisibilities(true, true, false, false, false);
mRootContainer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
mRootContainer.setDrawerLockMode(HackyDrawerLayout.LOCK_MODE_LOCKED_CLOSED);
mAudioPlayer.showPlaylistTips();
}
......@@ -984,8 +982,8 @@ public class MainActivity extends ActionBarActivity implements OnItemClickListen
removeTipViewIfDisplayed();
View v = LayoutInflater.from(this).inflate(layoutId, null);
mRootContainer.addView(v,
new DrawerLayout.LayoutParams(DrawerLayout.LayoutParams.MATCH_PARENT,
DrawerLayout.LayoutParams.MATCH_PARENT));
new HackyDrawerLayout.LayoutParams(HackyDrawerLayout.LayoutParams.MATCH_PARENT,
HackyDrawerLayout.LayoutParams.MATCH_PARENT));
v.setOnClickListener(new View.OnClickListener() {
@Override
......
/*
* *************************************************************************
* HackyDrawerLayout.java
* **************************************************************************
* Copyright © 2015 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.support.v4.widget.DrawerLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;
/*
* Workaround for support lib bug, see https://code.google.com/p/android/issues/detail?id=60464
*/
public class HackyDrawerLayout extends DrawerLayout {
public HackyDrawerLayout(Context context) {
super(context);
}
public HackyDrawerLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public HackyDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
try {
return super.onInterceptTouchEvent(ev);
} catch (Throwable t) {
t.printStackTrace();
return false;
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment