本文整理汇总了Java中com.bumptech.glide.load.resource.drawable.GlideDrawable类的典型用法代码示例。如果您正苦于以下问题:Java GlideDrawable类的具体用法?Java GlideDrawable怎么用?Java GlideDrawable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GlideDrawable类属于com.bumptech.glide.load.resource.drawable包,在下文中一共展示了GlideDrawable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showAdPacket
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
private void showAdPacket() {
adaptationADBanner();
Glide.with(mContext).load(mBannerUrl).into(new GlideDrawableImageViewTarget(mAdBg) {
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
super.onResourceReady(resource, animation);
mPresenter.sendADStatistics(RPConstant.STATISTICS_TYPE_VIEW_AD, mRedPacketInfo.redPacketId);
}
});
Glide.with(mContext).load(mRedPacketInfo.logoURL).transform(new CircleTransform(mContext)).into(mAdIcon);
mLayoutBom.setBackgroundColor(Color.parseColor(mRedPacketInfo.adBgColor));
mTVSponsor.setText(String.format(getString(R.string.money_sponsor_username_format), mRedPacketInfo.ownerName));
if (mRedPacketInfo.status == RPConstant.RED_PACKET_STATUS_RECEIVABLE) {//未领取
mTVMoney.setText(mRedPacketInfo.redPacketGreeting);
} else if (mRedPacketInfo.status == RPConstant.RED_PACKET_STATUS_RECEIVED) {//已被领取
//myAmount大于0,说明当前用户领取到了红包
if (Double.parseDouble(mRedPacketInfo.myAmount) > 0) {
receiveSuccess();
} else {//红包抢完了
redPacketOut(getString(R.string.money_is_out));
}
} else if (mRedPacketInfo.status == RPConstant.RED_PACKET_STATUS_EXPIRED) {//红包过期
redPacketOut(getString(R.string.ad_packet_out));
}
}
示例2: loadFallbackPicture
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
private void loadFallbackPicture(Address address, ImageView imageView) {
Context context = imageView.getContext();
Glide.with(context)
.using(new FallbackGlideModelLoader(), FallbackGlideParams.class)
.from(FallbackGlideParams.class)
.as(Bitmap.class)
.transcode(new BitmapToGlideDrawableTranscoder(context), GlideDrawable.class)
.decoder(new FallbackGlideBitmapDecoder(context))
.encoder(new BitmapEncoder(Bitmap.CompressFormat.PNG, 0))
.cacheDecoder(new FileToStreamDecoder<>(new StreamBitmapDecoder(context)))
.diskCacheStrategy(DiskCacheStrategy.NONE)
.load(new FallbackGlideParams(address))
// for some reason, following 2 lines fix loading issues.
.dontAnimate()
.override(mPictureSizeInPx, mPictureSizeInPx)
.into(imageView);
}
示例3: setImageViewUri
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
private void setImageViewUri(MasterSecret masterSecret, Uri uri) {
subsamplingImageView.setVisibility(View.GONE);
imageView.setVisibility(View.VISIBLE);
Glide.with(getContext())
.load(new DecryptableUri(masterSecret, uri))
.diskCacheStrategy(DiskCacheStrategy.NONE)
.dontTransform()
.dontAnimate()
.into(new GlideDrawableImageViewTarget(imageView) {
@Override protected void setResource(GlideDrawable resource) {
super.setResource(resource);
imageViewAttacher.update();
}
});
}
示例4: updateBackground
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
protected void updateBackground(String uri) {
int width = mMetrics.widthPixels;
int height = mMetrics.heightPixels;
Glide.with(getActivity())
.load(uri)
.centerCrop()
.error(mDefaultBackground)
.into(new SimpleTarget<GlideDrawable>(width, height) {
@Override
public void onResourceReady(GlideDrawable resource,
GlideAnimation<? super GlideDrawable>
glideAnimation) {
mBackgroundManager.setDrawable(resource);
}
});
mBackgroundTimer.cancel();
}
示例5: loadGif
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
/**
* 加载gif
*/
private void loadGif() {
Glide.with(ImageBrowseActivity.this)
.load(mImageUrl)
.fitCenter()
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(new GlideDrawableImageViewTarget(pvPic) {
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<?
super GlideDrawable> animation) {
super.onResourceReady(resource, animation);
//在这里添加一些图片加载完成的操作
pbPicBrowse.setVisibility(View.GONE);
}
});
}
示例6: displayVideoThumbnail
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
private void displayVideoThumbnail(ViewHolder h, Video v) {
Glide.with(h.mThumbnail.getContext())
.load(v.getThumbnailUrl())
.centerCrop()
.crossFade()
.into(new ImageViewTarget<GlideDrawable>(h.mThumbnail) {
@Override
protected void setResource(GlideDrawable resource) {
view.setImageDrawable(resource);
}
public void onLoadFailed(Exception e, Drawable errorDrawable) {
view.setImageResource(R.drawable.ic_photo_grey600_48dp);
}
});
}
示例7: setupUIElements
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
private void setupUIElements() {
Glide.with(getActivity())
.load(mConference.getLogoUrl())
.centerCrop()
.error(mDefaultBackground)
.into(new SimpleTarget<GlideDrawable>(432, 243) {
@Override
public void onResourceReady(GlideDrawable resource,
GlideAnimation<? super GlideDrawable>
glideAnimation) {
setBadgeDrawable(resource);
}
});
setTitle(mConference.getTitle()); // Badge, when set, takes precedent
// over title
setHeadersState(HEADERS_ENABLED);
setHeadersTransitionOnBackEnabled(true);
// set fastLane (or headers) background color
setBrandColor(getResources().getColor(R.color.fastlane_background));
// set search icon color
setSearchAffordanceColor(getResources().getColor(R.color.search_opaque));
}
示例8: updateBackground
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
protected void updateBackground(String uri) {
int width = mMetrics.widthPixels;
int height = mMetrics.heightPixels;
Glide.with(getActivity())
.load(uri)
.centerCrop()
.error(mDefaultBackground)
.into(new SimpleTarget<GlideDrawable>(width, height) {
@Override
public void onResourceReady(GlideDrawable resource,
GlideAnimation<? super GlideDrawable>
glideAnimation) {
mBackgroundManager.setDrawable(resource);
}
});
mBackgroundTimer.cancel();
}
示例9: updateBackground
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
protected void updateBackground(String uri) {
int width = mMetrics.widthPixels;
int height = mMetrics.heightPixels;
Glide.with(getActivity())
.load(uri)
.centerCrop()
.error(mDefaultBackground)
.into(new SimpleTarget<GlideDrawable>(width, height) {
@Override
public void onResourceReady(GlideDrawable resource,
GlideAnimation<? super GlideDrawable>
glideAnimation) {
mBackgroundManager.setDrawable(resource);
}
});
mBackgroundTimer.cancel();
}
示例10: onException
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
@Override
public boolean onException(
Exception e,
GlideUrl uri,
Target<GlideDrawable> target,
boolean isFirstResource
) {
OkHttpProgressGlideModule.forget(uri.toStringUrl());
if (!(target instanceof ImageViewTarget)) {
return false;
}
ImageViewWithUrl view = (ImageViewWithUrl) ((ImageViewTarget) target).getView();
ThemedReactContext context = (ThemedReactContext) view.getContext();
RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
int viewId = view.getId();
eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, new WritableNativeMap());
eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
return false;
}
示例11: onResourceReady
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
@Override
public boolean onResourceReady(
GlideDrawable resource,
GlideUrl uri,
Target<GlideDrawable> target,
boolean isFromMemoryCache,
boolean isFirstResource
) {
if (!(target instanceof ImageViewTarget)) {
return false;
}
ImageViewWithUrl view = (ImageViewWithUrl) ((ImageViewTarget) target).getView();
ThemedReactContext context = (ThemedReactContext) view.getContext();
RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
int viewId = view.getId();
eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_EVENT, new WritableNativeMap());
eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
return false;
}
示例12: loadImageWithProgress
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
/**
* 显示加载进度
*
* @param path 图片地址
* @param mImageView 图片控件
* @param loadView 加载view
*/
public static void loadImageWithProgress(String path, final ImageView mImageView, final View loadView, int errorRes) {
Glide.with(mImageView.getContext()).load(path).error(errorRes).into(new GlideDrawableImageViewTarget(mImageView) {
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
super.onResourceReady(resource, animation);
loadView.setVisibility(View.GONE);
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
loadView.setVisibility(View.GONE);
}
});
}
示例13: instantiateItem
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, final int position) {
final View view = LayoutInflater.from(context)
.inflate(R.layout.page_image_item_preview, container, false);
final ViewHolder viewHolder = new ViewHolder(view);
ViewCompat.setTransitionName(viewHolder.photoView, images.get(position).getUrl());
Glide.with(context)
.load(images.get(position).getUrl())
.dontTransform()
.dontAnimate()
.into(new SimpleTarget<GlideDrawable>() {
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
viewHolder.photoView.setImageDrawable(resource);
startPostponedEnterTransition(position);
}
});
container.addView(viewHolder.itemView);
return viewHolder;
}
示例14: getView
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
@Override public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView = recycle(convertView, parent);
//.with(getActivity().getApplicationContext())
//or
//Glide.with(this).resumeRequests();
// AND imageview size must not have match_parent
SyncLoadImageViewTarget target = Glide
.with(TestListFragment.this)
.load(getItem(position))
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.glide_placeholder)
.listener(new LoggingListener<String, GlideDrawable>())
.into(new SyncLoadImageViewTarget(imageView));
Log.d("isLoaded", target.isLoaded() + "");
if (!target.isLoaded()) {
//Glide.clear(target); NOT CLEARING ANYMORE
}
return imageView;
}
示例15: GeneratingAdapter
import com.bumptech.glide.load.resource.drawable.GlideDrawable; //导入依赖的package包/类
public GeneratingAdapter(final Context context) {
generator = Glide // this part should be cleaner in Glide 4.0, but that's not released yet
.with(context)
.using(new GeneratePassthroughModelLoader(), GenerateParams.class) // custom class
.from(GenerateParams.class)
.as(Bitmap.class)
.transcode(new BitmapToGlideDrawableTranscoder(context), GlideDrawable.class) // builtin
.decoder(new GenerateBitmapResourceDecoder(context)) // custom class
.encoder(new BitmapEncoder(Bitmap.CompressFormat.PNG, 0/*ignored for lossless*/)) // builtin
.cacheDecoder(new FileToStreamDecoder<Bitmap>(new StreamBitmapDecoder(context))) // builtin
//.placeholder(new ColorDrawable(Color.YELLOW)) // you can pre-set placeholder and error
//.error(new ColorDrawable(Color.RED)) // so it's easier when binding
//.diskCacheStrategy(DiskCacheStrategy.NONE) // only for debugging to always regenerate
//.skipMemoryCache(true) // only for debugging to always regenerate
;
}