|
|
@@ -1,15 +1,21 @@
|
|
|
package com.uas.appme.settings.activity;
|
|
|
|
|
|
+import android.app.Activity;
|
|
|
import android.graphics.Bitmap;
|
|
|
import android.graphics.BitmapFactory;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Environment;
|
|
|
import android.os.Handler;
|
|
|
+import android.util.DisplayMetrics;
|
|
|
import android.util.Log;
|
|
|
import android.view.Gravity;
|
|
|
import android.view.LayoutInflater;
|
|
|
+import android.view.Menu;
|
|
|
+import android.view.MenuItem;
|
|
|
import android.view.View;
|
|
|
+import android.view.WindowManager;
|
|
|
import android.widget.Button;
|
|
|
+import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.PopupWindow;
|
|
|
@@ -70,6 +76,8 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
private ImageView clear_im;
|
|
|
private String master;
|
|
|
private String emcode;
|
|
|
+ private EditText msg_et;
|
|
|
+ private ImageView received_im;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -106,15 +114,23 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
LogUtil.prinlnLongMsg("fanglh",JSON.toJSONString(kvModeList));
|
|
|
}
|
|
|
}
|
|
|
- }else
|
|
|
- mEmptyLayout.showEmpty();
|
|
|
- }else
|
|
|
- mEmptyLayout.showEmpty();
|
|
|
+ }else{
|
|
|
+ showEnty();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ showEnty();
|
|
|
+ }
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void showEnty() {
|
|
|
+ received_im.setVisibility(View.GONE);
|
|
|
+ mEmptyLayout.showEmpty();
|
|
|
+ }
|
|
|
+
|
|
|
private EmptyLayout mEmptyLayout;
|
|
|
private void initView() {
|
|
|
// emcode = MyApplication.getInstance().getLoginUserId();
|
|
|
@@ -138,6 +154,7 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
mEmptyLayout.setShowEmptyButton(false);
|
|
|
mEmptyLayout.setShowErrorButton(false);
|
|
|
mEmptyLayout.setShowLoadingButton(false);
|
|
|
+ received_im = (ImageView) findViewById(R.id.received_im);
|
|
|
// findViewById(R.id.h_sign_tv).setOnClickListener(this);
|
|
|
|
|
|
String result = getIntent().getStringExtra("WageDatas");
|
|
|
@@ -185,9 +202,46 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
}else {
|
|
|
Toast.makeText(this,"您没有签名~", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
+ }else if (v.getId() == R.id.sure_tv){
|
|
|
+ if (StringUtil.isEmpty(msg_et.getText().toString())){
|
|
|
+ ToastMessage("请输入你的问题");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!CommonUtil.isNetWorkConnected(ct)){
|
|
|
+ ToastMessage(getString(R.string.common_notlinknet));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ doErrorMsgHandle();
|
|
|
+ }else if (v.getId() == R.id.cancel1_tv){
|
|
|
+ popupWindow.dismiss();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void doErrorMsgHandle() {
|
|
|
+// HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
|
|
|
+ HttpClient httpClient = new HttpClient.Builder("http://192.168.253.58:8080/ERP/").isDebug(true).build(true);
|
|
|
+ httpClient.Api().send(new HttpClient.Builder()
|
|
|
+ .url("mobile/salary/salaryWrong.action")
|
|
|
+ .add("sl_id",sl_id)
|
|
|
+ .add("emcode",emcode)
|
|
|
+ .add("msg",msg_et.getText().toString())
|
|
|
+ .add("result",true)
|
|
|
+ .add("master", master)
|
|
|
+ .method(Method.POST)
|
|
|
+ .build(),new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object o) {
|
|
|
+ if (!JSONUtil.validate(o.toString()) || o == null) return;
|
|
|
+ LogUtil.prinlnLongMsg("salaryWrong", o.toString()+"");
|
|
|
+ if (o.toString().contains("success") && JSON.parseObject(o.toString()).getBoolean("success")){
|
|
|
+ ToastMessage("你的问题已提交");
|
|
|
+ popupWindow.dismiss();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
private void doNewSubmit(Bitmap pathBm, String plainpath) {
|
|
|
String url = "http://192.168.253.58:8080/ERP/"+"mobile/salary/salaryBack.action";
|
|
|
byte[] ppp = getBitmapByte(pathBm);
|
|
|
@@ -211,11 +265,10 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
ViewUtil.ToastMessage(ct, getString(R.string.Uploaded_successfully));
|
|
|
Log.i("doNewSubmit",JSON.parseObject(responseInfo.result).toJSONString());
|
|
|
if (JSONUtil.validate(responseInfo.result) && JSON.parseObject(responseInfo.result).getBoolean("success")) {
|
|
|
- Toast.makeText(ct,"提交成功",Toast.LENGTH_LONG).show();
|
|
|
+ Toast.makeText(ct,"工资条签名提交成功",Toast.LENGTH_LONG).show();
|
|
|
closePopupWindow();
|
|
|
}
|
|
|
progressDialog.dismiss();
|
|
|
- Toast.makeText(ct,getString(R.string.fangkui_success),Toast.LENGTH_LONG).show();
|
|
|
new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
@@ -305,4 +358,73 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
setWindow.dismiss();
|
|
|
DisplayUtil.backgroundAlpha(this, 1f);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
+ getMenuInflater().inflate(R.menu.wage_error, menu);
|
|
|
+ return super.onCreateOptionsMenu(menu);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
+ if (item.getItemId() == R.id.wage_error){
|
|
|
+ showErrorWindow();
|
|
|
+ }
|
|
|
+ return super.onOptionsItemSelected(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ private PopupWindow popupWindow;
|
|
|
+ private void showErrorWindow() {
|
|
|
+
|
|
|
+ // 一个自定义的布局,作为显示的内容
|
|
|
+ View contentView = LayoutInflater.from(ct).inflate(
|
|
|
+ R.layout.input_error_msg, null);
|
|
|
+
|
|
|
+ // 设置按钮的点击事件
|
|
|
+ msg_et = (EditText) contentView.findViewById(R.id.msg_et);
|
|
|
+ contentView.findViewById(R.id.cancel1_tv).setOnClickListener(this);
|
|
|
+ contentView.findViewById(R.id.sure_tv).setOnClickListener(this);
|
|
|
+
|
|
|
+ DisplayMetrics dm = getResources().getDisplayMetrics();
|
|
|
+ int w_screen = dm.widthPixels;
|
|
|
+ int h_screen = dm.heightPixels;
|
|
|
+ w_screen = DisplayUtil.dip2px(this, 300);
|
|
|
+ h_screen = DisplayUtil.dip2px(this, 300);
|
|
|
+
|
|
|
+ popupWindow = new PopupWindow(contentView, w_screen, h_screen, true);
|
|
|
+ popupWindow.setTouchable(true);
|
|
|
+ popupWindow.setOutsideTouchable(false);
|
|
|
+ // 如果不设置PopupWindow的背景,无论是点击外部区域还是Back键都无法dismiss弹框
|
|
|
+ popupWindow.setBackgroundDrawable(getResources().getDrawable(com.uas.appworks.R.drawable.pop_round_bg));
|
|
|
+ // 设置好参数之后再show
|
|
|
+ popupWindow.showAtLocation(contentView, Gravity.CENTER, 0, 0);
|
|
|
+ setbg(0.4f);
|
|
|
+ }
|
|
|
+ private void setbg(float alpha) {
|
|
|
+ setBackgroundAlpha(this, alpha);
|
|
|
+ if (popupWindow == null) return;
|
|
|
+ popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
|
|
+ @Override
|
|
|
+ public void onDismiss() {
|
|
|
+ setBackgroundAlpha(WagesDetailsActivity.this, 1f);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 设置页面的透明度
|
|
|
+ * 兼容华为手机(在个别华为手机上 设置透明度会不成功)
|
|
|
+ *
|
|
|
+ * @param bgAlpha 透明度 1表示不透明
|
|
|
+ */
|
|
|
+ public void setBackgroundAlpha(Activity activity, float bgAlpha) {
|
|
|
+ WindowManager.LayoutParams lp = activity.getWindow().getAttributes();
|
|
|
+ lp.alpha = bgAlpha;
|
|
|
+ if (bgAlpha == 1) {
|
|
|
+ activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);//不移除该Flag的话,在有视频的页面上的视频会出现黑屏的bug
|
|
|
+ } else {
|
|
|
+ activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);//此行代码主要是解决在华为手机上半透明效果无效的bug
|
|
|
+ }
|
|
|
+ activity.getWindow().setAttributes(lp);
|
|
|
+ }
|
|
|
+
|
|
|
}
|