本文整理匯總了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
;
}