@Override public void onStop() { if (animatable != null) { animatable.stop(); } }
/** * Stop showing progress. */ public void stop(){ if(mProgressDrawable != null) ((Animatable)mProgressDrawable).stop(); }
@Override public void error(Exception e) { Drawable placeholder = target.getDrawable(); if (placeholder instanceof Animatable) { ((Animatable) placeholder).stop(); } if (errorResId != 0) { target.setImageResource(errorResId); } else if (errorDrawable != null) { target.setImageDrawable(errorDrawable); } if (callback != null) { callback.onError(e); } }
@Override public int onFinish(@NonNull RefreshLayout refreshLayout, boolean success) { final View progressView = mProgressView; Drawable drawable = mProgressView.getDrawable(); if (drawable instanceof Animatable) { if (((Animatable) drawable).isRunning()) { ((Animatable) drawable).stop(); } } else { progressView.animate().rotation(0).setDuration(0); } progressView.setVisibility(GONE); return mFinishDuration;//延迟500毫秒之后再弹回 }
@Override public void stop() { Drawable dr = getCurrent(); if (dr != null && dr instanceof Animatable) { ((Animatable) dr).stop(); } }
/** * Sets the given {@link android.graphics.drawable.Drawable} on the view using {@link * android.widget.ImageView#setImageDrawable(android.graphics.drawable.Drawable)}. * * @param placeholder {@inheritDoc} */ @Override public void onLoadCleared(@Nullable Drawable placeholder) { super.onLoadCleared(placeholder); if (animatable != null) { animatable.stop(); } setResourceInternal(null); setDrawable(placeholder); }
@Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { final View arrowView = mArrowView; final View progressView = mProgressView; arrowView.animate().cancel(); progressView.animate().cancel(); } final Drawable drawable = mProgressView.getDrawable(); if (drawable instanceof Animatable) { if (((Animatable) drawable).isRunning()) { ((Animatable) drawable).stop(); } } }
/** * 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 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; } } } } }
@Override public void onStop() { if (animatable != null) { animatable.stop(); } }
private void restartCursiveAnimation() { cursiveAvd.stop(); cursiveAvd.start(); } }
@Override public void onUIRefreshComplete(PtrFrameLayout frame) { statusHint.setText(com.chanven.lib.cptr.R.string.cube_ptr_refresh_complete); SharedPreferences sharedPreferences = getContext().getSharedPreferences(UPDATE_TIME_KEY, 0); if (!TextUtils.isEmpty(mLastUpdateTimeKey)) { mLastUpdateTime = new Date().getTime(); sharedPreferences.edit().putLong(mLastUpdateTimeKey, mLastUpdateTime).commit(); } ((Animatable) loadingImage.getDrawable()).stop(); loadingImage.setVisibility(GONE); }
/** * <p>Stop the indeterminate progress animation.</p> */ void stopAnimation() { mAnimation = null; mTransformation = null; if (mIndeterminateDrawable instanceof Animatable) { ((Animatable) mIndeterminateDrawable).stop(); mShouldStartAnimationDrawable = false; } postInvalidate(); }
/** * <p>Stop the indeterminate progress animation.</p> */ void stopAnimation() { mAnimation = null; mTransformation = null; if (mIndeterminateDrawable instanceof Animatable) { ((Animatable) mIndeterminateDrawable).stop(); mShouldStartAnimationDrawable = false; } postInvalidate(); }
@Override public void onUIRefreshBegin(PtrFrameLayout frame) { mShouldShowLastUpdate = false; statusHint.setText(com.chanven.lib.cptr.R.string.cube_ptr_refreshing); updateLastTime(); mLastUpdateTimeUpdater.stop(); loadingImage.setVisibility(VISIBLE); ((Animatable) loadingImage.getDrawable()).start(); }
private void handleScanStateChanged(boolean state) { if (mScanState == state) return; mScanState = state; final Animatable anim = (Animatable) mQsDetailHeaderProgress.getDrawable(); if (state) { mQsDetailHeaderProgress.animate().alpha(1f); anim.start(); } else { mQsDetailHeaderProgress.animate().alpha(0f); anim.stop(); } }
@Override public void hideProgress() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (mFab.getDrawable() instanceof Animatable) { ((Animatable) mFab.getDrawable()).stop(); } } else { //低于5.0,显示其他动画 } }
@Override public void hideProgress() { mSwipeRefreshLayout.post(() -> mSwipeRefreshLayout.setRefreshing(false)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (mFab.getDrawable() instanceof Animatable) { ((Animatable) mFab.getDrawable()).stop(); } } else { //低于5.0,显示其他动画 } }
@Override protected void onDestroy() { // eBookPresenter.cancelLoading(); if (mFab.getDrawable() instanceof Animatable) { ((Animatable) mFab.getDrawable()).stop(); } super.onDestroy(); }
@Override protected void onDestroy() { bookDetailPresenter.cancelLoading(); if (mFab.getDrawable() instanceof Animatable) { ((Animatable) mFab.getDrawable()).stop(); } super.onDestroy(); }