Java 类com.bumptech.glide.load.resource.drawable.GlideDrawable 实例源码

项目:redpacketui-open    文件:ADPacketFragment.java   
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));
    }
}
项目:q-mail    文件:ContactPictureLoader.java   
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);
}
项目:PeSanKita-android    文件:ZoomingImageView.java   
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();
         }
       });
}
项目:HelloTV    文件:MainFragment.java   
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();
}
项目:YiZhi    文件:ImageBrowseActivity.java   
/**
 * 加载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);
                }
            });
}
项目:Android-MVVM-Example    文件:VideoListAdapter.java   
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);
                }
            });
}
项目:chaosflix-leanback    文件:EventsBrowseFragment.java   
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));

}
项目:chaosflix-leanback    文件:EventsBrowseFragment.java   
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();
}
项目:tubik    文件:MainFragment.java   
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();
}
项目:leanback-extensions    文件:MainFragment.java   
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();
}
项目:chaosflix    文件:EventsBrowseFragment.java   
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));

}
项目:chaosflix    文件:EventsBrowseFragment.java   
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();
}
项目:react-native-fast-image    文件:FastImageViewManager.java   
@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;
}
项目:react-native-fast-image    文件:FastImageViewManager.java   
@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;
}
项目:Cable-Android    文件:ZoomingImageView.java   
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();
         }
       });
}
项目:AndroidModulePattern    文件:ImageUtils.java   
/**
 * 显示加载进度
 *
 * @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);
        }
    });
}
项目:Appmatic-Android    文件:ImagePreviewAdapter.java   
@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;
}
项目:glide-support    文件:TestListFragment.java   
@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;
}
项目:glide-support    文件:GeneratingAdapter.java   
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
    ;
}
项目:beautyleg    文件:DetailActivity.java   
@Override
protected void initView() {
    super.initView();
    setContentView(R.layout.image_detail);
    ButterKnife.bind(this);
    i = getIntent().getIntExtra("position", 1);
    url = ImageUrlList.bigurl.get(i);
    progressBar.setVisibility(View.VISIBLE);
    Glide.with(this).load(url).diskCacheStrategy(DiskCacheStrategy.ALL).into(new SimpleTarget<GlideDrawable>() {
        @Override
        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
            image.setImageDrawable(resource);
            progressBar.setVisibility(View.GONE);
        }
    });
    image.setOnLongClickListener(this);
}
项目:eanalytics-android    文件:MainFragment.java   
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();
}
项目:glide-support    文件:DetailFragmentWithPager.java   
@Override public Object instantiateItem(ViewGroup container, int position) {
    ImageView image;
    if (position == 0) { // main image
        // already added, no need for container.addView
        image = DetailFragmentWithPager.this.imageView;
        if (image.getDrawable() == null) {
            // nothing is loaded, that is loadThumb() wasn't called
            // this happens when the ViewPager destroys the main page, but scrolls back to it
            // if a transition happens loadThumb() already set the image and there's no need to do anything
            // the transition listeners will finish the full load
            loadFull(false);
        }
    } else { // rest of the images
        image = new ImageView(container.getContext());
        image.setLayoutParams(new MarginLayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        container.addView(image);
        Glide
                .with(DetailFragmentWithPager.this)
                .load(item.images.get(position - 1))
                .centerCrop()
                .listener(new LoggingListener<String, GlideDrawable>())
                .into(image);
    }
    return image;
}
项目:glide-support    文件:ListFragment.java   
private void bind(final ListItem model) {
    bound = model;
    Glide
            .with(itemView.getContext())
            .load(model.getLowUrl())
            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .listener(new LoggingListener<String, GlideDrawable>())
            .into(new GlideDrawableImageViewTarget(image) {
                @Override public void onLoadFailed(Exception e, Drawable errorDrawable) {
                    Glide
                            .with(itemView.getContext())
                            .load(model.getThumbUrl())
                            .error(R.drawable.glide_error)
                            .listener(new LoggingListener<String, GlideDrawable>())
                            .into(image);
                }
            });
}
项目:glide-support    文件:TestFragment_Single.java   
@Override protected void load(final Context context) throws Exception {
    String url = "http://www.kizoa.com/img/e8nZC.gif";
    Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.github_1261_nine_to_five);
    if (drawable instanceof Animatable) {
        ((Animatable)drawable).stop();
        ((Animatable)drawable).start();
    }
    Glide
            .with(this)
            .load(url)
            .placeholder(drawable)
            .crossFade(3000)
            .skipMemoryCache(true) // make sure the image is reloaded so the placeholder has a chance
            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .bitmapTransform(DelayTransformation.<Bitmap>create(2000)) // debug lengthen decode to see placeholder
            .listener(new LoggingListener<String, GlideDrawable>())
            .into(new LoggingTarget<>(new GlideDrawableImageViewTarget(imageView)))
    ;
}
项目:Hillffair    文件:SplashActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_splash);
    image_splash = (ImageView) findViewById(R.id.image_spalsh);
    Target<GlideDrawable> into = Glide.with(SplashActivity.this).load(R.drawable.splash_new2).into(image_splash);
    Handler handler=new Handler();
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            startActivity(new Intent(SplashActivity.this,WelcomeActivity.class));
              finish();
        }
    },TIME_SPLASH);

}
项目:glide-support    文件:TestFragment.java   
@Override protected void load(Context context) throws Exception {
    String urlString = "http://web.twisterrob.net/glide/1257_changing.php";
    Glide
            .with(this)
            .load(new ForceLoadGlideUrl(urlString))
            .fitCenter()
            .diskCacheStrategy(DiskCacheStrategy.NONE)
            .skipMemoryCache(true)
            //.placeholder(R.drawable.glide_placeholder)
            //.error(R.drawable.glide_error)
            .listener(new LoggingListener<GlideUrl, GlideDrawable>("full"))
            .thumbnail(Glide
                    .with(this)
                    .load(new CachedGlideUrl(urlString))
                    .diskCacheStrategy(DiskCacheStrategy.NONE)
                    .skipMemoryCache(true)
                    .listener(new LoggingListener<GlideUrl, GlideDrawable>("thumbnail"))
                    .bitmapTransform(new FitCenter(context), new GrayscaleTransformation(context))
                    .sizeMultiplier(0.25f)
            )
            .into(imageView);
}
项目:inbbbox-android    文件:ShotLoadingUtil.java   
public static void loadMainViewShotWithPlaceholderAndListener(Context context, ImageView placeholderView,
                                                              ImageView targetView, ShotImage shot,
                                                              RequestListener<String, GlideDrawable> requestListener) {
    Glide.clear(targetView);
    String imageUrl = getImageUrl(shot);

    Glide.clear(placeholderView);
    placeholderView.setVisibility(View.GONE);

    GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(targetView);
    Glide.with(context)
            .load(imageUrl)
            .listener(requestListener)
            .placeholder(R.drawable.shot_placeholder)
            .thumbnail(ShotLoadingUtil.getThumbnailRequest(context, shot.thumbnailUrl()))
            .animate(android.R.anim.fade_in)
            .into(imageViewTarget);

}
项目:Android-High-Performance-Programming    文件:MainFragment.java   
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();
}
项目:Android-High-Performance-Programming    文件:MainFragment.java   
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();
}
项目:likequanmintv    文件:VerFullLiveUI.java   
private void initData() {
    if (mPlayBean!=null){
        livePlayerPresenterImpl.enterRoom(mPlayBean.uid);
    }

    Glide.with(this)
            .load(mPlayBean.love_cover)
            .into(new ImageViewTarget<GlideDrawable>(bgImg) {
                @Override
                protected void setResource(GlideDrawable resource) {
                    bgImg.setImageDrawable(resource);
                    Blurry.with(VerFullLiveUI.this)
                            .animate()
                            .radius(10)
                            .sampling(8)
                            .capture(bgImg)
                            .into(bgImg);
                }
            });
}
项目:Mediathek    文件:MainFragment.java   
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();
}
项目:glide-support    文件:DetailFragment.java   
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final ListItem model = (ListItem)getArguments().getSerializable("model");
    Glide
            .with(this)
            .using(new NetworkDisablingLoader<String>()) // TODO disables network for debug
            .load(model.getStandardUrl())
            .listener(new LoggingListener<String, GlideDrawable>())
            .into(new GlideDrawableImageViewTarget(imageView) {
                @Override public void onLoadFailed(Exception e, Drawable errorDrawable) {
                    Glide
                            .with(DetailFragment.this)
                            .using(new NetworkDisablingLoader<String>()) // TODO disables network for debug
                            .load(model.getLowUrl())
                            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                            .error(R.drawable.glide_error)
                            .listener(new LoggingListener<String, GlideDrawable>())
                            .into(imageView);
                }
            });
}
项目:MyTouchGallery    文件:PictureSlideFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v=inflater.inflate(R.layout.fragment_picture_slide,container,false);

    imageView= (ImageView) v.findViewById(R.id.iv_main_pic);
    mAttacher = new PhotoViewAttacher(imageView);

    Glide.with(getActivity()).load(url).crossFade().into(new GlideDrawableImageViewTarget(imageView) {
        @Override
        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
            super.onResourceReady(resource, animation);
            mAttacher.update();
        }
    });
    return v;
}
项目:Pasta-for-Spotify    文件:CustomImageView.java   
public void load(final DrawableRequestBuilder request) {
    if (getWidth() > 0 && getHeight() > 0) {
        request.dontAnimate().into(new SimpleTarget<GlideDrawable>(getWidth(), getHeight()) {
            @Override
            public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
                transition(resource);
            }
        });
    } else {
        getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                load(request);
                getViewTreeObserver().removeOnGlobalLayoutListener(this);
            }
        });
    }
}
项目:glide-support    文件:TestFragment.java   
void bind(Item item, int position) {
    this.item = item;
    Glide
            .with(TestFragment.this)
            .load(item.thumbUrl)
            .override(256, 256)
            .centerCrop()
            .listener(new LoggingListener<String, GlideDrawable>("adapter"))
            .into(image)
    ;
    text.setText(item.color);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        text.setTransitionName("transtext" + position);
        image.setTransitionName("transimage" + position);
    }
}
项目:PeSanKita-android    文件:GiphyAdapter.java   
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
  Log.w(TAG, e);

  synchronized (this) {
    if (image.getGifUrl().equals(model)) {
      this.modelReady = true;
      notifyAll();
    }
  }

  return false;
}
项目:PeSanKita-android    文件:GiphyAdapter.java   
@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
  synchronized (this) {
    if (image.getGifUrl().equals(model)) {
      this.modelReady = true;
      notifyAll();
    }
  }

  return false;
}
项目:HelloTV    文件:PlaybackOverlayFragment.java   
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());
                }
            });
}
项目:HelloTV    文件:VideoDetailsFragment.java   
protected void updateBackground(String uri) {
    Glide.with(getActivity())
            .load(uri)
            .centerCrop()
            .error(mDefaultBackground)
            .into(new SimpleTarget<GlideDrawable>(mMetrics.widthPixels, mMetrics.heightPixels) {
                @Override
                public void onResourceReady(GlideDrawable resource,
                                            GlideAnimation<? super GlideDrawable> glideAnimation) {
                    mBackgroundManager.setDrawable(resource);
                }
            });
}
项目:HelloTV    文件:VideoDetailsFragment.java   
private void setupDetailsOverviewRow() {
    Log.d(TAG, "doInBackground: " + mSelectedMovie.toString());
    final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedMovie);
    row.setImageDrawable(getResources().getDrawable(R.drawable.default_background));
    int width = Utils.convertDpToPixel(getActivity()
            .getApplicationContext(), DETAIL_THUMB_WIDTH);
    int height = Utils.convertDpToPixel(getActivity()
            .getApplicationContext(), DETAIL_THUMB_HEIGHT);
    Glide.with(getActivity())
            .load(mSelectedMovie.getCardImageUrl())
            .centerCrop()
            .error(R.drawable.default_background)
            .into(new SimpleTarget<GlideDrawable>(width, height) {
                @Override
                public void onResourceReady(GlideDrawable resource,
                                            GlideAnimation<? super GlideDrawable>
                                                    glideAnimation) {
                    Log.d(TAG, "details overview card image url ready: " + resource);
                    row.setImageDrawable(resource);
                    mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size());
                }
            });

    row.addAction(new Action(ACTION_WATCH_TRAILER, getResources().getString(
            R.string.watch_trailer_1), getResources().getString(R.string.watch_trailer_2)));
    row.addAction(new Action(ACTION_RENT, getResources().getString(R.string.rent_1),
            getResources().getString(R.string.rent_2)));
    row.addAction(new Action(ACTION_BUY, getResources().getString(R.string.buy_1),
            getResources().getString(R.string.buy_2)));

    mAdapter.add(row);
}