Java Code Examples for com.bumptech.glide.RequestManager#load()
The following examples show how to use
com.bumptech.glide.RequestManager#load() .
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: ZoomFragment.java From NClientV2 with Apache License 2.0 | 6 votes |
@Nullable private RequestBuilder<Drawable> loadPage() { RequestBuilder<Drawable> request; RequestManager glide=GlideX.with(photoView); if(glide==null)return null; File file=LocalGallery.getPage(galleryFolder,page+1); if(file!=null){ request=glide.load(file); }else { if (url==null) request = glide.load(R.mipmap.ic_launcher); else { LogUtility.d("Requested url glide: "+ url); request = glide.load(url); } } return request; }
Example 2
Source File: ImageLoader.java From AccountBook with GNU General Public License v3.0 | 6 votes |
private DrawableRequestBuilder load(Object object, RequestManager with){ DrawableRequestBuilder builder = null; if(object instanceof String){ String imageUrl = (String) object; if(!imageUrl.startsWith("http://")){ imageUrl = Api.IMG_SERVER_URL.concat(imageUrl); } builder = with.load(imageUrl); }else if(object instanceof Integer){ builder = with.load((Integer) object); }else if(object instanceof File){ builder = with.load((File) object); }else if(object instanceof Uri){ builder = with.load((Uri) object); }else if(object instanceof Byte[]){ builder = with.load((Byte[]) object); } return builder; }
Example 3
Source File: AFGlideUtil.java From AFBaseLibrary with Apache License 2.0 | 6 votes |
@Nullable private static DrawableTypeRequest getDrawableTypeRequest(Object obj, View img) { if (img == null || obj == null) return null; Context context = img.getContext(); RequestManager manager = Glide.with(context); DrawableTypeRequest drawableTypeRequest = null; if (obj instanceof String) { drawableTypeRequest = manager.load((String) obj); } else if (obj instanceof Integer) { drawableTypeRequest = manager.load((Integer) obj); } else if (obj instanceof Uri) { drawableTypeRequest = manager.load((Uri) obj); } else if (obj instanceof File) { drawableTypeRequest = manager.load((File) obj); } return drawableTypeRequest; }
Example 4
Source File: UsageExampleNetworkDependent.java From android-tutorials-glide with MIT License | 5 votes |
private void loadNetworkDependent() { RequestManager requestManager = Glide.with(context); DrawableTypeRequest<String> request; // if you need transformations or other options specific for the load, chain them here if (deviceOnWifi()) { request = requestManager.load("http://www.placehold.it/750x750"); } else { request = requestManager.load("http://www.placehold.it/100x100"); } request.into(imageView1); }
Example 5
Source File: ArtistGlideRequest.java From Phonograph with GNU General Public License v3.0 | 5 votes |
public static DrawableTypeRequest createBaseRequest(RequestManager requestManager, Artist artist, boolean noCustomImage) { boolean hasCustomImage = CustomArtistImageUtil.getInstance(App.getInstance()).hasCustomArtistImage(artist); if (noCustomImage || !hasCustomImage) { final List<AlbumCover> songs = new ArrayList<>(); for (final Album album : artist.albums) { final Song song = album.safeGetFirstSong(); songs.add(new AlbumCover(album.getYear(), song.data)); } return requestManager.load(new ArtistImage(artist.getName(), songs)); } else { return requestManager.load(CustomArtistImageUtil.getFile(artist)); } }
Example 6
Source File: SongGlideRequest.java From Phonograph with GNU General Public License v3.0 | 5 votes |
public static DrawableTypeRequest createBaseRequest(RequestManager requestManager, Song song, boolean ignoreMediaStore) { if (ignoreMediaStore) { return requestManager.load(new AudioFileCover(song.data)); } else { return requestManager.loadFromMediaStore(MusicUtil.getMediaStoreAlbumCoverUri(song.albumId)); } }
Example 7
Source File: ArtistGlideRequest.java From RetroMusicPlayer with GNU General Public License v3.0 | 5 votes |
public static DrawableTypeRequest createBaseRequest(RequestManager requestManager, Artist artist, boolean noCustomImage, boolean forceDownload) { boolean hasCustomImage = CustomArtistImageUtil.getInstance(RetroApplication.getInstance()).hasCustomArtistImage(artist); if (noCustomImage || !hasCustomImage) { return requestManager.load(new ArtistImage(artist.getName(), forceDownload)); } else { return requestManager.load(CustomArtistImageUtil.getFile(artist)); } }
Example 8
Source File: SongGlideRequest.java From RetroMusicPlayer with GNU General Public License v3.0 | 5 votes |
public static DrawableTypeRequest createBaseRequest(RequestManager requestManager, Song song, boolean ignoreMediaStore) { if (ignoreMediaStore) { return requestManager.load(new AudioFileCover(song.data)); } else { return requestManager.loadFromMediaStore(MusicUtil.getMediaStoreAlbumCoverUri(song.albumId)); } }
Example 9
Source File: SongGlideRequest.java From Orin with GNU General Public License v3.0 | 5 votes |
public static DrawableTypeRequest createBaseRequest(RequestManager requestManager, Song song, boolean ignoreMediaStore) { if (ignoreMediaStore) { return requestManager.load(new AudioFileCover(song.data)); } else { return requestManager.loadFromMediaStore(MusicUtil.getMediaStoreAlbumCoverUri(song.albumId)); } }
Example 10
Source File: GlideLoader.java From ImageLoader with Apache License 2.0 | 5 votes |
@Nullable private DrawableTypeRequest getDrawableTypeRequest(SingleConfig config, RequestManager requestManager) { DrawableTypeRequest request = null; if(!TextUtils.isEmpty(config.getUrl())){ request= requestManager.load(MyUtil.appendUrl(config.getUrl())); }else if(!TextUtils.isEmpty(config.getFilePath())){ request= requestManager.load(config.getFilePath()); }else if(!TextUtils.isEmpty(config.getContentProvider())){ request= requestManager.loadFromMediaStore(Uri.parse(config.getContentProvider())); }else if(config.getResId() != 0){ request= requestManager.load(config.getResId()); }else if(config.getBytes() != null){ request = requestManager.load(config.getBytes()); } else { //request= requestManager.load("http://www.baidu.com/1.jpg");//故意失败 int resId = getUseableResId(config); if(resId != 0){ request = requestManager.load(resId); }else { request= requestManager.load(""); } } /* if(!TextUtils.isEmpty(config.getUrl()) && config.getUrl().contains(".gif")){ request.diskCacheStrategy(DiskCacheStrategy.ALL);//只缓存result }else{ request.diskCacheStrategy(DiskCacheStrategy.SOURCE);//只缓存原图 }*/ request.diskCacheStrategy(DiskCacheStrategy.SOURCE);//只缓存原图 return request; }
Example 11
Source File: ArtistGlideRequest.java From MusicPlayer with GNU General Public License v3.0 | 5 votes |
public static RequestBuilder<Drawable> createBaseRequestForDrawable( RequestManager requestManager, Artist artist, boolean noCustomImage, boolean forceDownload, boolean loadOriginal, int imageNumber) { RequestBuilder<Drawable> builder; boolean hasCustomImage = CustomArtistImageUtil.getInstance(App.getInstance()).hasCustomArtistImage(artist); if (noCustomImage || !hasCustomImage) { builder = requestManager.load(new ArtistImage(artist.getName(), forceDownload, loadOriginal, imageNumber)); } else { builder = requestManager.load(CustomArtistImageUtil.getFile(artist)); } return builder; }
Example 12
Source File: ArtistGlideRequest.java From Music-Player with GNU General Public License v3.0 | 5 votes |
public static DrawableTypeRequest createBaseRequest(RequestManager requestManager, Artist artist, boolean noCustomImage) { boolean hasCustomImage = CustomArtistImageUtil.getInstance(App.getInstance()).hasCustomArtistImage(artist); if (noCustomImage || !hasCustomImage) { final List<AlbumCover> songs = new ArrayList<>(); for (final Album album : artist.albums) { final Song song = album.safeGetFirstSong(); songs.add(new AlbumCover(album.getYear(), song.data)); } return requestManager.load(new ArtistImage(artist.getName(), songs)); } else { return requestManager.load(CustomArtistImageUtil.getFile(artist)); } }
Example 13
Source File: SongGlideRequest.java From Music-Player with GNU General Public License v3.0 | 5 votes |
public static DrawableTypeRequest createBaseRequest(RequestManager requestManager, Song song, boolean ignoreMediaStore) { if (ignoreMediaStore) { return requestManager.load(new AudioFileCover(song.data)); } else { return requestManager.loadFromMediaStore(MusicUtil.getMediaStoreAlbumCoverUri(song.albumId)); } }
Example 14
Source File: DialogUtils.java From SoloPi with Apache License 2.0 | 5 votes |
/** * 初始化监听器 */ private void initData() { img.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ImageDialog.this.dismiss(); } }); // 对于resourceId类型,暂时只能走直接设置 if (id != null) { img.setImageResource(id); return; } RequestManager manager = GlideApp.with(img.getContext()); RequestBuilder<?> request; if (file != null) { request = manager.load(file); } else if (path != null) { request = manager.load(path); } else if (uri != null) { request = manager.load(uri); } else if (bitmap != null){ request = manager.load(bitmap); } else if (data != null){ request = manager.load(data); } else { return; } request.apply(RequestOptions.fitCenterTransform()).into(img); }
Example 15
Source File: GlideImageSpec.java From litho-glide with MIT License | 4 votes |
@OnMount static void onMount(ComponentContext c, ImageView imageView, @Prop(optional = true) String imageUrl, @Prop(optional = true) File file, @Prop(optional = true) Uri uri, @Prop(optional = true) Integer resourceId, @Prop(optional = true) RequestManager glideRequestManager, @Prop(optional = true, resType = DRAWABLE) Drawable failureImage, @Prop(optional = true, resType = DRAWABLE) Drawable fallbackImage, @Prop(optional = true, resType = DRAWABLE) Drawable placeholderImage, @Prop(optional = true) DiskCacheStrategy diskCacheStrategy, @Prop(optional = true) RequestListener requestListener, @Prop(optional = true) boolean asBitmap, @Prop(optional = true) boolean asGif, @Prop(optional = true) boolean crossFade, @Prop(optional = true) int crossFadeDuration, @Prop(optional = true) boolean centerCrop, @Prop(optional = true) boolean fitCenter, @Prop(optional = true) boolean skipMemoryCache, @Prop(optional = true) Target target) { if (imageUrl == null && file == null && uri == null && resourceId == null) { throw new IllegalArgumentException( "You must provide at least one of String, File, Uri or ResourceId"); } if (glideRequestManager == null) { glideRequestManager = Glide.with(c.getAndroidContext()); } DrawableTypeRequest request; if (imageUrl != null) { request = glideRequestManager.load(imageUrl); } else if (file != null) { request = glideRequestManager.load(file); } else if (uri != null) { request = glideRequestManager.load(uri); } else { request = glideRequestManager.load(resourceId); } if (request == null) { throw new IllegalStateException("Could not instantiate DrawableTypeRequest"); } if (diskCacheStrategy != null) { request.diskCacheStrategy(diskCacheStrategy); } if (asBitmap) { request.asBitmap(); } if (asGif) { request.asGif(); } if (crossFade) { request.crossFade(); } if (crossFadeDuration != DEFAULT_INT_VALUE) { request.crossFade(crossFadeDuration); } if (centerCrop) { request.centerCrop(); } if (failureImage != null) { request.error(failureImage); } if (fallbackImage != null) { request.fallback(fallbackImage); } if (fitCenter) { request.fitCenter(); } if (requestListener != null) { request.listener(requestListener); } if (placeholderImage != null) { request.placeholder(placeholderImage); } request.skipMemoryCache(skipMemoryCache); if (target != null) { request.into(target); } else { request.into(imageView); } }
Example 16
Source File: ImageLoadMnanger.java From star-zone-android with Apache License 2.0 | 4 votes |
private RequestBuilder getGlideFile(RequestManager manager, File file, ImageView iv) { return manager.load(file); }
Example 17
Source File: ImageLoadMnanger.java From star-zone-android with Apache License 2.0 | 4 votes |
private RequestBuilder getGlideUri(RequestManager manager, Uri uri, ImageView iv) { return manager.load(uri); }
Example 18
Source File: ImageLoadMnanger.java From star-zone-android with Apache License 2.0 | 4 votes |
private RequestBuilder getGlideInteger(RequestManager manager, int source, ImageView iv) { return manager.load(source); }
Example 19
Source File: ImageLoadMnanger.java From star-zone-android with Apache License 2.0 | 4 votes |
private RequestBuilder getGlideString(RequestManager manager, String str, ImageView iv) { return manager.load(str); }