本文整理汇总了Java中com.bumptech.glide.request.animation.GlideAnimation类的典型用法代码示例。如果您正苦于以下问题:Java GlideAnimation类的具体用法?Java GlideAnimation怎么用?Java GlideAnimation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GlideAnimation类属于com.bumptech.glide.request.animation包,在下文中一共展示了GlideAnimation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showWhenPictureReady
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的package包/类
public void showWhenPictureReady (final int id) {
Glide.with(getCenter().getContext()).load(url)
.asBitmap().into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
Log.v(TAG, "showWhenPictureReady onResourceReady");
bigPicture(resource).show(id);
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
getCenter().show(id);
Log.v(TAG, "showWhenPictureReady onLoadFailed " + e.getMessage());
}
});
}
示例2: setImgBackGround
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的package包/类
private void setImgBackGround() {
String[] images = getResources().getStringArray(R.array.splash_background);
int position = new Random().nextInt(images.length - 1) % (images.length);
Glide.with(this)
.load(images[position])
.into(mImgBackGround);
String path = SpUtil.getString(this, "path");
Glide.with(this)
.load(path)
.asBitmap()
.error(R.drawable.def_avatar)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
mCircleImageView.setImageBitmap(resource);
}
});
//设置图像的透明度
AlphaAnimation animation = new AlphaAnimation(0.1f, 1.0f);
animation.setDuration(800);
mCircleImageView.startAnimation(animation);
animation.setAnimationListener(this);
}
示例3: showAdPacket
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的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));
}
}
示例4: onCreateView
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View contentView = inflater.inflate(R.layout.fragment_image_preview, container, false);
final ImageView imageView = (ImageView) contentView.findViewById(R.id.preview_image);
final PhotoViewAttacher mAttacher = new PhotoViewAttacher(imageView);
Glide.with(container.getContext())
.load(new File(getArguments().getString(PATH)))
.asBitmap()
.into(new SimpleTarget<Bitmap>(480, 800) {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
imageView.setImageBitmap(resource);
mAttacher.update();
}
});
mAttacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
@Override
public void onViewTap(View view, float x, float y) {
ImagePreviewActivity activity = (ImagePreviewActivity) getActivity();
activity.switchBarVisibility();
}
});
return contentView;
}
示例5: initEventAndData
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的package包/类
@Override
protected void initEventAndData() {
setToolBar(toolBar,"");
mRealmHelper = App.getAppComponent().realmHelper();
Intent intent = getIntent();
url = intent.getExtras().getString(Constants.IT_GANK_GRIL_URL);
id = intent.getExtras().getString(Constants.IT_GANK_GRIL_ID);
if (url != null) {
Glide.with(mContext).load(url).asBitmap().into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
bitmap = resource;
ivGirlDetail.setImageBitmap(resource);
mAttacher = new PhotoViewAttacher(ivGirlDetail);
}
});
}
}
示例6: setupDetailsOverviewRow
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的package包/类
private DetailsOverviewRow setupDetailsOverviewRow(Object event) {
final DetailsOverviewRow row = new DetailsOverviewRow(event);
String thumbUrl;
if (event instanceof Event) {
thumbUrl = ((Event) event).getThumbUrl();
} else {
thumbUrl = ((Room) event).getThumb();
}
Glide.with(getActivity())
.load(thumbUrl)
.asBitmap()
.into(new SimpleTarget<Bitmap>(DETAIL_THUMB_WIDTH, DETAIL_THUMB_HEIGHT) {
@Override
public void onResourceReady(Bitmap resource,
GlideAnimation<? super Bitmap> glideAnimation) {
row.setImageBitmap(getActivity(), resource);
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
// super.onLoadFailed(e, errorDrawable);
row.setImageDrawable(getResources().getDrawable(DEFAULT_DRAWABLE));
}
});
return row;
}
示例7: onUpdateMusicNotification
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的package包/类
/**
* 更新通知
*/
public void onUpdateMusicNotification(MusicBean bean, boolean isplay){
Log.e(TAG,"更新通知--歌曲名称:"+ bean.getSongname()+"--isplay:"+isplay);
if (null == bean) return;
//更新歌曲名称
remoteViews.setTextViewText(R.id.tv_song_name,(bean.getSongname() == null ? "" : bean.getSongname()));
//更新歌手名字
remoteViews.setTextViewText(R.id.tv_singer,(bean.getSingername() == null ? "" : bean.getSingername()));
//更新歌曲图片
Glide.with(context).load(bean.getAlbumpic_big()).asBitmap().into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
remoteViews.setImageViewBitmap(R.id.img_song, resource);
}
});
//更新播放状态:播放或者暂停
if (isplay){
remoteViews.setImageViewResource(R.id.img_play,R.mipmap.play);
}else {
remoteViews.setImageViewResource(R.id.img_play,R.mipmap.pause);
}
onCreateMusicNotification();//弹出更新的通知
}
示例8: initEventAndData
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的package包/类
@Override
protected void initEventAndData() {
setToolBar(toolBar,"");
mRealmHelper = App.getAppComponent().realmHelper();
Intent intent = getIntent();
url = intent.getExtras().getString("url");
id = intent.getExtras().getString("id");
if (url != null) {
Glide.with(mContext).load(url).asBitmap().into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
bitmap = resource;
ivGirlDetail.setImageBitmap(resource);
mAttacher = new PhotoViewAttacher(ivGirlDetail);
}
});
}
}
示例9: onActivityResult
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的package包/类
@Override
public void onActivityResult(int reqCode, int resultCode, final Intent data) {
super.onActivityResult(reqCode, resultCode, data);
Uri outputFile = Uri.fromFile(new File(getCacheDir(), "cropped"));
if (data == null || resultCode != Activity.RESULT_OK)
return;
switch (reqCode) {
case PICK_CONTACT:
List<String> selected = data.getStringArrayListExtra("contacts");
for (String contact : selected) {
final Recipient recipient = RecipientFactory.getRecipientsFromString(this, contact, false).getPrimaryRecipient();
if (recipient != null) addSelectedContacts(recipient);
}
break;
case Crop.REQUEST_PICK:
new Crop(data.getData()).output(outputFile).asSquare().start(this);
break;
case Crop.REQUEST_CROP:
Glide.with(this).load(Crop.getOutput(data)).asBitmap()
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.centerCrop().override(AVATAR_SIZE, AVATAR_SIZE)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
setAvatar(Crop.getOutput(data), resource);
}
});
}
}
示例10: updateBackground
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的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();
}
示例11: updateMetadata
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的package包/类
private void updateMetadata(final Movie movie) {
final MediaMetadata.Builder metadataBuilder = new MediaMetadata.Builder();
String title = movie.getTitle().replace("_", " -");
metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_TITLE, title);
metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE,
movie.getDescription());
metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI,
movie.getCardImageUrl());
// And at minimum the title and artist for legacy support
metadataBuilder.putString(MediaMetadata.METADATA_KEY_TITLE, title);
metadataBuilder.putString(MediaMetadata.METADATA_KEY_ARTIST, movie.getStudio());
Glide.with(this)
.load(Uri.parse(movie.getCardImageUrl()))
.asBitmap()
.into(new SimpleTarget<Bitmap>(500, 500) {
@Override
public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
metadataBuilder.putBitmap(MediaMetadata.METADATA_KEY_ART, bitmap);
mSession.setMetadata(metadataBuilder.build());
}
});
}
示例12: DebouncedImageLoader
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的package包/类
public DebouncedImageLoader(Context context, BackgroundManager backgroundManager, int width, int height) {
mBackgroundManager = backgroundManager;
Observable.create(this)
.debounce(1, TimeUnit.SECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(posterProvider -> {
Glide.with(context)
.load(posterProvider.providePosterURL())
.asBitmap()
.centerCrop()
.into(new SimpleTarget<Bitmap>(width, height) {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap>
glideAnimation) {
mBackgroundManager.setBitmap(resource);
}
});
});
}
示例13: loadImageWithProgress
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的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);
}
});
}
示例14: loadGif
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的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);
}
});
}
示例15: initializeBackground
import com.bumptech.glide.request.animation.GlideAnimation; //导入依赖的package包/类
private void initializeBackground(Movie data) {
mDetailsBackground.enableParallax();
Glide.with(getActivity())
.load(data.getBackgroundImageUrl())
.asBitmap()
.centerCrop()
.error(R.drawable.default_background)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap bitmap,
GlideAnimation<? super Bitmap> glideAnimation) {
mDetailsBackground.setCoverBitmap(bitmap);
mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size());
}
});
}