|
@@ -1,22 +1,24 @@
|
|
|
package com.xzjmyk.pm.activity.ui.erp.activity.oa;
|
|
package com.xzjmyk.pm.activity.ui.erp.activity.oa;
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
import android.app.Activity;
|
|
|
-import android.content.DialogInterface;
|
|
|
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
|
import android.net.Uri;
|
|
import android.net.Uri;
|
|
|
import android.os.AsyncTask;
|
|
import android.os.AsyncTask;
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
import android.os.Handler;
|
|
|
import android.os.Message;
|
|
import android.os.Message;
|
|
|
-import android.support.v7.app.AlertDialog;
|
|
|
|
|
import android.text.Editable;
|
|
import android.text.Editable;
|
|
|
import android.text.TextWatcher;
|
|
import android.text.TextWatcher;
|
|
|
|
|
+import android.view.Gravity;
|
|
|
|
|
+import android.view.LayoutInflater;
|
|
|
import android.view.Menu;
|
|
import android.view.Menu;
|
|
|
import android.view.MenuItem;
|
|
import android.view.MenuItem;
|
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
import android.view.WindowManager;
|
|
import android.view.WindowManager;
|
|
|
import android.widget.EditText;
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
|
|
|
+import android.widget.LinearLayout;
|
|
|
|
|
+import android.widget.PopupWindow;
|
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
@@ -73,7 +75,8 @@ public class OutSigninOKActivity extends BaseActivity {
|
|
|
private ImageView image;
|
|
private ImageView image;
|
|
|
private String baseUrl;
|
|
private String baseUrl;
|
|
|
private Uri mNewPhotoUri;
|
|
private Uri mNewPhotoUri;
|
|
|
- private boolean isSubmit=false;
|
|
|
|
|
|
|
+ private boolean isSubmit = false;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
@@ -165,29 +168,8 @@ public class OutSigninOKActivity extends BaseActivity {
|
|
|
private String path = null;
|
|
private String path = null;
|
|
|
|
|
|
|
|
private void showPopup() {
|
|
private void showPopup() {
|
|
|
- AlertDialog.Builder builder = new AlertDialog.Builder(ct);
|
|
|
|
|
- String[] items = {"拍照", "从相册中选择"};
|
|
|
|
|
- builder.setTitle("选择操作");
|
|
|
|
|
- builder.setItems(items, new DialogInterface.OnClickListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
|
|
- if (i == 0) {
|
|
|
|
|
- //调用拍照
|
|
|
|
|
- isTask = true;
|
|
|
|
|
- mNewPhotoUri = CameraUtil.getOutputMediaFileUri(OutSigninOKActivity.this, CameraUtil.MEDIA_TYPE_IMAGE);
|
|
|
|
|
- CameraUtil.captureImage(OutSigninOKActivity.this, mNewPhotoUri, REQUEST_CODE_CAPTURE_PHOTO);
|
|
|
|
|
- } else if (i == 1) {
|
|
|
|
|
- if (!getIntent().getBooleanExtra("isImage", false)) {
|
|
|
|
|
- Crouton.makeText(ct, "您没有被允许使用系统相册,请使用拍照");
|
|
|
|
|
- } else {
|
|
|
|
|
- isTask = false;
|
|
|
|
|
- //调用系统相册
|
|
|
|
|
- CameraUtil.pickImageSimple(OutSigninOKActivity.this, REQUEST_CODE_PICK_PHOTO);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- builder.show();
|
|
|
|
|
|
|
+ mNewPhotoUri = CameraUtil.getOutputMediaFileUri(OutSigninOKActivity.this, CameraUtil.MEDIA_TYPE_IMAGE);
|
|
|
|
|
+ CameraUtil.captureImage(OutSigninOKActivity.this, mNewPhotoUri, REQUEST_CODE_CAPTURE_PHOTO);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private int getID(String chche) {
|
|
private int getID(String chche) {
|
|
@@ -205,17 +187,17 @@ public class OutSigninOKActivity extends BaseActivity {
|
|
|
|
|
|
|
|
private void uploadFile(String path) {
|
|
private void uploadFile(String path) {
|
|
|
if (StringUtils.isEmpty(path)) return;
|
|
if (StringUtils.isEmpty(path)) return;
|
|
|
- File finalFile = new File(path);
|
|
|
|
|
- if (!finalFile.isFile()) return;
|
|
|
|
|
|
|
+ File waterBitmapToFile = ImageUtil.compressWaterBitmapToFile(path, 100, 300, 300
|
|
|
|
|
+ , time_tv.getText().toString().trim(), addr_tv.getText().toString().trim(), 0);
|
|
|
|
|
+ if (!waterBitmapToFile.isFile()) return;
|
|
|
RequestParams params = new RequestParams();
|
|
RequestParams params = new RequestParams();
|
|
|
params.addQueryStringParameter("master", CommonUtil.getSharedPreferences(ct, "erp_master"));
|
|
params.addQueryStringParameter("master", CommonUtil.getSharedPreferences(ct, "erp_master"));
|
|
|
params.addHeader("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
params.addHeader("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
params.addBodyParameter("em_code", CommonUtil.getSharedPreferences(ct, "erp_username"));
|
|
params.addBodyParameter("em_code", CommonUtil.getSharedPreferences(ct, "erp_username"));
|
|
|
params.addBodyParameter("type", "common");
|
|
params.addBodyParameter("type", "common");
|
|
|
- if (isTask)
|
|
|
|
|
- params.addBodyParameter("img", ImageUtil.compressBitmapToFile(path, 100, 300, 300));
|
|
|
|
|
- else
|
|
|
|
|
- params.addBodyParameter("img", finalFile);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ params.addBodyParameter("img", waterBitmapToFile);
|
|
|
|
|
+
|
|
|
String url = Constants.getAppBaseUrl(ct) + "mobile/uploadEmployeeAttach.action";
|
|
String url = Constants.getAppBaseUrl(ct) + "mobile/uploadEmployeeAttach.action";
|
|
|
final HttpUtils http = new HttpUtils();
|
|
final HttpUtils http = new HttpUtils();
|
|
|
http.send(HttpRequest.HttpMethod.POST, url, params, new RequestCallBack<String>() {
|
|
http.send(HttpRequest.HttpMethod.POST, url, params, new RequestCallBack<String>() {
|
|
@@ -265,22 +247,74 @@ public class OutSigninOKActivity extends BaseActivity {
|
|
|
path = mNewPhotoUri.getPath();
|
|
path = mNewPhotoUri.getPath();
|
|
|
// path = CameraUtil.getImagePathFromUri(ct, mNewPhotoUri);
|
|
// path = CameraUtil.getImagePathFromUri(ct, mNewPhotoUri);
|
|
|
if (StringUtils.isEmpty(path)) return;
|
|
if (StringUtils.isEmpty(path)) return;
|
|
|
- ImageLoader.getInstance().displayImage(Uri.fromFile(new File(path)).toString(), image);
|
|
|
|
|
|
|
+ final File waterBitmapToFile = ImageUtil.compressWaterBitmapToFile(path, 100, 300, 300
|
|
|
|
|
+ , time_tv.getText().toString().trim(), addr_tv.getText().toString().trim(), 0);
|
|
|
|
|
+// ImageLoader.getInstance().displayImage(Uri.fromFile(new File(path)).toString(), image);
|
|
|
|
|
+ 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();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
} else {
|
|
} else {
|
|
|
ToastUtil.showToast(this, R.string.c_take_picture_failed);
|
|
ToastUtil.showToast(this, R.string.c_take_picture_failed);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- } else if (requestCode == REQUEST_CODE_PICK_PHOTO) {// 选择一张图片,然后立即调用裁减
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ /*else if (requestCode == REQUEST_CODE_PICK_PHOTO) {// 选择一张图片,然后立即调用裁减
|
|
|
if (resultCode == Activity.RESULT_OK) {
|
|
if (resultCode == Activity.RESULT_OK) {
|
|
|
if (data != null && data.getData() != null) {
|
|
if (data != null && data.getData() != null) {
|
|
|
path = CameraUtil.getImagePathFromUri(ct, data.getData());
|
|
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;
|
|
if (StringUtils.isEmpty(path)) return;
|
|
|
- ImageLoader.getInstance().displayImage(Uri.fromFile(new File(path)).toString(), image);
|
|
|
|
|
|
|
+ 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();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
} else {
|
|
} else {
|
|
|
ToastUtil.showToast(this, R.string.c_photo_album_failed);
|
|
ToastUtil.showToast(this, R.string.c_photo_album_failed);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ }*/
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|