|
@@ -1,12 +1,18 @@
|
|
|
package com.zkjc.policedemo.mvp.ui.activity;
|
|
|
|
|
|
+import android.app.AlertDialog;
|
|
|
+import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
+import android.view.WindowManager;
|
|
|
+import android.widget.AdapterView;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.RelativeLayout;
|
|
|
+import android.widget.Spinner;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
@@ -15,31 +21,47 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONPatch;
|
|
|
+import com.google.gson.Gson;
|
|
|
+import com.google.gson.JsonObject;
|
|
|
+import com.google.gson.JsonParser;
|
|
|
+import com.hjq.toast.ToastUtils;
|
|
|
import com.jess.arms.di.component.AppComponent;
|
|
|
import com.jess.arms.utils.ArmsUtils;
|
|
|
import com.lzy.imagepicker.ImagePicker;
|
|
|
import com.lzy.imagepicker.bean.ImageItem;
|
|
|
import com.lzy.imagepicker.ui.ImageGridActivity;
|
|
|
-import com.lzy.imagepicker.ui.ImagePreviewDelActivity;
|
|
|
import com.lzy.imagepicker.view.CropImageView;
|
|
|
import com.zkjc.common.base.ZkjcBaseActivity;
|
|
|
+import com.zkjc.common.utils.ScreenUtils;
|
|
|
+import com.zkjc.common.utils.Utils;
|
|
|
import com.zkjc.common.view.CommonTitleBarV3;
|
|
|
import com.zkjc.policedemo.R;
|
|
|
+import com.zkjc.policedemo.app.utils.CommonInterFace;
|
|
|
+import com.zkjc.policedemo.app.utils.DateTimePicker;
|
|
|
import com.zkjc.policedemo.app.utils.GlideImageLoader;
|
|
|
+import com.zkjc.policedemo.app.utils.UploadUtil;
|
|
|
import com.zkjc.policedemo.di.component.DaggerAddMzjmhComponent;
|
|
|
import com.zkjc.policedemo.mvp.contract.AddMzjmhContract;
|
|
|
+import com.zkjc.policedemo.mvp.model.entity.JmhEntity;
|
|
|
+import com.zkjc.policedemo.mvp.model.entity.JwsJgEntity;
|
|
|
+import com.zkjc.policedemo.mvp.model.entity.SqmyEntity;
|
|
|
import com.zkjc.policedemo.mvp.presenter.AddMzjmhPresenter;
|
|
|
-import com.zkjc.policedemo.mvp.ui.adapter.ImagePickerAdapter;
|
|
|
+import com.zkjc.policedemo.mvp.ui.adapter.AddPicAdapter;
|
|
|
+import com.zkjc.policedemo.mvp.ui.adapter.BaseRecycleAdapter;
|
|
|
+import com.zkjc.policedemo.mvp.ui.adapter.JgAdapter;
|
|
|
import com.zkjc.policedemo.mvp.ui.adapter.MzchryAdapter;
|
|
|
-import com.zkjc.policedemo.mvp.ui.adapter.XstgrAdapter;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
-import butterknife.ButterKnife;
|
|
|
|
|
|
+import static com.alibaba.fastjson.JSONPatch.OperationType.remove;
|
|
|
import static com.jess.arms.utils.Preconditions.checkNotNull;
|
|
|
+import static com.zkjc.policedemo.mvp.ui.fragment.SydwLeftFragment.QXZ;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -54,7 +76,7 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
|
|
|
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
|
|
|
* ================================================
|
|
|
*/
|
|
|
-public class AddMzjmhActivity extends ZkjcBaseActivity<AddMzjmhPresenter> implements AddMzjmhContract.View, ImagePickerAdapter.OnRecyclerViewItemClickListener {
|
|
|
+public class AddMzjmhActivity extends ZkjcBaseActivity<AddMzjmhPresenter> implements AddMzjmhContract.View, AddPicAdapter.OnRecyclerViewItemClickListener {
|
|
|
|
|
|
@BindView(R.id.title_bar)
|
|
|
CommonTitleBarV3 titleBar;
|
|
@@ -74,10 +96,8 @@ public class AddMzjmhActivity extends ZkjcBaseActivity<AddMzjmhPresenter> implem
|
|
|
RelativeLayout rlHysj;
|
|
|
@BindView(R.id.sssq)
|
|
|
TextView sssq;
|
|
|
- @BindView(R.id.tv_sssq)
|
|
|
- TextView tvSssq;
|
|
|
- @BindView(R.id.jt2)
|
|
|
- ImageView jt2;
|
|
|
+ @BindView(R.id.sp_sssq)
|
|
|
+ Spinner spSssq;
|
|
|
@BindView(R.id.rl_sssq)
|
|
|
RelativeLayout rlSssq;
|
|
|
@BindView(R.id.et_xsnr)
|
|
@@ -96,11 +116,17 @@ public class AddMzjmhActivity extends ZkjcBaseActivity<AddMzjmhPresenter> implem
|
|
|
TextView tvConfirm;
|
|
|
private int maxImgCount = 9; //允许选择图片最大数
|
|
|
private ArrayList<ImageItem> selImageList; //当前选择的所有图片
|
|
|
- private ImagePickerAdapter adapter;
|
|
|
+ private AddPicAdapter adapter;
|
|
|
public static final int IMAGE_ITEM_ADD = -1;
|
|
|
public static final int REQUEST_CODE_SELECT = 100;
|
|
|
public static final int REQUEST_CODE_PREVIEW = 101;
|
|
|
private MzchryAdapter mzchryAdapter;
|
|
|
+ private Map<String, String> urlMap = new HashMap<>();
|
|
|
+ private String sqId;
|
|
|
+ private ArrayList<JmhEntity.JmhRy> list;
|
|
|
+ private ArrayList<JmhEntity.JmhRy> listRemove;
|
|
|
+ private String mId;
|
|
|
+ private List<JwsJgEntity.DataBean> sqList;
|
|
|
|
|
|
@Override
|
|
|
public void setupActivityComponent(@NonNull AppComponent appComponent) {
|
|
@@ -119,24 +145,178 @@ public class AddMzjmhActivity extends ZkjcBaseActivity<AddMzjmhPresenter> implem
|
|
|
|
|
|
@Override
|
|
|
public void initData(@Nullable Bundle savedInstanceState) {
|
|
|
- titleBar.setTitle("新增见面会");
|
|
|
+ mId = getIntent().getStringExtra("id");
|
|
|
+ if (TextUtils.isEmpty(mId)) {
|
|
|
+ titleBar.setTitle("新增见面会");
|
|
|
+ } else {
|
|
|
+ titleBar.setTitle("修改见面会");
|
|
|
+ }
|
|
|
initfj();
|
|
|
- List<String> list = new ArrayList<>();
|
|
|
- list.add("1");
|
|
|
- list.add("2");
|
|
|
- //线索关系人
|
|
|
+ initDatePicker();
|
|
|
+ list = new ArrayList<>();
|
|
|
+ listRemove = new ArrayList<>();
|
|
|
mzchryAdapter = new MzchryAdapter(list);
|
|
|
+ mzchryAdapter.setListener(new BaseRecycleAdapter.OnRecyclerViewListenerV2() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(View view, int position) {
|
|
|
+ JmhEntity.JmhRy ry = list.get(position);
|
|
|
+ switch (view.getId()) {
|
|
|
+ case R.id.iv_delete:
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(AddMzjmhActivity.this)
|
|
|
+ .setTitle("温馨提示")
|
|
|
+ .setMessage("是否确认删除?")
|
|
|
+ .setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ dialogInterface.dismiss();
|
|
|
+ if (!TextUtils.isEmpty(mId)) {
|
|
|
+ JmhEntity.JmhRy remove = list.remove(position);
|
|
|
+ remove.setIsDeleted(1);
|
|
|
+ listRemove.add(remove);
|
|
|
+ }
|
|
|
+ mzchryAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ dialogInterface.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ AlertDialog dialog = builder.create();
|
|
|
+ dialog.show();
|
|
|
+
|
|
|
+ WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
|
|
|
+ params.width = ScreenUtils.dip2px(AddMzjmhActivity.this, 320);
|
|
|
+
|
|
|
+ params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
|
|
+ dialog.getWindow().setAttributes(params);
|
|
|
+
|
|
|
+
|
|
|
+ break;
|
|
|
+ case R.id.item_root: {
|
|
|
+ Intent intent = new Intent(AddMzjmhActivity.this, AddChryActivity.class);
|
|
|
+ intent.putExtra("ry", ry);
|
|
|
+ startActivityForResult(intent, position);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onItemLongClick(View view, int position) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
|
|
recyclerView.setAdapter(mzchryAdapter);
|
|
|
rlAddry.setOnClickListener(view -> {
|
|
|
- //此出弹窗填写相关人员 职务 电话
|
|
|
+ Intent intent = new Intent(AddMzjmhActivity.this, AddChryActivity.class);
|
|
|
+ startActivityForResult(intent, 2000);
|
|
|
+ });
|
|
|
+ tvConfirm.setOnClickListener(v -> {
|
|
|
+ save();
|
|
|
});
|
|
|
+ Utils.getInstances().showDialog(this, "正在获取数据");
|
|
|
+ mPresenter.zd();
|
|
|
}
|
|
|
+
|
|
|
+ private void setNetData(JmhEntity.Jmh jmh) {
|
|
|
+ etHysz.setText(jmh.getHyzt());
|
|
|
+ tvHysjx.setText(jmh.getHysj());
|
|
|
+ etXsnr.setText(jmh.getHynr());
|
|
|
+ String fj = jmh.getFj();
|
|
|
+ if (!TextUtils.isEmpty(fj)) {
|
|
|
+ String[] split = fj.split(",");
|
|
|
+ for (String url: split) {
|
|
|
+ ImageItem item = new ImageItem();
|
|
|
+ item.path = url;
|
|
|
+ selImageList.add(item);
|
|
|
+ urlMap.put(url, url);
|
|
|
+ }
|
|
|
+ adapter.notifyDataSetChanged();
|
|
|
+ adapter = new AddPicAdapter(this, selImageList, maxImgCount);
|
|
|
+ adapter.setOnItemClickListener(this);
|
|
|
+// adapter.showDelete(false);
|
|
|
+ recyclerViewHyzp.setAdapter(adapter);
|
|
|
+ }
|
|
|
+ list.addAll(jmh.getRyList());
|
|
|
+ mzchryAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void save() {
|
|
|
+ if (TextUtils.isEmpty(etHysz.getText().toString())) {
|
|
|
+ ToastUtils.show("请选择会议主题");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(tvHysjx.getText().toString())) {
|
|
|
+ ToastUtils.show("请选择会议时间");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(etXsnr.getText().toString())) {
|
|
|
+ ToastUtils.show("请填写会议内容");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(sqId) || QXZ.equals(sqId)) {
|
|
|
+ ToastUtils.show("请选择社区");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (list.isEmpty()) {
|
|
|
+ ToastUtils.show("请选择人员");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("hyzt", etHysz.getText().toString());
|
|
|
+ map.put("hynr", etXsnr.getText().toString());
|
|
|
+ map.put("hysj", tvHysjx.getText().toString());
|
|
|
+ map.put("sssqBm", sqId);
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ for (Map.Entry<String, String> entry : urlMap.entrySet()) {
|
|
|
+ String key = entry.getKey();
|
|
|
+ String value = entry.getValue();
|
|
|
+ builder.append(value);
|
|
|
+ builder.append(",");
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(builder.toString())) {
|
|
|
+ ToastUtils.show("请选择照片");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ builder.delete(builder.lastIndexOf(","), builder.length());
|
|
|
+ map.put("fj", builder.toString());
|
|
|
+ }
|
|
|
+ if (!listRemove.isEmpty()) {
|
|
|
+ list.addAll(listRemove);
|
|
|
+ }
|
|
|
+ map.put("ryList", list);
|
|
|
+ Utils.getInstances().showDialog(this, "正在上传");
|
|
|
+ if (TextUtils.isEmpty(mId)) {
|
|
|
+ mPresenter.save(map);
|
|
|
+ } else {
|
|
|
+ map.put("id", mId);
|
|
|
+ mPresenter.update(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initDatePicker() {
|
|
|
+ DateTimePicker dateTimePicker = new DateTimePicker(this, "请选择会议时间", true);
|
|
|
+ dateTimePicker.setOnDateSelectListener(new DateTimePicker.OnDateSelectListener() {
|
|
|
+ @Override
|
|
|
+ public void onDateSelect(String start) {
|
|
|
+ tvHysjx.setText(start);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ tvHysjx.setFocusable(false);
|
|
|
+ tvHysjx.setOnClickListener(v -> dateTimePicker.show());
|
|
|
+ }
|
|
|
+
|
|
|
private void initfj() {
|
|
|
initImagePicker();
|
|
|
selImageList = new ArrayList<>();
|
|
|
//普通照片
|
|
|
- adapter = new ImagePickerAdapter(this, selImageList, maxImgCount);
|
|
|
+ adapter = new AddPicAdapter(this, selImageList, maxImgCount);
|
|
|
adapter.setOnItemClickListener(this);
|
|
|
recyclerViewHyzp.setLayoutManager(new GridLayoutManager(this, 3));
|
|
|
recyclerViewHyzp.setHasFixedSize(true);
|
|
@@ -159,39 +339,39 @@ public class AddMzjmhActivity extends ZkjcBaseActivity<AddMzjmhPresenter> implem
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void onItemClick(View view, int position) {
|
|
|
- switch (position) {
|
|
|
- case IMAGE_ITEM_ADD:
|
|
|
- ImagePicker.getInstance().setSelectLimit(maxImgCount - selImageList.size());
|
|
|
- Intent intent = new Intent(AddMzjmhActivity.this, ImageGridActivity.class);
|
|
|
- //intent.putExtra(ImageGridActivity.EXTRAS_IMAGES,(ArrayList<ImageItem>) adapter.getImages());
|
|
|
- // intent.putExtra(ImageGridActivity.EXTRAS_TAKE_PICKERS, true);
|
|
|
- intent.putExtra(ImageGridActivity.EXTRAS_IMAGES, (ArrayList<ImageItem>) adapter.getImages());
|
|
|
-
|
|
|
- startActivityForResult(intent, REQUEST_CODE_SELECT);
|
|
|
- break;
|
|
|
- default:
|
|
|
- //打开预览
|
|
|
- Intent intentPreview = new Intent(this, ImagePreviewDelActivity.class);
|
|
|
- intentPreview.putExtra(ImagePicker.EXTRA_IMAGE_ITEMS, (ArrayList<ImageItem>) adapter.getImages());
|
|
|
- intentPreview.putExtra(ImagePicker.EXTRA_SELECTED_IMAGE_POSITION, position);
|
|
|
- intentPreview.putExtra(ImagePicker.EXTRA_FROM_ITEMS, true);
|
|
|
- startActivityForResult(intentPreview, REQUEST_CODE_PREVIEW);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
if (resultCode == ImagePicker.RESULT_CODE_ITEMS) {
|
|
|
//添加图片返回
|
|
|
if (data != null && requestCode == REQUEST_CODE_SELECT) {
|
|
|
ArrayList<ImageItem> images = (ArrayList<ImageItem>) data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS);
|
|
|
- if (images != null) {
|
|
|
- selImageList.addAll(images);
|
|
|
- adapter.setImages(selImageList);
|
|
|
+ if (images != null && !images.isEmpty()) {
|
|
|
+ Utils.getInstances().showDialog(this, "正在上传数据");
|
|
|
+ UploadUtil.getInstance().init(this).getRequest(images.get(0).path, new CommonInterFace() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(String result) {
|
|
|
+ Utils.getInstances().dismissDialog();
|
|
|
+ JsonObject jsonObject1 = new JsonParser().parse(result).getAsJsonObject();
|
|
|
+ JsonObject jsonObject = jsonObject1.get("data").getAsJsonObject();
|
|
|
+ if (jsonObject.has("link")) {
|
|
|
+ String url = jsonObject.get("link").getAsString();
|
|
|
+ urlMap.put(images.get(0).path, url);
|
|
|
+
|
|
|
+ selImageList.add(images.get(0));
|
|
|
+ adapter.setImages(selImageList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(Throwable throwable) {
|
|
|
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFinsh() {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -207,6 +387,15 @@ public class AddMzjmhActivity extends ZkjcBaseActivity<AddMzjmhPresenter> implem
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ if (resultCode == RESULT_OK) {
|
|
|
+ if (requestCode == 2000) {
|
|
|
+ list.add((JmhEntity.JmhRy) data.getSerializableExtra("ry"));
|
|
|
+ mzchryAdapter.notifyDataSetChanged();
|
|
|
+ } else {
|
|
|
+ list.set(requestCode, (JmhEntity.JmhRy) data.getSerializableExtra("ry"));
|
|
|
+ mzchryAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
@Override
|
|
|
public void showLoading() {
|
|
@@ -236,4 +425,106 @@ public class AddMzjmhActivity extends ZkjcBaseActivity<AddMzjmhPresenter> implem
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onItemClickSn(View view, int position) {
|
|
|
+ switch (view.getId()) {
|
|
|
+ case R.id.item_add_pic_iv_delete:
|
|
|
+ android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(this)
|
|
|
+ .setMessage("是否删除这张照片")
|
|
|
+ .setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ dialogInterface.dismiss();
|
|
|
+ ImageItem item = selImageList.get(position);
|
|
|
+ urlMap.remove(item.path);
|
|
|
+ selImageList.remove(position);
|
|
|
+ adapter.setImages(selImageList);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ dialogInterface.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ AlertDialog dialog = builder.create();
|
|
|
+ dialog.show();
|
|
|
+ WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
|
|
|
+ params.width = ScreenUtils.dip2px(this, 320);
|
|
|
+
|
|
|
+ params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
|
|
+ dialog.getWindow().setAttributes(params);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ switch (position) {
|
|
|
+ case AddPicAdapter.IMAGE_ITEM_ADD:
|
|
|
+ ImagePicker.getInstance().setSelectLimit(maxImgCount - selImageList.size());
|
|
|
+ Intent intent = new Intent(this, ImageGridActivity.class);
|
|
|
+// intent.putExtra(ImageGridActivity.EXTRAS_IMAGES, (ArrayList<ImageItem>) snAdapter.getImages());
|
|
|
+ // intent.putExtra(ImageGridActivity.EXTRAS_TAKE_PICKERS, true);
|
|
|
+ startActivityForResult(intent, REQUEST_CODE_SELECT);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onSaveSuccess(String result) {
|
|
|
+ setResult(RESULT_OK);
|
|
|
+ finish();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onUpdateSuccess(String result) {
|
|
|
+ setResult(RESULT_OK);
|
|
|
+ finish();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDit(String result) {
|
|
|
+ try {
|
|
|
+ JwsJgEntity entity = new Gson().fromJson(result, JwsJgEntity.class);
|
|
|
+ sqList = entity.getData();
|
|
|
+ JwsJgEntity.DataBean dataBean = new JwsJgEntity.DataBean();
|
|
|
+ dataBean.setDeptName(QXZ);
|
|
|
+ dataBean.setId(QXZ);
|
|
|
+ sqList.add(0, dataBean);
|
|
|
+ spSssq.setAdapter(new JgAdapter(sqList, this));
|
|
|
+ spSssq.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
+ JwsJgEntity.DataBean dataBean = sqList.get(position);
|
|
|
+ sqId = dataBean.getId();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onNothingSelected(AdapterView<?> parent) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (!TextUtils.isEmpty(mId)) {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("id", mId);
|
|
|
+ mPresenter.getDetail(map);
|
|
|
+ } else {
|
|
|
+ Utils.getInstances().dismissDialog();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onGetDetailSuccess(JmhEntity.Jmh data) {
|
|
|
+ setNetData(data);
|
|
|
+ for (int i = 0; i < sqList.size(); i++) {
|
|
|
+ if (sqList.get(i).getId().equals(data.getSssqBm())) {
|
|
|
+ spSssq.setSelection(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|