コード例 #1
0
 @Override
 protected Bitmap doInBackground(Object... args) {
   thumbnailPath = (String) args[0];
   localFullSizePath = (String) args[1];
   remotePath = (String) args[2];
   chatType = (ChatType) args[3];
   iv = (ImageView) args[4];
   // if(args[2] != null) {
   activity = (Activity) args[5];
   // }
   message = (EMMessage) args[6];
   File file = new File(thumbnailPath);
   if (file.exists()) {
     return ImageUtils.decodeScaleImage(thumbnailPath, 160, 160);
   } else {
     if (message.direct == EMMessage.Direct.SEND) {
       return ImageUtils.decodeScaleImage(localFullSizePath, 160, 160);
     } else {
       return null;
     }
   }
 }
コード例 #2
0
 @Override
 protected Bitmap doInBackground(Object... params) {
   thumbnailPath = (String) params[0];
   thumbnailUrl = (String) params[1];
   iv = (ImageView) params[2];
   activity = (Activity) params[3];
   message = (EMMessage) params[4];
   adapter = (BaseAdapter) params[5];
   if (new File(thumbnailPath).exists()) {
     return ImageUtils.decodeScaleImage(thumbnailPath, 120, 120);
   } else {
     return null;
   }
 }
コード例 #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.alert_dialog);
    mTextView = (TextView) findViewById(R.id.title);
    mButton = (TextView) findViewById(R.id.btn_cancel);
    imageView = (ImageView) findViewById(R.id.image);
    editText = (EditText) findViewById(R.id.edit);
    // 提示内容
    String msg = getIntent().getStringExtra("msg");
    // 提示标题
    String title = getIntent().getStringExtra("title");
    position = getIntent().getIntExtra("position", -1);
    // 是否显示取消标题
    boolean isCanceTitle = getIntent().getBooleanExtra("titleIsCancel", false);
    // 是否显示取消按钮
    boolean isCanceShow = getIntent().getBooleanExtra("cancel", false);
    // 是否显示文本编辑框
    isEditextShow = getIntent().getBooleanExtra("editTextShow", false);
    // 转发复制的图片的path
    String path = getIntent().getStringExtra("forwardImage");
    //
    String edit_text = getIntent().getStringExtra("edit_text");

    if (msg != null) ((TextView) findViewById(R.id.alert_message)).setText(msg);
    if (title != null) mTextView.setText(title);
    if (isCanceTitle) {
      mTextView.setVisibility(View.GONE);
    }
    if (isCanceShow) mButton.setVisibility(View.VISIBLE);
    if (path != null) {
      // 优先拿大图,没有去取缩略图
      if (!new File(path).exists()) path = DownloadImageTask.getThumbnailImagePath(path);
      imageView.setVisibility(View.VISIBLE);
      ((TextView) findViewById(R.id.alert_message)).setVisibility(View.GONE);
      if (ImageCache.getInstance().get(path) != null) {
        imageView.setImageBitmap(ImageCache.getInstance().get(path));
      } else {
        Bitmap bm = ImageUtils.decodeScaleImage(path, 150, 150);
        imageView.setImageBitmap(bm);
        ImageCache.getInstance().put(path, bm);
      }
    }
    if (isEditextShow) {
      editText.setVisibility(View.VISIBLE);
      editText.setText(edit_text);
    }
  }