Fixed bug with zooming in viewpager (FullScreenActivity) (application crashed)
This commit is contained in:
parent
23044d78d2
commit
7ed5e7dd9a
@ -0,0 +1,40 @@
|
|||||||
|
package ru.volgorobot.vrcatalog.additional;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ViewPager fixer class (which fix bug with zooming)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class HackyViewPager extends android.support.v4.view.ViewPager {
|
||||||
|
|
||||||
|
public HackyViewPager(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HackyViewPager(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 ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -9,7 +9,7 @@
|
|||||||
tools:context="ru.volgorobot.vrcatalog.view.FullScreenImageActivity"
|
tools:context="ru.volgorobot.vrcatalog.view.FullScreenImageActivity"
|
||||||
android:background="@android:color/black">
|
android:background="@android:color/black">
|
||||||
|
|
||||||
<android.support.v4.view.ViewPager
|
<ru.volgorobot.vrcatalog.additional.HackyViewPager
|
||||||
android:id="@+id/fullscreen_mode_viewpager"
|
android:id="@+id/fullscreen_mode_viewpager"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
Loading…
Reference in New Issue
Block a user