Skip to content

Commit 8e7540e

Browse files
committed
Merge branch 'master' into develop
2 parents 7142b83 + 47ba3ae commit 8e7540e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,32 @@ public void onCreate(Bundle savedInstanceState) {
6969
mAttacher.update();
7070
```
7171

72+
## Issues With ViewGroups
73+
There are some ViewGroups (ones that utilize onInterceptTouchEvent) that throw exceptions when a PhotoView is placed within them, most notably [ViewPager](http://developer.android.com/reference/android/support/v4/view/ViewPager.html) and [DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html). This is a framework issue that has not been resolved. In order to prevent this exception (which typically occurs when you zoom out), take a look at [HackyDrawerLayout](https://github.com/chrisbanes/PhotoView/blob/master/sample/src/main/java/uk/co/senab/photoview/sample/HackyDrawerLayout.java) and you can see the solution is to simply catch the exception. Any ViewGroup which uses onInterceptTouchEvent will also need to be extended and exceptions caught. Use the [HackyDrawerLayout](https://github.com/chrisbanes/PhotoView/blob/master/sample/src/main/java/uk/co/senab/photoview/sample/HackyDrawerLayout.java) as a template of how to do so. The basic implementation is:
74+
```java
75+
public class HackyProblematicViewGroup extends ProblematicViewGroup {
76+
77+
public HackyProblematicViewGroup(Context context) {
78+
super(context);
79+
}
80+
81+
@Override
82+
public boolean onInterceptTouchEvent(MotionEvent ev) {
83+
try {
84+
return super.onInterceptTouchEvent(ev);
85+
} catch (IllegalArgumentException e) {
86+
e.printStackTrace();
87+
return false;
88+
}
89+
}
90+
}
91+
```
92+
7293
## Pull Requests / Contribution
7394
Development happens in **develop** branch of this repository, and Pull Requests should be filled against that branch.
7495
Any Pull Request against **master** will be rejected
7596

97+
7698
## License
7799

78100
Copyright 2011, 2012 Chris Banes

0 commit comments

Comments
 (0)