com.bumptech.glide.request.RequestFutureTarget Java Examples
The following examples show how to use
com.bumptech.glide.request.RequestFutureTarget.
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: GenericRequestBuilder.java From giffun with Apache License 2.0 | 6 votes |
/** * Returns a future that can be used to do a blocking get on a background thread. * * @param width The desired width in pixels, or {@link Target#SIZE_ORIGINAL}. This will be overridden by * {@link #override * (int, int)} if previously called. * @param height The desired height in pixels, or {@link Target#SIZE_ORIGINAL}. This will be overridden by * {@link #override * (int, int)}} if previously called). * * @see Glide#clear(FutureTarget) * * @return An {@link FutureTarget} that can be used to obtain the * resource in a blocking manner. */ public FutureTarget<TranscodeType> into(int width, int height) { final RequestFutureTarget<ModelType, TranscodeType> target = new RequestFutureTarget<ModelType, TranscodeType>(glide.getMainHandler(), width, height); // TODO: Currently all loads must be started on the main thread... glide.getMainHandler().post(new Runnable() { @Override public void run() { if (!target.isCancelled()) { into(target); } } }); return target; }
Example #2
Source File: ReadAloudService.java From HaoReader with GNU General Public License v3.0 | 6 votes |
/** * 更新通知 */ private void updateNotification() { final int dimen = DensityUtil.dp2px(this, 128); Glide.with(this) .asBitmap() .load(cover) .into(new RequestFutureTarget<Bitmap>(dimen, dimen) { @Override public synchronized void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { showNotification(resource); } @Override public synchronized void onLoadFailed(@Nullable Drawable errorDrawable) { showNotification(BitmapFactory.decodeResource(getResources(), R.drawable.img_cover_default)); } }); }
Example #3
Source File: AudioBookPlayService.java From HaoReader with GNU General Public License v3.0 | 6 votes |
private void updateNotification() { final String coverUrl = bookShelfBean == null ? null : bookShelfBean.getBookInfoBean().getRealCoverUrl(); final int dimen = DensityUtil.dp2px(this, 128); Glide.with(this) .asBitmap() .load(coverUrl) .into(new RequestFutureTarget<Bitmap>(dimen, dimen) { @Override public synchronized void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { showNotification(resource); } @Override public synchronized void onLoadFailed(@Nullable Drawable errorDrawable) { showNotification(BitmapFactory.decodeResource(getResources(), R.drawable.img_cover_default)); } }); }