Search in sources :

Example 1 with BitmapTransitionOptions

use of com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions in project TicktockMusic by Lauzy.

the class GlideImageLoaderStrategy method display.

@Override
public void display(Context context, ImageConfig imageConfig) {
    RequestOptions options = getOptions(context, imageConfig);
    Object url = getPath(imageConfig);
    if (!imageConfig.isAsBitmap()) {
        RequestBuilder<Drawable> requestBuilder = Glide.with(context).load(url).apply(options);
        if (!imageConfig.isRound() && imageConfig.getDuration() != 0) {
            requestBuilder = requestBuilder.transition(new DrawableTransitionOptions().crossFade(imageConfig.getDuration()));
        }
        requestBuilder.into(imageConfig.getImageView());
    } else {
        RequestBuilder<Bitmap> requestBuilder = Glide.with(context).asBitmap().load(url).apply(options);
        if (!imageConfig.isRound() && imageConfig.getDuration() != 0) {
            requestBuilder = requestBuilder.transition(new BitmapTransitionOptions().crossFade(imageConfig.getDuration()));
        }
        requestBuilder.into(imageConfig.getTarget());
    }
}
Also used : DrawableTransitionOptions(com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions) Bitmap(android.graphics.Bitmap) RequestOptions(com.bumptech.glide.request.RequestOptions) Drawable(android.graphics.drawable.Drawable) BitmapTransitionOptions(com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions)

Example 2 with BitmapTransitionOptions

use of com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions in project 91Pop by DanteAndroid.

the class Mm99Adapter method convert.

@Override
protected void convert(final BaseViewHolder helper, final Mm99 item) {
    final ImageView imageView = helper.getView(R.id.iv_item_99_mm);
    GlideApp.with(helper.itemView.getContext()).asBitmap().load(item.getImgUrl()).transition(new BitmapTransitionOptions().crossFade(300)).into(new SimpleTarget<Bitmap>() {

        @Override
        public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
            imageView.setImageBitmap(resource);
            int height;
            if (!heightMap.containsKey(item.getImgUrl())) {
                height = resource.getHeight() * width / item.getImgWidth();
                heightMap.put(item.getImgUrl(), height);
            } else {
                height = heightMap.get(item.getImgUrl());
            }
            StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) helper.itemView.getLayoutParams();
            layoutParams.height = height;
            helper.itemView.setLayoutParams(layoutParams);
        }
    });
}
Also used : Bitmap(android.graphics.Bitmap) BitmapTransitionOptions(com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) ImageView(android.widget.ImageView)

Example 3 with BitmapTransitionOptions

use of com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions in project Audient by komamj.

the class FavoriteDetailActivity method onPermissonGranted.

@Override
protected void onPermissonGranted() {
    Favorite favorite = getIntent().getParcelableExtra(Constants.KEY_FAVORITE);
    mToolbar.setTitle(favorite.favoriteName);
    setSupportActionBar(mToolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_back);
    }
    GlideApp.with(this).asBitmap().transition(new BitmapTransitionOptions()).placeholder(R.drawable.ic_album).load(favorite.coverImageUrl).into(mAlbum);
    mFab.setImageResource(R.drawable.ic_unfavorite);
    FavoriteDetailFragment fragment = (FavoriteDetailFragment) getSupportFragmentManager().findFragmentById(R.id.content_main);
    if (fragment == null) {
        fragment = FavoriteDetailFragment.newInstance(favorite);
        getSupportFragmentManager().beginTransaction().add(R.id.content_main, fragment).commit();
    }
    DaggerFavoriteDetailComponent.builder().audientRepositoryComponent(((AudientApplication) getApplication()).getRepositoryComponent()).favoriteDetailPresenterModule(new FavoriteDetailPresenterModule(fragment)).build().inject(this);
}
Also used : Favorite(com.xinshang.audient.model.entities.Favorite) BitmapTransitionOptions(com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions) AudientApplication(com.xinshang.audient.AudientApplication)

Aggregations

BitmapTransitionOptions (com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions)3 Bitmap (android.graphics.Bitmap)2 Drawable (android.graphics.drawable.Drawable)1 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)1 ImageView (android.widget.ImageView)1 DrawableTransitionOptions (com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions)1 RequestOptions (com.bumptech.glide.request.RequestOptions)1 AudientApplication (com.xinshang.audient.AudientApplication)1 Favorite (com.xinshang.audient.model.entities.Favorite)1