@Override
    public View instantiateItem(ViewGroup container, int position) {
      PhotoView photoView = new PhotoView(container.getContext());
      ImageFetcher fetcher = ImageLoader.createImageFetcher((BaseActivity) context);
      fetcher.setLoadingImage(R.drawable.default_weibo_image);
      try {

        Msg_ChatMessageBean bean = data.get(position);
        Bitmap bitmap = ImageUtil.byteArray2Bitmap(bean.Image);
        photoView.setImageBitmap(bitmap);
        photoView.setOnPhotoTapListener(
            new OnPhotoTapListener() {

              @Override
              public void onPhotoTap(View view, float x, float y) {
                Msg_ImageZoomActivity.this.onBackPressed();
              }
            });

        container.addView(photoView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
      } catch (Exception e) {
        e.printStackTrace();
      } catch (OutOfMemoryError ex) {
        ex.printStackTrace();
      }
      return photoView;
    }
예제 #2
0
 public static void loadDocHeadImage(BaseActivity activity, ImageView imageView, String uri) {
   if (activity == null) {
     return;
   }
   ImageFetcher fetcher = createImageFetcher(activity);
   if (imageView instanceof CircleImageView) {
     fetcher.setImageFadeIn(false); // 与CircleImageView搭配使用时关闭fadein
   }
   fetcher.loadImage(encodeUri(uri), imageView);
 }
예제 #3
0
 public static ImageFetcher createImageFetcher(BaseActivity activity) {
   if (activity.getImageFether() != null) {
     return activity.getImageFether();
   }
   ImageCacheParams params = new ImageCacheParams(activity, IMAGE_CACHE_DIR);
   params.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of app memory
   ImageFetcher fetcher = new ImageFetcher(activity, getMaxScreenSide(activity));
   fetcher.addImageCache(activity.getSupportFragmentManager(), params);
   activity.setImageFetcher(fetcher);
   return fetcher;
 }
예제 #4
0
 public static void removeBitmapCache(BaseActivity activity, String uri) {
   ImageFetcher fetcher = createThumbImageFetcher(activity);
   fetcher.removeBitmapAllCache(uri);
 }
예제 #5
0
 public static void clearCache(BaseActivity activity) {
   ImageFetcher fetcher = createThumbImageFetcher(activity);
   fetcher.clearCache();
 }
예제 #6
0
 //	public static void loadGroupImage(BaseActivity activity, ImageView imageView, String uri) {
 //
 //		ImageFetcher fetcher  = createThumbImageFetcher(activity);
 //		fetcher.setLoadingImage(R.drawable.msg_img_user_default);
 //		fetcher.loadGroupImage(encodeUri(uri), imageView);
 //
 //	}
 public static void loadPushImage(BaseActivity activity, ImageView imageView, String uri) {
   ImageFetcher fetcher = createThumbImageFetcher(activity);
   fetcher.setLoadingImage(R.drawable.default_weibo_image);
   fetcher.loadImage(encodeUri(uri), imageView);
 }
예제 #7
0
  public static void loadBackgroundImage(BaseActivity activity, ImageView imageView, String uri) {

    ImageFetcher fetcher = createImageFetcher(activity);
    fetcher.setLoadingImage(R.drawable.me_img_info);
    fetcher.loadImage(encodeUri(uri), imageView);
  }
예제 #8
0
  public static void loadShareImage(BaseActivity activity, ImageView imageView, String uri) {

    ImageFetcher fetcher = createThumbImageFetcher(activity);
    fetcher.setLoadingImage(R.drawable.worklife_ic_launcher);
    fetcher.loadImage(encodeUri(uri), imageView);
  }
예제 #9
0
  public static void loadHeadImage(BaseActivity activity, ImageView imageView, String uri) {

    ImageFetcher fetcher = createThumbImageFetcher(activity);
    fetcher.setLoadingImage(R.drawable.msg_img_user_default);
    fetcher.loadImage(encodeUri(uri), imageView);
  }