Created
March 4, 2017 10:57
-
-
Save shakil807g/cceb3840abfc5a7c582eb06a1934b1fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PluseView extends FrameLayout { | |
@BindView(R.id.circleview) | |
CircleView circleview; | |
@BindView(R.id.circleview2) | |
CircleView circleview2; | |
@BindView(R.id.circleview3) | |
CircleView circleview3; | |
@BindView(R.id.profile_image) | |
CircleImageView profileImage; | |
private ObjectAnimator scaleanimation2; | |
private ObjectAnimator scaleanimation; | |
private ObjectAnimator scaleanimation3; | |
public PluseView(Context context) { | |
super(context); | |
initializeViews(context); | |
} | |
public PluseView(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
initializeViews(context); | |
} | |
public PluseView(Context context, AttributeSet attrs, int defStyleAttr) { | |
super(context, attrs, defStyleAttr); | |
initializeViews(context); | |
} | |
private void initializeViews(Context context) { | |
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); | |
View view = inflater.inflate(R.layout.pluse_layout, this); | |
ButterKnife.bind(this, view); | |
} | |
@Override | |
protected void onFinishInflate() { | |
super.onFinishInflate(); | |
PropertyValuesHolder viewX = PropertyValuesHolder.ofFloat(View.SCALE_X, 10); | |
PropertyValuesHolder viewY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 10); | |
PropertyValuesHolder viewalpha = PropertyValuesHolder.ofFloat(View.ALPHA, 0); | |
scaleanimation = ObjectAnimator.ofPropertyValuesHolder(circleview, viewX, viewY, viewalpha); | |
scaleanimation.setRepeatCount(ValueAnimator.INFINITE); | |
scaleanimation.setDuration(3000); | |
scaleanimation.setRepeatMode(ValueAnimator.RESTART); | |
scaleanimation2 = ObjectAnimator.ofPropertyValuesHolder(circleview2, viewX, viewY, viewalpha); | |
scaleanimation2.setRepeatCount(ValueAnimator.INFINITE); | |
scaleanimation2.setDuration(3000); | |
scaleanimation2.setStartDelay(500); | |
scaleanimation2.setRepeatMode(ValueAnimator.RESTART); | |
scaleanimation3 = ObjectAnimator.ofPropertyValuesHolder(circleview3, viewX, viewY, viewalpha); | |
scaleanimation3.setRepeatCount(ValueAnimator.INFINITE); | |
scaleanimation3.setDuration(3000); | |
scaleanimation3.setStartDelay(1000); | |
scaleanimation3.setRepeatMode(ValueAnimator.RESTART); | |
} | |
public void startPulse() { | |
scaleanimation.start(); | |
scaleanimation2.start(); | |
scaleanimation3.start(); | |
} | |
public void endPulse() { | |
scaleanimation.end(); | |
scaleanimation2.end(); | |
scaleanimation3.end(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment