當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。