本文整理汇总了Java中com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions类的典型用法代码示例。如果您正苦于以下问题:Java DrawableTransitionOptions类的具体用法?Java DrawableTransitionOptions怎么用?Java DrawableTransitionOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DrawableTransitionOptions类属于com.bumptech.glide.load.resource.drawable包,在下文中一共展示了DrawableTransitionOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
@Override
protected void convert(CommonViewHolder holder, Book bookItem) {
ImageView ivCover = holder.getView(R.id.iv_cover);
GlideApp
.with(mContext)
.load(bookItem.getCoverUrl())
.transition(DrawableTransitionOptions.withCrossFade())
.placeholder(R.drawable.ic_book_cover_default)
.into(ivCover);
holder
.setText(R.id.tv_author, bookItem.getAuthor())
.setText(R.id.tv_describe, bookItem.getDescribe())
.setText(R.id.tv_is_finish,bookItem.isFinished()?
mContext.getString(R.string.book_finished):mContext.getString(R.string.book_unfinished))
.setText(R.id.tv_word_count,formatDownloads(bookItem.getBookWordNum())+"字")
.setText(R.id.tv_title, bookItem.getName());
}
示例2: onBindViewHolder
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
@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 · %s",
new SimpleDateFormat("yyyy.MM.dd HH:mm:ss", Locale.getDefault()).format(new Date(item.mEventTime)),
item.mCount,
getResources().getString(R.string.times_only), 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);
}
示例3: getView
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup viewGroup) {
GridViewHolder holder = null;
if(convertView == null){
convertView = LayoutInflater.from(mContext).inflate(R.layout.rl_photo_gridview_item,viewGroup,false);
holder = new GridViewHolder(convertView);
convertView.setTag(holder);
}else {
holder = (GridViewHolder) convertView.getTag();
}
OvLoad ovLoad = new OvLoad();
if(position != 0){
String path = (String) mData.get(position);
ovLoad.loadPicture(mActivity,path,holder.mImg);
}else {
//位置0 加载本地资源文件
int itemPath = (int) mData.get(position);
GlideApp.with(mContext)
.load(itemPath)
.transition(new DrawableTransitionOptions().crossFade(200))
.centerCrop()
.into(holder.mImg);
}
return convertView;
}
示例4: onProgressUpdate
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
@Override
protected void onProgressUpdate(byte[]... cover){
if(mContext != null && !((MainActivity) mContext.get()).isDestroyed() ) {
GlideApp.with(mContext.get()).
load(cover[0].length == 0 ? null : cover[0])
.thumbnail(0.1f)
.error(R.drawable.ic_album_white_48px)
.apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.NONE))
.apply(RequestOptions.skipMemoryCacheOf(true))
.transition(DrawableTransitionOptions.withCrossFade(100))
.fitCenter()
.placeholder(R.drawable.ic_album_white_48px)
.into(mHolder.get().mImageView);
}
System.gc();
}
示例5: load
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
@Override protected void load(Context context) {
String url = "...";
Glide
.with(context)
.load(url)
.apply(new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
.placeholder(R.drawable.glide_placeholder)
.fallback(R.drawable.glide_fallback)
.error(R.drawable.glide_error)
)
.transition(new DrawableTransitionOptions()
.crossFade()
)
.listener(new LoggingListener<Drawable>())
.into(imageView)
;
}
示例6: UserRowHolder
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
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();
}
示例7: loadFlickrThumb
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
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);
}
示例8: getDefaultTransitionOptions_withSuperClassRegistered_returnsSuperClassOptions
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
@Test
public void getDefaultTransitionOptions_withSuperClassRegistered_returnsSuperClassOptions() {
DrawableTransitionOptions expected = new DrawableTransitionOptions();
transitionOptions.put(Drawable.class, expected);
assertThat(context.getDefaultTransitionOptions(BitmapDrawable.class))
.isEqualTo(expected);
assertThat(context.getDefaultTransitionOptions(GifDrawable.class))
.isEqualTo(expected);
}
示例9: onBindViewHolder
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
@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);
}
示例10: bindTo
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
public void bindTo(KitsuItem item) {
this.item = item;
if (null != item && null != item.type) {
itemTypeView.setText(item.type);
} else {
itemTypeView.setText("Ouhh...");
}
if (null != item && null != item.attributes && null != item.attributes.subtype) {
itemSubtypeView.setText(item.attributes.subtype);
} else {
itemSubtypeView.setText("Ouhhhhh...");
}
if (null != item && null != item.attributes && null != item.attributes.titles && null != item.attributes.titles.en_jp) {
itemNameView.setText(item.attributes.titles.en_jp);
} else {
itemNameView.setText("Ouhhhhhhhh...");
}
if (null != item && null != item.attributes && null != item.attributes.synopsis) {
itemSynopsisView.setText(item.attributes.synopsis);
} else {
itemSynopsisView.setText("Ouhhhhhhhhhhh...\nYou know what?\nThe quick brown fox jumps over the lazy dog!");
}
if (null != item && null != item.attributes && null != item.attributes.posterImage && null != item.attributes.posterImage.small) {
itemCoverView.setVisibility(View.VISIBLE);
Glide.with(itemView.getContext())
.load(item.attributes.posterImage.small)
.apply(new RequestOptions().placeholder(R.drawable.empty_placeholder))
.transition(DrawableTransitionOptions.withCrossFade())
.into(itemCoverView);
} else {
Glide.with(itemView.getContext()).clear(itemCoverView);
itemCoverView.setImageResource(R.drawable.empty_placeholder);
}
}
示例11: loadPicture
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
/**
* 默认加载图片方式,使用Glide默认的加载方式,除此方法外,其他方案均有动画效果,并且跳过内存缓存,开启磁盘缓存
* @param activity 在Activity中加载
* @param url
* @param targetView
*/
public void loadPicture(Activity activity, String url, ImageView targetView) {
GlideApp.with(activity)
.load(url)
.skipMemoryCache(false)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.transition(new DrawableTransitionOptions().crossFade(200))
.centerCrop()
.priority(Priority.HIGH)
.into(targetView);
}
示例12: loadBigPicture
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
public void loadBigPicture(Context context, String url, ImageView targetView) {
GlideApp.with(context)
.load(url)
.skipMemoryCache(false)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.transition(new DrawableTransitionOptions().crossFade(200))
.centerCrop()
.priority(Priority.NORMAL)
.into(targetView);
}
示例13: loadHolderPicture
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
/**有占位图的加载
* @param fragment 在Activity中加载
* @param url
* @param targetView
* @param placeHolder 加载图片时的占位图
*/
public void loadHolderPicture(Fragment fragment, String url, ImageView targetView,
int placeHolder) {
GlideApp.with(fragment)
.load(url)
.centerCrop()
.skipMemoryCache(false)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.priority(Priority.HIGH)
.placeholder(placeHolder)
.transition(new DrawableTransitionOptions().crossFade(200))
.into(targetView);
}
示例14: onBindViewHolder
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
@Override
public void onBindViewHolder(StepsAdapter.StepsAdapterViewHolder holder, int position) {
Step step = mStepList.get(position);
if (step != null){
if (step.getVideoURL() != null && !step.getVideoURL().isEmpty()) {
Glide.with(mContext)
.load(step.getVideoURL())
.apply(new RequestOptions()
.placeholder(R.drawable.placeholder_food)
.fallback(R.drawable.placeholder_food)
.centerCrop())
.into(holder.stepThumbnailView);
} else if (step.getThumbnailURL() != null && !step.getVideoURL().isEmpty()) {
Glide.with(mContext)
.load(step.getThumbnailURL())
.apply(new RequestOptions()
.placeholder(R.drawable.placeholder_food)
.fallback(R.drawable.placeholder_food)
.centerCrop())
.into(holder.stepThumbnailView);
} else {
Glide.with(mContext)
.load(R.drawable.placeholder_food)
.apply(new RequestOptions()
.centerCrop())
.transition(DrawableTransitionOptions.withCrossFade())
.into(holder.stepThumbnailView);
}
holder.stepNameView.setText(step.getShortDescription());
}
}
示例15: onBindViewHolder
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecipeAdapterViewHolder holder, int position) {
Recipe recipe = mRecipeList.get(position);
if (recipe != null){
holder.titleView.setText(recipe.getName());
holder.servingsView.setText(Integer.toString(recipe.getServings()));
if (recipe.getImage() != null && !recipe.getImage().isEmpty()){
Glide.with(mContext)
.load(recipe.getImage())
.apply(new RequestOptions()
.placeholder(R.drawable.placeholder_food)
.fallback(R.drawable.placeholder_food)
.centerCrop())
.transition(DrawableTransitionOptions.withCrossFade())
.into(holder.thumbnailView);
} else {
List<Step> steps = recipe.getSteps();
Glide.with(mContext)
.load(steps.get(steps.size() - 1).getVideoURL())
.apply(new RequestOptions()
.placeholder(R.drawable.placeholder_food)
.fallback(R.drawable.placeholder_food)
.centerCrop())
.transition(DrawableTransitionOptions.withCrossFade())
.into(holder.thumbnailView);
}
}
}