mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-12 18:23:40 +00:00
33 lines
886 B
Java
33 lines
886 B
Java
|
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;
|
||
|
|
||
|
/**
|
||
|
* An implementation of {@link ViewPager} that disables swiping when the view is disabled.
|
||
|
*/
|
||
|
public class ControllableViewPager extends ViewPager {
|
||
|
|
||
|
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);
|
||
|
}
|
||
|
}
|