|
|
@@ -14,6 +14,7 @@ import android.os.Handler;
|
|
|
import android.os.Message;
|
|
|
import android.text.Editable;
|
|
|
import android.text.TextWatcher;
|
|
|
+import android.util.DisplayMetrics;
|
|
|
import android.util.Log;
|
|
|
import android.view.Gravity;
|
|
|
import android.view.LayoutInflater;
|
|
|
@@ -21,10 +22,12 @@ import android.view.Menu;
|
|
|
import android.view.MenuItem;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
+import android.view.WindowManager;
|
|
|
import android.view.inputmethod.InputMethodManager;
|
|
|
import android.widget.AdapterView;
|
|
|
import android.widget.BaseAdapter;
|
|
|
import android.widget.Button;
|
|
|
+import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.PopupWindow;
|
|
|
@@ -72,8 +75,10 @@ import com.xzjmyk.pm.activity.ui.erp.util.ListUtils;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.LogUtil;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.view.NScrollerGridView;
|
|
|
import com.xzjmyk.pm.activity.ui.tool.MultiImagePreviewActivity;
|
|
|
+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.PermissionUtil;
|
|
|
import com.xzjmyk.pm.activity.util.StringUtils;
|
|
|
import com.xzjmyk.pm.activity.util.ToastUtil;
|
|
|
@@ -234,9 +239,6 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
//{"fp_id": 38366,"success": true,"fpd_id": [[28859,1]]}
|
|
|
keyValue = JSON.parseObject(result).getIntValue("fp_id");
|
|
|
sendPicture();
|
|
|
-// commitSuccess(keyValue);
|
|
|
- //TODO 测试接口返回数据
|
|
|
-// getUpdateData(keyValue);
|
|
|
}
|
|
|
LogUtil.prinlnLongMsg("0x05result",result);
|
|
|
break;
|
|
|
@@ -275,6 +277,9 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
if (!ListUtils.isEmpty(selected_detailsData))
|
|
|
selected_detailsData.remove(cd_table_position);
|
|
|
|
|
|
+ if ("S".equals(dg_type)){
|
|
|
+ costFormModel_list.remove(cd_table_position);
|
|
|
+ }
|
|
|
if (costFormModel_list.size() == 0){
|
|
|
detail_table_ll.setVisibility(View.GONE);
|
|
|
sum_money_tv.setText(null);
|
|
|
@@ -768,7 +773,7 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
dg_type = mGridconfigsBean.get(i).getDg_type();
|
|
|
if ("S".equals(dg_type)){
|
|
|
url= Constants.getAppBaseUrl(ct) + "mobile/common/getComboValue.action";
|
|
|
- ViewUtil.httpSendRequest(ct, url, params_Details, erhandler, headers1, 0x16, null, null, "get");
|
|
|
+ ViewUtil.httpSendRequest(ct, url, params_Details, erhandler, headers1, 0x04, null, null, "get");
|
|
|
}else if ("DF".equals(dg_type)){
|
|
|
url = Constants.getAppBaseUrl(ct) + "common/dbfind.action";
|
|
|
ViewUtil.httpSendRequest(ct, url, params_Details, erhandler, headers1, 0x04, null, null, "get");
|
|
|
@@ -876,7 +881,11 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
doSingleSelect(money_combdatas,2,getString(R.string.currency),SELECT_CURRENCY);
|
|
|
break;
|
|
|
case R.id.add_details_tv:
|
|
|
- showPopupWindow();
|
|
|
+ if ("S".equals(dg_type)){
|
|
|
+ showEditWindow();
|
|
|
+ }else if ("DF".equals(dg_type)){
|
|
|
+ showPopupWindow();
|
|
|
+ }
|
|
|
putDownInput();
|
|
|
break;
|
|
|
case R.id.automatic_calculation_tv:
|
|
|
@@ -960,9 +969,80 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+ private PopupWindow etpopupWindow = null;
|
|
|
+ private void showEditWindow() {
|
|
|
+// 一个自定义的布局,作为显示的内容
|
|
|
+ View contentView = LayoutInflater.from(ct).inflate(
|
|
|
+ R.layout.item_select_cost_details, null);
|
|
|
+
|
|
|
+ // 设置按钮的点击事件
|
|
|
+ final EditText detail_et = (EditText) contentView.findViewById(R.id.input_cost_detail_et);
|
|
|
+ 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, 150);
|
|
|
+ contentView.findViewById(R.id.cancel_ll).setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ etpopupWindow.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ contentView.findViewById(R.id.sure_ll).setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ if (StringUtils.isEmpty(detail_et.getText().toString())){
|
|
|
+ ToastMessage(getString(R.string.input_cost_name));
|
|
|
+ return;
|
|
|
+ }else {
|
|
|
+ costFormModel = new CostFormModel();
|
|
|
+ costFormModel.setCost_type(detail_et.getText().toString());
|
|
|
+ costFormModel_list.add(costFormModel);
|
|
|
|
|
|
+ dtAdapter.setModels(costFormModel_list);
|
|
|
+ dtAdapter.notifyDataSetChanged();
|
|
|
+ detail_table_ll.setVisibility(View.VISIBLE);
|
|
|
+ Log.i("costFormModel_list", JSON.toJSONString(costFormModel_list)+"et");
|
|
|
+ etpopupWindow.dismiss();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ etpopupWindow = new PopupWindow(contentView, w_screen, h_screen, true);
|
|
|
+ etpopupWindow.setTouchable(true);
|
|
|
+ etpopupWindow.setOutsideTouchable(false);
|
|
|
+ // 如果不设置PopupWindow的背景,无论是点击外部区域还是Back键都无法dismiss弹框
|
|
|
+ etpopupWindow.setBackgroundDrawable(getResources().getDrawable(R.drawable.pop_round_bg));
|
|
|
+ // 设置好参数之后再show
|
|
|
+ etpopupWindow.showAtLocation(contentView, Gravity.CENTER, 0, 0);
|
|
|
+ setbg(0.4f);
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
+ private void setbg(float alpha) {
|
|
|
+ setBackgroundAlpha(this, alpha);
|
|
|
+ if (etpopupWindow == null) return;
|
|
|
+ etpopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
|
|
+ @Override
|
|
|
+ public void onDismiss() {
|
|
|
+ setBackgroundAlpha(ExpenseReimbursementActivity.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);
|
|
|
+ }
|
|
|
private void c_onclick(String s) {
|
|
|
if(isClickEqu)
|
|
|
{
|
|
|
@@ -1399,9 +1479,14 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
cd_table_position = position;
|
|
|
doDeleteCostDetailshttp(position);
|
|
|
}else {
|
|
|
- if (!ListUtils.isEmpty(selected_detailsData)) {
|
|
|
- selected_detailsData.remove(position);
|
|
|
+
|
|
|
+ if ("S".equals(dg_type)){
|
|
|
models.remove(position);
|
|
|
+ }else if ("DF".equals(dg_type)){
|
|
|
+ if (!ListUtils.isEmpty(selected_detailsData)) {
|
|
|
+ selected_detailsData.remove(position);
|
|
|
+ models.remove(position);
|
|
|
+ }
|
|
|
}
|
|
|
if (ListUtils.isEmpty(models)) {
|
|
|
detail_table_ll.setVisibility(View.GONE);
|
|
|
@@ -1427,7 +1512,7 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
if (StringUtils.isEmpty(s.toString())) return;
|
|
|
if (finalViewHolder.details_money.testValidity()){
|
|
|
money_editString = s.toString();
|
|
|
- models.get(position).setCost_money(Double.valueOf(money_editString));
|
|
|
+ models.get(position).setCost_money(Double.valueOf(money_editString)); //TODO有bug
|
|
|
doAutoCalculateJudge();
|
|
|
}
|
|
|
|
|
|
@@ -1588,12 +1673,6 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
// "&master=" + CommonUtil.getSharedPreferences(ct, "erp_master");
|
|
|
// }
|
|
|
|
|
|
- private String getImageUrl(int id) {
|
|
|
- return Constants.getAppBaseUrl(ct) + "common/downloadbyId.action?id=" + id + "&sessionId=" +
|
|
|
- CommonUtil.getSharedPreferences(ct, "sessionId") +
|
|
|
- "&sessionUser=" + CommonUtil.getSharedPreferences(ct, "erp_username") +
|
|
|
- "&master=" + CommonUtil.getSharedPreferences(ct, "erp_master");
|
|
|
- }
|
|
|
@Override
|
|
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
|
|
if (getItemViewType(position) == 0) {// 普通的视图
|
|
|
@@ -1623,7 +1702,12 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ private String getImageUrl(int id) {
|
|
|
+ return Constants.getAppBaseUrl(ct) + "common/downloadbyId.action?id=" + id + "&sessionId=" +
|
|
|
+ CommonUtil.getSharedPreferences(ct, "sessionId") +
|
|
|
+ "&sessionUser=" + CommonUtil.getSharedPreferences(ct, "erp_username") +
|
|
|
+ "&master=" + CommonUtil.getSharedPreferences(ct, "erp_master");
|
|
|
+ }
|
|
|
/**
|
|
|
* 通用跳转界面单选方法
|
|
|
* @param combdatas
|
|
|
@@ -1709,11 +1793,22 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
Log.i("dP_position",mPosition+"");
|
|
|
if (which == 0) {// 查看
|
|
|
- Intent intent = new Intent(ct, MultiImagePreviewActivity.class);
|
|
|
- intent.putExtra(AppConstant.EXTRA_IMAGES, mPhotoList);
|
|
|
- intent.putExtra(AppConstant.EXTRA_POSITION, mPosition);
|
|
|
- intent.putExtra(AppConstant.EXTRA_CHANGE_SELECTED, false);
|
|
|
- startActivity(intent);
|
|
|
+ if (mCostUpdatePModel != null && !ListUtils.isEmpty(mCostUpdatePModel.getFiles())
|
|
|
+ && mPosition < mCostUpdatePModel.getFiles().size()){
|
|
|
+ Toast.makeText(ct,"下载的图片,不可与本地选择的图片滑动查看",Toast.LENGTH_LONG).show();
|
|
|
+ Intent intent = new Intent(mContext, SingleImagePreviewActivity.class);
|
|
|
+ intent.putExtra(AppConstant.EXTRA_IMAGE_URI,
|
|
|
+ getImageUrl(mCostUpdatePModel.getFiles().get(mPosition).getFp_id()));
|
|
|
+ startActivity(intent);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ Intent intent = new Intent(ct, MultiImagePreviewActivity.class);
|
|
|
+ intent.putExtra(AppConstant.EXTRA_IMAGES, mPhotoList);
|
|
|
+ intent.putExtra(AppConstant.EXTRA_POSITION, mPosition);
|
|
|
+ intent.putExtra(AppConstant.EXTRA_CHANGE_SELECTED, false);
|
|
|
+ startActivity(intent);
|
|
|
+ }
|
|
|
+
|
|
|
} else {// 删除
|
|
|
deletePhoto(mPosition);
|
|
|
}
|
|
|
@@ -1825,8 +1920,8 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
LogUtil.prinlnLongMsg("mPhotoListsP",JSON.toJSONString(mPhotoList));
|
|
|
for (int i = 0; i < mPhotoList.size(); i++) {
|
|
|
String path = mPhotoList.get(i);
|
|
|
+ now_p = i;
|
|
|
sendPictureRequest(path);
|
|
|
- now_p = i;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -1847,6 +1942,7 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ waterBitmapToFile = ImageUtil.compressBitmapToFile(path,100,240,320);
|
|
|
RequestParams params = new RequestParams();
|
|
|
if (platform){
|
|
|
params.addQueryStringParameter("master", CommonUtil.getSharedPreferences(MyApplication.getInstance().getApplicationContext(), "companyEnUu"));
|