Search in sources :

Example 76 with RequestOptions

use of com.bumptech.glide.request.RequestOptions in project BGARefreshLayout-Android by bingoogolapple.

the class ViewPagerActivity method initBanner.

private void initBanner() {
    mBanner.setAdapter(new BGABanner.Adapter<ImageView, String>() {

        @Override
        public void fillBannerItem(BGABanner banner, ImageView itemView, String model, int position) {
            Glide.with(itemView.getContext()).load(model).apply(new RequestOptions().placeholder(R.mipmap.holder).error(R.mipmap.holder).dontAnimate()).thumbnail(0.1f).into(itemView);
        }
    });
    App.getInstance().getEngine().getBannerModel().enqueue(new Callback<BannerModel>() {

        @Override
        public void onResponse(Call<BannerModel> call, Response<BannerModel> response) {
            BannerModel bannerModel = response.body();
            mBanner.setData(R.layout.view_image, bannerModel.imgs, bannerModel.tips);
        }

        @Override
        public void onFailure(Call<BannerModel> call, Throwable t) {
        }
    });
}
Also used : RequestOptions(com.bumptech.glide.request.RequestOptions) ImageView(android.widget.ImageView) BannerModel(cn.bingoogolapple.refreshlayout.demo.model.BannerModel) BGABanner(cn.bingoogolapple.bgabanner.BGABanner)

Example 77 with RequestOptions

use of com.bumptech.glide.request.RequestOptions in project BGARefreshLayout-Android by bingoogolapple.

the class SwipeRecyclerViewActivity method initBanner.

private void initBanner() {
    mBanner.setAdapter(new BGABanner.Adapter<ImageView, String>() {

        @Override
        public void fillBannerItem(BGABanner banner, ImageView itemView, String model, int position) {
            Glide.with(itemView.getContext()).load(model).apply(new RequestOptions().placeholder(R.mipmap.holder).error(R.mipmap.holder).dontAnimate()).thumbnail(0.1f).into(itemView);
        }
    });
    App.getInstance().getEngine().getBannerModel().enqueue(new Callback<BannerModel>() {

        @Override
        public void onResponse(Call<BannerModel> call, Response<BannerModel> response) {
            BannerModel bannerModel = response.body();
            mBanner.setData(R.layout.view_image, bannerModel.imgs, bannerModel.tips);
        }

        @Override
        public void onFailure(Call<BannerModel> call, Throwable t) {
        }
    });
}
Also used : RequestOptions(com.bumptech.glide.request.RequestOptions) ImageView(android.widget.ImageView) BannerModel(cn.bingoogolapple.refreshlayout.demo.model.BannerModel) BGABanner(cn.bingoogolapple.bgabanner.BGABanner)

Example 78 with RequestOptions

use of com.bumptech.glide.request.RequestOptions in project BGARefreshLayout-Android by bingoogolapple.

the class NormalRecyclerViewActivity method initBanner.

private void initBanner() {
    mBanner.setAdapter(new BGABanner.Adapter<ImageView, String>() {

        @Override
        public void fillBannerItem(BGABanner banner, ImageView itemView, String model, int position) {
            Glide.with(itemView.getContext()).load(model).apply(new RequestOptions().placeholder(R.mipmap.holder).error(R.mipmap.holder).dontAnimate()).thumbnail(0.1f).into(itemView);
        }
    });
    App.getInstance().getEngine().getBannerModel().enqueue(new Callback<BannerModel>() {

        @Override
        public void onResponse(Call<BannerModel> call, Response<BannerModel> response) {
            BannerModel bannerModel = response.body();
            mBanner.setData(R.layout.view_image, bannerModel.imgs, bannerModel.tips);
        }

        @Override
        public void onFailure(Call<BannerModel> call, Throwable t) {
        }
    });
}
Also used : RequestOptions(com.bumptech.glide.request.RequestOptions) ImageView(android.widget.ImageView) BannerModel(cn.bingoogolapple.refreshlayout.demo.model.BannerModel) BGABanner(cn.bingoogolapple.bgabanner.BGABanner)

Example 79 with RequestOptions

use of com.bumptech.glide.request.RequestOptions in project bdcodehelper by boredream.

the class GlideHelper method loadImg.

public static void loadImg(ImageView iv, String url, int defaultImg) {
    RequestOptions options = new RequestOptions();
    if (defaultImg != -1) {
        options = options.placeholder(defaultImg).error(defaultImg);
    }
    Glide.with(iv.getContext()).load(url).apply(options).into(iv);
}
Also used : RequestOptions(com.bumptech.glide.request.RequestOptions)

Example 80 with RequestOptions

use of com.bumptech.glide.request.RequestOptions in project bdcodehelper by boredream.

the class GlideHelper method loadOvalImg.

public static void loadOvalImg(ImageView iv, String url, int defaultImg) {
    RequestOptions options = new RequestOptions();
    if (defaultImg != -1) {
        options = options.placeholder(defaultImg).error(defaultImg);
    }
    Glide.with(iv.getContext()).load(url).apply(RequestOptions.circleCropTransform()).apply(options).into(iv);
}
Also used : RequestOptions(com.bumptech.glide.request.RequestOptions)

Aggregations

RequestOptions (com.bumptech.glide.request.RequestOptions)96 ImageView (android.widget.ImageView)23 View (android.view.View)18 Drawable (android.graphics.drawable.Drawable)16 TextView (android.widget.TextView)13 Bitmap (android.graphics.Bitmap)9 BitmapDrawable (android.graphics.drawable.BitmapDrawable)8 File (java.io.File)8 Uri (android.net.Uri)7 ColorDrawable (android.graphics.drawable.ColorDrawable)6 Context (android.content.Context)5 Intent (android.content.Intent)5 RecyclerView (android.support.v7.widget.RecyclerView)5 DataSource (com.bumptech.glide.load.DataSource)5 GlideException (com.bumptech.glide.load.engine.GlideException)5 FitCenter (com.bumptech.glide.load.resource.bitmap.FitCenter)5 RoundedCorners (com.bumptech.glide.load.resource.bitmap.RoundedCorners)5 Test (org.junit.Test)5 Activity (android.app.Activity)3 LayoutInflater (android.view.LayoutInflater)3