當前位置: 首頁>>代碼示例>>Java>>正文


Java RequestManager類代碼示例

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

}
 
開發者ID:Assassinss,項目名稱:Moment,代碼行數:19,代碼來源:RxDownload.java

示例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);
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:22,代碼來源:TweetSelectImageAdapter.java

示例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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:25,代碼來源:RequestManagerRetriever.java

示例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);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:RecyclerViewPreloader.java

示例5: getImgLoader

import com.bumptech.glide.RequestManager; //導入依賴的package包/類
@Override
public RequestManager getImgLoader() {
    if (mCurImageLoader == null) {
        mCurImageLoader = Glide.with(getContext());
    }
    return mCurImageLoader;
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:8,代碼來源:TweetPicturesPreviewer.java

示例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));
    }
}
 
開發者ID:h4h13,項目名稱:RetroMusicPlayer,代碼行數:9,代碼來源:ArtistGlideRequest.java

示例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);
}
 
開發者ID:jsaund,項目名稱:RxUploader,代碼行數:11,代碼來源:UploadViewHolder.java

示例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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:RequestManagerRetriever.java

示例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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:RequestManagerRetriever.java

示例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());
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:11,代碼來源:RequestManagerRetrieverTest.java

示例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);
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:11,代碼來源:RequestManagerRetrieverTest.java

示例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));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:RequestManagerRetrieverTest.java

示例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));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:12,代碼來源:RequestManagerRetrieverTest.java

示例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()));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:RequestManagerRetrieverTest.java

示例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);
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:8,代碼來源:ImageLoader.java


注:本文中的com.bumptech.glide.RequestManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。