本文整理匯總了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);
}