use of android.view.GestureDetector in project Timber by naman14.
the class SlideTrackSwitcher method attach.
public void attach(@NonNull View v) {
mView = v;
mDetector = new GestureDetector(v.getContext(), new SwipeListener());
v.setOnTouchListener(this);
}
use of android.view.GestureDetector in project ImageViewZoom by sephiroth74.
the class ImageViewTouch method init.
@Override
protected void init(Context context, AttributeSet attrs, int defStyle) {
super.init(context, attrs, defStyle);
mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
mGestureListener = getGestureListener();
mScaleListener = getScaleListener();
mScaleDetector = new ScaleGestureDetector(getContext(), mScaleListener);
mGestureDetector = new GestureDetector(getContext(), mGestureListener, null, true);
mDoubleTapDirection = 1;
setQuickScaleEnabled(false);
}
use of android.view.GestureDetector in project MaterialLibrary by DeveloperPaul123.
the class MaterialFloatingActionButtonMenu method init.
/**
* Initialize the view and fields.
* @param context the context of this view.
* @param attrs the attribute set of this view.
*/
private void init(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MaterialFloatingActionButtonMenu);
circleColor = a.getColor(R.styleable.MaterialFloatingActionButtonMenu_mat_fab_menu_color, getColor(android.R.color.holo_blue_dark));
mShowAllChildren = a.getBoolean(R.styleable.MaterialFloatingActionButtonMenu_mat_fab_menu_showChildrenAlways, false);
circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
buttonColor = getColor(android.R.color.holo_blue_dark);
circlePaint.setStyle(Paint.Style.FILL);
circlePaint.setColor(circleColor);
menuRadius = 1f;
circleShowAnimator = ObjectAnimator.ofFloat(this, "menuRadius", maxRadius);
circleCloseAnimator = ObjectAnimator.ofFloat(this, "menuRadius", 1.0f);
degreeOffsetAnimator = ObjectAnimator.ofFloat(this, "degreeOffset", 0.0f);
OvershootInterpolator interpolator = new OvershootInterpolator();
mExpandAnimation = new AnimatorSet().setDuration(150);
mExpandAnimation.setInterpolator(interpolator);
mExpandAnimation.addListener(expandMenuListener);
mCollapseAnimation = new AnimatorSet().setDuration(100);
mCollapseAnimation.addListener(collapseMenuListener);
showButtonsSet = new AnimatorSet().setDuration(100);
showButtonsSet.setInterpolator(interpolator);
showButtonsSet.addListener(showButtonsListener);
hideButtonsSet = new AnimatorSet().setDuration(50);
hideButtonsSet.addListener(hideButtonsListener);
setWillNotDraw(false);
setClickable(false);
setLongClickable(false);
createAddButton(context);
interceptDownEvents[0] = 0.0f;
interceptDownEvents[1] = 0.0f;
lastEventPoints[0] = 0.0f;
lastEventPoints[1] = 0.0f;
ViewConfiguration configuration = ViewConfiguration.get(getContext());
mSlop = configuration.getScaledTouchSlop();
minFlingVel = configuration.getScaledMinimumFlingVelocity();
maxFlingVel = configuration.getScaledMaximumFlingVelocity();
startAngle = 225f;
collapseOnChildClick = true;
expands = new ArrayList<>();
collapses = new ArrayList<>();
DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
windowWidth = metrics.widthPixels;
windowHeight = metrics.heightPixels;
gestureDetector = new GestureDetector(getContext(), new GestureListener());
mScroller = new Scroller(context, new AccelerateDecelerateInterpolator(), true);
}
use of android.view.GestureDetector in project enroscar by stanfy.
the class LoadableImageSwitcher method init.
private void init(final Context context) {
super.setFactory(this);
gestureDetector = new GestureDetector(context, this);
gestureDetector.setIsLongpressEnabled(true);
}
use of android.view.GestureDetector in project Shuttle by timusus.
the class ArtworkFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_artwork, container, false);
GestureDetector gestureDetector = new GestureDetector(this.getActivity(), new GestureListener(this));
imageView = (ImageView) rootView.findViewById(R.id.image);
imageView.setOnTouchListener((view, motionEvent) -> gestureDetector.onTouchEvent(motionEvent));
updateArtwork();
return rootView;
}
Aggregations