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

The following examples show how to use android.animation.ObjectAnimator#setPropertyName() . 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: 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 6
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 7
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 8
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 9
Source File: PathAnimatorInflater.java    From ElasticProgressBar with Apache License 2.0 5 votes vote down vote up
/**
 * Setup ObjectAnimator's property or values from pathData.
 *
 * @param anim                The target Animator which will be updated.
 * @param arrayObjectAnimator TypedArray for the ObjectAnimator.
 */
private static void setupObjectAnimator(ValueAnimator anim, TypedArray arrayObjectAnimator) {
    ObjectAnimator oa = (ObjectAnimator) anim;
    String propertyName =
            arrayObjectAnimator.getString(R.styleable.PropertyAnimator_vc_propertyName);
    oa.setPropertyName(propertyName);
}
 
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 ObjectAnimator createBaseWobble(View v) {
    ObjectAnimator animator = new ObjectAnimator();
    animator.setDuration(180);
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setPropertyName("rotation");
    animator.setTarget(v);
    return animator;
}
 
Example 12
Source File: CircularView.java    From CircularView with Apache License 2.0 4 votes vote down vote up
private void init(AttributeSet attrs, int defStyle) {
    // Load attributes
    final TypedArray a = getContext().obtainStyledAttributes(
            attrs, R.styleable.CircularView, defStyle, 0);
    final int centerBackgroundColor = a.getColor(
            R.styleable.CircularView_centerBackgroundColor,
            CircularViewObject.NO_COLOR);

    // Set up a default TextPaint object
    mTextPaint = new TextPaint();
    mTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mTextPaint.setTextAlign(Paint.Align.LEFT);

    mText = a.getString(R.styleable.CircularView_text);
    mTextPaint.setTextSize(a.getDimension(
            R.styleable.CircularView_textSize,
            24f));
    mTextPaint.setColor(a.getColor(
            R.styleable.CircularView_textColor,
            mTextPaint.getColor()));


    Drawable circleDrawable = null;
    if (a.hasValue(R.styleable.CircularView_centerDrawable)) {
        circleDrawable = a.getDrawable(
                R.styleable.CircularView_centerDrawable);
        circleDrawable.setCallback(this);
    }

    mHighlightedDegreeObjectAnimator = new ObjectAnimator();
    mHighlightedDegreeObjectAnimator.setTarget(CircularView.this);
    mHighlightedDegreeObjectAnimator.setPropertyName("highlightedDegree");
    mHighlightedDegreeObjectAnimator.addListener(mAnimatorListener);

    // Update TextPaint and text measurements from attributes
    invalidateTextPaintAndMeasurements();

    mCirclePaint = new Paint();
    mCirclePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mCirclePaint.setStyle(Paint.Style.FILL);
    mCirclePaint.setColor(Color.RED);

    mDrawHighlightedMarkerOnTop = a.getBoolean(R.styleable.CircularView_drawHighlightedMarkerOnTop, false);
    mHighlightedMarker = null;
    mHighlightedMarkerPosition = -1;
    mHighlightedDegree = a.getFloat(R.styleable.CircularView_highlightedDegree, HIGHLIGHT_NONE);
    mMarkerStartingPoint = a.getFloat(R.styleable.CircularView_markerStartingPoint, 0f);
    mAnimateMarkersOnStillHighlight = a.getBoolean(R.styleable.CircularView_animateMarkersOnStillHighlight, false);
    mAnimateMarkersOnHighlightAnimation = false;
    mIsAnimating = false;

    mCircle = new CircularViewObject(getContext(), CIRCLE_TO_MARKER_PADDING, centerBackgroundColor);
    mCircle.setSrc(circleDrawable);
    mCircle.setFitToCircle(a.getBoolean(R.styleable.CircularView_fitToCircle, false));

    mDefaultMarkerRadius = getResources().getInteger(R.integer.cv_default_marker_radius);

    mEditModeMarkerCount = a.getInt(R.styleable.CircularView_editMode_markerCount, 0);
    mEditModeMarkerRadius = a.getInt(R.styleable.CircularView_editMode_markerRadius, mDefaultMarkerRadius);

    a.recycle();

    setOnLongClickListener(mOnLongClickListener);

    if (isInEditMode()) {
        mAdapter = new SimpleCircularViewAdapter() {
            @Override
            public int getCount() {
                return mEditModeMarkerCount;
            }

            @Override
            public void setupMarker(int position, Marker marker) {
                marker.setRadius(mEditModeMarkerRadius);
                marker.setCenterBackgroundColor(getResources().getColor(android.R.color.black));
            }
        };
    }
}
 
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 );
}