/*
 * Copyright 2016-present The Material Motion Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.android.material.motion.gestures.testing;

import android.view.MotionEvent;
import android.view.View;

import com.google.android.material.motion.gestures.GestureRecognizer;

/**
 * A no-op gesture recognizer for testing that exposes {@link #setState(int)}.
 */
public class SimulatedGestureRecognizer extends GestureRecognizer {

  public SimulatedGestureRecognizer(View element) {
    setElement(element);
  }

  @Override
  public boolean onTouchEvent(MotionEvent event) {
    return false;
  }

  @Override
  public float getUntransformedCentroidX() {
    return 0;
  }

  @Override
  public float getUntransformedCentroidY() {
    return 0;
  }

  @Override
  public void setState(@GestureRecognizerState int state) {
    super.setState(state);
  }
}

@@ -697,16 +697,48 @@
 sting;%0A%0A
+import android.graphics.PointF;%0A
 import a
@@ -762,16 +762,16 @@
 nEvent;%0A
-
 import a
@@ -1016,16 +1016,97 @@
 izer %7B%0A%0A
+  private float untransformedCentroidX;%0A  private float untransformedCentroidY;%0A%0A
   public
@@ -1175,24 +1175,405 @@
 ment);%0A  %7D%0A%0A
+  @Override%0A  public void setState(@GestureRecognizerState int state) %7B%0A    super.setState(state);%0A  %7D%0A%0A  public void setCentroid(float x, float y) %7B%0A    PointF centroid =%0A      calculateUntransformedCentroid(MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE, x, y, 0));%0A    untransformedCentroidX = centroid.x;%0A    untransformedCentroidY = centroid.y;%0A%0A    setState(CHANGED);%0A  %7D%0A%0A
   @Override%0A
@@ -1706,33 +1706,54 @@
 () %7B%0A    return 
-0
+untransformedCentroidX
 ;%0A  %7D%0A%0A  @Overri
@@ -1815,113 +1815,30 @@
 urn 
-0;%0A  %7D%0A%0A  @Override%0A  public void setState(@GestureRecognizerState int state) %7B%0A    super.setState(state)
+untransformedCentroidY
 ;%0A  

Add centroid functionality to SimulatedGestureRecognizer.