48 lines
1.1 KiB
Java
48 lines
1.1 KiB
Java
|
package cy.agorise.crystalwallet.util;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.support.v4.view.ViewPager;
|
||
|
import android.util.AttributeSet;
|
||
|
import android.view.MotionEvent;
|
||
|
|
||
|
/**
|
||
|
* Created by xd on 1/18/18.
|
||
|
*/
|
||
|
|
||
|
|
||
|
public class ChildViewPager extends ViewPager {
|
||
|
|
||
|
private boolean swipeLocked;
|
||
|
|
||
|
public ChildViewPager(Context context) {
|
||
|
super(context);
|
||
|
}
|
||
|
|
||
|
public ChildViewPager(Context context, AttributeSet attrs) {
|
||
|
super(context, attrs);
|
||
|
}
|
||
|
|
||
|
public boolean getSwipeLocked() {
|
||
|
return swipeLocked;
|
||
|
}
|
||
|
|
||
|
public void setSwipeLocked(boolean swipeLocked) {
|
||
|
this.swipeLocked = swipeLocked;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean onTouchEvent(MotionEvent event) {
|
||
|
return !swipeLocked && super.onTouchEvent(event);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||
|
return !swipeLocked && super.onInterceptTouchEvent(event);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean canScrollHorizontally(int direction) {
|
||
|
return !swipeLocked && super.canScrollHorizontally(direction);
|
||
|
}
|
||
|
|
||
|
}
|