@Override public void onStart() { if (animatable != null) { animatable.start(); } }
@Override public void onAnimationStart(Animator animation) { animatable.start(); } });
/** * Start showing progress. */ public void start(){ if(mProgressDrawable != null) ((Animatable)mProgressDrawable).start(); }
private void maybeUpdateAnimatable(@Nullable Z resource) { if (resource instanceof Animatable) { animatable = (Animatable) resource; animatable.start(); } else { animatable = null; } }
/** * Create or update the drawable on the target {@link ImageView} to display the supplied * placeholder image. */ static void setPlaceholder(ImageView target, @Nullable Drawable placeholderDrawable) { target.setImageDrawable(placeholderDrawable); if (target.getDrawable() instanceof Animatable) { ((Animatable) target.getDrawable()).start(); } }
@Override public void onStartAnimator(@NonNull RefreshLayout refreshLayout, int height, int maxDragHeight) { final View progressView = mProgressView; if (progressView.getVisibility() != VISIBLE) { progressView.setVisibility(VISIBLE); Drawable drawable = mProgressView.getDrawable(); if (drawable instanceof Animatable) { ((Animatable) drawable).start(); } else { progressView.animate().rotation(36000).setDuration(100000); } } }
private void animateNavIcon() { if (navIconShown) { this.navIcon.setImageResource(R.drawable.ic_menu_animated); } else { this.navIcon.setImageResource(R.drawable.ic_back_animated); } Drawable mDrawable = navIcon.getDrawable(); if (mDrawable instanceof Animatable) { ((Animatable) mDrawable).start(); } navIconShown = !navIconShown; }
@Override public void start() { Drawable dr = getCurrent(); if (dr != null && dr instanceof Animatable) { ((Animatable) dr).start(); } }
void drawTrack(Canvas canvas) { final Drawable d = mIndicator; if (d != null) { // Translate canvas so a indeterminate circular progress bar with padding // rotates properly in its animation final int saveCount = canvas.save(); canvas.translate(getPaddingLeft(), getPaddingTop()); d.draw(canvas); canvas.restoreToCount(saveCount); if (mShouldStartAnimationDrawable && d instanceof Animatable) { ((Animatable) d).start(); mShouldStartAnimationDrawable = false; } } }
@Override public boolean onCreateOptionsMenu(final Menu menu) { getMenuInflater().inflate(R.menu.ucrop_menu_activity, menu); // Change crop & loader menu icons color to match the rest of the UI colors MenuItem menuItemLoader = menu.findItem(R.id.menu_loader); Drawable menuItemLoaderIcon = menuItemLoader.getIcon(); if (menuItemLoaderIcon != null) { try { menuItemLoaderIcon.mutate(); menuItemLoaderIcon.setColorFilter(mToolbarWidgetColor, PorterDuff.Mode.SRC_ATOP); menuItemLoader.setIcon(menuItemLoaderIcon); } catch (IllegalStateException e) { Log.i(TAG, String.format("%s - %s", e.getMessage(), getString(R.string.ucrop_mutate_exception_hint))); } ((Animatable) menuItemLoader.getIcon()).start(); } MenuItem menuItemCrop = menu.findItem(R.id.menu_crop); Drawable menuItemCropIcon = ContextCompat.getDrawable(this, mToolbarCropDrawable); if (menuItemCropIcon != null) { menuItemCropIcon.mutate(); menuItemCropIcon.setColorFilter(mToolbarWidgetColor, PorterDuff.Mode.SRC_ATOP); menuItemCrop.setIcon(menuItemCropIcon); } return true; }
@Override public boolean onOptionsItemSelected(MenuItem item) { Drawable drawable = item.getIcon(); if (drawable instanceof Animatable) { ((Animatable) drawable).start(); } switch (item.getItemId()) { case R.id.action_cut: return true; case R.id.action_copy: return true; case R.id.action_share: return true; case R.id.action_delete: return true; default: return super.onOptionsItemSelected(item); } }
private void animateProgress(ItemHeartCardBinding binding) { binding.favorite.setImageResource(R.drawable.avd_favorite_progress); ((Animatable) binding.favorite.getDrawable()).start(); }
/** * Create or update the drawable on the target {@link ImageView} to display the supplied bitmap * image. */ static void setResult(ImageView target, Context context, RequestHandler.Result result, boolean noFade, boolean debugging) { Drawable placeholder = target.getDrawable(); if (placeholder instanceof Animatable) { ((Animatable) placeholder).stop(); } Bitmap bitmap = result.getBitmap(); if (bitmap != null) { Picasso.LoadedFrom loadedFrom = result.getLoadedFrom(); PicassoDrawable drawable = new PicassoDrawable(context, bitmap, placeholder, loadedFrom, noFade, debugging); target.setImageDrawable(drawable); return; } Drawable drawable = result.getDrawable(); if (drawable != null) { target.setImageDrawable(drawable); if (drawable instanceof Animatable) { ((Animatable) drawable).start(); } } }
private void bindIcon(ItemHeaderBinding viewBinding) { viewBinding.icon.setVisibility(View.VISIBLE); viewBinding.icon.setImageResource(expandableGroup.isExpanded() ? R.drawable.collapse_animated : R.drawable.expand_animated); Animatable drawable = (Animatable) viewBinding.icon.getDrawable(); drawable.start(); }
@Override public void onClick(View v) { if (v instanceof ImageView) { Drawable drawable = ((ImageView) v).getDrawable(); if (drawable instanceof Animatable) { ((Animatable) drawable).start(); } } } }
void drawTrack(Canvas canvas) { final Drawable d = mIndicator; if (d != null) { // Translate canvas so a indeterminate circular progress bar with padding // rotates properly in its animation final int saveCount = canvas.save(); canvas.translate(getPaddingLeft(), getPaddingTop()); d.draw(canvas); canvas.restoreToCount(saveCount); if (mShouldStartAnimationDrawable) { ((Animatable) d).start(); mShouldStartAnimationDrawable = false; } } }
private void changeAnimation(Operation operation) { Drawable[] drawables = textView.getCompoundDrawables(); for (Drawable drawable : drawables) { if (drawable != null && drawable instanceof Animatable) { Animatable animatable = ((Animatable) drawable); switch (operation) { case START: animatable.start(); break; case STOP: animatable.stop(); break; } } } } }
/** * Close the menu. */ public void close() { updateDimensions(width, height); state = State.CLOSED; showIcons(false); animator[LEFT].setFloatValues(0, button[LEFT]); animator[RIGHT].setFloatValues(width, button[RIGHT]); animator[RADIUS].setFloatValues(0, button[RADIUS]); animator[TOP].setFloatValues(0, button[TOP]); animator[BOTTOM].setFloatValues(height, button[BOTTOM]); animatorSet.cancel(); animatorSet.start(); if (iconClosedDrawable instanceof Animatable) { ((Animatable) iconClosedDrawable).start(); } this.animate() .y(yPosition) .setDuration(animationDuration) .setInterpolator(DECELERATE_INTERPOLATOR) .start(); }
/** * Open the menu. */ public void open() { state = State.OPENED; showIcons(true); animator[LEFT].setFloatValues(button[LEFT], 0); animator[RIGHT].setFloatValues(button[RIGHT], width); animator[RADIUS].setFloatValues(button[RADIUS], 0); animator[TOP].setFloatValues(button[TOP], 0); animator[BOTTOM].setFloatValues(button[BOTTOM], height); animatorSet.cancel(); animatorSet.start(); if (iconOpenedDrawable instanceof Animatable) { ((Animatable) iconOpenedDrawable).start(); } ViewGroup parentView = (ViewGroup) TapBarMenu.this.getParent(); this.animate() .y(menuAnchor == MENU_ANCHOR_BOTTOM ? parentView.getBottom() - height : 0) .setDuration(animationDuration) .setInterpolator(DECELERATE_INTERPOLATOR) .start(); }
@Override protected void drawableStateChanged() { super.drawableStateChanged(); // autostart if(getDrawable().getCurrent() instanceof Animatable) { Animatable animatable = (Animatable) getDrawable().getCurrent(); if(!animatable.isRunning()) animatable.start(); } if (tint != null && tint.isStateful()) { setColorFilter(tint.getColorForState(getDrawableState(), 0)); } }