Search in sources :

Example 11 with SimpleOnGestureListener

use of android.view.GestureDetector.SimpleOnGestureListener in project android_packages_apps_Dialer by MoKee.

the class AccessibleAnswerFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup group = (ViewGroup) inflater.inflate(R.layout.accessible_answer_fragment, container, false);
    mTouchListener = new TouchListener();
    mGestureDetector = new GestureDetector(getContext(), new SimpleOnGestureListener() {

        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            return AccessibleAnswerFragment.this.onFling(e1, e2, velocityX, velocityX);
        }
    });
    mAnswer = group.findViewById(R.id.accessible_answer_fragment_answer);
    mAnswer.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Log.d(TAG, "Answer Button Clicked");
            onAnswer(VideoProfile.STATE_AUDIO_ONLY, getContext());
        }
    });
    mDecline = group.findViewById(R.id.accessible_answer_fragment_decline);
    mDecline.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Log.d(TAG, "Decline Button Clicked");
            onDecline(getContext());
        }
    });
    mText = group.findViewById(R.id.accessible_answer_fragment_text);
    mText.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Log.d(TAG, "Text Button Clicked");
            onText();
        }
    });
    return group;
}
Also used : ViewGroup(android.view.ViewGroup) SimpleOnGestureListener(android.view.GestureDetector.SimpleOnGestureListener) GestureDetector(android.view.GestureDetector) View(android.view.View) MotionEvent(android.view.MotionEvent)

Example 12 with SimpleOnGestureListener

use of android.view.GestureDetector.SimpleOnGestureListener in project FoldableLayout by alexvasilkov.

the class FoldableListLayout method init.

private void init(Context context) {
    gestureDetector = new GestureDetector(context, new SimpleOnGestureListener() {

        @Override
        public boolean onDown(MotionEvent event) {
            return FoldableListLayout.this.onDown();
        }

        @Override
        public boolean onScroll(MotionEvent e1, MotionEvent e2, float distX, float distY) {
            return FoldableListLayout.this.onScroll(e1, e2);
        }

        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velX, float velY) {
            return FoldableListLayout.this.onFling(velY);
        }
    });
    gestureDetector.setIsLongpressEnabled(false);
    animator = ObjectAnimator.ofFloat(this, "foldRotation", 0f);
    minDistanceBeforeScroll = ViewConfiguration.get(context).getScaledTouchSlop();
    flingAnimation = new FlingAnimation();
    foldShading = new SimpleFoldShading();
    setChildrenDrawingOrderEnabled(true);
}
Also used : SimpleOnGestureListener(android.view.GestureDetector.SimpleOnGestureListener) SimpleFoldShading(com.alexvasilkov.foldablelayout.shading.SimpleFoldShading) GestureDetector(android.view.GestureDetector) MotionEvent(android.view.MotionEvent)

Aggregations

SimpleOnGestureListener (android.view.GestureDetector.SimpleOnGestureListener)12 MotionEvent (android.view.MotionEvent)12 GestureDetector (android.view.GestureDetector)10 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)5 FlingAnimationUtils (com.android.systemui.statusbar.FlingAnimationUtils)5 View (android.view.View)4 GestureDetectorCompat (android.support.v4.view.GestureDetectorCompat)2 ViewGroup (android.view.ViewGroup)2 AbsListView (android.widget.AbsListView)2 ValueAnimator (android.animation.ValueAnimator)1 Bitmap (android.graphics.Bitmap)1 Canvas (android.graphics.Canvas)1 Matrix (android.graphics.Matrix)1 Paint (android.graphics.Paint)1 Path (android.graphics.Path)1 PorterDuffXfermode (android.graphics.PorterDuffXfermode)1 Rect (android.graphics.Rect)1 RectF (android.graphics.RectF)1 Handler (android.os.Handler)1 RecyclerView (android.support.v7.widget.RecyclerView)1