com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions Java Examples

The following examples show how to use com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From AppsMonitor with MIT License 6 votes vote down vote up
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
    AppItem item = getItemInfoByPosition(position);
    holder.mName.setText(item.mName);
    holder.mUsage.setText(AppUtil.formatMilliSeconds(item.mUsageTime));
    holder.mTime.setText(String.format(Locale.getDefault(),
            "%s · %d %s",
            new SimpleDateFormat("yyyy.MM.dd HH:mm:ss", Locale.getDefault()).format(new Date(item.mEventTime)),
            item.mCount,
            getResources().getString(R.string.times_only))
    );
    holder.mDataUsage.setText(String.format(Locale.getDefault(), "%s", AppUtil.humanReadableByteCount(item.mMobile)));
    if (mTotal > 0) {
        holder.mProgress.setProgress((int) (item.mUsageTime * 100 / mTotal));
    } else {
        holder.mProgress.setProgress(0);
    }
    GlideApp.with(MainActivity.this)
            .load(AppUtil.getPackageIcon(MainActivity.this, item.mPackageName))
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .transition(new DrawableTransitionOptions().crossFade())
            .into(holder.mIcon);
    holder.setOnClickListener(item);
}
 
Example #2
Source File: StickerPackPreviewActivity.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
private void presentManifest(@NonNull StickerManifest manifest) {
  stickerTitle.setText(manifest.getTitle().or(getString(R.string.StickerPackPreviewActivity_untitled)));
  stickerAuthor.setText(manifest.getAuthor().or(getString(R.string.StickerPackPreviewActivity_unknown)));
  adapter.setStickers(manifest.getStickers());

  Sticker first = manifest.getStickers().isEmpty() ? null : manifest.getStickers().get(0);
  Sticker cover = manifest.getCover().or(Optional.fromNullable(first)).orNull();

  if (cover != null) {
    Object  model = cover.getUri().isPresent() ? new DecryptableStreamUriLoader.DecryptableUri(cover.getUri().get())
                                               : new StickerRemoteUri(cover.getPackId(), cover.getPackKey(), cover.getId());
    GlideApp.with(this).load(model)
                       .transition(DrawableTransitionOptions.withCrossFade())
                       .into(coverImage);
  } else {
    coverImage.setImageDrawable(null);
  }
}
 
Example #3
Source File: UserRowHolder.java    From DelegateAdapter with Apache License 2.0 6 votes vote down vote up
public UserRowHolder(View itemView) {
    super(itemView);

    profileIv = findViewById(R.id.user_row_profile);
    nameTv = findViewById(R.id.user_row_name);
    locationTv = findViewById(R.id.user_row_location);
    bioTv = findViewById(R.id.user_row_bio);

    moreView = findViewById(R.id.user_row_more);
    socialView = findViewById(R.id.user_row_social_layout);
    emailIv = findViewById(R.id.user_row_email);
    twitterIv = findViewById(R.id.user_row_twitter);
    insIv = findViewById(R.id.user_row_instagram);

    fadeInOptions = DrawableTransitionOptions.withCrossFade();
    mCircleCropOption = RequestOptions.circleCropTransform();
}
 
Example #4
Source File: ExoMediaPlayerActivity.java    From v9porn with MIT License 6 votes vote down vote up
@Override
public void playVideo(String title, String videoUrl, String name, String thumImgUrl) {

    if (isPauseByActivityEvent) {
        isPauseByActivityEvent = false;
        videoPlayer.reset();
    }
    videoControlsMobile.setOnBackButtonClickListener(new ExoVideoControlsMobile.OnBackButtonClickListener() {
        @Override
        public void onBackClick(View view) {
            onBackPressed();
        }
    });
    if (!TextUtils.isEmpty(thumImgUrl)) {
        GlideApp.with(this).load(Uri.parse(thumImgUrl)).transition(new DrawableTransitionOptions().crossFade(300)).into(videoPlayer.getPreviewImageView());
    }
    videoPlayer.setVideoURI(Uri.parse(videoUrl));
    videoControlsMobile.setTitle(title);
}
 
Example #5
Source File: DemoGlideHelper.java    From GestureViews with Apache License 2.0 6 votes vote down vote up
public static void loadFlickrThumb(Photo photo, ImageView image) {
    final RequestOptions options = new RequestOptions()
            .diskCacheStrategy(DiskCacheStrategy.DATA)
            .override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
            .dontTransform();

    final RequestBuilder<Drawable> thumbRequest = Glide.with(image)
            .load(photo.getThumbnailUrl())
            .apply(options)
            .transition(DrawableTransitionOptions.with(TRANSITION_FACTORY));

    Glide.with(image).load(photo.getMediumUrl())
            .apply(options)
            .thumbnail(thumbRequest)
            .into(image);
}
 
Example #6
Source File: ExoMediaPlayerActivity.java    From v9porn with MIT License 6 votes vote down vote up
@Override
public void playVideo(String title, String videoUrl, String name, String thumImgUrl) {

    if (isPauseByActivityEvent) {
        isPauseByActivityEvent = false;
        videoPlayer.reset();
    }
    videoControlsMobile.setOnBackButtonClickListener(new ExoVideoControlsMobile.OnBackButtonClickListener() {
        @Override
        public void onBackClick(View view) {
            onBackPressed();
        }
    });
    if (!TextUtils.isEmpty(thumImgUrl)) {
        GlideApp.with(this).load(Uri.parse(thumImgUrl)).transition(new DrawableTransitionOptions().crossFade(300)).into(videoPlayer.getPreviewImageView());
    }
    videoPlayer.setVideoURI(Uri.parse(videoUrl));
    videoControlsMobile.setTitle(title);
}
 
Example #7
Source File: ImageLoader.java    From aptoide-client-v8 with GNU General Public License v3.0 6 votes vote down vote up
public Target<Drawable> loadWithShadowCircleTransformWithPlaceholder(String url,
    ImageView imageView, float strokeSize, @AttrRes int placeHolderDrawable) {
  Context context = weakContext.get();
  if (context != null) {
    return Glide.with(context)
        .load(AptoideUtils.IconSizeU.generateSizeStoreString(url, resources, windowManager))
        .apply(getRequestOptions().transform(
            new ShadowCircleTransformation(context, imageView, strokeSize))
            .placeholder(getAttrDrawable(placeHolderDrawable)))
        .transition(DrawableTransitionOptions.withCrossFade())
        .into(imageView);
  } else {
    Log.e(TAG, "::loadWithShadowCircleTransform() Context is null");
  }
  return null;
}
 
Example #8
Source File: AnimeRecommendItem.java    From DanDanPlayForAndroid with MIT License 6 votes vote down vote up
@Override
public void onUpdateViews(AnimeBean model, int position) {
    RequestOptions options = new RequestOptions()
            .centerCrop()
            .transform(new CornersCenterCrop(ConvertUtils.dp2px(5)));

    Glide.with(imageIv.getContext())
            .load(model.getImageUrl())
            .apply(options)
            .transition((DrawableTransitionOptions.withCrossFade()))
            .into(imageIv);

    titleTv.setText(model.getAnimeTitle());

    typeTv.setText(model.isIsOnAir() ? "连载中" : "已完结");

    ratingTv.setText(model.getRating()+"");

    mView.setOnClickListener(v ->
            AnimeDetailActivity.launchAnimeDetail(
                    (Activity)mView.getContext(),
                    model.getAnimeId()+"")
    );
}
 
Example #9
Source File: GlideHelper.java    From hipda with GNU General Public License v2.0 6 votes vote down vote up
public static void loadAvatar(RequestManager glide, ImageView view, String avatarUrl) {
    avatarUrl = Utils.nullToText(avatarUrl);
    String cacheKey = AVATAR_CACHE_KEYS.get(avatarUrl);
    if (cacheKey == null) {
        cacheKey = avatarUrl;
    }
    if (HiSettingsHelper.getInstance().isCircleAvatar()) {
        glide.load(new AvatarModel(avatarUrl))
                .signature(new ObjectKey(cacheKey))
                .diskCacheStrategy(DiskCacheStrategy.NONE)
                .circleCrop()
                .error(DEFAULT_USER_ICON)
                .transition(DrawableTransitionOptions.withCrossFade())
                .into(view);
    } else {
        glide.load(new AvatarModel(avatarUrl))
                .signature(new ObjectKey(cacheKey))
                .diskCacheStrategy(DiskCacheStrategy.NONE)
                .transform(new CenterCrop(), new RoundedCorners(Utils.dpToPx(4)))
                .error(DEFAULT_USER_ICON)
                .transition(DrawableTransitionOptions.withCrossFade())
                .into(view);
    }
}
 
Example #10
Source File: PersonalFavoriteAnimeItem.java    From DanDanPlayForAndroid with MIT License 6 votes vote down vote up
@Override
public void onUpdateViews(AnimeFavoriteBean.FavoritesBean model, int position) {
    RequestOptions options = new RequestOptions()
            .centerCrop()
            .transform(new CornersCenterCrop(3));

    Glide.with(imageView.getContext())
            .load(model.getImageUrl())
            .apply(options)
            .transition((DrawableTransitionOptions.withCrossFade()))
            .into(imageView);

    animeTitle.setText(model.getAnimeTitle());

    mView.setOnClickListener(v ->
            AnimeDetailActivity.launchAnimeDetail(
                    (Activity)mView.getContext(),
                    model.getAnimeId()+"")
    );
}
 
Example #11
Source File: EverydayAdapter.java    From CloudReader with Apache License 2.0 6 votes vote down vote up
@Override
        protected void onBindingView(BaseBindingHolder holder, List<AndroidBean> object, int position) {
            DensityUtil.setWidthHeight(binding.ivOnePhoto, width, 2.6f);
            if ("福利".equals(object.get(0).getType())) {
                binding.tvOnePhotoTitle.setVisibility(View.GONE);
                binding.ivOnePhoto.setScaleType(ImageView.ScaleType.CENTER_CROP);
//                ImageLoadUtil.displayEspImage(object.get(0).getUrl(), binding.ivOnePhoto, 1);
                Glide.with(binding.ivOnePhoto.getContext())
                        .load(object.get(0).getUrl())
                        .transition(DrawableTransitionOptions.withCrossFade(1500))
                        .placeholder(R.drawable.img_two_bi_one)
                        .error(R.drawable.img_two_bi_one)
                        .into(binding.ivOnePhoto);

            } else {
                binding.tvOnePhotoTitle.setVisibility(View.VISIBLE);
                setDes(object, 0, binding.tvOnePhotoTitle);
                displayRandomImg(1, 0, binding.ivOnePhoto, object);
            }
            setOnClick(binding.llOnePhoto, object.get(0));
        }
 
Example #12
Source File: MeFragment.java    From AndroidPlusJava with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode) {
        case REQUEST_GALLERY_IMAGES:
            if (resultCode == RESULT_OK) {
                Uri uri = data.getData();
                GlideApp.with(this).load(uri).transform(new CircleCrop()).into(mAvatar);
                ImageUtils.saveAvatar(getContext(), uri);
            }
            break;
        case REQUEST_CAMERA_IMAGES:
            if (resultCode == RESULT_OK) {
                GlideApp.with(getContext())
                        .load(IMAGE_DIR + mImageName)
                        .transform(new CircleCrop())
                        .transition(new DrawableTransitionOptions().crossFade())
                        .into(mAvatar);
                ImageUtils.saveAvatar(mImageName, IMAGE_DIR + mImageName);

            }
            break;

    }
}
 
Example #13
Source File: MeFragment.java    From AndroidPlusJava with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void init() {
    super.init();
    mUser = AVUser.getCurrentUser(User.class);
    mUserName.setText(mUser.getUsername());
    if (mUser.getSlogan() != null) {
        mSlogan.setText(mUser.getSlogan());
    }
    GlideApp.with(this)
            .load(mUser.getAvatar())
            .transform(new CircleCrop())
            .transition(new DrawableTransitionOptions().crossFade())
            .placeholder(R.mipmap.ic_launcher_round)
            .into(mAvatar);

}
 
Example #14
Source File: ImageLoader.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
public Target<Drawable> loadWithShadowCircleTransform(String url, ImageView imageView,
    @ColorInt int color, float spaceBetween, float strokeSize) {
  Context context = weakContext.get();
  if (context != null) {
    return Glide.with(context)
        .load(url)
        .apply(getRequestOptions().transform(
            new ShadowCircleTransformation(context, imageView, color, spaceBetween, strokeSize)))
        .transition(DrawableTransitionOptions.withCrossFade())
        .into(imageView);
  } else {
    Log.e(TAG, "::loadWithShadowCircleTransform() Context is null");
  }
  return null;
}
 
Example #15
Source File: GlideUtil.java    From CloudReader with Apache License 2.0 5 votes vote down vote up
/**
 * 加载固定宽高图片
 */
@BindingAdapter({"android:imageUrl", "android:imageWidthDp", "android:imageHeightDp"})
public static void imageUrl(ImageView imageView, String url, int imageWidthDp, int imageHeightDp) {
    Glide.with(imageView.getContext())
            .load(url)
            .override(DensityUtil.dip2px(imageView.getContext(), imageWidthDp), DensityUtil.dip2px(imageView.getContext(), imageHeightDp))
            .transition(DrawableTransitionOptions.withCrossFade(500))
            .placeholder(getMusicDefaultPic(4))
            .centerCrop()
            .error(getDefaultPic(0))
            .into(imageView);
}
 
Example #16
Source File: RemoteVideoItem.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
@Override
public void onUpdateViews(RemoteVideoBean model, int position) {
    String imageUrl = model.getOriginUrl() + "api/v1/image/" + model.getHash();
    coverIv.setScaleType(ImageView.ScaleType.FIT_XY);
    Glide.with(context)
            .load(imageUrl)
            .transition((DrawableTransitionOptions.withCrossFade()))
            .into(coverIv);

    String duration = CommonUtils.formatDuring(model.getDuration() * 1000);
    durationTv.setText(duration);

    titleTv.setText(model.getName());

    itemView.setOnClickListener(v -> {
        String videoUrl = model.getOriginUrl() + "api/v1/stream/" + model.getHash();
        int episodeId = StringUtils.isEmpty(model.getDanmuPath()) ? 0 : model.getEpisodeId();
        PlayerManagerActivity.launchPlayerRemote(
                context,
                model.getEpisodeTitle(),
                videoUrl,
                model.getDanmuPath(),
                0,
                episodeId);
    });

    if (StringUtils.isEmpty(model.getDanmuPath())){
        danmuBindIv.setImageResource(R.mipmap.ic_danmu_unexists);
    }else{
        danmuBindIv.setImageResource(R.mipmap.ic_danmu_exists);
    }

    danmuBindIv.setOnClickListener(v -> {
        if (listener != null){
            listener.onBindClick(position);
        }
    });
}
 
Example #17
Source File: GlideUtil.java    From CloudReader with Apache License 2.0 5 votes vote down vote up
/**
 * 电影列表图片
 */
@BindingAdapter("android:showMovieImg")
public static void showMovieImg(ImageView imageView, String url) {
    Glide.with(imageView.getContext())
            .load(url)
            .transition(DrawableTransitionOptions.withCrossFade(500))
            .override((int) CommonUtils.getDimens(R.dimen.movie_detail_width), (int) CommonUtils.getDimens(R.dimen.movie_detail_height))
            .placeholder(getDefaultPic(0))
            .error(getDefaultPic(0))
            .into(imageView);
}
 
Example #18
Source File: ImageLoader.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
public Target<Drawable> loadWithShadowCircleTransform(String url, ImageView imageView,
    @ColorInt int shadowColor) {
  Context context = weakContext.get();
  if (context != null) {
    return Glide.with(context)
        .load(AptoideUtils.IconSizeU.generateSizeStoreString(url, resources, windowManager))
        .apply(getRequestOptions().transform(
            new ShadowCircleTransformation(context, imageView, shadowColor)))
        .transition(DrawableTransitionOptions.withCrossFade())
        .into(imageView);
  } else {
    Log.e(TAG, "::loadWithShadowCircleTransform() Context is null");
  }
  return null;
}
 
Example #19
Source File: ImageLoader.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
public Target<Drawable> load(String url, @AttrRes int loadingPlaceHolder, ImageView imageView) {
  Context context = weakContext.get();
  if (context != null) {
    return Glide.with(context)
        .load(url)
        .apply(getRequestOptions().placeholder(getAttrDrawable(loadingPlaceHolder)))
        .transition(DrawableTransitionOptions.withCrossFade())
        .into(imageView);
  } else {
    Log.e(TAG, "::load() Context is null");
  }
  return null;
}
 
Example #20
Source File: IgnoreActivity.java    From AppsMonitor with MIT License 5 votes vote down vote up
@Override
public void onBindViewHolder(IgnoreViewHolder holder, int position) {
    IgnoreItem item = mData.get(position);
    holder.mCreated.setText(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.getDefault()).format(new Date(item.mCreated)));
    holder.mName.setText(item.mName);
    GlideApp.with(getApplicationContext())
            .load(AppUtil.getPackageIcon(getApplicationContext(), item.mPackageName))
            .transition(new DrawableTransitionOptions().crossFade())
            .into(holder.mIcon);
    holder.setOnClickListener(item);
}
 
Example #21
Source File: AnimeItem.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
@Override
public void onUpdateViews(AnimeBean model, int position) {

    if (AppConfig.getInstance().isLogin()) {
        followTagView.setVisibility(model.isIsFavorited()
                ? View.VISIBLE
                : View.GONE);
    }

    animeTitle.setText(model.getAnimeTitle());

    RequestOptions options = new RequestOptions()
            .centerCrop()
            .transform(new CornersCenterCrop(ConvertUtils.dp2px(3)));

    Glide.with(imageView.getContext())
            .load(model.getImageUrl())
            .apply(options)
            .transition((DrawableTransitionOptions.withCrossFade()))
            .into(imageView);

    mView.setOnClickListener(v ->
            AnimeDetailActivity.launchAnimeDetail(
                    (Activity) mView.getContext(),
                    model.getAnimeId() + "")
    );
}
 
Example #22
Source File: AnimeMoreItem.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
@Override
public void onUpdateViews(AnimeBean model, int position) {
    RequestOptions options = new RequestOptions()
            .centerCrop()
            .transform(new CornersCenterCrop(ConvertUtils.dp2px(5)));

    Glide.with(imageIv.getContext())
            .load(model.getImageUrl())
            .apply(options)
            .transition((DrawableTransitionOptions.withCrossFade()))
            .into(imageIv);

    titleTv.setText(model.getAnimeTitle());

    followTv.setVisibility(model.isIsFavorited() ? View.VISIBLE : View.GONE);

    airTv.setText(model.isIsOnAir() ? "连载中" : "已完结");

    typeTv.setVisibility(View.GONE);

    restrictedTv.setVisibility(model.isIsRestricted() ? View.VISIBLE : View.GONE);

    ratingTv.setText(model.getRating() + "分");

    mView.setOnClickListener(v ->
            AnimeDetailActivity.launchAnimeDetail(
            (Activity)mView.getContext(),
            model.getAnimeId()+"")
    );
}
 
Example #23
Source File: ImageLoader.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
public Target<Drawable> loadWithColorAttrPlaceholder(String url, @AttrRes int colorResource,
    ImageView imageView) {
  Context context = weakContext.get();

  if (context != null) {
    return Glide.with(context)
        .load(url)
        .apply(getRequestOptions().placeholder(new ColorDrawable(getAttrColor(colorResource))))
        .transition(DrawableTransitionOptions.withCrossFade())
        .into(imageView);
  } else {
    Log.e(TAG, "::load() Context is null");
  }
  return null;
}
 
Example #24
Source File: TagAnimeItem.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
@Override
public void onUpdateViews(AnimeTagBean.AnimesBean model, int position) {

    if (AppConfig.getInstance().isLogin()) {
        followTagView.setVisibility(model.isIsFavorited()
                ? View.VISIBLE
                : View.GONE);
    }

    RequestOptions options = new RequestOptions()
            .centerCrop()
            .transform(new CornersCenterCrop(3));

    Glide.with(imageView.getContext())
            .load(model.getImageUrl())
            .apply(options)
            .transition((DrawableTransitionOptions.withCrossFade()))
            .into(imageView);

    anime_title.setText(model.getAnimeTitle());

    mView.setOnClickListener(v ->
            AnimeDetailActivity.launchAnimeDetail(
                    (Activity)mView.getContext(),
                    model.getAnimeId()+"")
    );
}
 
Example #25
Source File: GlideUtil.java    From CloudReader with Apache License 2.0 5 votes vote down vote up
/**
     * 加载圆角图,暂时用到显示头像
     */
    @BindingAdapter("android:displayCircle")
    public static void displayCircle(ImageView imageView, String imageUrl) {
        Glide.with(imageView.getContext())
                .load(imageUrl)
                .transition(DrawableTransitionOptions.withCrossFade(500))
                .error(R.drawable.ic_avatar_default)
                .transform(new CircleCrop())
//                .apply(bitmapTransform(new CircleCrop()))
//                .transform(new GlideCircleTransform())
//                .transform(new RoundedCorners(20))
//                .transform(new CenterCrop(), new RoundedCorners(20))
                .into(imageView);
    }
 
Example #26
Source File: PersonalFragment.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
@Override
public void initView() {
    if (AppConfig.getInstance().isLogin()) {
        loginButton.setVisibility(View.GONE);
        RequestOptions options = new RequestOptions()
                .error(R.mipmap.default_image)
                .placeholder(R.mipmap.default_image);

        Glide.with(this)
                .load(AppConfig.getInstance().getUserImage())
                .apply(options)
                .transition((DrawableTransitionOptions.withCrossFade()))
                .into(userImageIv);
        userNameTv.setText(AppConfig.getInstance().getUserScreenName());
    } else {
        loginButton.setVisibility(View.VISIBLE);
    }

    if (isLoadedSkin()) {
        skinIv.setImageResource(R.mipmap.ic_skin_light);
        skinTv.setTextColor(CommonUtils.getResColor(R.color.immutable_text_orange));
        skinTv.setText("日间模式");
    } else {
        skinIv.setImageResource(R.mipmap.ic_skin_dark);
        skinTv.setTextColor(CommonUtils.getResColor(R.color.immutable_text_black));
        skinTv.setText("夜间模式");
    }
}
 
Example #27
Source File: GlideImageLoader.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
@Override
public void displayImage(Context context, Object path, ImageView imageView) {
    Glide.with(context)
            .load(path)
            .transition((DrawableTransitionOptions.withCrossFade()))
            .into(imageView);
}
 
Example #28
Source File: BigImageActivity.java    From HaoReader with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void bindView() {
    ButterKnife.bind(this);

    Glide.with(this)
            .load(imageUrl)
            .transition(new DrawableTransitionOptions().crossFade())
            .into(bigImage);

    flContent.setOnClickListener(v -> supportFinishAfterTransition());
}
 
Example #29
Source File: GlideUtil.java    From CloudReader with Apache License 2.0 5 votes vote down vote up
/**
 * 书籍、妹子图、电影列表图
 * 默认图区别
 */
public static void displayEspImage(String url, ImageView imageView, int type) {
    Glide.with(imageView.getContext())
            .load(url)
            .transition(DrawableTransitionOptions.withCrossFade(500))
            .placeholder(getDefaultPic(type))
            .error(getDefaultPic(type))
            .into(imageView);
}
 
Example #30
Source File: StickerManagementAdapter.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
void bind(@NonNull GlideRequests glideRequests,
          @NonNull EventListener eventListener,
          @NonNull StickerPackRecord stickerPack,
          boolean lastInList)
{
  title.setText(stickerPack.getTitle().or(itemView.getResources().getString(R.string.StickerManagementAdapter_untitled)));
  author.setText(stickerPack.getAuthor().or(itemView.getResources().getString(R.string.StickerManagementAdapter_unknown)));
  divider.setVisibility(lastInList ? View.GONE : View.VISIBLE);

  if (BlessedPacks.contains(stickerPack.getPackId())) {
    title.setOverflowText(blessedBadge);
  } else {
    title.setOverflowText(null);
  }

  glideRequests.load(new DecryptableUri(stickerPack.getCover().getUri()))
               .transition(DrawableTransitionOptions.withCrossFade())
               .into(cover);

  if (stickerPack.isInstalled()) {
    actionButtonImage.setImageResource(R.drawable.ic_x);
    actionButton.setOnClickListener(v -> eventListener.onStickerPackUninstallClicked(stickerPack.getPackId(), stickerPack.getPackKey()));

    shareButton.setVisibility(View.VISIBLE);
    shareButtonImage.setVisibility(View.VISIBLE);
    shareButton.setOnClickListener(v -> eventListener.onStickerPackShareClicked(stickerPack.getPackId(), stickerPack.getPackKey()));
  } else {
    actionButtonImage.setImageResource(R.drawable.ic_arrow_down);
    actionButton.setOnClickListener(v -> eventListener.onStickerPackInstallClicked(stickerPack.getPackId(), stickerPack.getPackKey()));

    shareButton.setVisibility(View.GONE);
    shareButtonImage.setVisibility(View.GONE);
    shareButton.setOnClickListener(null);
  }

  itemView.setOnClickListener(v -> eventListener.onStickerPackClicked(stickerPack.getPackId(), stickerPack.getPackKey()));
}