Tabnine Logo
FlingAnimation.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
android.support.animation.FlingAnimation
constructor

Best Java code snippets using android.support.animation.FlingAnimation.<init> (Showing top 7 results out of 315)

origin: recruit-lifestyle/FloatingView

/**
 * Start fling animation(X coordinate)
 *
 * @param velocityX velocity X coordinate
 */
private void startFlingAnimationX(float velocityX) {
  final FlingAnimation flingAnimationX = new FlingAnimation(new FloatValueHolder());
  flingAnimationX.setStartVelocity(velocityX);
  flingAnimationX.setMaxValue(mPositionLimitRect.right);
  flingAnimationX.setMinValue(mPositionLimitRect.left);
  flingAnimationX.setStartValue(mParams.x);
  flingAnimationX.setFriction(ANIMATION_FLING_X_FRICTION);
  flingAnimationX.setMinimumVisibleChange(DynamicAnimation.MIN_VISIBLE_CHANGE_PIXELS);
  flingAnimationX.addUpdateListener(new DynamicAnimation.OnAnimationUpdateListener() {
    @Override
    public void onAnimationUpdate(DynamicAnimation animation, float value, float velocity) {
      final int x = Math.round(value);
      // Not moving, or the touch operation is continuing
      if (mParams.x == x || mVelocityTracker != null) {
        return;
      }
      // update y coordinate
      mParams.x = x;
      updateViewLayout();
    }
  });
  flingAnimationX.start();
}
origin: recruit-lifestyle/FloatingView

/**
 * Start fling animation(Y coordinate)
 *
 * @param velocityY velocity Y coordinate
 */
private void startFlingAnimationY(float velocityY) {
  final FlingAnimation flingAnimationY = new FlingAnimation(new FloatValueHolder());
  flingAnimationY.setStartVelocity(velocityY);
  flingAnimationY.setMaxValue(mPositionLimitRect.bottom);
  flingAnimationY.setMinValue(mPositionLimitRect.top);
  flingAnimationY.setStartValue(mParams.y);
  flingAnimationY.setFriction(ANIMATION_FLING_Y_FRICTION);
  flingAnimationY.setMinimumVisibleChange(DynamicAnimation.MIN_VISIBLE_CHANGE_PIXELS);
  flingAnimationY.addUpdateListener(new DynamicAnimation.OnAnimationUpdateListener() {
    @Override
    public void onAnimationUpdate(DynamicAnimation animation, float value, float velocity) {
      final int y = Math.round(value);
      // Not moving, or the touch operation is continuing
      if (mParams.y == y || mVelocityTracker != null) {
        return;
      }
      // update y coordinate
      mParams.y = y;
      updateViewLayout();
    }
  });
  flingAnimationY.start();
}
origin: Rkhcy/PhysicsBasedAnimation

  @Override
  public void onClick(View view) {
    final FlingAnimation flingAnimation = new FlingAnimation(img, DynamicAnimation.X);
    flingAnimation.setStartVelocity(500f);
    flingAnimation.setFriction(0.5f);
    flingAnimation.start();
  }
});
origin: richakhanna/physicsbasedanimation

  @Override
  public boolean onFling(MotionEvent downEvent, MotionEvent moveEvent, float velocityX, float velocityY) {
    //downEvent : when user puts his finger down on the view
    //moveEvent : when user lifts his finger at the end of the movement
    float distanceInX = Math.abs(moveEvent.getRawX() - downEvent.getRawX());
    float distanceInY = Math.abs(moveEvent.getRawY() - downEvent.getRawY());
    mTvFlingDistance.setText("distanceInX : " + distanceInX + "\n" + "distanceInY : " + distanceInY);
    if (distanceInX > MIN_DISTANCE_MOVED) {
      //Fling Right/Left
      FlingAnimation flingX = new FlingAnimation(mViewTobeFlung, DynamicAnimation.TRANSLATION_X);
      flingX.setStartVelocity(velocityX)
          .setMinValue(MIN_TRANSLATION) // minimum translationX property
          .setMaxValue(maxTranslationX)  // maximum translationX property
          .setFriction(FRICTION)
          .start();
    } else if (distanceInY > MIN_DISTANCE_MOVED) {
      //Fling Down/Up
      FlingAnimation flingY = new FlingAnimation(mViewTobeFlung, DynamicAnimation.TRANSLATION_Y);
      flingY.setStartVelocity(velocityY)
          .setMinValue(MIN_TRANSLATION)  // minimum translationY property
          .setMaxValue(maxTranslationY) // maximum translationY property
          .setFriction(FRICTION)
          .start();
    }
    return true;
  }
};
origin: google-developer-training/android-advanced

  @Override
  public boolean onTouchEvent(MotionEvent event) {
    switch (event.getActionMasked()) {
      case MotionEvent.ACTION_DOWN:
        // Create an animation that rotates around the views X value.
        FlingAnimation fling = new FlingAnimation(
            this, DynamicAnimation.ROTATION_X);
        // Set parameters and constraints for the animation.
        // This does almost a full rotation, but not quite.
        // Play with these values!
        fling.setStartVelocity(150) // In pixels per second.
            .setFriction(0.11f) // Friction slows animation.
            .start();
        break;
      default:
        // Do nothing.
    }
    return super.onTouchEvent(event);
  }
}
origin: TakuSemba/CropMe

HorizontalMoveAnimatorImpl(View target, RectF restrictionRect, int maxScale) {
  this.maxScale = maxScale;
  this.restrictionRect = restrictionRect;
  spring = new SpringAnimation(target,
      new FloatPropertyCompat<View>("X") {
        @Override
        public float getValue(View view) {
          return view.getX();
        }
        @Override
        public void setValue(View view, float value) {
          view.setX(value);
        }
      })
      .setSpring(new SpringForce()
          .setStiffness(STIFFNESS)
          .setDampingRatio(DAMPING_RATIO)
      );
  fling = new FlingAnimation(target, DynamicAnimation.X).setFriction(FRICTION);
  animator = new ObjectAnimator();
  animator.setProperty(TRANSLATION_X);
  animator.setTarget(target);
}
origin: TakuSemba/CropMe

VerticalMoveAnimatorImpl(View target, RectF restrictionRect, int maxScale) {
  this.maxScale = maxScale;
  this.restrictionRect = restrictionRect;
  spring = new SpringAnimation(target,
      new FloatPropertyCompat<View>("Y") {
        @Override
        public float getValue(View view) {
          return view.getY();
        }
        @Override
        public void setValue(View view, float value) {
          view.setY(value);
        }
      })
      .setSpring(new SpringForce()
          .setStiffness(STIFFNESS)
          .setDampingRatio(DAMPING_RATIO)
      );
  fling = new FlingAnimation(target, DynamicAnimation.Y).setFriction(FRICTION);
  animator = new ObjectAnimator();
  animator.setProperty(TRANSLATION_Y);
  animator.setTarget(target);
}
android.support.animationFlingAnimation<init>

Popular methods of FlingAnimation

  • setFriction
  • setStartVelocity
  • start
  • addUpdateListener
  • setMaxValue
  • setMinValue
  • addEndListener
  • cancel
  • removeEndListener
  • removeUpdateListener
  • setMinimumVisibleChange
  • setStartValue
  • setMinimumVisibleChange,
  • setStartValue

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • findViewById (Activity)
  • getSystemService (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Table (org.hibernate.mapping)
    A relational table
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now