当前位置: 首页>>代码示例>>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;未经允许,请勿转载。