47 lines
1.1 KiB
Java
47 lines
1.1 KiB
Java
package de.vanitasvitae.slam.ui;
|
|
|
|
import android.content.Context;
|
|
import android.support.annotation.NonNull;
|
|
import android.support.annotation.Nullable;
|
|
import android.support.v4.view.ViewPager;
|
|
import android.util.AttributeSet;
|
|
import android.view.MotionEvent;
|
|
|
|
/**
|
|
* Created by Paul Schaub on 14.02.18.
|
|
*/
|
|
public class NonPagingViewPager extends ViewPager {
|
|
|
|
private boolean pagingEnabled = false;
|
|
|
|
public NonPagingViewPager(@NonNull Context context) {
|
|
super(context);
|
|
}
|
|
|
|
public NonPagingViewPager(@NonNull Context context, @Nullable AttributeSet attrs) {
|
|
super(context, attrs);
|
|
}
|
|
|
|
@Override
|
|
public boolean onTouchEvent(MotionEvent event) {
|
|
if (this.pagingEnabled) {
|
|
return super.onTouchEvent(event);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean onInterceptTouchEvent(MotionEvent event) {
|
|
if (this.pagingEnabled) {
|
|
return super.onInterceptTouchEvent(event);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public void setPagingEnabled(boolean enabled) {
|
|
this.pagingEnabled = enabled;
|
|
}
|
|
}
|