本文整理汇总了Java中com.bumptech.glide.RequestManager类的典型用法代码示例。如果您正苦于以下问题:Java RequestManager类的具体用法?Java RequestManager怎么用?Java RequestManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RequestManager类属于com.bumptech.glide包,在下文中一共展示了RequestManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
public static Observable<File> get(RequestManager requestManager, String url) {
return Observable.create(new Observable.OnSubscribe<File>() {
@Override
public void call(Subscriber<? super File> subscriber) {
try {
subscriber.onNext(requestManager.load(url)
.downloadOnly(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
.get());
} catch (InterruptedException | ExecutionException e) {
subscriber.onError(e);
} finally {
subscriber.onCompleted();
}
}
}).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
示例2: bind
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
public void bind(int position, TweetSelectImageAdapter.Model model, RequestManager loader) {
mDelete.setTag(model);
// In this we need clear before load
Glide.clear(mImage);
// Load image
if (model.path.toLowerCase().endsWith("gif")) {
loader.load(model.path)
.asBitmap()
.centerCrop()
.error(R.mipmap.ic_split_graph)
.into(mImage);
// Show gif mask
mGifMask.setVisibility(View.VISIBLE);
} else {
loader.load(model.path)
.centerCrop()
.error(R.mipmap.ic_split_graph)
.into(mImage);
mGifMask.setVisibility(View.GONE);
}
}
示例3: getApplicationManager
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
private RequestManager getApplicationManager(Context context) {
// Either an application context or we're on a background thread.
if (applicationManager == null) {
synchronized (this) {
if (applicationManager == null) {
// Normally pause/resume is taken care of by the fragment we add to the fragment or
// activity. However, in this case since the manager attached to the application will not
// receive lifecycle events, we must force the manager to start resumed using
// ApplicationLifecycle.
// TODO(b/27524013): Factor out this Glide.get() call.
Glide glide = Glide.get(context.getApplicationContext());
applicationManager =
factory.build(
glide,
new ApplicationLifecycle(),
new EmptyRequestManagerTreeNode(),
context.getApplicationContext());
}
}
}
return applicationManager;
}
示例4: RecyclerViewPreloader
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
/**
* Constructor that accepts interfaces for providing the dimensions of images to preload, the list
* of models to preload for a given position, and the request to use to load images.
*
* @param preloadModelProvider Provides models to load and requests capable of loading them.
* @param preloadDimensionProvider Provides the dimensions of images to load.
* @param maxPreload Maximum number of items to preload.
*/
public RecyclerViewPreloader(RequestManager requestManager,
PreloadModelProvider<T> preloadModelProvider,
PreloadSizeProvider<T> preloadDimensionProvider, int maxPreload) {
ListPreloader<T> listPreloader = new ListPreloader<>(requestManager, preloadModelProvider,
preloadDimensionProvider, maxPreload);
recyclerScrollListener = new RecyclerToListViewScrollListener(listPreloader);
}
示例5: getImgLoader
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
@Override
public RequestManager getImgLoader() {
if (mCurImageLoader == null) {
mCurImageLoader = Glide.with(getContext());
}
return mCurImageLoader;
}
示例6: createBaseRequest
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
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));
}
}
示例7: create
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
@NonNull
public static UploadViewHolder create(@NonNull ViewGroup parent,
@NonNull RequestManager glide) {
final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
final View itemView = inflater.inflate(R.layout.upload_item, parent, false);
final ImageView thumbnail = (ImageView) itemView.findViewById(R.id.image_thumbnail);
final TextView filename = (TextView) itemView.findViewById(R.id.text_filename);
final TextView status = (TextView) itemView.findViewById(R.id.text_status);
return new UploadViewHolder(itemView, thumbnail, filename, status, glide);
}
示例8: fragmentGet
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
private RequestManager fragmentGet(Context context, android.app.FragmentManager fm,
android.app.Fragment parentHint) {
RequestManagerFragment current = getRequestManagerFragment(fm, parentHint);
RequestManager requestManager = current.getRequestManager();
if (requestManager == null) {
// TODO(b/27524013): Factor out this Glide.get() call.
Glide glide = Glide.get(context);
requestManager =
factory.build(glide, current.getLifecycle(), current.getRequestManagerTreeNode());
current.setRequestManager(requestManager);
}
return requestManager;
}
示例9: supportFragmentGet
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
private RequestManager supportFragmentGet(Context context, FragmentManager fm,
Fragment parentHint) {
SupportRequestManagerFragment current = getSupportRequestManagerFragment(fm, parentHint);
RequestManager requestManager = current.getRequestManager();
if (requestManager == null) {
// TODO(b/27524013): Factor out this Glide.get() call.
Glide glide = Glide.get(context);
requestManager =
factory.build(glide, current.getLifecycle(), current.getRequestManagerTreeNode());
current.setRequestManager(requestManager);
}
return requestManager;
}
示例10: testReturnsExistingRequestManagerIfExists
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
@Test
public void testReturnsExistingRequestManagerIfExists() {
for (RetrieverHarness harness : harnesses) {
RequestManager requestManager = mock(RequestManager.class);
harness.addFragmentWithTag(RequestManagerRetriever.FRAGMENT_TAG, requestManager);
assertEquals(requestManager, harness.doGet());
}
}
示例11: testSavesNewRequestManagerToFragmentIfCreatesRequestManagerForExistingFragment
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
@Test
public void testSavesNewRequestManagerToFragmentIfCreatesRequestManagerForExistingFragment() {
for (RetrieverHarness harness : harnesses) {
harness.addFragmentWithTag(RequestManagerRetriever.FRAGMENT_TAG, null);
RequestManager first = harness.doGet();
RequestManager second = harness.doGet();
assertEquals(first, second);
}
}
示例12: testSupportCanGetRequestManagerFromActivity
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
@Test
public void testSupportCanGetRequestManagerFromActivity() {
FragmentActivity fragmentActivity =
Robolectric.buildActivity(FragmentActivity.class).create().start().get();
RequestManager manager = retriever.get(fragmentActivity);
assertEquals(manager, retriever.get(fragmentActivity));
}
示例13: testSupportCanGetRequestManagerFromFragment
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
@Test
public void testSupportCanGetRequestManagerFromFragment() {
FragmentActivity activity =
Robolectric.buildActivity(FragmentActivity.class).create().start().resume().get();
Fragment fragment = new Fragment();
activity.getSupportFragmentManager().beginTransaction().add(fragment, PARENT_TAG).commit();
activity.getSupportFragmentManager().executePendingTransactions();
RequestManager manager = retriever.get(fragment);
assertEquals(manager, retriever.get(fragment));
}
示例14: testChecksIfContextIsFragmentActivity
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
@Test
public void testChecksIfContextIsFragmentActivity() {
RetrieverHarness harness = new SupportRetrieverHarness();
RequestManager requestManager = harness.doGet();
assertEquals(requestManager, retriever.get((Context) harness.getController().get()));
}
示例15: loadImage
import com.bumptech.glide.RequestManager; //导入依赖的package包/类
public static void loadImage(RequestManager loader, ImageView view, String url, int placeholder, int error) {
boolean isCenterCrop = false;
if (view instanceof CircleImageView) {
isCenterCrop = true;
}
loadImage(loader, view, url, placeholder, error, isCenterCrop);
}