Search in sources :

Example 26 with RequestManager

use of com.bumptech.glide.RequestManager in project Rocket by mozilla-tw.

the class RequestManagerRetriever method supportFragmentGet.

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.getGlideLifecycle(), current.getRequestManagerTreeNode());
        current.setRequestManager(requestManager);
    }
    return requestManager;
}
Also used : RequestManager(com.bumptech.glide.RequestManager) Glide(com.bumptech.glide.Glide)

Example 27 with RequestManager

use of com.bumptech.glide.RequestManager in project Rocket by mozilla-tw.

the class RequestManagerRetriever method fragmentGet.

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.getGlideLifecycle(), current.getRequestManagerTreeNode());
        current.setRequestManager(requestManager);
    }
    return requestManager;
}
Also used : RequestManager(com.bumptech.glide.RequestManager) Glide(com.bumptech.glide.Glide)

Example 28 with RequestManager

use of com.bumptech.glide.RequestManager in project AndroidStudy by tinggengyan.

the class GlideMainActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_imageview);
    prescale_iamgeview = (ImageView) findViewById(R.id.prescale_iamgeview);
    RequestManager requestManager = Glide.with(this);
    requestManager.load(Constants.IMAGES[0]).placeholder(R.drawable.accept).diskCacheStrategy(DiskCacheStrategy.NONE).override(100, 100).listener(new RequestListener<String, GlideDrawable>() {

        @Override
        public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
            return false;
        }

        @Override
        public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
            return false;
        }
    }).into(prescale_iamgeview);
    requestManager.load(Constants.IMAGES[1]).diskCacheStrategy(DiskCacheStrategy.SOURCE).preload();
    downloadImage(prescale_iamgeview);
}
Also used : Target(com.bumptech.glide.request.target.Target) FutureTarget(com.bumptech.glide.request.FutureTarget) RequestManager(com.bumptech.glide.RequestManager) RequestListener(com.bumptech.glide.request.RequestListener) GlideDrawable(com.bumptech.glide.load.resource.drawable.GlideDrawable)

Example 29 with RequestManager

use of com.bumptech.glide.RequestManager in project glide by bumptech.

the class RequestManagerRetriever method supportFragmentGet.

@NonNull
private RequestManager supportFragmentGet(@NonNull Context context, @NonNull FragmentManager fm, @Nullable Fragment parentHint, boolean isParentVisible) {
    SupportRequestManagerFragment current = getSupportRequestManagerFragment(fm, parentHint, isParentVisible);
    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.getGlideLifecycle(), current.getRequestManagerTreeNode(), context);
        current.setRequestManager(requestManager);
    }
    return requestManager;
}
Also used : RequestManager(com.bumptech.glide.RequestManager) Glide(com.bumptech.glide.Glide) NonNull(android.support.annotation.NonNull)

Example 30 with RequestManager

use of com.bumptech.glide.RequestManager in project glide by bumptech.

the class RequestManagerRetrieverTest method testApplicationRequestManagerIsNotReResumedAfterFirstRetrieval.

@Test
public void testApplicationRequestManagerIsNotReResumedAfterFirstRetrieval() {
    RequestManager manager = retriever.get(RuntimeEnvironment.application);
    manager.pauseRequests();
    manager = retriever.get(RuntimeEnvironment.application);
    assertTrue(manager.isPaused());
}
Also used : RequestManager(com.bumptech.glide.RequestManager) Test(org.junit.Test)

Aggregations

RequestManager (com.bumptech.glide.RequestManager)41 Context (android.content.Context)15 View (android.view.View)15 Bundle (android.os.Bundle)14 Glide (com.bumptech.glide.Glide)14 Test (org.junit.Test)14 Stream (com.annimon.stream.Stream)13 MusicUtils (com.simplecity.amp_library.utils.MusicUtils)13 List (java.util.List)13 PopupMenu (android.support.v7.widget.PopupMenu)11 MenuItem (android.view.MenuItem)11 Toast (android.widget.Toast)11 R (com.simplecity.amp_library.R)11 MenuUtils (com.simplecity.amp_library.utils.MenuUtils)11 Intent (android.content.Intent)10 LayoutInflater (android.view.LayoutInflater)10 ViewGroup (android.view.ViewGroup)10 Song (com.simplecity.amp_library.model.Song)10 ViewModel (com.simplecityapps.recycler_adapter.model.ViewModel)10 AndroidSchedulers (io.reactivex.android.schedulers.AndroidSchedulers)10