|
|
@@ -11,12 +11,15 @@ import android.os.Message;
|
|
|
import android.text.Editable;
|
|
|
import android.text.TextWatcher;
|
|
|
import android.util.Log;
|
|
|
+import android.view.Gravity;
|
|
|
import android.view.Menu;
|
|
|
import android.view.MenuItem;
|
|
|
import android.view.View;
|
|
|
import android.view.inputmethod.InputMethodManager;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
+import android.widget.LinearLayout;
|
|
|
+import android.widget.PopupWindow;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
@@ -45,6 +48,7 @@ import com.xzjmyk.pm.activity.ui.erp.util.JsonValidator;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.StringUtils;
|
|
|
import com.xzjmyk.pm.activity.ui.tool.SingleImagePreviewActivity;
|
|
|
import com.xzjmyk.pm.activity.util.CameraUtil;
|
|
|
+import com.xzjmyk.pm.activity.util.DisplayUtil;
|
|
|
import com.xzjmyk.pm.activity.util.ImageUtil;
|
|
|
import com.xzjmyk.pm.activity.util.TimeUtils;
|
|
|
import com.xzjmyk.pm.activity.util.ToastUtil;
|
|
|
@@ -80,6 +84,8 @@ public class OutSigninOKActivity extends BaseActivity {
|
|
|
private boolean isSubmit = false;
|
|
|
private String netDate;
|
|
|
private File waterBitmapToFile = null;
|
|
|
+ private PopupWindow mPopupWindow;
|
|
|
+ private File mCurrentFile;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -160,13 +166,63 @@ public class OutSigninOKActivity extends BaseActivity {
|
|
|
|
|
|
private static final int REQUEST_CODE_CAPTURE_PHOTO = 1;// 拍照
|
|
|
private static final int REQUEST_CODE_PICK_PHOTO = 2;// 图库
|
|
|
+ private static final int REQUEST_CODE_CROP_PHOTO = 3;//裁剪
|
|
|
private String path = null;
|
|
|
|
|
|
private void showPopup() {
|
|
|
- mNewPhotoUri = CameraUtil.getOutputMediaFileUri(OutSigninOKActivity.this, CameraUtil.MEDIA_TYPE_IMAGE);
|
|
|
- CameraUtil.captureImage(OutSigninOKActivity.this, mNewPhotoUri, REQUEST_CODE_CAPTURE_PHOTO);
|
|
|
- }
|
|
|
+ View headSelectView = View.inflate(OutSigninOKActivity.this, R.layout.layout_select_head, null);
|
|
|
+
|
|
|
+ mPopupWindow = new PopupWindow(headSelectView,
|
|
|
+ LinearLayout.LayoutParams.MATCH_PARENT,
|
|
|
+ LinearLayout.LayoutParams.WRAP_CONTENT);
|
|
|
+ mPopupWindow.setAnimationStyle(R.style.MenuAnimationFade);
|
|
|
+ mPopupWindow.setFocusable(true);
|
|
|
+ mPopupWindow.setOutsideTouchable(true);
|
|
|
+ DisplayUtil.backgroundAlpha(this, 0.5f);
|
|
|
+ mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
|
|
+ @Override
|
|
|
+ public void onDismiss() {
|
|
|
+ closePopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ mPopupWindow.showAtLocation(View.inflate(this, R.layout.activity_base_info, null), Gravity.BOTTOM, 0, 0);
|
|
|
+ TextView takePicTv = (TextView) headSelectView.findViewById(R.id.head_take_picture);
|
|
|
+ TextView selectPicTv = (TextView) headSelectView.findViewById(R.id.head_select_photos);
|
|
|
+ TextView cancelTv = (TextView) headSelectView.findViewById(R.id.head_cancel);
|
|
|
+
|
|
|
+ takePicTv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ mNewPhotoUri = CameraUtil.getOutputMediaFileUri(OutSigninOKActivity.this, CameraUtil.MEDIA_TYPE_IMAGE);
|
|
|
+ CameraUtil.captureImage(OutSigninOKActivity.this, mNewPhotoUri, REQUEST_CODE_CAPTURE_PHOTO);
|
|
|
+ closePopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ selectPicTv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ mNewPhotoUri = CameraUtil.getOutputMediaFileUri(OutSigninOKActivity.this, CameraUtil.MEDIA_TYPE_IMAGE);
|
|
|
+ CameraUtil.pickImageSimple(OutSigninOKActivity.this, REQUEST_CODE_PICK_PHOTO);
|
|
|
+ closePopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ cancelTv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closePopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
+ }
|
|
|
+ private void closePopupWindow() {
|
|
|
+ if (mPopupWindow != null) {
|
|
|
+ mPopupWindow.dismiss();
|
|
|
+ mPopupWindow = null;
|
|
|
+ DisplayUtil.backgroundAlpha(this, 1f);
|
|
|
+ }
|
|
|
+ }
|
|
|
private int getID(String chche) {
|
|
|
if (StringUtils.isEmpty(chche)) return 0;
|
|
|
Pattern p = Pattern.compile("(\\d+)");
|
|
|
@@ -252,39 +308,47 @@ public class OutSigninOKActivity extends BaseActivity {
|
|
|
/*else if (requestCode == REQUEST_CODE_PICK_PHOTO) {// 选择一张图片,然后立即调用裁减
|
|
|
if (resultCode == Activity.RESULT_OK) {
|
|
|
if (data != null && data.getData() != null) {
|
|
|
+ String path = CameraUtil.getImagePathFromUri(this, data.getData());
|
|
|
+ Uri o = Uri.fromFile(new File(path));
|
|
|
+ mNewPhotoUri = CameraUtil.getOutputMediaFileUri(this, CameraUtil.MEDIA_TYPE_IMAGE);
|
|
|
+ mCurrentFile = new File(mNewPhotoUri.getPath());
|
|
|
+ CameraUtil.cropImage(this, o, mNewPhotoUri, REQUEST_CODE_CROP_PHOTO, 1, 1, 300, 300);
|
|
|
+ } else {
|
|
|
+ ToastUtil.showToast(this, R.string.c_photo_album_failed);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+ else if (requestCode == REQUEST_CODE_PICK_PHOTO){
|
|
|
+ if (resultCode == Activity.RESULT_OK) {
|
|
|
+ if (data != null && data.getData() != null) {
|
|
|
+// path = mNewPhotoUri.getPath();
|
|
|
path = CameraUtil.getImagePathFromUri(ct, data.getData());
|
|
|
- final File waterBitmapToFile = ImageUtil.compressWaterBitmapToFile(path, 100, 300, 300
|
|
|
- , time_tv.getText().toString().trim(), addr_tv.getText().toString().trim(), 0);
|
|
|
+ if (StringUtils.isEmpty(path)) return;
|
|
|
+ progressDialog.show();
|
|
|
+ CommonUtil.getNetTime(handler);
|
|
|
+
|
|
|
+ /* waterBitmapToFile = ImageUtil.compressWaterBitmapToFile(path, 100, 300, 300
|
|
|
+ , CommonUtil.getSharedPreferences(getApplicationContext(), "erp_emname")
|
|
|
+ , netDate, addr_tv.getText().toString().trim(), 0);
|
|
|
if (StringUtils.isEmpty(path)) return;
|
|
|
ImageLoader.getInstance().displayImage(Uri.fromFile(waterBitmapToFile).toString(), image);
|
|
|
image.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- LayoutInflater inflater = LayoutInflater.from(OutSigninOKActivity.this);
|
|
|
- final View largeImageView = inflater.inflate(R.layout.layout_large_image, null);
|
|
|
- ImageView imageView = (ImageView) largeImageView.findViewById(R.id.large_image_iv);
|
|
|
- ImageLoader.getInstance().displayImage(Uri.fromFile(waterBitmapToFile).toString(), imageView);
|
|
|
- final PopupWindow largeImageWindow = new PopupWindow(largeImageView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
|
|
|
- largeImageWindow.setAnimationStyle(R.style.Animation_CustomPopup);
|
|
|
- largeImageWindow.setFocusable(true);
|
|
|
- largeImageWindow.setOutsideTouchable(true);
|
|
|
- largeImageWindow.showAtLocation(View.inflate(OutSigninOKActivity.this, R.layout.activity_out_signin_ok, null), Gravity.CENTER, 0, 0);
|
|
|
-
|
|
|
- imageView.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- if (largeImageWindow.isShowing()) {
|
|
|
- largeImageWindow.dismiss();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ try {
|
|
|
+ Intent intent = new Intent(OutSigninOKActivity.this, SingleImagePreviewActivity.class);
|
|
|
+ intent.putExtra(AppConstant.EXTRA_IMAGE_URI, waterBitmapToFile.getCanonicalPath());
|
|
|
+ startActivity(intent);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
- });
|
|
|
+ });*/
|
|
|
} else {
|
|
|
ToastUtil.showToast(this, R.string.c_photo_album_failed);
|
|
|
}
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|