use of android.animation.ObjectAnimator in project mosby by sockeqwe.
the class DetailsFragment method setData.
@Override
public void setData(Mail data) {
this.mail = data;
senderImageView.setImageResource(data.getSender().getImageRes());
senderNameView.setText(data.getSender().getName());
senderMailView.setText(data.getSender().getEmail());
subjectView.setText(data.getSubject());
contentView.setText(data.getText() + data.getText() + data.getText() + data.getText());
starView.setStarred(data.isStarred());
dateView.setText(format.format(data.getDate()));
labelView.setMail(data);
labelView.setVisibility(View.VISIBLE);
replayView.setVisibility(View.VISIBLE);
// Animate only if not restoring
if (!isRestoringViewState()) {
labelView.setAlpha(0f);
labelView.animate().alpha(1f).setDuration(150).start();
PropertyValuesHolder holderX = PropertyValuesHolder.ofFloat("scaleX", 0, 1);
PropertyValuesHolder holderY = PropertyValuesHolder.ofFloat("scaleY", 0, 1);
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(replayView, holderX, holderY);
animator.setInterpolator(new OvershootInterpolator());
animator.start();
}
}
use of android.animation.ObjectAnimator in project SwitchButton by kyleduo.
the class UseActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_use);
findView();
LinearLayout toggleWrapper = (LinearLayout) findViewById(R.id.toggle_wrapper);
for (int i = 0; i < toggleWrapper.getChildCount(); i++) {
toggleWrapper.getChildAt(i).setOnClickListener(this);
}
LinearLayout checkWrapper = (LinearLayout) findViewById(R.id.check_wrapper);
for (int i = 0; i < checkWrapper.getChildCount(); i++) {
checkWrapper.getChildAt(i).setOnClickListener(this);
}
// work with listener
mListenerSb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mListenerFinish.setVisibility(isChecked ? View.VISIBLE : View.INVISIBLE);
}
});
// work with delay
mDelaySb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mDelaySb.setEnabled(false);
mDelaySb.postDelayed(new Runnable() {
@Override
public void run() {
mDelaySb.setEnabled(true);
}
}, 1500);
}
});
// work with stuff takes long
mStartBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ObjectAnimator animator = ObjectAnimator.ofInt(mPb, "progress", 0, 1000);
animator.setDuration(1000);
animator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
mStartBt.setEnabled(false);
mLongSb.setChecked(false);
}
@Override
public void onAnimationEnd(Animator animation) {
mStartBt.setEnabled(true);
mLongSb.setChecked(true);
}
@Override
public void onAnimationCancel(Animator animation) {
mStartBt.setEnabled(true);
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
animator.start();
}
});
// check in check
mForceOpenSb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (mForceOpenControlSb.isChecked()) {
toast("Call mForceOpenSb.setChecked(true); in on CheckedChanged");
mForceOpenSb.setChecked(true);
}
}
});
}
use of android.animation.ObjectAnimator in project Shuttle by timusus.
the class IntroductoryOverlay method fadeOut.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void fadeOut(long duration) {
ObjectAnimator oa = ObjectAnimator.ofFloat(this, ALPHA_PROPERTY, INVISIBLE_VALUE);
oa.setDuration(duration).addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
setFtuShown();
if (mListener != null) {
mListener.onOverlayDismissed();
mListener = null;
}
remove();
}
});
oa.start();
}
use of android.animation.ObjectAnimator in project Shuttle by timusus.
the class ViewUtils method fadeOut.
public static void fadeOut(View view, @Nullable Action0 completion) {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, View.ALPHA, 1f, 0f).setDuration(250);
objectAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setVisibility(View.GONE);
objectAnimator.removeAllListeners();
if (completion != null) {
completion.call();
}
}
});
objectAnimator.start();
}
use of android.animation.ObjectAnimator in project Shuttle by timusus.
the class ViewUtils method fadeIn.
public static void fadeIn(View view, @Nullable Action0 completion) {
view.setVisibility(View.VISIBLE);
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, View.ALPHA, 0f, 1f).setDuration(250);
objectAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
animation.removeAllListeners();
if (completion != null) {
completion.call();
}
}
});
objectAnimator.start();
}
Aggregations