-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MaterialDrawer: use a HackyDrawerLayout to catch exceptions, linked t…
…o chrisbanes/PhotoView, closes #28
- Loading branch information
1 parent
1b87ac0
commit 42ab442
Showing
4 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
muninforAndroid/src/main/java/com/chteuchteu/munin/ui/HackyDrawerLayout.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.chteuchteu.munin.ui; | ||
|
||
import android.content.Context; | ||
import android.support.v4.widget.DrawerLayout; | ||
import android.util.AttributeSet; | ||
import android.view.MotionEvent; | ||
|
||
public class HackyDrawerLayout extends DrawerLayout { | ||
public HackyDrawerLayout(Context context) { | ||
super(context); | ||
} | ||
|
||
public HackyDrawerLayout(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
@Override | ||
public boolean onTouchEvent(MotionEvent ev) { | ||
try { | ||
return super.onTouchEvent(ev); | ||
} catch (IllegalArgumentException ex) { | ||
//ex.printStackTrace(); | ||
return false; | ||
} | ||
} | ||
|
||
@Override | ||
public boolean onInterceptTouchEvent(MotionEvent ev) { | ||
try { | ||
return super.onInterceptTouchEvent(ev); | ||
} catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) { | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<com.chteuchteu.munin.ui.HackyDrawerLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:id="@+id/material_drawer_layout" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> |