2018-09-27 09:47:08 -07:00
|
|
|
package org.thoughtcrime.securesms.components;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2018-11-20 09:59:23 -08:00
|
|
|
import org.thoughtcrime.securesms.components.viewpager.HackyViewPager;
|
|
|
|
|
2018-09-27 09:47:08 -07:00
|
|
|
/**
|
|
|
|
* An implementation of {@link ViewPager} that disables swiping when the view is disabled.
|
|
|
|
*/
|
2018-11-20 09:59:23 -08:00
|
|
|
public class ControllableViewPager extends HackyViewPager {
|
2018-09-27 09:47:08 -07:00
|
|
|
|
|
|
|
public ControllableViewPager(@NonNull Context context) {
|
|
|
|
super(context);
|
|
|
|
}
|
|
|
|
|
|
|
|
public ControllableViewPager(@NonNull Context context, @Nullable AttributeSet attrs) {
|
|
|
|
super(context, attrs);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onTouchEvent(MotionEvent ev) {
|
|
|
|
return isEnabled() && super.onTouchEvent(ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
|
|
|
return isEnabled() && super.onInterceptTouchEvent(ev);
|
|
|
|
}
|
|
|
|
}
|