com.bumptech.glide.load.DataSource Java Examples
The following examples show how to use
com.bumptech.glide.load.DataSource.
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: GlidePalette.java From GlidePalette with Apache License 2.0 | 6 votes |
@Override public boolean onResourceReady(TranscodeType resource, Object model, Target<TranscodeType> target, DataSource dataSource, boolean isFirstResource) { boolean callbackResult = this.callback != null && this.callback.onResourceReady(resource, model, target, dataSource, isFirstResource); Bitmap b = null; if (resource instanceof BitmapDrawable) { b = ((BitmapDrawable) resource).getBitmap(); } else if (resource instanceof GifDrawable) { b = ((GifDrawable) resource).getFirstFrame(); } else if (target instanceof BitmapHolder) { b = ((BitmapHolder) target).getBitmap(); } if (b != null) { start(b); } return callbackResult; }
Example #2
Source File: DilbertFragment.java From Simple-Dilbert with Apache License 2.0 | 5 votes |
@Override public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) { if (progress != null) { progress.setVisibility(View.GONE); } applyZoomLevel(); return false; }
Example #3
Source File: LoggingListener.java From glide-support with The Unlicense | 5 votes |
@Override public boolean onResourceReady(R resource, Object model, Target<R> target, DataSource dataSource, boolean isFirstResource) { String resourceString = strip(getResourceDescription(resource)); String targetString = strip(getTargetDescription(target)); android.util.Log.println(level, "GLIDE", String.format(Locale.ROOT, "%s.onResourceReady(%s, %s, %s, %s, %s)", name, resourceString, model, targetString, dataSource, isFirst(isFirstResource))); return delegate.onResourceReady(resource, model, target, dataSource, isFirstResource); }
Example #4
Source File: FileExpandableAdapter.java From ShareBox with Apache License 2.0 | 5 votes |
@Override public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) { if (model instanceof String) { CacheUtil.makeCache((String) model, ImageUtil.drawable2Bitmap(resource), resource.getIntrinsicWidth(), resource.getIntrinsicHeight(), mContext); } return false; }
Example #5
Source File: NowPlayingActivity.java From PainlessMusicPlayer with Apache License 2.0 | 5 votes |
@Override public boolean onResourceReady( @NonNull final Drawable resource, @NonNull final Object model, @NonNull final Target<Drawable> target, @NonNull final DataSource dataSource, final boolean isFirstResource) { onArtProcessed(); return false; }
Example #6
Source File: QueueActivity.java From PainlessMusicPlayer with Apache License 2.0 | 5 votes |
@Override public boolean onResourceReady( @NonNull final Drawable resource, @NonNull final Object model, @NonNull final Target<Drawable> target, @NonNull final DataSource dataSource, final boolean isFirstResource) { onImageSet(); return false; }
Example #7
Source File: ImageLoader.java From Android-App-Architecture-MVVM-Databinding with Apache License 2.0 | 5 votes |
@Override public boolean onResourceReady(final Drawable resource, final Object model, final Target<Drawable> target, final DataSource dataSource, final boolean isFirstResource) { if (BuildConfig.DEBUG) { Log.i(TAG, String.format(Locale.ROOT, "GLIDE onResourceReady(%s, %s, %s, %s, %s)", resource, model, target, dataSource, isFirstResource)); } return false; }
Example #8
Source File: SvgSoftwareLayerSetter.java From GlideToVectorYou with Apache License 2.0 | 5 votes |
@Override public boolean onResourceReady(PictureDrawable resource, Object model, Target<PictureDrawable> target, DataSource dataSource, boolean isFirstResource) { ImageView view = ((ImageViewTarget<?>) target).getView(); view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null); if (customListener != null) { customListener.onResourceReady(); } return false; }
Example #9
Source File: ConditionalAlbumListFragment.java From PainlessMusicPlayer with Apache License 2.0 | 5 votes |
@Override public boolean onResourceReady( @NonNull final Drawable resource, @NonNull final Object model, @NonNull final Target<Drawable> target, @NonNull final DataSource dataSource, final boolean isFirstResource) { final FragmentActivity activity = getActivity(); if (activity != null) { activity.supportStartPostponedEnterTransition(); } return false; }
Example #10
Source File: GiphyAdapter.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
@Override public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) { synchronized (this) { if (new ChunkedImageUrl(image.getGifUrl(), image.getGifSize()).equals(model)) { this.modelReady = true; notifyAll(); } } return false; }
Example #11
Source File: DemoGlideHelper.java From GestureViews with Apache License 2.0 | 5 votes |
@Override public boolean onResourceReady(T resource, Object model, Target<T> target, DataSource dataSource, boolean isFirstResource) { if (listener != null) { listener.onSuccess(); } return false; }
Example #12
Source File: ImagePagerAdapter.java From Hentoid with Apache License 2.0 | 4 votes |
@Override public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) { if (Preferences.Constant.PREF_VIEWER_ORIENTATION_VERTICAL == viewerOrientation) adjustHeight(resource.getIntrinsicHeight()); return false; }
Example #13
Source File: SingleSignOnStreamFetcher.java From nextcloud-notes with GNU General Public License v3.0 | 4 votes |
@NonNull @Override public DataSource getDataSource() { return DataSource.REMOTE; }
Example #14
Source File: GlideVFSLoader.java From Zom-Android-XMPP with GNU General Public License v3.0 | 4 votes |
@NonNull @Override public DataSource getDataSource() { return DataSource.LOCAL; }
Example #15
Source File: FirebaseImageLoader.java From FirebaseUI-Android with Apache License 2.0 | 4 votes |
@NonNull @Override public DataSource getDataSource() { return DataSource.REMOTE; }
Example #16
Source File: AvatarStreamFetcher.java From hipda with GNU General Public License v2.0 | 4 votes |
@NonNull @Override public DataSource getDataSource() { return DataSource.REMOTE; }
Example #17
Source File: ImageStreamFetcher.java From hipda with GNU General Public License v2.0 | 4 votes |
@NonNull @Override public DataSource getDataSource() { return DataSource.REMOTE; }
Example #18
Source File: GalleryAdapter.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 4 votes |
@Override public boolean onResourceReady(Drawable drawable, Object o, Target<Drawable> target, DataSource dataSource, boolean b) { callbackActivity(); return false; }
Example #19
Source File: ContactPhotoFetcher.java From deltachat-android with GNU General Public License v3.0 | 4 votes |
@NonNull @Override public DataSource getDataSource() { return DataSource.LOCAL; }
Example #20
Source File: TinyGifDrawableLoader.java From BaseProject with Apache License 2.0 | 4 votes |
@Override public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) { GifDrawable loadedDrawable = resource; if (loadedDrawable != null) { if (loadCallback != null || playTimes >= 1) {//指定了播放次数,则需要监听动画执行的结束 loadedDrawable.registerAnimationCallback(this); } //默认是循环播放的 if (playTimes >= 1) { loadedDrawable.setLoopCount(playTimes); if (isToJudgePlayEndWithPlayDuration) { if (playTotalDuration == 0) { //计算出播放的总时长 try { Field gifStateField = GifDrawable.class.getDeclaredField("state"); gifStateField.setAccessible(true); Class gifStateClass = Class.forName("com.bumptech.glide.load.resource.gif.GifDrawable$GifState"); Field gifFrameLoaderField = gifStateClass.getDeclaredField("frameLoader"); gifFrameLoaderField.setAccessible(true); Class gifFrameLoaderClass = Class.forName("com.bumptech.glide.load.resource.gif.GifFrameLoader"); Field gifDecoderField = gifFrameLoaderClass.getDeclaredField("gifDecoder"); gifDecoderField.setAccessible(true); Class gifDecoderClass = Class.forName("com.bumptech.glide.gifdecoder.GifDecoder"); Object gifDecoder = gifDecoderField.get(gifFrameLoaderField.get(gifStateField.get(loadedDrawable))); Method getDelayMethod = gifDecoderClass.getDeclaredMethod("getDelay", int.class); getDelayMethod.setAccessible(true); int frameCount = loadedDrawable.getFrameCount(); int framePlayDelay = 0; for (int frame = 0; frame < frameCount; frame++) { framePlayDelay += (int) getDelayMethod.invoke(gifDecoder, frame); } playTotalDuration = this.playTimes * framePlayDelay; } catch (Exception e) { e.printStackTrace(); } } } //计时 if (playTotalDuration > 0 && isToJudgePlayEndWithPlayDuration) { startPlay(false); } } } loadCallback(true, false, loadedDrawable, playTotalDuration, null); this.curGifDrawable = loadedDrawable; return false; }
Example #21
Source File: ImageUtil.java From BaseProject with Apache License 2.0 | 4 votes |
public static void loadGifModel(Context context, Object mayBeGifModel, @RawRes @DrawableRes int defHolderPicRes, ImageView ivTarget, final int needPlayTime) { if (mayBeGifModel == null) { return; } RequestBuilder<GifDrawable> gifDrawableBuilder = null; try { gifDrawableBuilder = Glide.with(context).asGif() ; } catch (Exception e) { //java.lang.IllegalArgumentException You cannot start a load for a destroyed activity gifDrawableBuilder = null; e.printStackTrace(); } if (gifDrawableBuilder == null) { return; } if (defHolderPicRes != 0) { gifDrawableBuilder.placeholder(defHolderPicRes) .error(defHolderPicRes); } RequestListener<GifDrawable> loadGifDrawableListener = null; if (needPlayTime >= 1) { loadGifDrawableListener = new RequestListener<GifDrawable>() { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) { return false; } @Override public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) { resource.setLoopCount(needPlayTime); return false; } }; gifDrawableBuilder.listener(loadGifDrawableListener); } if (mayBeGifModel instanceof Integer) {//还有:load(Bitmap xx);load(byte[]xxx);loadDrawable(Drawable xx);有差异 Integer gifResId = (Integer) mayBeGifModel; if (gifResId != 0) { gifDrawableBuilder.load(gifResId); } else { return; } } else{ gifDrawableBuilder.load(mayBeGifModel); } gifDrawableBuilder.into(ivTarget); }
Example #22
Source File: OkHttpStreamFetcher.java From MVPArms with Apache License 2.0 | 4 votes |
@NonNull @Override public DataSource getDataSource() { return DataSource.REMOTE; }
Example #23
Source File: ArtistImageFetcher.java From VinylMusicPlayer with GNU General Public License v3.0 | 4 votes |
@NonNull @Override public DataSource getDataSource() { return DataSource.REMOTE; }
Example #24
Source File: NoOpRequestListener.java From glide-support with The Unlicense | 4 votes |
@Override public boolean onResourceReady(R resource, Object model, Target<R> target, DataSource dataSource, boolean isFirstResource) { return false; }
Example #25
Source File: OkHttpStreamFetcher.java From pandroid with Apache License 2.0 | 4 votes |
@NonNull @Override public DataSource getDataSource() { return DataSource.REMOTE; }
Example #26
Source File: OkHttpFetcher.java From AndroidProject with Apache License 2.0 | 4 votes |
@NonNull @Override public DataSource getDataSource() { return DataSource.REMOTE; }
Example #27
Source File: OkHttpStreamFetcher.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
@Override public @NonNull DataSource getDataSource() { return DataSource.REMOTE; }
Example #28
Source File: ChunkedImageUrlFetcher.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
@NonNull @Override public DataSource getDataSource() { return DataSource.REMOTE; }
Example #29
Source File: ContactPhotoFetcher.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
@Override public @NonNull DataSource getDataSource() { return DataSource.LOCAL; }
Example #30
Source File: AttachmentStreamLocalUriFetcher.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
@Override public @NonNull DataSource getDataSource() { return DataSource.LOCAL; }