android.animation.ArgbEvaluator Java Examples
The following examples show how to use
android.animation.ArgbEvaluator.
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: TouchRippleAdapter.java From TouchEffects with MIT License | 6 votes |
@Override protected Animator createEngineAnimator(View view) { ArgbEvaluator argbEvaluator = new ArgbEvaluator();//渐变色计算类 ValueAnimator valueAnimator = ValueAnimator.ofFloat(0f,1f); valueAnimator.setDuration(850); // valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { mColorValue = (float) animation.getAnimatedValue(); mCurrentColor = (int) (argbEvaluator.evaluate(mColorValue, TRANSPARENT_COLOR, mPressedColor)); view.invalidate(); } }); return valueAnimator; }
Example #2
Source File: TransitionsExampleFragment.java From ifican with Apache License 2.0 | 6 votes |
private void runEnterAnimation() { /* Animate color transitions */ ObjectAnimator background = ObjectAnimator.ofObject(container, "backgroundColor", new ArgbEvaluator(), green, pink).setDuration(500); background.start(); /* Translate text1 to its current (R.layout.fragment_transitions_example) position */ text1.animate().setDuration(500) .translationX(0) .translationY(0) .setInterpolator(sDecelerator).setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { getActivity().getWindow().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.pink))); } }); }
Example #3
Source File: ProgressButtonLayout.java From pandroid with Apache License 2.0 | 6 votes |
public void load(boolean anim) { if (contentView == null) return; int duration = anim ? getResources().getInteger(R.integer.anim_speed) : 1; progressWheel.setVisibility(VISIBLE); if (contentView.getMeasuredHeight() == 0) { AnimUtils.mesureView(contentView); } int buttonHeight = contentView.getMeasuredHeight() - contentView.getPaddingTop() - contentView.getPaddingBottom(); progressWheel.setCircleRadius(buttonHeight / 2); progressWheel.animate().setDuration(duration).alpha(1); progressWheel.spin(); if (contentView instanceof TextView) { int color = ((TextView) contentView).getTextColors().getDefaultColor(); ValueAnimator textColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), color, Color.argb(0, Color.red(color), Color.green(color), Color.blue(color))); textColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { ((TextView) contentView).setTextColor((Integer) animator.getAnimatedValue()); } }); textColorAnimator.setDuration(duration); textColorAnimator.start(); } animateToRadius(buttonHeight / 2, duration, new SimpleAnimatorListener()); }
Example #4
Source File: ContactSelectActivity.java From weMessage with GNU Affero General Public License v3.0 | 6 votes |
private void invalidateField(final EditText editText){ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.invalidRed)); colorAnimation.setDuration(200); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { editText.getBackground().setColorFilter((int) animation.getAnimatedValue(), PorterDuff.Mode.SRC_ATOP); editText.setTextColor((int) animation.getAnimatedValue()); } }); Animation invalidShake = AnimationUtils.loadAnimation(getActivity(), R.anim.invalid_shake); invalidShake.setInterpolator(new CycleInterpolator(7F)); colorAnimation.start(); editText.startAnimation(invalidShake); }
Example #5
Source File: GoogleMapsBottomSheetBehavior.java From Google-Maps-BottomSheet with The Unlicense | 6 votes |
private void updateHeaderColor(int newBackgroundColor, int newTextColor) { if (mCurrentColor != newBackgroundColor) { if (colorAnimation != null && colorAnimation.isRunning()) { colorAnimation.cancel(); } if (headerLayout != null) { final int DURATION = 200; colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), mCurrentColor, newBackgroundColor).setDuration(DURATION); mCurrentColor = newBackgroundColor; colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { headerLayout.setBackgroundColor((int) valueAnimator.getAnimatedValue()); } }); colorAnimation.start(); for (int i = 0, size = headerTextViews.size(); i < size; i++) { animateTextColorChange(newTextColor, DURATION, headerTextViews.get(i)); } } } }
Example #6
Source File: SetNumberActivity.java From weMessage with GNU Affero General Public License v3.0 | 6 votes |
private void invalidateField(final EditText editText){ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.invalidRed)); colorAnimation.setDuration(200); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { editText.getBackground().setColorFilter((int) animation.getAnimatedValue(), PorterDuff.Mode.SRC_ATOP); editText.setTextColor((int) animation.getAnimatedValue()); } }); Animation invalidShake = AnimationUtils.loadAnimation(this, R.anim.invalid_shake); invalidShake.setInterpolator(new CycleInterpolator(7F)); colorAnimation.start(); editText.startAnimation(invalidShake); }
Example #7
Source File: SyncActivity.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void saveTheme(Integer themeId) { SharedPreferences prefs = getAbstracContext().getSharedPreferences( Constants.SHARE_PREFS, Context.MODE_PRIVATE); prefs.edit().putInt(Constants.THEME, themeId).apply(); setTheme(themeId); int startColor = ColorUtils.getPrimaryColor(this, ColorUtils.ColorType.PRIMARY); TypedValue typedValue = new TypedValue(); TypedArray a = obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorPrimary}); int endColor = a.getColor(0, 0); a.recycle(); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), startColor, endColor); colorAnimation.setDuration(2000); // milliseconds colorAnimation.addUpdateListener(animator -> binding.logo.setBackgroundColor((int) animator.getAnimatedValue())); colorAnimation.start(); }
Example #8
Source File: PartyLightView.java From AndroidWearable-Samples with Apache License 2.0 | 6 votes |
private void init() { mEvaluator = new ArgbEvaluator(); mHandler = new Handler() { @Override public void handleMessage(Message msg) { mCurrentColor = getColor(mProgress, mColors[mFromColorIndex], mColors[mToColorIndex]); postInvalidate(); mProgress += 0.1; if (mProgress > 1.0) { mFromColorIndex = mToColorIndex; // Find a new color. mToColorIndex++; if (mToColorIndex >= mColors.length) { mToColorIndex = 0; } } mHandler.sendEmptyMessageDelayed(0, 100); } }; }
Example #9
Source File: ExitFragmentTransition.java From iGap-Android with GNU Affero General Public License v3.0 | 6 votes |
private void animateClose(final View v) { int colorFrom = G.context.getResources().getColor(R.color.black); int colorTo = G.context.getResources().getColor(R.color.transparent); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); colorAnimation.setDuration(300); // milliseconds colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { v.setBackgroundColor((int) animator.getAnimatedValue()); } }); colorAnimation.start(); }
Example #10
Source File: CubeReversalView.java From CrazyDaily with Apache License 2.0 | 6 votes |
public CubeReversalView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mBottomOutAnimation = new BottomOutAnimation(); mBottomOutAnimation.setDuration(DURATION); mBottomOutAnimation.setFillAfter(true); mBottomInAnimation = new BottomInAnimation(); mBottomInAnimation.setDuration(DURATION); mBottomInAnimation.setFillAfter(true); mTopOutAnimation = new TopOutAnimation(); mTopOutAnimation.setDuration(DURATION); mTopOutAnimation.setFillAfter(true); mTopInAnimation = new TopInAnimation(); mTopInAnimation.setDuration(DURATION); mTopInAnimation.setFillAfter(true); mArgbEvaluator = new ArgbEvaluator(); mBackgroundDrawable = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP, new int[]{0x00000000, 0x00000000, 0x00000000}); mForegroundDrawable = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{0x00000000, 0x00000000, 0x00000000}); }
Example #11
Source File: SettingsActivity.java From EdXposedManager with GNU General Public License v3.0 | 6 votes |
@Override public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int color) { int colorFrom = XposedApp.getColor(this); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, color); colorAnimation.addUpdateListener(animator -> { int color1 = (int) animator.getAnimatedValue(); toolbar.setBackgroundColor(color1); int darkenColor = XposedApp.darkenColor(color1, getDarkenFactor()); getWindow().setStatusBarColor(darkenColor); if (navBar != null && navBar.isChecked()) { getWindow().setNavigationBarColor(darkenColor); } }); colorAnimation.setDuration(750); colorAnimation.start(); if (!dialog.isAccentMode()) { XposedApp.getPreferences().edit().putInt("colors", color).apply(); } }
Example #12
Source File: LaunchFragment.java From weMessage with GNU Affero General Public License v3.0 | 6 votes |
private void invalidateField(final EditText editText){ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.invalidRed)); colorAnimation.setDuration(200); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { editText.getBackground().setColorFilter((int) animation.getAnimatedValue(), PorterDuff.Mode.SRC_ATOP); editText.setTextColor((int) animation.getAnimatedValue()); } }); Animation invalidShake = AnimationUtils.loadAnimation(getActivity(), R.anim.invalid_shake); invalidShake.setInterpolator(new CycleInterpolator(7F)); colorAnimation.start(); editText.startAnimation(invalidShake); }
Example #13
Source File: ValueAnimatorActivity.java From coursera-android with MIT License | 6 votes |
private void startAnimation() { final ImageView imageView = findViewById(R.id.image_view); ValueAnimator anim = ValueAnimator.ofObject(new ArgbEvaluator(), RED, BLUE); anim.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { imageView.setBackgroundColor((Integer) animation .getAnimatedValue()); } }); anim.setDuration(10000); anim.start(); }
Example #14
Source File: AbstractContentLoadingState.java From empty-state-recyclerview with MIT License | 6 votes |
@Override public final void onDrawState(final EmptyStateRecyclerView rv, Canvas canvas) { final int width = rv.getMeasuredWidth(); final int height = rv.getMeasuredHeight(); // Draw all of our content items renderContent(numberOfContentItems, width, height, canvas, contentPaint); // Setup and start animation, if possible if (animateContentItems) { if (anim == null) { this.anim = ObjectAnimator.ofObject(contentPaint, "color", new ArgbEvaluator(), Color.parseColor("#E0E0E0"), Color.parseColor("#BDBDBD"), Color.parseColor("#9E9E9E")); onInterceptAnimatorCreation(anim); this.anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { rv.invalidate(); } }); this.anim.start(); } } }
Example #15
Source File: MaterialViewPagerAnimator.java From MaterialViewPager with Apache License 2.0 | 6 votes |
/** * Change the color of the statusbackground, toolbar, toolbarlayout and pagertitlestrip * With a color transition animation * * @param color the final color * @param duration the transition color animation duration */ void setColor(int color, int duration) { final ValueAnimator colorAnim = ObjectAnimator.ofInt(mHeader.headerBackground, "backgroundColor", settings.color, color); colorAnim.setEvaluator(new ArgbEvaluator()); colorAnim.setDuration(duration); colorAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { final int animatedValue = (Integer) animation.getAnimatedValue(); int colorAlpha = colorWithAlpha(animatedValue, lastPercent); mHeader.headerBackground.setBackgroundColor(colorAlpha); mHeader.statusBackground.setBackgroundColor(colorAlpha); mHeader.toolbar.setBackgroundColor(colorAlpha); mHeader.toolbarLayoutBackground.setBackgroundColor(colorAlpha); mHeader.mPagerSlidingTabStrip.setBackgroundColor(colorAlpha); //set the new color as MaterialViewPager's color settings.color = animatedValue; } }); colorAnim.start(); }
Example #16
Source File: ContentItemLoadingStateFactory.java From empty-state-recyclerview with MIT License | 6 votes |
@Override public final void onDrawState(final EmptyStateRecyclerView rv, Canvas canvas) { final int width = rv.getMeasuredWidth(); final int height = rv.getMeasuredHeight(); // Draw all of our content items renderContent(numberOfContentItems, width, height, canvas, contentPaint); // Setup and start animation, if possible if (animateContentItems) { if (anim == null) { this.anim = ObjectAnimator.ofObject(contentPaint, "color", new ArgbEvaluator(), Color.parseColor("#E0E0E0"), Color.parseColor("#BDBDBD"), Color.parseColor("#9E9E9E")); onInterceptAnimatorCreation(anim); this.anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { rv.invalidate(); } }); this.anim.start(); } } }
Example #17
Source File: DefaultLoadingState.java From empty-state-recyclerview with MIT License | 6 votes |
@Override public void onDrawState(final EmptyStateRecyclerView rv, Canvas canvas) { canvas.drawText(title, (rv.getMeasuredWidth() >> 1), (rv.getMeasuredHeight() >> 1), textPaint); // Setup animator, if necessary if (anim == null) { this.anim = ObjectAnimator.ofObject(textPaint, "color", new ArgbEvaluator(), Color.parseColor("#E0E0E0"), Color.parseColor("#BDBDBD"), Color.parseColor("#9E9E9E")); this.anim.setDuration(900); this.anim.setRepeatMode(ValueAnimator.REVERSE); this.anim.setRepeatCount(ValueAnimator.INFINITE); this.anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { rv.invalidate(); } }); this.anim.start(); } }
Example #18
Source File: SunsetFragment.java From AndroidProgramming3e with Apache License 2.0 | 6 votes |
private void startAnimation() { float sunYStart = mSunView.getTop(); float sunYEnd = mSkyView.getHeight(); ObjectAnimator heightAnimator = ObjectAnimator .ofFloat(mSunView, "y", sunYStart, sunYEnd) .setDuration(3000); heightAnimator.setInterpolator(new AccelerateInterpolator()); ObjectAnimator sunsetSkyAnimator = ObjectAnimator .ofInt(mSkyView, "backgroundColor", mBlueSkyColor, mSunsetSkyColor) .setDuration(3000); sunsetSkyAnimator.setEvaluator(new ArgbEvaluator()); ObjectAnimator nightSkyAnimator = ObjectAnimator .ofInt(mSkyView, "backgroundColor", mSunsetSkyColor, mNightSkyColor) .setDuration(1500); nightSkyAnimator.setEvaluator(new ArgbEvaluator()); AnimatorSet animatorSet = new AnimatorSet(); animatorSet .play(heightAnimator) .with(sunsetSkyAnimator) .before(nightSkyAnimator); animatorSet.start(); }
Example #19
Source File: ExpandIconView.java From Android-ExpandIcon with Apache License 2.0 | 6 votes |
private void updateColor(@NonNull ArgbEvaluator colorEvaluator) { float fraction; int colorFrom; int colorTo; if (colorIntermediate != -1) { colorFrom = alpha <= 0f ? colorMore : colorIntermediate; colorTo = alpha <= 0f ? colorIntermediate : colorLess; fraction = alpha <= 0 ? (1 + alpha / 45f) : alpha / 45f; } else { colorFrom = colorMore; colorTo = colorLess; fraction = (alpha + 45f) / 90f; } color = (int) colorEvaluator.evaluate(fraction, colorFrom, colorTo); paint.setColor(color); }
Example #20
Source File: TouchStateAdapter.java From TouchEffects with MIT License | 6 votes |
@Override protected Animator createExtinctAnimator(View view) { ArgbEvaluator argbEvaluator = new ArgbEvaluator();//渐变色计算类 ValueAnimator valueAnimator; if(mColorValue < 0.5f){ valueAnimator = ValueAnimator.ofFloat(mColorValue,0.8f,0.6f,0.4f,0.2f,0f); }else{ valueAnimator = ValueAnimator.ofFloat(mColorValue,0f); } valueAnimator.setDuration(450); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { mColorValue = (float) animation.getAnimatedValue(); mCurrentColor = (int) (argbEvaluator.evaluate(mColorValue, TRANSPARENT_COLOR, mNormalColor)); view.invalidate(); } }); return valueAnimator; }
Example #21
Source File: ValueAnimatorActivity.java From coursera-android with MIT License | 6 votes |
public void startAnimation() { final ImageView imageView = (ImageView) findViewById(R.id.image_view); ValueAnimator anim = ValueAnimator.ofObject(new ArgbEvaluator(), RED, BLUE); anim.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { imageView.setBackgroundColor((Integer) animation .getAnimatedValue()); } }); anim.setDuration(10000); anim.start(); }
Example #22
Source File: RootActivity.java From Android-Plugin-Framework with MIT License | 5 votes |
private void fadeColoTo(int newColor, TextView view) { ObjectAnimator color = ObjectAnimator.ofObject(view, "TextColor", new ArgbEvaluator(), view.getCurrentTextColor(), newColor); color.setDuration(200); color.start(); }
Example #23
Source File: OC_MoreNumbers_S1.java From GLEXP-Team-onebillion with Apache License 2.0 | 5 votes |
public OBAnim firstNumsAnim(final OBLabel label,int colour) { final ArgbEvaluator evaluator = new ArgbEvaluator(); OBAnim anim = new OBAnimBlock() { @Override public void runAnimBlock(float frac) { label.setHighRange(0,label.text().length()-1,(int)evaluator.evaluate(frac, Color.BLACK, Color.RED)); } }; return anim; }
Example #24
Source File: SpringFloatingActionMenu.java From SpringFloatingActionMenu with Apache License 2.0 | 5 votes |
private void fadeOut() { int colorFrom = Color.parseColor("#40000000"); int colorTo = Color.parseColor("#00000000"); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); colorAnimation.setDuration(250); // milliseconds colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { setBackgroundColor((int) animator.getAnimatedValue()); } }); colorAnimation.start(); }
Example #25
Source File: MainActivity.java From welcome-coordinator with Apache License 2.0 | 5 votes |
private void initializeBackgroundTransitions() { final Resources resources = getResources(); final int colorPage1 = ResourcesCompat.getColor(resources, R.color.page1, getTheme()); final int colorPage2 = ResourcesCompat.getColor(resources, R.color.page2, getTheme()); final int colorPage3 = ResourcesCompat.getColor(resources, R.color.page3, getTheme()); final int colorPage4 = ResourcesCompat.getColor(resources, R.color.page4, getTheme()); backgroundAnimator = ValueAnimator .ofObject(new ArgbEvaluator(), colorPage1, colorPage2, colorPage3, colorPage4); backgroundAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { coordinatorLayout.setBackgroundColor((int) animation.getAnimatedValue()); } }); }
Example #26
Source File: VoIPActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void hideRetry(){ if(retryAnim!=null) retryAnim.cancel(); retrying=false; //bottomButtons.setVisibility(View.VISIBLE); ObjectAnimator colorAnim; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { colorAnim = ObjectAnimator.ofArgb(endBtnBg, "color", 0xFF45bc4d, 0xFFe61e44); } else { colorAnim = ObjectAnimator.ofInt(endBtnBg, "color", 0xFF45bc4d, 0xFFe61e44); colorAnim.setEvaluator(new ArgbEvaluator()); } AnimatorSet set=new AnimatorSet(); set.playTogether( colorAnim, ObjectAnimator.ofFloat(endBtnIcon, "rotation", -135, 0), ObjectAnimator.ofFloat(endBtn, "translationX", 0), ObjectAnimator.ofFloat(cancelBtn, "alpha", 0)//, //ObjectAnimator.ofFloat(bottomButtons, "alpha", 1) ); set.setStartDelay(200); set.setDuration(300); set.setInterpolator(CubicBezierInterpolator.DEFAULT); set.addListener(new AnimatorListenerAdapter(){ @Override public void onAnimationEnd(Animator animation){ cancelBtn.setVisibility(View.GONE); endBtn.setEnabled(true); retryAnim=null; } }); retryAnim=set; set.start(); }
Example #27
Source File: AllAppsTransitionController.java From LaunchEnr with GNU General Public License v3.0 | 5 votes |
public AllAppsTransitionController(Launcher l) { mLauncher = l; mDetector = new VerticalPullDetector(l); mDetector.setListener(this); mShiftRange = DEFAULT_SHIFT_RANGE; mProgress = 1f; mEvaluator = new ArgbEvaluator(); mAllAppsBackgroundColor = PreferencesState.isDarkThemeEnabled(l) ? ContextCompat.getColor(l, R.color.material_dark) : ContextCompat.getColor(l, R.color.material_light_o); }
Example #28
Source File: CircularProgressButton.java From ProgressButton with Apache License 2.0 | 5 votes |
private void animateIdleStateButtonAfterClick() { int textColorChangeDuration = 10; ObjectAnimator colorAnim = ObjectAnimator.ofInt(this, "textColor", getNormalColor(this.getTextColors()), mIdleStateTextColorAfterClick); colorAnim.setDuration(textColorChangeDuration); colorAnim.setEvaluator(new ArgbEvaluator()); colorAnim.start(); ObjectAnimator colorAnim1 = ObjectAnimator.ofInt(this, "textColor", mIdleStateTextColorAfterClick, getNormalColor(this.getTextColors())); colorAnim1.setDuration(0); colorAnim1.setStartDelay(IDLE_STATE_ANIMATION_DURATION_AFTER_CLICK - textColorChangeDuration); colorAnim1.setEvaluator(new ArgbEvaluator()); colorAnim1.setInterpolator(new BounceInterpolator()); colorAnim1.start(); ObjectAnimator bgAnim = ObjectAnimator.ofInt(this, "backgroundColor", getNormalColor(mIdleColorState), mIdleStateBackgroundColorAfterClick); bgAnim.setDuration(0); bgAnim.setEvaluator(new ArgbEvaluator()); bgAnim.start(); int textSizeAnimationDuration = 150; ValueAnimator animator = ValueAnimator.ofFloat(textSize, textSize - textSize / 4); animator.setDuration(textSizeAnimationDuration); animator.setRepeatCount(1); animator.setRepeatMode(ValueAnimator.REVERSE); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float animatedValue = (float) valueAnimator.getAnimatedValue(); setTextSize(animatedValue); } }); animator.start(); }
Example #29
Source File: VoIPActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void showRetry(){ if(retryAnim!=null) retryAnim.cancel(); endBtn.setEnabled(false); retrying=true; cancelBtn.setVisibility(View.VISIBLE); cancelBtn.setAlpha(0); AnimatorSet set=new AnimatorSet(); ObjectAnimator colorAnim; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { colorAnim = ObjectAnimator.ofArgb(endBtnBg, "color", 0xFFe61e44, 0xFF45bc4d); } else { colorAnim = ObjectAnimator.ofInt(endBtnBg, "color", 0xFFe61e44, 0xFF45bc4d); colorAnim.setEvaluator(new ArgbEvaluator()); } set.playTogether( ObjectAnimator.ofFloat(cancelBtn, "alpha", 0, 1), ObjectAnimator.ofFloat(endBtn, "translationX", 0, content.getWidth()/2-AndroidUtilities.dp(52)-endBtn.getWidth()/2), colorAnim, ObjectAnimator.ofFloat(endBtnIcon, "rotation", 0, -135)//, //ObjectAnimator.ofFloat(spkToggle, "alpha", 0), //ObjectAnimator.ofFloat(micToggle, "alpha", 0), //ObjectAnimator.ofFloat(chatBtn, "alpha", 0) ); set.setStartDelay(200); set.setDuration(300); set.setInterpolator(CubicBezierInterpolator.DEFAULT); set.addListener(new AnimatorListenerAdapter(){ @Override public void onAnimationEnd(Animator animation){ //bottomButtons.setVisibility(View.GONE); retryAnim=null; endBtn.setEnabled(true); } }); retryAnim=set; set.start(); }
Example #30
Source File: BaseWeatherType.java From FakeWeather with Apache License 2.0 | 5 votes |
public void startAnimation(DynamicWeatherView dynamicWeatherView, int fromColor) { ValueAnimator animator = ValueAnimator.ofObject(new ArgbEvaluator(), fromColor, color); animator.setInterpolator(new LinearInterpolator()); animator.setDuration(1000); animator.setRepeatCount(0); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { dynamicColor = (int) animation.getAnimatedValue(); } }); animator.start(); }