Java Code Examples for android.animation.ObjectAnimator#setFloatValues()

The following examples show how to use android.animation.ObjectAnimator#setFloatValues() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RapidFloatingActionContentLabelList.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void onExpandAnimator(AnimatorSet animatorSet) {
    int count = contentView.getChildCount();
    for (int i = 0; i < count; i++) {
        View rootView = contentView.getChildAt(i);
        ImageView iconIv = RFABViewUtil.obtainView(rootView, R.id.rfab__content_label_list_icon_iv);
        if (null == iconIv) {
            return;
        }
        ObjectAnimator animator = new ObjectAnimator();
        animator.setTarget(iconIv);
        animator.setFloatValues(45f, 0);
        animator.setPropertyName("rotation");
        animator.setInterpolator(mOvershootInterpolator);
        animator.setStartDelay((count * i) * 20);
        animatorSet.playTogether(animator);
    }
}
 
Example 2
Source File: RapidFloatingActionContentLabelList.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void onCollapseAnimator(AnimatorSet animatorSet) {
    int count = contentView.getChildCount();
    for (int i = 0; i < count; i++) {
        View rootView = contentView.getChildAt(i);
        ImageView iconIv = RFABViewUtil.obtainView(rootView, R.id.rfab__content_label_list_icon_iv);
        if (null == iconIv) {
            return;
        }
        ObjectAnimator animator = new ObjectAnimator();
        animator.setTarget(iconIv);
        animator.setFloatValues(0, 45f);
        animator.setPropertyName("rotation");
        animator.setInterpolator(mOvershootInterpolator);
        animator.setStartDelay((count * i) * 20);
        animatorSet.playTogether(animator);
    }
}
 
Example 3
Source File: RapidFloatingActionContentLabelList.java    From RapidFloatingActionButton with Apache License 2.0 6 votes vote down vote up
@Override
public void onExpandAnimator(AnimatorSet animatorSet) {
    int count = contentView.getChildCount();
    for (int i = 0; i < count; i++) {
        View rootView = contentView.getChildAt(i);
        ImageView iconIv = RFABViewUtil.obtainView(rootView, R.id.rfab__content_label_list_icon_iv);
        if (null == iconIv) {
            return;
        }
        ObjectAnimator animator = new ObjectAnimator();
        animator.setTarget(iconIv);
        animator.setFloatValues(45f, 0);
        animator.setPropertyName("rotation");
        animator.setInterpolator(mOvershootInterpolator);
        animator.setStartDelay((count * i) * 20);
        animatorSet.playTogether(animator);
    }
}
 
Example 4
Source File: RapidFloatingActionContentLabelList.java    From RapidFloatingActionButton with Apache License 2.0 6 votes vote down vote up
@Override
public void onCollapseAnimator(AnimatorSet animatorSet) {
    int count = contentView.getChildCount();
    for (int i = 0; i < count; i++) {
        View rootView = contentView.getChildAt(i);
        ImageView iconIv = RFABViewUtil.obtainView(rootView, R.id.rfab__content_label_list_icon_iv);
        if (null == iconIv) {
            return;
        }
        ObjectAnimator animator = new ObjectAnimator();
        animator.setTarget(iconIv);
        animator.setFloatValues(0, 45f);
        animator.setPropertyName("rotation");
        animator.setInterpolator(mOvershootInterpolator);
        animator.setStartDelay((count * i) * 20);
        animatorSet.playTogether(animator);
    }
}
 
Example 5
Source File: UDAnimator.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 浮点数
 *
 * @param values
 * @return
 */
public UDAnimator setFloatValues(float... values) {
    ObjectAnimator animator = getAnimator();
    if (animator != null && values != null && values.length > 0) {
        animator.setFloatValues(values);
    }
    return this;
}
 
Example 6
Source File: GeneralAnimatorGenerator.java    From IndicatorBox with MIT License 5 votes vote down vote up
/**
 * Make a heart-beat expand animation.
 * @param duration
 * @return
 */
public static Animator heartbeatExpandAnimator(int duration){
    AnimatorSet animatorSet = new AnimatorSet();
    ObjectAnimator xExpandAnimator = new ObjectAnimator();
    xExpandAnimator.setPropertyName("scaleX");
    xExpandAnimator.setFloatValues(0.5f, 1.0f);
    ObjectAnimator yExpandAnimator = new ObjectAnimator();
    yExpandAnimator.setPropertyName("scaleY");
    yExpandAnimator.setFloatValues(0.5f, 1.0f);
    animatorSet.play(xExpandAnimator).with(yExpandAnimator);
    animatorSet.setDuration(duration);
    animatorSet.setInterpolator(new DampingInterpolator());

    return animatorSet;
}
 
Example 7
Source File: GeneralAnimatorGenerator.java    From IndicatorBox with MIT License 5 votes vote down vote up
/**
 * Make a shrink animation.
 * @param duration
 * @return
 */
public static Animator shrinkAnimator(int duration){
    AnimatorSet animatorSet = new AnimatorSet();
    ObjectAnimator xExpandAnimator = new ObjectAnimator();
    xExpandAnimator.setPropertyName("scaleX");
    xExpandAnimator.setFloatValues(1.0f, 0.5f);
    ObjectAnimator yExpandAnimator = new ObjectAnimator();
    yExpandAnimator.setPropertyName("scaleY");
    yExpandAnimator.setFloatValues(1.0f, 0.5f);
    animatorSet.play(xExpandAnimator).with(yExpandAnimator);
    animatorSet.setDuration(duration);
    animatorSet.setInterpolator(new AnticipateInterpolator());
    return animatorSet;
}
 
Example 8
Source File: LauncherAnimUtils.java    From Trebuchet with GNU General Public License v3.0 5 votes vote down vote up
public static ObjectAnimator ofFloat(View target, String propertyName, float... values) {
    ObjectAnimator anim = new ObjectAnimator();
    anim.setTarget(target);
    anim.setPropertyName(propertyName);
    anim.setFloatValues(values);
    cancelOnDestroyActivity(anim);
    new FirstFrameAnimatorHelper(anim, target);
    return anim;
}
 
Example 9
Source File: LauncherAnimUtils.java    From TurboLauncher with Apache License 2.0 5 votes vote down vote up
public static ObjectAnimator ofFloat(View target, String propertyName, float... values) {
    ObjectAnimator anim = new ObjectAnimator();
    anim.setTarget(target);
    anim.setPropertyName(propertyName);
    anim.setFloatValues(values);
    cancelOnDestroyActivity(anim);
    new FirstFrameAnimatorHelper(anim, target);
    return anim;
}
 
Example 10
Source File: LauncherAnimUtils.java    From LB-Launcher with Apache License 2.0 5 votes vote down vote up
public static ObjectAnimator ofFloat(View target, String propertyName, float... values) {
    ObjectAnimator anim = new ObjectAnimator();
    anim.setTarget(target);
    anim.setPropertyName(propertyName);
    anim.setFloatValues(values);
    cancelOnDestroyActivity(anim);
    new FirstFrameAnimatorHelper(anim, target);
    return anim;
}
 
Example 11
Source File: DynamicGridView.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void animateWobble(View v) {
    ObjectAnimator animator = createBaseWobble(v);
    animator.setFloatValues(-2, 2);
    animator.start();
    mWobbleAnimators.add(animator);
}
 
Example 12
Source File: DynamicGridView.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void animateWobbleInverse(View v) {
    ObjectAnimator animator = createBaseWobble(v);
    animator.setFloatValues(2, -2);
    animator.start();
    mWobbleAnimators.add(animator);
}
 
Example 13
Source File: PicturePasswordView.java    From android-picturepassword with MIT License 4 votes vote down vote up
public PicturePasswordView( Context context, AttributeSet attrs )
{
	super( context, attrs );
	
	setScaleType( ScaleType.CENTER_CROP );
	
	mRandom = new Random();
	mSeed = mRandom.nextInt();
	
	mGridSize = DEFAULT_GRID_SIZE;
	
	///////////////////////
	// Initialize Paints //
	///////////////////////
	final DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
	final float shadowOff = TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 2, displayMetrics );
	
	mPaint = new Paint( Paint.LINEAR_TEXT_FLAG );
	
	mPaint.setColor( Color.WHITE );
	
	mPaint.setShadowLayer( 10, shadowOff, shadowOff, Color.BLACK );
	mPaint.setTextSize( TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, FONT_SIZE, displayMetrics ) );
	
	mPaint.setAntiAlias( true );

	mCirclePaint = new Paint( Paint.ANTI_ALIAS_FLAG );

	mCirclePaint.setColor( Color.argb( 255, 0x33, 0xb5, 0xe5 ) );
	
	mCirclePaint.setStyle( Paint.Style.STROKE );
	mCirclePaint.setStrokeWidth( 5 );
	
	mUnlockPaint = new Paint( Paint.ANTI_ALIAS_FLAG );
	
	mTextBounds = new Rect();
	mPaint.getTextBounds( "8", 0, 1, mTextBounds );
	
	///////////////////////////
	// Initialize animations //
	///////////////////////////

	mScale = 1.0f;
	
	mAnimator = new ObjectAnimator();
	mAnimator.setTarget( this );
	mAnimator.setFloatValues( 0, 1 );
	mAnimator.setPropertyName( "scale" );
	mAnimator.setDuration( 200 );
	
	mCircleAnimator = new ObjectAnimator();
	mCircleAnimator.setTarget( this );
	mCircleAnimator.setPropertyName( "internalUnlockProgress" ); // ugh!
	mCircleAnimator.setDuration( 300 );
	
	///////////////////////
	// Hide/show numbers //
	///////////////////////
	
	mShowNumbers = true;
	
	TypedArray a = context.getTheme().obtainStyledAttributes( attrs, R.styleable.PicturePasswordView, 0, 0 );
	
	try
	{
		mShowNumbers = a.getBoolean( R.styleable.PicturePasswordView_showNumbers, true );
	}
	finally
	{
		a.recycle();
	}
	
	//////////////////////
	// Initialize sizes //
	//////////////////////
	mCircleSize = ( int ) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 6, displayMetrics );
	mCircleSpacing = ( int ) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 5, displayMetrics );
	mCirclePadding = ( int ) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 10, displayMetrics );
}