Fixed bug with zooming in viewpager (FullScreenActivity) (application crashed)

This commit is contained in:
ChronosX88 2019-02-25 18:54:36 +04:00
parent 23044d78d2
commit 7ed5e7dd9a
No known key found for this signature in database
GPG Key ID: 8F92E090A87804AA
2 changed files with 41 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -9,7 +9,7 @@
tools:context="ru.volgorobot.vrcatalog.view.FullScreenImageActivity"
android:background="@android:color/black">
<android.support.v4.view.ViewPager
<ru.volgorobot.vrcatalog.additional.HackyViewPager
android:id="@+id/fullscreen_mode_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent" />