use of android.animation.ObjectAnimator in project ShowcaseView by amlcurran.
the class AnimatorAnimationFactory method fadeOutView.
@Override
public void fadeOutView(View target, long duration, final AnimationEndListener listener) {
ObjectAnimator oa = ObjectAnimator.ofFloat(target, ALPHA, INVISIBLE);
oa.setDuration(duration).addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
listener.onAnimationEnd();
}
});
oa.start();
}
use of android.animation.ObjectAnimator in project ShowcaseView by amlcurran.
the class AnimatorAnimationFactory method fadeInView.
@Override
public void fadeInView(View target, long duration, final AnimationStartListener listener) {
ObjectAnimator oa = ObjectAnimator.ofFloat(target, ALPHA, INVISIBLE, VISIBLE);
oa.setDuration(duration).addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
listener.onAnimationStart();
}
});
oa.start();
}
use of android.animation.ObjectAnimator in project gdk-apidemo-sample by googleglass.
the class SliderActivity method processSliderRequest.
/**
* Processes a request to show a slider.
*
* Starting a new Slider, regardless of its type, automatically hides any shown Slider.
*/
private void processSliderRequest(int position) {
switch(position) {
case SCROLLER:
Slider.Scroller scroller = mSlider.startScroller(MAX_SLIDER_VALUE, 0);
// Start an animation showing the different positions of the slider, the slider
// automatically hides after a short time of inactivity.
ObjectAnimator.ofFloat(scroller, "position", 0, MAX_SLIDER_VALUE).setDuration(ANIMATION_DURATION_MILLIS).start();
break;
case DETERMINATE:
final Slider.Determinate determinate = mSlider.startDeterminate(MAX_SLIDER_VALUE, 0);
ObjectAnimator animator = ObjectAnimator.ofFloat(determinate, "position", 0, MAX_SLIDER_VALUE);
// Hide the slider when the animation stops.
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
determinate.hide();
}
});
// Start an animation showing the different positions of the slider.
animator.setDuration(ANIMATION_DURATION_MILLIS).start();
break;
case GRACE_PERIOD:
// Start the grace period slider and play a sound when one of the listener method
// gets fired.
mGracePeriod = mSlider.startGracePeriod(mGracePeriodListener);
break;
case INDETERMINATE:
// Toggle between showing/hiding the indeterminate slider.
if (mIndeterminate != null) {
mIndeterminate.hide();
mIndeterminate = null;
} else {
mIndeterminate = mSlider.startIndeterminate();
}
break;
}
}
use of android.animation.ObjectAnimator in project android-topeka by googlesamples.
the class AbsQuizView method resizeViewProperty.
private void resizeViewProperty(Property<View, Float> property, float targetScale, int durationOffset) {
ObjectAnimator animator = ObjectAnimator.ofFloat(this, property, 1f, targetScale);
animator.setInterpolator(mLinearOutSlowInInterpolator);
animator.setStartDelay(FOREGROUND_COLOR_CHANGE_DELAY + durationOffset);
animator.start();
}
use of android.animation.ObjectAnimator in project iosched by google.
the class SessionDetailFragment method displayTrackColor.
/**
* Update the header box background color & status bar color depending upon which track this
* session belongs to.
* <p>
* Note this requires both the {@link SessionDetailQueryEnum#SESSIONS} &
* {@link SessionDetailQueryEnum#TAG_METADATA) queries to have returned.
*/
private void displayTrackColor(SessionDetailModel data) {
if (data.isSessionTrackColorAvailable()) {
int trackColor = data.getSessionTrackColor();
if (trackColor == Color.TRANSPARENT) {
trackColor = UIUtils.getThemeColor(getContext(), R.attr.colorPrimary, R.color.theme_primary);
}
final Drawable background = mHeaderBox.getBackground();
if (background instanceof ColorDrawable && ((ColorDrawable) background).getColor() == trackColor) {
return;
}
// Animate the color change to make the transition smoother
final ObjectAnimator color = ObjectAnimator.ofInt(mHeaderBox, UIUtils.BACKGROUND_COLOR, trackColor);
color.setEvaluator(new ArgbEvaluator());
if (mHasEnterTransition) {
color.setStartDelay(200L);
}
color.setDuration(300L);
color.start();
if (mCollapsingToolbar.getFitsSystemWindows() && mPhotoViewContainer.getVisibility() == View.VISIBLE) {
// immersive+photo
mCollapsingToolbar.setStatusBarScrimColor(trackColor);
} else {
UIUtils.adjustAndSetStatusBarColor(getActivity(), trackColor);
}
}
}
Aggregations