@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;
    }
Exemplo n.º 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);
 }
Exemplo n.º 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;
 }
Exemplo n.º 4
0
 public static void removeBitmapCache(BaseActivity activity, String uri) {
   ImageFetcher fetcher = createThumbImageFetcher(activity);
   fetcher.removeBitmapAllCache(uri);
 }
Exemplo n.º 5
0
 public static void clearCache(BaseActivity activity) {
   ImageFetcher fetcher = createThumbImageFetcher(activity);
   fetcher.clearCache();
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
  }
Exemplo n.º 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);
  }
Exemplo n.º 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);
  }