List of usage examples for android.animation ObjectAnimator start
@Override public void start()
From source file:cn.fulldroid.lib.datetimepicker.time.TimePickerDialog.java
private void setCurrentItemShowing(int index, boolean animateCircle, boolean delayLabelAnimate, boolean announce) { mTimePicker.setCurrentItemShowing(index, animateCircle); TextView labelToAnimate;/*w w w.j av a2s. c o m*/ if (index == HOUR_INDEX) { int hours = mTimePicker.getHours(); if (!mIs24HourMode) { hours = hours % 12; } mTimePicker.setContentDescription(mHourPickerDescription + ": " + hours); if (announce) { Utils.tryAccessibilityAnnounce(mTimePicker, mSelectHours); } labelToAnimate = mHourView; } else { int minutes = mTimePicker.getMinutes(); mTimePicker.setContentDescription(mMinutePickerDescription + ": " + minutes); if (announce) { Utils.tryAccessibilityAnnounce(mTimePicker, mSelectMinutes); } labelToAnimate = mMinuteView; } int hourColor = (index == HOUR_INDEX) ? mBlue : mBlack; int minuteColor = (index == MINUTE_INDEX) ? mBlue : mBlack; mHourView.setTextColor(hourColor); mMinuteView.setTextColor(minuteColor); ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f); if (delayLabelAnimate) { pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY); } pulseAnimator.start(); }
From source file:com.github.jokar.rxupload.widget.ProgressDownloadView.java
public void drawSuccess() { mTarget = 100;// w w w . j a v a 2s. c o m final ObjectAnimator successAnim = ObjectAnimator.ofFloat(this, "flip", 1, -1); successAnim.setInterpolator(new OvershootInterpolator()); successAnim.setDuration(ANIMATION_DURATION_BASE); ObjectAnimator anim = ObjectAnimator.ofFloat(this, "progress", getProgress(), mTarget); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration((long) (ANIMATION_DURATION_BASE + Math.abs(mTarget * 10 - getProgress() * 10) / 2)); anim.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mState = State.STATE_SUCCESS; successAnim.start(); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); anim.start(); }
From source file:com.sbgapps.scoreit.ui.ScoreItActivity.java
public void animateLapContainer() { ObjectAnimator animY; float height = mLapContainer.getHeight(); if (null != mLap) { animY = ObjectAnimator.ofFloat(mLapContainer, "y", 0); } else {/*from w w w .j av a 2 s.c om*/ mLapContainer.scrollTo(0, 0); animY = ObjectAnimator.ofFloat(mLapContainer, "y", height); } animY.start(); }
From source file:com.boko.vimusic.ui.activities.AudioPlayerActivity.java
/** * @param v// ww w. ja v a 2 s. co m * The view to animate * @param alpha * The alpha to apply */ private void fade(final View v, final float alpha) { final ObjectAnimator fade = ObjectAnimator.ofFloat(v, "alpha", alpha); fade.setInterpolator( AnimationUtils.loadInterpolator(this, android.R.anim.accelerate_decelerate_interpolator)); fade.setDuration(400); fade.start(); }
From source file:com.android.tv.settings.dialog.SettingsLayoutFragment.java
private void performEntryTransition() { final View dialogView = getView(); final View contentView = (View) dialogView.getTag(R.id.content_fragment); final View actionContainerView = dialogView.findViewById(R.id.action_fragment); mIntroAnimationInProgress = true;// w ww . j av a 2 s .co m // Fade out the old activity. getActivity().overridePendingTransition(0, R.anim.lb_dialog_fade_out); int bgColor = contentView.getContext().getResources().getColor(R.color.lb_dialog_activity_background); final ColorDrawable bgDrawable = new ColorDrawable(); bgDrawable.setColor(bgColor); bgDrawable.setAlpha(0); dialogView.setBackground(bgDrawable); dialogView.setVisibility(View.INVISIBLE); // We need to defer the remainder of the animation preparation until the first layout has // occurred, as we don't yet know the final location of the icon. contentView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { contentView.getViewTreeObserver().removeOnGlobalLayoutListener(this); // if we buildLayer() at this time, the texture is // actually not created delay a little so we can make // sure all hardware layer is created before animation, // in that way we can avoid the jittering of start // animation contentView.postOnAnimationDelayed(mEntryAnimationRunnable, mAnimateDelay); } Runnable mEntryAnimationRunnable = new Runnable() { @Override public void run() { if (!isAdded()) { // We have been detached before this could run, so just bail. return; } dialogView.setVisibility(View.VISIBLE); // Fade in the activity background protection ObjectAnimator oa = ObjectAnimator.ofInt(bgDrawable, "alpha", 255); oa.setDuration(mAnimateInDuration); oa.setStartDelay(mSecondaryAnimateDelay); oa.setInterpolator(new DecelerateInterpolator(1.0f)); oa.start(); boolean isRtl = ViewCompat.getLayoutDirection(contentView) == View.LAYOUT_DIRECTION_RTL; int startDist = isRtl ? mSlideInDistance : -mSlideInDistance; int endDist = isRtl ? -actionContainerView.getMeasuredWidth() : actionContainerView.getMeasuredWidth(); // Fade in and slide in the ContentFragment TextViews from the start. prepareAndAnimateView((View) contentView.getTag(R.id.title), startDist, false); prepareAndAnimateView((View) contentView.getTag(R.id.breadcrumb), startDist, false); prepareAndAnimateView((View) contentView.getTag(R.id.description), startDist, false); // Fade in and slide in the ActionFragment from the end. prepareAndAnimateView(actionContainerView, endDist, false); prepareAndAnimateView((View) contentView.getTag(R.id.icon), startDist, true); } }; }); }
From source file:com.yekertech.tvbarsetting.dialog.SettingsLayoutFragment.java
private void performEntryTransition() { final View dialogView = getView(); final View contentView = (View) dialogView.getTag(R.id.content_fragment); final View actionContainerView = dialogView.findViewById(R.id.action_fragment); mIntroAnimationInProgress = true;/*from w w w . j av a2s .c o m*/ // Fade out the old activity. getActivity().overridePendingTransition(0, R.anim.lb_dialog_fade_out); int bgColor = contentView.getContext().getColor(R.color.lb_dialog_activity_background); final ColorDrawable bgDrawable = new ColorDrawable(); bgDrawable.setColor(bgColor); bgDrawable.setAlpha(0); dialogView.setBackground(bgDrawable); dialogView.setVisibility(View.INVISIBLE); // We need to defer the remainder of the animation preparation until the first layout has // occurred, as we don't yet know the final location of the icon. contentView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { contentView.getViewTreeObserver().removeOnGlobalLayoutListener(this); // if we buildLayer() at this time, the texture is // actually not created delay a little so we can make // sure all hardware layer is created before animation, // in that way we can avoid the jittering of start // animation contentView.postOnAnimationDelayed(mEntryAnimationRunnable, mAnimateDelay); } final Runnable mEntryAnimationRunnable = new Runnable() { @Override public void run() { if (!isAdded()) { // We have been detached before this could run, so just bail. return; } dialogView.setVisibility(View.VISIBLE); // Fade in the activity background protection ObjectAnimator oa = ObjectAnimator.ofInt(bgDrawable, "alpha", 255); oa.setDuration(mAnimateInDuration); oa.setStartDelay(mSecondaryAnimateDelay); oa.setInterpolator(new DecelerateInterpolator(1.0f)); oa.start(); boolean isRtl = ViewCompat.getLayoutDirection(contentView) == ViewCompat.LAYOUT_DIRECTION_RTL; int startDist = isRtl ? mSlideInDistance : -mSlideInDistance; int endDist = isRtl ? -actionContainerView.getMeasuredWidth() : actionContainerView.getMeasuredWidth(); // Fade in and slide in the ContentFragment TextViews from the start. prepareAndAnimateView((View) contentView.getTag(R.id.title), startDist, false); prepareAndAnimateView((View) contentView.getTag(R.id.breadcrumb), startDist, false); prepareAndAnimateView((View) contentView.getTag(R.id.description), startDist, false); // Fade in and slide in the ActionFragment from the end. prepareAndAnimateView(actionContainerView, endDist, false); prepareAndAnimateView((View) contentView.getTag(R.id.icon), startDist, true); } }; }); }
From source file:com.philliphsu.hybridtimepicker.HybridTimePickerDialog.java
private void setCurrentItemShowing(int index, boolean animatePage, boolean delayLabelAnimate, boolean announce) { mGridPicker.setCurrentItemShowing(index, animatePage); TextView labelToAnimate;/*w w w .j a v a 2 s . co m*/ if (index == HOUR_INDEX) { /* int hours = mTimePicker.getHours(); if (!mIs24HourMode) { hours = hours % 12; } mTimePicker.setContentDescription(mHourPickerDescription + ": " + hours); if (announce) { Utils.tryAccessibilityAnnounce(mTimePicker, mSelectHours); } */ labelToAnimate = mHourView; } else { /* int minutes = mTimePicker.getMinutes(); mTimePicker.setContentDescription(mMinutePickerDescription + ": " + minutes); if (announce) { Utils.tryAccessibilityAnnounce(mTimePicker, mSelectMinutes); } */ labelToAnimate = mMinuteView; } int hourColor = (index == HOUR_INDEX) ? mSelectedColor : mUnselectedColor; int minuteColor = (index == MINUTE_INDEX) ? mSelectedColor : mUnselectedColor; mHourView.setTextColor(hourColor); mMinuteView.setTextColor(minuteColor); ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f); if (delayLabelAnimate) { pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY); } pulseAnimator.start(); }
From source file:com.example.pickerclickcar.time.TimePickerDialog.java
private void setCurrentItemShowing(int index, boolean animateCircle, boolean delayLabelAnimate, boolean announce) { mTimePicker.setCurrentItemShowing(index, animateCircle); TextView labelToAnimate;//from ww w. j a va 2 s. com if (index == HOUR_INDEX) { int hours = mTimePicker.getHours(); if (!mIs24HourMode) { hours = hours % 12; } mTimePicker.setContentDescription(mHourPickerDescription + ": " + hours); if (announce) { Utils.tryAccessibilityAnnounce(mTimePicker, mSelectHours); } labelToAnimate = mHourView; } else { int minutes = mTimePicker.getMinutes(); mTimePicker.setContentDescription(mMinutePickerDescription + ": " + minutes); if (announce) { Utils.tryAccessibilityAnnounce(mTimePicker, mSelectMinutes); } labelToAnimate = mMinuteView; } int hourColor = (index == HOUR_INDEX) ? mSelectedColor : mUnselectedColor; int minuteColor = (index == MINUTE_INDEX) ? mSelectedColor : mUnselectedColor; mHourView.setTextColor(hourColor); mMinuteView.setTextColor(minuteColor); ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f); if (delayLabelAnimate) { pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY); } pulseAnimator.start(); }
From source file:de.blinkt.openvpn.fragments.LogFragment.java
private void showHideOptionsPanel() { boolean optionsVisible = (mOptionsLayout.getVisibility() != View.GONE); ObjectAnimator anim; if (optionsVisible) { anim = ObjectAnimator.ofFloat(mOptionsLayout, "alpha", 1.0f, 0f); anim.addListener(collapseListener); } else {/*from w ww. j a va 2 s . c om*/ mOptionsLayout.setVisibility(View.VISIBLE); anim = ObjectAnimator.ofFloat(mOptionsLayout, "alpha", 0f, 1.0f); //anim = new TranslateAnimation(0.0f, 0.0f, mOptionsLayout.getHeight(), 0.0f); } //anim.setInterpolator(new AccelerateInterpolator(1.0f)); //anim.setDuration(300); //mOptionsLayout.startAnimation(anim); anim.start(); }
From source file:com.waz.zclient.pages.main.profile.camera.CameraFragment.java
@Override public void onAccentColorHasChanged(Object sender, int color) { colorOverlay.setBackgroundColor(color); float accentColorOpacity = ResourceUtils.getResourceFloat(getResources(), R.dimen.background_color_overlay_opacity); float accentColorOpacityOverdriven = ResourceUtils.getResourceFloat(getResources(), R.dimen.background_color_overlay_opacity_overdriven); ObjectAnimator anim = ObjectAnimator.ofFloat(colorOverlay, View.ALPHA, 0, accentColorOpacityOverdriven, accentColorOpacityOverdriven, accentColorOpacityOverdriven / 2, accentColorOpacity); anim.setInterpolator(new AccentColorInterpolator()); anim.setDuration(//from w ww.j av a 2 s . c o m getResources().getInteger(R.integer.background_accent_color_transition_animation_duration)); anim.start(); cameraBottomControl.setAccentColor(color); }