コード例 #1
0
  /** 初始化ImageLoader,在Application中执行 */
  @Override
  public void initImageLoader() {
    initUIL();

    if (imageLoader == null) imageLoader = ImageLoader.getInstance();
    if (!imageLoader.isInited()) imageLoader.init(defaultUilLoader);

    mImageCacheDir = fileHandler.getCacheDirByType(CacheDir.IMAGE);
  }
コード例 #2
0
  public StickyGridAdapter(Activity activity, List<PictureItem> hasHeaderIdList) {

    this.mActivity = activity;
    mInflater = LayoutInflater.from(mActivity);
    this.hasHeaderIdList = hasHeaderIdList;
    mImageLoader = ImageLoader.getInstance();
    ImageLoaderConfiguration configuration = ImageLoaderConfiguration.createDefault(mActivity);
    if (!mImageLoader.isInited()) {
      mImageLoader.init(configuration);
    }
  }
コード例 #3
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    Log.e("wat", "" + imageLoader.isInited());

    imageLoader.displayImage(
        mUrl,
        imageDisplay,
        options,
        new SimpleImageLoadingListener() {
          @Override
          public void onLoadingStarted(String imageUri, View view) {
            Log.d("testing", mUrl);
          }

          @Override
          public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
            String message = null;
            switch (failReason.getType()) {
              case IO_ERROR:
                message = "Input/Output error";
                break;
              case DECODING_ERROR:
                message = "Image can't be decoded";
                break;
              case NETWORK_DENIED:
                message = "Downloads are denied";
                break;
              case OUT_OF_MEMORY:
                message = "Out Of Memory error";
                break;
              case UNKNOWN:
                message = "Unknown error";
                break;
            }

            // CHANGED4
            // listener.removeUrlFromList(mImageNum);

          }

          @Override
          public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {}
        });
  }
コード例 #4
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mContext = getActivity().getApplicationContext();

    mGridViewAdapter = new ImageGridViewAdapter();
    mGridView.setAdapter(mGridViewAdapter);
    mGridView.setOnScrollListener(this);
    mGridView.setOnItemClickListener(this);
    imageLoader = ((BaseActivity) getActivity()).imageLoader;
    if (!imageLoader.isInited()) imageLoader.init(ImageLoaderConfiguration.createDefault(mContext));
    mInflater = getLayoutInflater(savedInstanceState);
    options =
        new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.ic_stub)
            .showImageForEmptyUri(R.drawable.ic_empty)
            .showImageOnFail(R.drawable.ic_error)
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .considerExifParams(true)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();
  }