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()); } }); }
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); }
@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; }
@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); } }); } }
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)); } }
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; }
/** * 更新通知 */ 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();//弹出更新的通知 }
@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); } }); } }
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(); }
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()); } }); }
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); } }); }); }
/** * 显示加载进度 * * @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); } }); }
/** * 加载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); } }); }
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()); } }); }
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)); }
@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; }
@Override public void onBindViewHolder(final XianViewHolder holder, int position) { final XianduItem item = xiandus.get(position); holder.rootView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { WebUtils.openInternal(context, item.getUrl()); } }); holder.tv_name.setText(String.format("%s. %s", position + 1, item.getName())); holder.tv_info.setText(item.getUpdateTime() + " • " + item.getFrom()); Glide.with(context).load(item.getIcon()).asBitmap().diskCacheStrategy(DiskCacheStrategy.ALL).fitCenter().into(new SimpleTarget<Bitmap>() { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(context.getResources(), resource); circularBitmapDrawable.setCircular(true); holder.iv.setImageDrawable(circularBitmapDrawable); } }); }
@Override public Drawable getDrawable(String source) { final URLDrawable urlDrawable = new URLDrawable(); try { URL url = new URL(source); Glide.with(mContext).load(url.toString()).asBitmap().into(new SimpleTarget<Bitmap>() { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { urlDrawable.bitmap = resource; int width = mTextView.getWidth() - 2 * mTextView.getTotalPaddingRight(); urlDrawable.setBounds(0, 0, width, resource.getHeight()); mTextView.invalidate(); mTextView.setText(mTextView.getText()); // 解决图文重叠 } }); } catch (Exception e) { e.printStackTrace(); } return urlDrawable; }
private void initializeBackground(Movie movie) { mDetailsBackground.enableParallax(); Glide.with(getActivity()) .load(movie.getBackgroundImage()) .asBitmap() .centerCrop() .error(R.drawable.assistant_tv_banner) .into( new SimpleTarget<Bitmap>() { @Override public void onResourceReady( Bitmap bitmap, GlideAnimation<? super Bitmap> glideAnimation) { mDetailsBackground.setCoverBitmap(bitmap); mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size()); } }); }
private void updateBackground(String uri) { int width = mMetrics.widthPixels; int height = mMetrics.heightPixels; Glide.with(this) .load(uri) .asBitmap() .centerCrop() .error(mDefaultBackground) .into(new SimpleTarget<Bitmap>(width, height) { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { mBackgroundManager.setBitmap(resource); } }); mBackgroundTimer.cancel(); }
@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); } }); } }
@Override protected void initData() { super.initData(); mPath = getIntent().getStringExtra("image"); getImageLoader() .load(mPath) .downloadOnly(new SimpleTarget<File>() { @Override public void onResourceReady(File resource, GlideAnimation<? super File> glideAnimation) { if (isDestroyed()) return; BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(resource.getPath(), options); int w = options.outWidth; int sw = Util.getScreenWidth(LargeImageActivity.this); float scale = (float) sw / (float) w; mImageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM); mImageView.setImage(ImageSource.uri(Uri.fromFile(resource)), new ImageViewState(scale, new PointF(0, 0), net.oschina.app.improve.utils.BitmapUtil.readPictureDegree(mPath))); mImageSave.setVisibility(View.VISIBLE); mLoading.stop(); mLoading.setVisibility(View.GONE); } }); }
private void replaceImage(final String imageName) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; File imageFile = new File(mView.getActivity().getExternalFilesDir(mNoteId).getPath() + "/" + imageName); BitmapFactory.decodeFile(imageFile.getPath(), options); int imageRequestWidth = getRequestImeWidth(); int imageRequestHeight = setNeedHeight(options); Glide.with(mView.getActivity()) .load(imageFile) .asBitmap() .override(imageRequestWidth, imageRequestHeight) .fitCenter() .priority(Priority.HIGH) .into(new SimpleTarget<Bitmap>() { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { mView.replaceImage(imageName, resource); } }); }
private void displayImage() { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; // 对图片进行设置 但不形成示例,不耗费内存 BitmapFactory.decodeFile(mImageFile.getPath(), options); int imageRequestWidth = getRequestImeWidth(); int imageRequestHeight = getRequestImeHeight(options); Logger.d("width " + imageRequestWidth + " height:" + imageRequestHeight); Logger.d("bitmap1 width " + options.outWidth + " height:" + options.outHeight); Glide.with(mView.getActivity()) .load(mImageFile) .asBitmap() .override(imageRequestWidth, imageRequestHeight) // 设置大小 .fitCenter() // 不按照比例 .into(new SimpleTarget<Bitmap>() { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { //根据Bitmap对象创建ImageSpan对象 Logger.d("bitmap width:" + resource.getWidth() + " height:" + resource.getHeight()); mView.insertImage(mImageName, resource); } }); }
public static void loadBitmap(Context context, String url, final OnLoadBitmapCallback callback) { Glide.with(context).load(url).asBitmap() .dontAnimate() .placeholder(R.drawable.ic_place_holder_small) .error(R.drawable.ic_error_small) .into(new SimpleTarget<Bitmap>() { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { callback.loadBitmap(resource); } }); }
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.settings_menu_timeline, menu); @SuppressWarnings("unused") MenuItem toot_settings_button = menu.findItem(R.id.toot_settings_button); Mastodon.getInstance().getLoggedUserInfo() .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe( (Response<Account> response) -> Glide.with(this) .load(response.body().getAvatar()) .asBitmap() .diskCacheStrategy(DiskCacheStrategy.ALL) .placeholder(R.drawable.missingavatar) .into(new SimpleTarget<Bitmap>(65, 65) { @Override public void onResourceReady(Bitmap resource, GlideAnimation glideAnimation) { RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(TimelineFragmentContainer.this.getResources(), resource); circularBitmapDrawable.setCircular(true); toot_settings_button.setIcon(circularBitmapDrawable); } }), this::errorAccountInfo ); return super.onCreateOptionsMenu(menu); }
@Override public void loadNet(Context context, String url, Options options, final LoadCallback callback) { DrawableTypeRequest request = getRequestManager(context).load(url); if (options == null) options = Options.defaultOptions(); if (options.loadingResId != Options.RES_NONE) { request.placeholder(options.loadingResId); } if (options.loadErrorResId != Options.RES_NONE) { request.error(options.loadErrorResId); } wrapScaleType(request, options) .diskCacheStrategy(DiskCacheStrategy.SOURCE) .crossFade() .into(new SimpleTarget<GlideBitmapDrawable>() { @Override public void onLoadFailed(Exception e, Drawable errorDrawable) { super.onLoadFailed(e, errorDrawable); if (callback != null) { callback.onLoadFailed(e); } } @Override public void onResourceReady(GlideBitmapDrawable resource, GlideAnimation<? super GlideBitmapDrawable> glideAnimation) { if (resource != null && resource.getBitmap() != null) { if (callback != null) { callback.onLoadReady(resource.getBitmap()); } } } }); }
@Override public Drawable getDrawable(String source) { final RichTextView tv = weakRef.get(); final LevelListDrawable mDrawable = new LevelListDrawable(); Glide.with(tv.getContext()).load(source).asBitmap().placeholder(R.drawable.ic_placeholder).into(new SimpleTarget<Bitmap>() { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { if (width == 0) { tv.measure(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); width = tv.getWidth(); } BitmapDrawable d = new BitmapDrawable(resource); mDrawable.addLevel(1, 1, d); int imageWidth; int imageHeight; //小图只需略微扩大,大图则宽度铺满 if (resource.getHeight() < 50 || resource.getWidth() < 50) { imageWidth = (int) (resource.getWidth() * zoomFactor); imageHeight = (int) (resource.getHeight() * zoomFactor); } else { imageWidth = width; double ratio = (double) resource.getHeight() / (double) resource.getWidth(); imageHeight = (int) (ratio * width); } mDrawable.setBounds(0, 0, imageWidth, imageHeight); mDrawable.setLevel(1); tv.invalidate(); tv.setText(tv.getText()); } }); return mDrawable; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SPUtils util = new SPUtils("theme_id"); int theme_id = util.getInt("theme_id", R.style.AppTheme); setTheme(theme_id); setContentView(R.layout.activity_image); ButterKnife.bind(this); // Calendar now = new GregorianCalendar(); // SimpleDateFormat simpleDate = new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()); // fileName = simpleDate.format(now.getTime()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { //透明状态栏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); //透明导航栏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); } Intent intent=getIntent(); String who=intent.getStringExtra("who"); url=intent.getStringExtra("imageUrl"); fileName=url.substring(50,60); setSupportActionBar(toolbar); ActionBar actionBar=getSupportActionBar(); if (actionBar!=null){ actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(who); } Glide.with(getApplicationContext()).load(url).asBitmap().into(new SimpleTarget<Bitmap>() { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { mBitmap=resource; imageView.setImageBitmap(resource); } }); }
public void showWhenPictureReady (final String tag, final int id) { Glide.with(getCenter().getContext()).load(url) .asBitmap().into(new SimpleTarget<Bitmap>() { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { bigPicture(resource).show(tag, id); } }); }
private void loadImage(String imageUrl, NotificationCompat.Builder builder){ if(!TextUtils.isEmpty(imageUrl)) { Glide.with(service) .load(imageUrl) .asBitmap() .priority(Priority.IMMEDIATE) .into(new SimpleTarget<Bitmap>() { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { builder.setLargeIcon(resource); manager.notify(NOTIFICATION_ID, builder.build()); } }); } }
protected void updateVideoImage(String uri) { Glide.with(getActivity()) .load(uri) .centerCrop() .into(new SimpleTarget<GlideDrawable>(CARD_WIDTH, CARD_HEIGHT) { @Override public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) { mPlaybackControlsRow.setImageDrawable(resource); mRowsAdapter.notifyArrayItemRangeChanged(0, mRowsAdapter.size()); } }); }
public void updateMenuBg() { Glide.with(this).load(user.getWallPaper()).into(new SimpleTarget<GlideDrawable>() { @Override public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) { container.setBackground(resource); } }); }