正在查看: 爱心e站 v1.0.0 应用的 ArtificialcochlearApplyActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 爱心e站 v1.0.0 应用的 ArtificialcochlearApplyActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.newheyd.JZKFcanjiren.Activity;
import android.app.Activity;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.View;
import com.igexin.assist.sdk.AssistPushConsts;
import com.newheyd.JZKFcanjiren.Adapter.TabAdapter;
import com.newheyd.JZKFcanjiren.BaseFragment;
import com.newheyd.JZKFcanjiren.BaseFragmentActiviy;
import com.newheyd.JZKFcanjiren.Bean.Dict;
import com.newheyd.JZKFcanjiren.Bean.DisabledFileInfoBean;
import com.newheyd.JZKFcanjiren.Bean.MechanismBean;
import com.newheyd.JZKFcanjiren.Bean.RehabilitativeArchivesBean;
import com.newheyd.JZKFcanjiren.Bean.TabItem;
import com.newheyd.JZKFcanjiren.Bean.UserInfo;
import com.newheyd.JZKFcanjiren.Fragment.FragmentCochlearApply;
import com.newheyd.JZKFcanjiren.Fragment.FragmentExamine;
import com.newheyd.JZKFcanjiren.Fragment.FragmentFarmlyInfo;
import com.newheyd.JZKFcanjiren.Fragment.FragmentInformedConsent;
import com.newheyd.JZKFcanjiren.Fragment.FragmentOtherApply;
import com.newheyd.JZKFcanjiren.MyApplication;
import com.newheyd.JZKFcanjiren.R;
import com.newheyd.JZKFcanjiren.Utils.ActivityCollector;
import com.newheyd.JZKFcanjiren.Utils.StastisticUtil;
import com.newheyd.JZKFcanjiren.Utils.ToastUtils;
import com.newheyd.JZKFcanjiren.Utils.locationUtil.LocationAddrUtil;
import com.newheyd.JZKFcanjiren.View.AdjustableScrollViewPager;
import com.newheyd.JZKFcanjiren.View.Dialog.MyDialog;
import com.newheyd.JZKFcanjiren.View.TitleView;
import com.newheyd.JZKFcanjiren.config.NewHYConfig;
import com.newheyd.JZKFcanjiren.model.BaseResult;
import com.newheyd.JZKFcanjiren.model.DataParser;
import com.newheyd.JZKFcanjiren.net.CommonDataListTask;
import com.newheyd.JZKFcanjiren.net.CommonTask;
import com.newheyd.JZKFcanjiren.net.NewHYTask;
import com.newheyd.JZKFcanjiren.net.RequestServiceList;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class ArtificialcochlearApplyActivity extends BaseFragmentActiviy {
private TabAdapter adapter;
private AdjustableScrollViewPager adjustableScrollViewPager;
private String id;
private TabLayout tab;
private TabItem tabCochlear;
private TabItem tabExamine;
private TabItem tabFamilyInfo;
private TabItem tabInformedConsent;
private TabItem tabOtherApply;
private TitleView titleView;
private ViewPager viewpager;
private OnMyPageChangeListener onMyPageChangeListener = null;
private ArrayList<TabItem> tabs = new ArrayList<>();
private List<BaseFragment> fragments = new ArrayList();
private DisabledFileInfoBean disabledFileInfoBean = null;
private ArrayList<MechanismBean> mOrgList = new ArrayList<>();
private ArrayList<Dict> mOrgDictList = new ArrayList<>();
private RehabilitativeArchivesBean rehabilitativeArchivesBean = null;
private UserInfo userInfo = null;
private BaseFragment fragmentInformedConsent = null;
private BaseFragment fragmentCochlearApply = null;
private BaseFragment fragmentFarmlyInfo = null;
private BaseFragment fragmentOtherApply = null;
private BaseFragment fragmentExamine = null;
private String flag = "1";
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_disabled_lifecircle);
super.onCreate(savedInstanceState);
this.userInfo = MyApplication.getInstance().getUserInfo();
checkIdtKind();
goStatistics();
}
public void goStatistics() {
HashMap<String, String> map = LocationAddrUtil.getInstance().getLocationParam(this.mContext);
StastisticUtil.getInstance().onEvent(this.mContext, "ArtificialcochlearApplyActivity", map);
}
public void checkIdtKind() {
HashMap<String, String> params = new HashMap<>();
params.put(AssistPushConsts.MSG_TYPE_TOKEN, this.userInfo == null ? "" : this.userInfo.getToken());
NewHYTask task = new CommonTask(RequestServiceList.COCHLEARAUDIT_COCHLEARDISCLAIMER, params);
executeRequest(task);
}
public void onShowApplyDialog() {
if ("3".equals(this.flag)) {
showMyDialog();
} else {
getInformedConsent();
}
}
public void getInformedConsent() {
HashMap<String, String> params = new HashMap<>();
params.put(AssistPushConsts.MSG_TYPE_TOKEN, this.userInfo == null ? "" : this.userInfo.getToken());
RequestServiceList method = null;
Class cls = null;
if ("1".equals(this.flag)) {
params.put("id", this.id);
cls = DisabledFileInfoBean.class;
method = RequestServiceList.ARTIFICIALCOCHLEAR_INFORMEDCONSENT;
} else if ("3".equals(this.flag)) {
cls = DisabledFileInfoBean.class;
method = RequestServiceList.ARTIFICIALCOCHLEAR_INFORMEDCONSENT;
} else if ("2".equals(this.flag)) {
params.put("id", this.id);
cls = DisabledFileInfoBean.class;
method = RequestServiceList.ARTIFICIALCOCHLEAR_VIEW;
}
NewHYTask task = new CommonDataListTask(method, params, cls);
executeRequest(task);
}
private void showMyDialog() {
MyDialog myDialog = new MyDialog(this.mContext, getResources().getString(R.string.cochlear_argeement), "关于服务办理的相关声明", "同意", "不同意", false);
myDialog.setOnDiaLogListener(new MyDialog.OnDialogListenerPN() {
@Override
public void dialogPositiveListener(View customView, DialogInterface dialogInterface, int which) {
ArtificialcochlearApplyActivity.this.getInformedConsent();
dialogInterface.dismiss();
}
@Override
public void dialogNegativeListener(View customView, DialogInterface dialogInterface, int which) {
ToastUtils.showShortToast(ArtificialcochlearApplyActivity.this.mContext, "您需要同意上述条款才可进行在线办理");
ArtificialcochlearApplyActivity.this.finish();
dialogInterface.dismiss();
}
});
myDialog.showDialog();
}
@Override
public void onResponseBefore(NewHYTask task) {
switch (task.getService()) {
case ARTIFICIALCOCHLEAR_INFORMEDCONSENT:
case ARTIFICIALCOCHLEAR_VIEW:
case COCHLEARAUDIT_COCHLEARDISCLAIMER:
showProgress(NewHYConfig.LOADING_HINT, false);
break;
}
}
@Override
public void onResponseAfter(NewHYTask task) {
switch (task.getService()) {
case ARTIFICIALCOCHLEAR_INFORMEDCONSENT:
case ARTIFICIALCOCHLEAR_VIEW:
case COCHLEARAUDIT_COCHLEARDISCLAIMER:
cancleProgress();
break;
}
}
@Override
public void onResponseSuccessful(NewHYTask task, BaseResult object) {
switch (task.getService()) {
case ARTIFICIALCOCHLEAR_INFORMEDCONSENT:
case ARTIFICIALCOCHLEAR_VIEW:
DataParser<DisabledFileInfoBean> mResult = (DataParser) object;
if (mResult.getObjects().size() != 0) {
this.disabledFileInfoBean = mResult.getObjects().get(0);
if ("1".equals(this.flag) || "3".equals(this.flag)) {
String data2 = mResult.getData2();
if (!isNull(data2)) {
try {
JSONArray arrayOrg = new JSONArray(data2);
for (int i = 0; i < arrayOrg.length(); i++) {
this.mOrgList.add(new MechanismBean(arrayOrg.getJSONObject(i)));
}
} catch (JSONException e) {
e.printStackTrace();
}
Iterator<MechanismBean> it = this.mOrgList.iterator();
while (it.hasNext()) {
MechanismBean bean = it.next();
this.mOrgDictList.add(new Dict(bean.getId(), bean.getOrgName()));
}
}
this.disabledFileInfoBean.setmOrgDictList(this.mOrgDictList);
String data3 = mResult.getData3();
if (!isNull(data3)) {
try {
this.rehabilitativeArchivesBean = new RehabilitativeArchivesBean(new JSONObject(data3));
} catch (JSONException e2) {
e2.printStackTrace();
}
}
} else if ("2".equals(this.flag)) {
try {
this.rehabilitativeArchivesBean = new RehabilitativeArchivesBean(new JSONObject(object.getData2()));
} catch (JSONException e3) {
e3.printStackTrace();
}
}
initTabData();
break;
}
break;
case COCHLEARAUDIT_COCHLEARDISCLAIMER:
onShowApplyDialog();
break;
}
}
public void initTabData() {
if ("1".equals(this.flag) || "3".equals(this.flag)) {
onNextTab("1");
this.adjustableScrollViewPager.setNoScroll(true);
} else if ("2".equals(this.flag)) {
this.adjustableScrollViewPager.setNoScroll(false);
if (this.disabledFileInfoBean == null || "1".equals(this.disabledFileInfoBean.getStatus()) || "2".equals(this.disabledFileInfoBean.getStatus())) {
onNextTab("1,2,3,4");
} else {
onNextTab("1,2,3,4,5");
}
}
}
public void freshData() {
if (this.adapter == null) {
this.adapter = new TabAdapter(getSupportFragmentManager(), this.fragments, this.tabs);
this.adjustableScrollViewPager.setAdapter(this.adapter);
this.tab.setTabMode(0);
this.adjustableScrollViewPager.setOffscreenPageLimit(1);
} else {
this.adapter.setFragments(this.fragments);
this.adapter.setTabs(this.tabs);
this.adapter.notifyDataSetChanged();
}
if ("1".equals(this.flag) || "3".equals(this.flag)) {
this.adjustableScrollViewPager.setCurrentItem(this.tab.getTabCount() - 1, false);
}
showNextIcon();
}
public void showNextIcon() {
if ("1".equals(this.flag) || "3".equals(this.flag)) {
if ("4".equals(this.tabs.get(this.tab.getTabCount() - 1).getKeytpe())) {
this.titleView.setSearchVisivle(false);
return;
} else {
this.titleView.setSearchVisivle(true);
return;
}
}
if ("2".equals(this.flag)) {
this.titleView.setSearchVisivle(false);
}
}
public void onNextTab(String keytype) {
String[] keytypes = keytype.split(",");
if (!"1".equals(this.flag) && !"3".equals(this.flag)) {
this.tabs.clear();
this.fragments.clear();
}
for (String key : keytypes) {
switch (key) {
case "1":
this.tabInformedConsent = new TabItem("1", "知情同意书");
this.tabInformedConsent.setShowing(true);
this.tabInformedConsent.setFlag(this.flag);
this.tabs.add(this.tabInformedConsent);
this.tab.addTab(this.tab.newTab().setText(this.tabInformedConsent.getName()));
if (this.fragmentInformedConsent == null) {
this.fragmentInformedConsent = FragmentInformedConsent.newInstance(this.tabInformedConsent);
}
this.fragments.add(this.fragmentInformedConsent);
break;
case "2":
this.tabCochlear = new TabItem("2", "人工耳蜗救助申请表");
this.tabCochlear.setFlag(this.flag);
this.tabs.add(this.tabCochlear);
this.tab.addTab(this.tab.newTab().setText(this.tabCochlear.getName()));
if (this.fragmentCochlearApply == null) {
this.fragmentCochlearApply = FragmentCochlearApply.newInstance(this.tabCochlear);
}
this.fragments.add(this.fragmentCochlearApply);
break;
case "3":
this.tabFamilyInfo = new TabItem("3", "家庭基本情况");
this.tabFamilyInfo.setFlag(this.flag);
this.tabs.add(this.tabFamilyInfo);
this.tab.addTab(this.tab.newTab().setText(this.tabFamilyInfo.getName()));
if (this.fragmentFarmlyInfo == null) {
this.fragmentFarmlyInfo = FragmentFarmlyInfo.newInstance(this.tabFamilyInfo);
}
this.fragments.add(this.fragmentFarmlyInfo);
break;
case "4":
this.tabOtherApply = new TabItem("4", "其他申请内容");
this.tabOtherApply.setFlag(this.flag);
this.tabs.add(this.tabOtherApply);
this.tab.addTab(this.tab.newTab().setText(this.tabOtherApply.getName()));
if (this.fragmentOtherApply == null) {
this.fragmentOtherApply = FragmentOtherApply.newInstance(this.tabOtherApply);
}
this.fragments.add(this.fragmentOtherApply);
break;
case "5":
this.tabExamine = new TabItem("5", "审核意见");
this.tabExamine.setFlag(this.flag);
this.tabs.add(this.tabExamine);
this.tab.addTab(this.tab.newTab().setText(this.tabExamine.getName()));
if ("1".equals(this.flag)) {
this.titleView.setSearchVisivle(false);
}
if (this.fragmentExamine == null) {
this.fragmentExamine = FragmentExamine.newInstance(this.tabExamine);
}
this.fragments.add(this.fragmentExamine);
break;
}
}
freshData();
}
public DisabledFileInfoBean getDisabledFileInfoBean() {
return this.disabledFileInfoBean;
}
public RehabilitativeArchivesBean getRehabilitativeArchivesBean() {
return this.rehabilitativeArchivesBean;
}
public void setRehabilitativeArchivesBean(RehabilitativeArchivesBean rehabilitativeArchivesBean) {
this.rehabilitativeArchivesBean = rehabilitativeArchivesBean;
}
@Override
public void onResponseError(NewHYTask task, BaseResult object) {
switch (task.getService()) {
case ARTIFICIALCOCHLEAR_INFORMEDCONSENT:
case ARTIFICIALCOCHLEAR_VIEW:
ToastUtils.showShortToast(this.mContext, object.getMsg());
break;
case COCHLEARAUDIT_COCHLEARDISCLAIMER:
TishiDialog(object.getMsg(), false, new BaseFragmentActiviy.OnTishiDialogClicked() {
@Override
public void onTishiDialogClicked(DialogInterface dialogInterface, int i) {
Activity baseActivity = ActivityCollector.getLastActivity();
if (!(baseActivity instanceof HomeFragActivity)) {
ArtificialcochlearApplyActivity.this.finish();
}
}
});
break;
}
}
@Override
public void onServerError(NewHYTask task, int failedType) {
switch (task.getService()) {
case ARTIFICIALCOCHLEAR_INFORMEDCONSENT:
case ARTIFICIALCOCHLEAR_VIEW:
case COCHLEARAUDIT_COCHLEARDISCLAIMER:
onResultShow(failedType);
break;
}
}
@Override
public void initViews() {
this.titleView = (TitleView) findViewById(R.id.titleview_tools);
this.tab = (TabLayout) findViewById(R.id.tab);
this.viewpager = (ViewPager) findViewById(R.id.viewpager);
this.viewpager.setVisibility(8);
this.adjustableScrollViewPager = (AdjustableScrollViewPager) findViewById(R.id.vp);
this.adjustableScrollViewPager.setVisibility(0);
}
@Override
public void getExtraParam() {
this.id = getIntent().getStringExtra("id");
this.flag = getIntent().getStringExtra("flag");
if ("1".equals(this.flag) || "3".equals(this.flag)) {
this.titleView.setSearchImg(R.mipmap.next);
this.titleView.setSearchVisivle(true);
} else if ("2".equals(this.flag)) {
this.titleView.setSearchVisivle(false);
}
}
public void dealEachStepNext(String keytype, int curTab) {
switch (keytype) {
case "1":
((FragmentInformedConsent) this.adapter.getItem(curTab)).saveInformedConsent();
break;
case "2":
((FragmentCochlearApply) this.adapter.getItem(curTab)).saveApplicationForm();
break;
case "3":
((FragmentFarmlyInfo) this.adapter.getItem(curTab)).saveFamilyBasicSituation();
break;
}
}
@Override
public void setListener() {
this.titleView.setOnTitleClik(new TitleView.BackListenner() {
@Override
public void BackSet() {
ArtificialcochlearApplyActivity.this.finish();
}
}, new TitleView.RightListenner() {
@Override
public void RightSet() {
int curTab = ArtificialcochlearApplyActivity.this.tab.getSelectedTabPosition();
if (curTab < ArtificialcochlearApplyActivity.this.tab.getTabCount()) {
ArtificialcochlearApplyActivity.this.dealEachStepNext(((TabItem) ArtificialcochlearApplyActivity.this.tabs.get(curTab)).getKeytpe(), curTab);
}
}
});
if ("1".equals(this.flag)) {
this.titleView.setTextName("人工耳蜗申请编辑");
} else if ("2".equals(this.flag)) {
this.titleView.setTextName("人工耳蜗申请查看");
} else if ("3".equals(this.flag)) {
this.titleView.setTextName("人工耳蜗申请");
}
this.onMyPageChangeListener = new OnMyPageChangeListener();
this.adjustableScrollViewPager.addOnPageChangeListener(this.onMyPageChangeListener);
this.tab.addOnTabSelectedListener(new OnMyTabSelectedListener());
}
class OnMyTabSelectedListener implements TabLayout.OnTabSelectedListener {
OnMyTabSelectedListener() {
}
@Override
public void onTabSelected(TabLayout.Tab tab) {
if ("1".equals(ArtificialcochlearApplyActivity.this.flag) || "3".equals(ArtificialcochlearApplyActivity.this.flag)) {
int position = tab.getPosition() + 1;
if (position < ArtificialcochlearApplyActivity.this.tab.getTabCount()) {
while (position < ArtificialcochlearApplyActivity.this.tab.getTabCount()) {
ArtificialcochlearApplyActivity.this.tab.removeTabAt(position);
ArtificialcochlearApplyActivity.this.tabs.remove(position);
ArtificialcochlearApplyActivity.this.fragments.remove(position);
position = (position - 1) + 1;
}
ArtificialcochlearApplyActivity.this.freshData();
return;
}
return;
}
if (tab.getPosition() == 0) {
ArtificialcochlearApplyActivity.this.adjustableScrollViewPager.setCurrentItem(0, false);
} else {
ArtificialcochlearApplyActivity.this.adjustableScrollViewPager.setCurrentItem(tab.getPosition());
}
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
}
class OnMyPageChangeListener implements ViewPager.OnPageChangeListener {
OnMyPageChangeListener() {
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
ArtificialcochlearApplyActivity.this.tab.getTabAt(position).select();
if (position == ArtificialcochlearApplyActivity.this.tab.getTabCount() - 1) {
ArtificialcochlearApplyActivity.this.titleView.setSearchVisivle(false);
return;
}
if ("1".equals(ArtificialcochlearApplyActivity.this.flag)) {
ArtificialcochlearApplyActivity.this.titleView.setSearchImg(R.mipmap.next);
ArtificialcochlearApplyActivity.this.titleView.setSearchVisivle(true);
} else if ("2".equals(ArtificialcochlearApplyActivity.this.flag)) {
ArtificialcochlearApplyActivity.this.titleView.setSearchVisivle(false);
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
}
}