正在查看: 爱心e站 v1.0.0 应用的 ActivityRehabilitationInfoShow.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 爱心e站 v1.0.0 应用的 ActivityRehabilitationInfoShow.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.newheyd.JZKFcanjiren.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.google.gson.Gson;
import com.igexin.assist.sdk.AssistPushConsts;
import com.newheyd.JZKFcanjiren.Adapter.ShowPhotoAdapter;
import com.newheyd.JZKFcanjiren.BaseActivity;
import com.newheyd.JZKFcanjiren.Bean.AttachmentBean;
import com.newheyd.JZKFcanjiren.Bean.AvatarBean;
import com.newheyd.JZKFcanjiren.Bean.ExamineBean;
import com.newheyd.JZKFcanjiren.Bean.MessageEvent;
import com.newheyd.JZKFcanjiren.Bean.RehabilitationApplicationBean;
import com.newheyd.JZKFcanjiren.Bean.RehabilitationApplicationExamineBean;
import com.newheyd.JZKFcanjiren.LargerPhoto.ShowLargerPhotoActivity;
import com.newheyd.JZKFcanjiren.R;
import com.newheyd.JZKFcanjiren.Utils.DataBaseUtils.DictionaryDatabaseManager;
import com.newheyd.JZKFcanjiren.Utils.DataUtil;
import com.newheyd.JZKFcanjiren.Utils.GlideUtils;
import com.newheyd.JZKFcanjiren.Utils.ImageUtil;
import com.newheyd.JZKFcanjiren.Utils.NewUtil;
import com.newheyd.JZKFcanjiren.Utils.SharedPreferencedUtils;
import com.newheyd.JZKFcanjiren.Utils.StastisticUtil;
import com.newheyd.JZKFcanjiren.Utils.ToastUtils;
import com.newheyd.JZKFcanjiren.Utils.locationUtil.LocationAddrUtil;
import com.newheyd.JZKFcanjiren.View.DateTimePickDialog;
import com.newheyd.JZKFcanjiren.View.ExamineView;
import com.newheyd.JZKFcanjiren.View.TitleView;
import com.newheyd.JZKFcanjiren.View.recycleview.SpacingItemDecoration;
import com.newheyd.JZKFcanjiren.config.NewHYConfig;
import com.newheyd.JZKFcanjiren.model.BaseResult;
import com.newheyd.JZKFcanjiren.model.DataParser;
import com.newheyd.JZKFcanjiren.net.AttachmentBeanTask;
import com.newheyd.JZKFcanjiren.net.AvatarBeanTask;
import com.newheyd.JZKFcanjiren.net.CommonTask;
import com.newheyd.JZKFcanjiren.net.NewHYTask;
import com.newheyd.JZKFcanjiren.net.RehabilitationApplicationTask;
import com.newheyd.JZKFcanjiren.net.RequestServiceList;
import com.tencent.connect.common.Constants;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import org.greenrobot.eventbus.EventBus;
public class ActivityRehabilitationInfoShow extends BaseActivity implements View.OnClickListener {
private ArrayList<AttachmentBean> attachmentBeans;
private RehabilitationApplicationBean bean;
private RelativeLayout checklayout;
private DictionaryDatabaseManager databaseManager;
private DateTimePickDialog dateTimePickDialogEnd;
private DateTimePickDialog dateTimePickDialogStart;
private String endTime;
private String id;
private ImageView iv_avatar;
private LinearLayout layoutMoney;
private LinearLayout layout_train;
private TextView mAddressTv;
private TextView mAidEndTimeTv;
private EditText mAidMoneyTv;
private TextView mAidStartTimeTv;
private LinearLayout mAttachLayout;
private TextView mBirthTv;
private TextView mCardTv;
private TextView mCitizenTv;
private TextView mContactTv;
private TextView mEconomicsTv;
private ExamineView mEvArea;
private ExamineView mEvCommunity;
private ExamineView mEvStreet;
private TextView mGuardianTv;
private Button mHandBtn;
private TextView mIsCertTv;
private TextView mLevelTv;
private TextView mMedicalTv;
private TextView mNameTv;
private TextView mNationTv;
private TextView mProjectTv;
private RecyclerView mRecycle;
private TextView mResidenceTv;
private TextView mServiceArea;
private TextView mServiceAreaName;
private TextView mSexTv;
private TitleView mTitleviewApply;
private TextView mTypeTv;
private String mobile;
private ShowPhotoAdapter pickerPhotoAdapter;
private RehabilitationApplicationExamineBean rehabilitationApplicationExamineBean;
private String shifouSubsidy;
private String starTime;
private String subsidyMonth;
private RadioGroup trainGroup;
private HashMap<Integer, ExamineView> examineMap = new HashMap<>();
private String subsidyMoney = "";
private ArrayList<AvatarBean> photos = new ArrayList<>();
private int workType = 0;
private String role = "4";
private int position = 0;
TextWatcher textWatcher = new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (s.toString().contains(".") && (s.length() - 1) - s.toString().indexOf(".") > 2) {
s = s.toString().subSequence(0, s.toString().indexOf(".") + 3);
ActivityRehabilitationInfoShow.this.mAidMoneyTv.setText(s);
ActivityRehabilitationInfoShow.this.mAidMoneyTv.setSelection(s.length());
}
if (s.toString().trim().substring(0).equals(".")) {
s = "0" + ((Object) s);
ActivityRehabilitationInfoShow.this.mAidMoneyTv.setText(s);
ActivityRehabilitationInfoShow.this.mAidMoneyTv.setSelection(2);
}
if (s.toString().startsWith("0") && s.toString().trim().length() > 1 && !s.toString().substring(1, 2).equals(".")) {
ActivityRehabilitationInfoShow.this.mAidMoneyTv.setText(s.subSequence(0, 1));
ActivityRehabilitationInfoShow.this.mAidMoneyTv.setSelection(1);
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void afterTextChanged(Editable s) {
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_rehabilitation_info_show);
super.onCreate(savedInstanceState);
requestPermissions();
this.databaseManager = new DictionaryDatabaseManager(this.mContext);
initApplyInfo();
goStatistics();
}
public void goStatistics() {
HashMap<String, String> map = LocationAddrUtil.getInstance().getLocationParam(this.mContext);
StastisticUtil.getInstance().onEvent(this.mContext, "ActivityRehabilitationInfoShow", map);
}
public void getRescuePreAudit() {
HashMap<String, String> params = new HashMap<>();
params.put(AssistPushConsts.MSG_TYPE_TOKEN, SharedPreferencedUtils.getInstance(this.mContext).getString(AssistPushConsts.MSG_TYPE_TOKEN));
params.put("id", this.id);
NewHYTask task = new RehabilitationApplicationTask(RequestServiceList.WORKER_BUSINESS_GETRESCUEPREAUDIT, params);
executeRequest(task);
}
public void getRescueAudit(String examimeTime, String appState, String appIdea, String starTime, String endTime, String subsidyMonth, String subsidyMoney, String shifouSubsidy) {
if (this.rehabilitationApplicationExamineBean != null) {
HashMap<String, String> params = new HashMap<>();
params.put(AssistPushConsts.MSG_TYPE_TOKEN, SharedPreferencedUtils.getInstance(this.mContext).getString(AssistPushConsts.MSG_TYPE_TOKEN));
params.put("id", isNull(this.rehabilitationApplicationExamineBean.getId()) ? "" : this.rehabilitationApplicationExamineBean.getId());
params.put("preId", this.bean.getId());
params.put("appState", appState);
params.put("appIdea", appIdea);
params.put("appDate", examimeTime);
if ("3".equals("4")) {
params.put("starTime", starTime);
params.put("endTime", endTime);
params.put("subsidyMonth", subsidyMonth);
params.put("subsidyMoney", subsidyMoney);
params.put("shifouSubsidy", shifouSubsidy);
}
NewHYTask task = new CommonTask(RequestServiceList.WORKER_BUSINESS_GETRESCUEAUDIT, params);
executeRequest(task);
}
}
public void getAttachment() {
if (this.rehabilitationApplicationExamineBean != null) {
HashMap<String, String> params = new HashMap<>();
params.put(AssistPushConsts.MSG_TYPE_TOKEN, SharedPreferencedUtils.getInstance(this.mContext).getString(AssistPushConsts.MSG_TYPE_TOKEN));
params.put("style", "KfServiceApplication");
params.put("relationId", isNull(this.rehabilitationApplicationExamineBean.getPreId()) ? this.id : this.rehabilitationApplicationExamineBean.getPreId());
NewHYTask task = new AttachmentBeanTask(RequestServiceList.ATTACHMENT_CALLBACK, params);
executeRequest(task);
}
}
public void getCitizenInfoNologin() {
if (this.bean != null) {
HashMap<String, String> params = new HashMap<>();
params.put("citizenId", this.bean.getIdcard());
params.put("name", this.bean.getName());
NewHYTask task = new AvatarBeanTask(RequestServiceList.CITIZEN_GETCITIZENINFONOLOGIN, params);
executeRequest(task);
}
}
public void initApplyInfo() {
String fileName = "";
switch (this.position) {
case 0:
fileName = "rehabilitation_info_one";
break;
case 1:
fileName = "rehabilitation_info_two";
break;
case 2:
fileName = "rehabilitation_info_third";
break;
case 3:
fileName = "rehabilitation_info_four";
break;
case 4:
fileName = "rehabilitation_info_five";
break;
}
try {
InputStream is = this.mContext.getAssets().open(fileName);
int length = is.available();
byte[] buffer = new byte[length];
is.read(buffer);
String temp = new String(buffer);
Gson gson = new Gson();
this.rehabilitationApplicationExamineBean = (RehabilitationApplicationExamineBean) gson.fromJson(temp, RehabilitationApplicationExamineBean.class);
this.bean = this.rehabilitationApplicationExamineBean.getKfServiceApplication();
} catch (IOException e) {
e.printStackTrace();
}
if (this.bean != null) {
this.mNameTv.setText(NewUtil.dataShowWithoutNull(this.bean.getName()));
this.mSexTv.setText(this.databaseManager.keyTOvalue(this.bean.getSex(), "O18"));
this.mNationTv.setText(this.databaseManager.keyTOvalue("race_" + this.bean.getNation(), "race"));
this.mBirthTv.setText(DataUtil.formatDateOther(this.bean.getBirthday()));
this.mCitizenTv.setText(NewUtil.dataShowWithoutNull(this.bean.getIdcard()));
this.mIsCertTv.setText(NewUtil.dataShowWithoutNull(NewUtil.keyNumToValues(this.mContext, this.bean.getHavingCard(), "havingCard")));
this.mCardTv.setText(NewUtil.dataShowWithoutNull(this.bean.getCardNum()));
this.mResidenceTv.setText(NewUtil.keyToValues(this.mContext, this.bean.getAccountType(), "G3"));
this.mProjectTv.setText(NewUtil.keyNumToValues(this.mContext, this.bean.getProjectType(), "kf_xiangmu_type"));
this.mTypeTv.setText(NewUtil.keyToValues(this.mContext, this.bean.getIdtKind(), "O15"));
this.mLevelTv.setText(NewUtil.keyToValues(this.mContext, this.bean.getIdtLevel(), "O16"));
this.mAddressTv.setText(NewUtil.dataShowWithoutNull(this.bean.getAddress()));
this.mGuardianTv.setText(NewUtil.dataShowWithoutNull(this.bean.getGuardianName()));
this.mContactTv.setText(NewUtil.dataShowWithoutNull(this.bean.getLinkTel()));
this.mEconomicsTv.setText(this.databaseManager.keyTOvalue("kf_jingji_status_" + this.bean.getFamilyEconomic(), "kf_jingji_status"));
this.mMedicalTv.setText(this.databaseManager.keyTOvalue("kf_medicalInsurance_" + this.bean.getMedicalInsurance(), "kf_medicalInsurance"));
String shifouSubsidy = this.bean.getShifouSubsidy();
if ("3".equals(this.role)) {
if (isNull(shifouSubsidy) && Constants.VIA_REPORT_TYPE_MAKE_FRIEND.equals(this.bean.getState())) {
if (this.workType == 0) {
this.layout_train.setVisibility(8);
} else {
this.layout_train.setVisibility(0);
this.mAidStartTimeTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (ActivityRehabilitationInfoShow.this.dateTimePickDialogStart == null) {
ActivityRehabilitationInfoShow.this.dateTimePickDialogStart = new DateTimePickDialog((BaseActivity) ActivityRehabilitationInfoShow.this.mContext, null);
}
ActivityRehabilitationInfoShow.this.dateTimePickDialogStart.dateTimePicKDialog(ActivityRehabilitationInfoShow.this.mAidStartTimeTv);
}
});
this.mAidEndTimeTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (ActivityRehabilitationInfoShow.this.dateTimePickDialogEnd == null) {
ActivityRehabilitationInfoShow.this.dateTimePickDialogEnd = new DateTimePickDialog((BaseActivity) ActivityRehabilitationInfoShow.this.mContext, null);
}
ActivityRehabilitationInfoShow.this.dateTimePickDialogEnd.dateTimePicKDialog(ActivityRehabilitationInfoShow.this.mAidEndTimeTv);
}
});
}
} else {
this.trainGroup.setEnabled(false);
this.trainGroup.setClickable(false);
((RadioButton) this.trainGroup.getChildAt(0)).setClickable(false);
((RadioButton) this.trainGroup.getChildAt(0)).setEnabled(false);
((RadioButton) this.trainGroup.getChildAt(1)).setClickable(false);
((RadioButton) this.trainGroup.getChildAt(1)).setEnabled(false);
if ("1".equals(shifouSubsidy)) {
((RadioButton) this.trainGroup.getChildAt(0)).setChecked(true);
} else if ("2".equals(shifouSubsidy)) {
((RadioButton) this.trainGroup.getChildAt(1)).setChecked(true);
} else {
this.layout_train.setVisibility(8);
}
this.mAidStartTimeTv.setText(NewUtil.getDateFromTimeStamp(this.bean.getStarTime()));
this.mAidEndTimeTv.setText(NewUtil.getDateFromTimeStamp(this.bean.getEndTime()) + " 共" + NewUtil.dataShowWithoutNull(this.bean.getSubsidyMonth()) + "月");
this.mAidMoneyTv.setText(NewUtil.string2Double(this.bean.getSubsidyMoney()));
this.mAidMoneyTv.setFocusable(false);
this.mAidMoneyTv.setEnabled(false);
}
} else if (isNull(shifouSubsidy)) {
this.layout_train.setVisibility(8);
} else {
this.layout_train.setVisibility(0);
this.trainGroup.setEnabled(false);
this.trainGroup.setClickable(false);
((RadioButton) this.trainGroup.getChildAt(0)).setClickable(false);
((RadioButton) this.trainGroup.getChildAt(0)).setEnabled(false);
((RadioButton) this.trainGroup.getChildAt(1)).setClickable(false);
((RadioButton) this.trainGroup.getChildAt(1)).setEnabled(false);
if ("1".equals(shifouSubsidy)) {
((RadioButton) this.trainGroup.getChildAt(0)).setChecked(true);
} else if ("2".equals(shifouSubsidy)) {
((RadioButton) this.trainGroup.getChildAt(1)).setChecked(true);
} else {
this.layout_train.setVisibility(8);
}
this.mAidStartTimeTv.setText(NewUtil.getDateFromTimeStamp(this.bean.getStarTime()));
this.mAidEndTimeTv.setText(NewUtil.getDateFromTimeStamp(this.bean.getEndTime()) + " 共" + NewUtil.dataShowWithoutNull(this.bean.getSubsidyMonth()) + "月");
this.mAidMoneyTv.setText(NewUtil.string2Double(this.bean.getSubsidyMoney()));
this.mAidMoneyTv.setFocusable(false);
this.mAidMoneyTv.setEnabled(false);
}
ExamineBean communityBean = new ExamineBean(this.workType, "5", this.rehabilitationApplicationExamineBean.getCommunityState(), this.rehabilitationApplicationExamineBean.getCommunityIdea(), this.rehabilitationApplicationExamineBean.getCommunityRen(), this.rehabilitationApplicationExamineBean.getCommunityTime());
this.mEvCommunity.setExamineContent(communityBean);
this.examineMap.put(new Integer("5"), this.mEvCommunity);
ExamineBean streetBean = new ExamineBean(this.workType, "4", this.rehabilitationApplicationExamineBean.getStreetState(), this.rehabilitationApplicationExamineBean.getStreetIdea(), this.rehabilitationApplicationExamineBean.getStreetRen(), this.rehabilitationApplicationExamineBean.getStreetTime());
this.mEvStreet.setExamineContent(streetBean);
this.examineMap.put(new Integer("4"), this.mEvStreet);
ExamineBean cityBean = new ExamineBean(this.workType, "3", this.rehabilitationApplicationExamineBean.getCountyState(), this.rehabilitationApplicationExamineBean.getCountyIdea(), this.rehabilitationApplicationExamineBean.getCountyRen(), this.rehabilitationApplicationExamineBean.getCountyTime());
this.mEvArea.setExamineContent(cityBean);
this.examineMap.put(new Integer("3"), this.mEvArea);
NewUtil.setCheckBtnVisibility(this.mHandBtn, this.bean.getState(), this.workType);
if (this.mEvCommunity.getVisibility() != 0 && this.mEvStreet.getVisibility() != 0 && this.mEvArea.getVisibility() != 0) {
this.checklayout.setVisibility(8);
} else {
this.checklayout.setVisibility(0);
}
}
}
public void initAttachMent() {
this.mAttachLayout.removeAllViews();
if (this.attachmentBeans == null || this.attachmentBeans.size() == 0) {
View child = LayoutInflater.from(this.mContext).inflate(R.layout.item_attach, (ViewGroup) null);
TextView attachTv = (TextView) child.findViewById(R.id.attach_tv);
attachTv.setText("暂无附件");
attachTv.setOnClickListener(this);
this.mAttachLayout.addView(child);
return;
}
this.photos.clear();
for (int i = 0; i < this.attachmentBeans.size(); i++) {
AttachmentBean bean = this.attachmentBeans.get(i);
if (NewUtil.isPicture(bean.getFileExt())) {
AvatarBean avatarBean = new AvatarBean(bean.getFilePath());
this.photos.add(avatarBean);
} else {
View child2 = LayoutInflater.from(this.mContext).inflate(R.layout.item_attach, (ViewGroup) null);
TextView attachTv2 = (TextView) child2.findViewById(R.id.attach_tv);
attachTv2.setText(this.attachmentBeans.get(i).getFileName());
attachTv2.setOnClickListener(this);
attachTv2.setTag(R.id.TAG_VIEWHOLDER, this.attachmentBeans.get(i));
this.mAttachLayout.addView(child2);
}
}
if (this.photos != null && this.photos.size() > 0) {
this.mRecycle.setVisibility(0);
freshData();
} else {
this.mRecycle.setVisibility(8);
}
}
public void freshData() {
if (this.pickerPhotoAdapter == null) {
this.pickerPhotoAdapter = new ShowPhotoAdapter(this.mContext, this.photos);
this.pickerPhotoAdapter.setBrowserLargerPhoto(new ShowPhotoAdapter.OnBrowserLargerPhoto() {
@Override
public void onBrowser(int position) {
Intent intent = new Intent(ActivityRehabilitationInfoShow.this.mContext, (Class<?>) ShowLargerPhotoActivity.class);
intent.putExtra("position", position);
intent.putExtra("photos", ActivityRehabilitationInfoShow.this.photos);
ActivityRehabilitationInfoShow.this.startActivity(intent);
}
});
this.mRecycle.setAdapter(this.pickerPhotoAdapter);
} else {
this.pickerPhotoAdapter.setmItems(this.photos);
this.pickerPhotoAdapter.notifyDataSetChanged();
}
}
@Override
public void onResponseBefore(NewHYTask task) {
switch (task.getService()) {
case ATTACH_FILE_DOWNLOAD:
case WORKER_BUSINESS_GETRESCUEAUDIT:
case WORKER_BUSINESS_GETRESCUEPREAUDIT:
case ATTACHMENT_CALLBACK:
case CITIZEN_GETCITIZENINFONOLOGIN:
showProgress(NewHYConfig.LOADING_HINT, false);
break;
}
}
@Override
public void onResponseAfter(NewHYTask task) {
switch (task.getService()) {
case ATTACH_FILE_DOWNLOAD:
case WORKER_BUSINESS_GETRESCUEAUDIT:
case WORKER_BUSINESS_GETRESCUEPREAUDIT:
case ATTACHMENT_CALLBACK:
case CITIZEN_GETCITIZENINFONOLOGIN:
cancleProgress();
break;
}
}
@Override
public void onResponseSuccessful(NewHYTask task, BaseResult object) {
switch (task.getService()) {
case WORKER_BUSINESS_GETRESCUEAUDIT:
ToastUtils.showShortToast(this.mContext, "审核提交成功");
MessageEvent messageEvent = new MessageEvent("康复审核提交成功");
messageEvent.setType(NewHYConfig.ACTIVITY_REHABILITATION_APPLICATION_SUSS);
EventBus.getDefault().post(messageEvent);
MessageEvent indexEvent = new MessageEvent("刷新待办事项");
indexEvent.setType(NewHYConfig.FRAGMENT_NEED);
EventBus.getDefault().post(indexEvent);
this.mTitleviewApply.postDelayed(new Runnable() {
@Override
public void run() {
ActivityRehabilitationInfoShow.this.finish();
}
}, 1000L);
break;
case WORKER_BUSINESS_GETRESCUEPREAUDIT:
DataParser<RehabilitationApplicationExamineBean> mResult = (DataParser) object;
if (mResult != null && mResult.getObjects() != null && mResult.getObjects().size() != 0) {
this.rehabilitationApplicationExamineBean = mResult.getObjects().get(0);
this.bean = this.rehabilitationApplicationExamineBean.getKfServiceApplication();
break;
}
break;
case ATTACHMENT_CALLBACK:
DataParser<AttachmentBean> mResultAttach = (DataParser) object;
if (mResultAttach == null || mResultAttach.getObjects() == null || mResultAttach.getObjects().size() == 0) {
initAttachMent();
break;
} else {
this.attachmentBeans = mResultAttach.getObjects();
initAttachMent();
break;
}
break;
case CITIZEN_GETCITIZENINFONOLOGIN:
DataParser<AvatarBean> mResultAvatar = (DataParser) object;
if (mResultAvatar != null && mResultAvatar.getObjects() != null && mResultAvatar.getObjects().size() != 0) {
AvatarBean avatarBean = mResultAvatar.getObjects().get(0);
GlideUtils.loadRadiusImage(this.mContext, NewHYConfig.ROOT + avatarBean.getPhotoPath(), this.iv_avatar, 0, R.mipmap.icon_man);
break;
}
break;
}
}
@Override
protected void onResponseBigData(NewHYTask task) {
String tempPath = task.getTempFile();
switch (task.getService()) {
case ATTACH_FILE_DOWNLOAD:
if (isNull(tempPath)) {
ToastUtils.showShortToast(this.mContext, "文件不存在或文件错误!");
break;
} else {
File file = new File(tempPath);
if (!file.exists() || file.length() <= 0) {
ToastUtils.showShortToast(this.mContext, "文件不存在或文件错误!");
break;
} else {
Intent intent = NewUtil.getIntentByFileType(this.mContext, tempPath);
if (NewUtil.isIntentAvailable(this.mContext, intent)) {
startActivity(intent);
break;
} else {
ToastUtils.showShortToast(this.mContext, "请安装第三方文档编辑器");
break;
}
}
}
break;
}
}
@Override
public void onResponseError(NewHYTask task, BaseResult object) {
switch (task.getService()) {
case ATTACH_FILE_DOWNLOAD:
case WORKER_BUSINESS_GETRESCUEAUDIT:
case WORKER_BUSINESS_GETRESCUEPREAUDIT:
case CITIZEN_GETCITIZENINFONOLOGIN:
ToastUtils.showShortToast(this.mContext, object.getMsg());
break;
case ATTACHMENT_CALLBACK:
initAttachMent();
break;
}
}
@Override
public void onServerError(NewHYTask task, int failedType) {
switch (task.getService()) {
case ATTACH_FILE_DOWNLOAD:
case WORKER_BUSINESS_GETRESCUEAUDIT:
case WORKER_BUSINESS_GETRESCUEPREAUDIT:
case CITIZEN_GETCITIZENINFONOLOGIN:
onResultShow(failedType);
break;
case ATTACHMENT_CALLBACK:
initAttachMent();
break;
}
}
public void requestPermissions() {
if (ContextCompat.checkSelfPermission(this.mContext, "android.permission.WRITE_EXTERNAL_STORAGE") != 0) {
ActivityCompat.requestPermissions(this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 1000);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) {
case 1000:
if (grantResults[0] == 0) {
AlertDialog.Builder dialog = new AlertDialog.Builder(this.mContext);
dialog.setTitle("提示");
dialog.setMessage("此操作需要文件写入权限,是否去设置?");
dialog.setCancelable(false);
dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = new Intent();
intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.setData(Uri.fromParts("package", ActivityRehabilitationInfoShow.this.mContext.getPackageName(), null));
ActivityRehabilitationInfoShow.this.startActivity(intent);
ActivityRehabilitationInfoShow.this.startActivity(intent);
}
});
dialog.show();
break;
}
break;
}
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
@Override
public void initViews() {
this.mTitleviewApply = (TitleView) findViewById(R.id.titleview_apply);
this.mNameTv = (TextView) findViewById(R.id.name_tv);
this.iv_avatar = (ImageView) findViewById(R.id.iv_avatar);
this.mSexTv = (TextView) findViewById(R.id.sex_tv);
this.mNationTv = (TextView) findViewById(R.id.nation_tv);
this.mBirthTv = (TextView) findViewById(R.id.birth_tv);
this.mCitizenTv = (TextView) findViewById(R.id.citizen_tv);
this.mIsCertTv = (TextView) findViewById(R.id.is_cert_tv);
this.mTypeTv = (TextView) findViewById(R.id.type_tv);
this.mLevelTv = (TextView) findViewById(R.id.level_tv);
this.mAddressTv = (TextView) findViewById(R.id.address_tv);
this.mGuardianTv = (TextView) findViewById(R.id.guardian_tv);
this.mContactTv = (TextView) findViewById(R.id.contact_tv);
this.mEconomicsTv = (TextView) findViewById(R.id.economics_tv);
this.mMedicalTv = (TextView) findViewById(R.id.medical_tv);
this.mCardTv = (TextView) findViewById(R.id.card_tv);
this.mResidenceTv = (TextView) findViewById(R.id.residence_tv);
this.mProjectTv = (TextView) findViewById(R.id.project_tv);
this.mAidStartTimeTv = (TextView) findViewById(R.id.aid_start_time_tv);
this.mAidEndTimeTv = (TextView) findViewById(R.id.aid_end_time_tv);
this.mAidMoneyTv = (EditText) findViewById(R.id.aid_money_tv);
this.mAidMoneyTv.addTextChangedListener(this.textWatcher);
this.layout_train = (LinearLayout) findViewById(R.id.layout_train);
this.layoutMoney = (LinearLayout) findViewById(R.id.layout_money);
this.trainGroup = (RadioGroup) findViewById(R.id.rg_agree);
this.mAttachLayout = (LinearLayout) findViewById(R.id.attach_layout);
this.mRecycle = (RecyclerView) findViewById(R.id.recycle);
GridLayoutManager layoutManager = new GridLayoutManager(this, 4) {
@Override
public boolean canScrollVertically() {
return false;
}
};
layoutManager.setOrientation(1);
this.mRecycle.setLayoutManager(layoutManager);
this.mRecycle.addItemDecoration(new SpacingItemDecoration(this.mContext, NewUtil.dip2px(this.mContext, 5.0f)));
this.checklayout = (RelativeLayout) findViewById(R.id.check_rl);
this.mEvCommunity = (ExamineView) findViewById(R.id.ev_community);
this.mEvStreet = (ExamineView) findViewById(R.id.ev_street);
this.mEvArea = (ExamineView) findViewById(R.id.ev_area);
this.mHandBtn = (Button) findViewById(R.id.hand_btn);
}
@Override
public void getExtraParam() {
this.id = getIntent().getStringExtra("id");
this.workType = getIntent().getIntExtra("workType", 0);
if (this.workType == 0) {
this.mTitleviewApply.setTextName("康复服务查看");
} else {
this.mTitleviewApply.setTextName("康复服务审核");
}
this.position = getIntent().getIntExtra("position", 0);
}
@Override
public void setListener() {
this.mTitleviewApply.setOnTitleClik(new TitleView.BackListenner() {
@Override
public void BackSet() {
ActivityRehabilitationInfoShow.this.finish();
}
}, null);
this.mHandBtn.setOnClickListener(this);
this.mContactTv.setOnClickListener(this);
this.trainGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
switch (checkedId) {
case R.id.rb_yes:
ActivityRehabilitationInfoShow.this.layoutMoney.setVisibility(0);
break;
case R.id.rb_no:
ActivityRehabilitationInfoShow.this.layoutMoney.setVisibility(8);
break;
}
}
});
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.hand_btn:
if (this.bean != null) {
ChoiceTishiDialog("确定审核" + this.bean.getName() + "的康复服务申请?", false, new BaseActivity.OnChoiceDialogYes() {
@Override
public void onChoiceDialogYes(DialogInterface dialogInterface, int i) {
ToastUtils.showLongToast(ActivityRehabilitationInfoShow.this.mContext, "审核处理");
}
}, new BaseActivity.OnChoiceDialogNo() {
@Override
public void onChoiceDialogNo(DialogInterface dialogInterface, int i) {
}
});
break;
}
break;
case R.id.contact_tv:
if (this.bean != null && !isNull(this.bean.getLinkTel())) {
ChoiceTishiDialog("确定拨打" + this.bean.getLinkTel() + "?", false, new BaseActivity.OnChoiceDialogYes() {
@Override
public void onChoiceDialogYes(DialogInterface dialogInterface, int i) {
Intent intent = new Intent("android.intent.action.DIAL");
intent.setData(Uri.parse("tel:" + ActivityRehabilitationInfoShow.this.bean.getLinkTel()));
ActivityRehabilitationInfoShow.this.startActivity(intent);
}
}, new BaseActivity.OnChoiceDialogNo() {
@Override
public void onChoiceDialogNo(DialogInterface dialogInterface, int i) {
}
});
break;
}
break;
case R.id.attach_tv:
final AttachmentBean attachmentBean = (AttachmentBean) v.getTag(R.id.TAG_VIEWHOLDER);
if (attachmentBean != null && !isNull(attachmentBean.getFilePath())) {
ChoiceTishiDialog("确定查看xx?", false, new BaseActivity.OnChoiceDialogYes() {
@Override
public void onChoiceDialogYes(DialogInterface dialogInterface, int i) {
HashMap<String, String> params = new HashMap<>();
params.put("path", NewHYConfig.ROOT + attachmentBean.getFilePath());
NewHYTask task = new CommonTask(RequestServiceList.ATTACH_FILE_DOWNLOAD, params);
ActivityRehabilitationInfoShow.this.executeRequest(task);
}
}, new BaseActivity.OnChoiceDialogNo() {
@Override
public void onChoiceDialogNo(DialogInterface dialogInterface, int i) {
}
});
break;
}
break;
}
}
@Override
protected void onDestroy() {
this.databaseManager.closeDB();
ImageUtil.deleteTempFile(this.mContext);
super.onDestroy();
}
}