当前位置: 首页>>代码示例>>Java>>正文


Java GlideDrawable类代码示例

本文整理汇总了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));
    }
}
 
开发者ID:YunzhanghuOpen,项目名称:redpacketui-open,代码行数:26,代码来源:ADPacketFragment.java

示例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);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:19,代码来源:ContactPictureLoader.java

示例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();
         }
       });
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:17,代码来源:ZoomingImageView.java

示例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();
}
 
开发者ID:bassaer,项目名称:HelloTV,代码行数:18,代码来源:MainFragment.java

示例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);
                }
            });
}
 
开发者ID:Horrarndoo,项目名称:YiZhi,代码行数:19,代码来源:ImageBrowseActivity.java

示例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);
                }
            });
}
 
开发者ID:aprochukhan,项目名称:Android-MVVM-Example,代码行数:17,代码来源:VideoListAdapter.java

示例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));

}
 
开发者ID:NiciDieNase,项目名称:chaosflix-leanback,代码行数:25,代码来源:EventsBrowseFragment.java

示例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();
}
 
开发者ID:NiciDieNase,项目名称:chaosflix-leanback,代码行数:18,代码来源:EventsBrowseFragment.java

示例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();
}
 
开发者ID:fasteque,项目名称:leanback-extensions,代码行数:18,代码来源:MainFragment.java

示例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;
}
 
开发者ID:DylanVann,项目名称:react-native-fast-image,代码行数:20,代码来源:FastImageViewManager.java

示例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;
}
 
开发者ID:DylanVann,项目名称:react-native-fast-image,代码行数:20,代码来源:FastImageViewManager.java

示例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);
        }
    });
}
 
开发者ID:guiying712,项目名称:AndroidModulePattern,代码行数:23,代码来源:ImageUtils.java

示例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;
}
 
开发者ID:Nulltilus,项目名称:Appmatic-Android,代码行数:22,代码来源:ImagePreviewAdapter.java

示例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;
}
 
开发者ID:TWiStErRob,项目名称:glide-support,代码行数:23,代码来源:TestListFragment.java

示例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
	;
}
 
开发者ID:TWiStErRob,项目名称:glide-support,代码行数:17,代码来源:GeneratingAdapter.java


注:本文中的com.bumptech.glide.load.resource.drawable.GlideDrawable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。