正在查看: 爱心e站 v1.0.0 应用的 RehabilitationGuidActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 爱心e站 v1.0.0 应用的 RehabilitationGuidActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.newheyd.JZKFcanjiren.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.bumptech.glide.load.Key;
import com.newheyd.JZKFcanjiren.BaseActivity;
import com.newheyd.JZKFcanjiren.Bean.AvatarBean;
import com.newheyd.JZKFcanjiren.Bean.FuJianBean;
import com.newheyd.JZKFcanjiren.Bean.WorkGuideBean;
import com.newheyd.JZKFcanjiren.LargerPhoto.ShowLargerPhotoActivity;
import com.newheyd.JZKFcanjiren.MyApplication;
import com.newheyd.JZKFcanjiren.R;
import com.newheyd.JZKFcanjiren.Utils.FileDownloadUtil;
import com.newheyd.JZKFcanjiren.Utils.NewLogUtil;
import com.newheyd.JZKFcanjiren.Utils.PermissionUtil;
import com.newheyd.JZKFcanjiren.Utils.StastisticUtil;
import com.newheyd.JZKFcanjiren.Utils.ToastUtils;
import com.newheyd.JZKFcanjiren.Utils.locationUtil.LocationAddrUtil;
import com.newheyd.JZKFcanjiren.Utils.recycleViewUtils.CommonAdapter;
import com.newheyd.JZKFcanjiren.Utils.recycleViewUtils.MultiItemTypeAdapter;
import com.newheyd.JZKFcanjiren.Utils.recycleViewUtils.base.ViewHolder;
import com.newheyd.JZKFcanjiren.View.TitleView;
import com.newheyd.JZKFcanjiren.config.NewHYConfig;
import com.newheyd.JZKFcanjiren.listener.RequestPermissionCallBack;
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.List;
public class RehabilitationGuidActivity extends BaseActivity implements View.OnClickListener {
private CommonAdapter adapter;
private CommonAdapter adapterFile;
private WebView banlichengxu;
private List<WorkGuideBean> dataList;
private List<FuJianBean> fileList;
private LinearLayout ll_shenqingbiaoge_content;
private ArrayList<AvatarBean> photoList;
private RecyclerView recycleView;
private RecyclerView recycleViewFile;
private ScrollView scroll;
private TitleView titleview;
private WorkGuideBean workGuideBean;
private int pageNo = 1;
private int pageSize = 100;
private String nowType = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_rehabilitation_guid);
super.onCreate(savedInstanceState);
getPersimmions();
getPolicyList(this.pageNo, this.pageSize);
initWebViewSetting();
goStatistics();
}
public void goStatistics() {
HashMap<String, String> map = LocationAddrUtil.getInstance().getLocationParam(this.mContext);
StastisticUtil.getInstance().onEvent(this.mContext, "RehabilitationGuidActivity", map);
}
private void initWebViewSetting() {
WebSettings webSettings = this.banlichengxu.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setUseWideViewPort(true);
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
webSettings.setDisplayZoomControls(false);
webSettings.setJavaScriptEnabled(true);
webSettings.setAllowFileAccess(true);
webSettings.setBuiltInZoomControls(true);
webSettings.setSupportZoom(true);
webSettings.setLoadWithOverviewMode(true);
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int mDensity = metrics.densityDpi;
NewLogUtil.debug("maomao==densityDpi = " + mDensity);
if (mDensity == 240) {
webSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
} else if (mDensity == 160) {
webSettings.setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
} else if (mDensity == 120) {
webSettings.setDefaultZoom(WebSettings.ZoomDensity.CLOSE);
} else if (mDensity == 320) {
webSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
} else if (mDensity == 213) {
webSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
} else {
webSettings.setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
}
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
}
private void getPersimmions() {
String[] permissionArr = {"android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"};
String[] permissionArr2 = {"android.permission.WRITE_EXTERNAL_STORAGE"};
PermissionUtil.getInstance().requestPermissions(this.mContext, permissionArr, new RequestPermissionCallBack() {
@Override
public void granted() {
}
@Override
public void denied() {
ToastUtils.showShortToast(RehabilitationGuidActivity.this.mContext, "未获取定位权限,导航功能可能无法使用");
}
});
PermissionUtil.getInstance().requestPermissions(this.mContext, permissionArr2, new RequestPermissionCallBack() {
@Override
public void granted() {
}
@Override
public void denied() {
ToastUtils.showShortToast(RehabilitationGuidActivity.this.mContext, "未获取到权限,某些功能可能无法使用");
}
});
}
@Override
public void onResponseBefore(NewHYTask task) {
showProgress("正在获取数据", false);
}
@Override
public void onResponseAfter(NewHYTask task) {
cancleProgress();
}
@Override
public void onResponseSuccessful(NewHYTask task, BaseResult object) {
switch (task.getService()) {
case BANSHI_GUID:
if (this.dataList != null) {
this.dataList.clear();
}
DataParser<WorkGuideBean> listtemp = (DataParser) object;
this.dataList.addAll(listtemp.getObjects());
this.adapter.notifyDataSetChanged();
break;
}
}
@Override
public void onResponseError(NewHYTask task, BaseResult object) {
switch (task.getService()) {
case BANSHI_GUID:
ToastUtils.showShortToast(this.mContext, object.getMsg());
break;
case ATTACHMENT_CALLBACK_CALLBACKNOTOKEN:
ToastUtils.showShortToast(this.mContext, object.getMsg());
break;
}
}
@Override
public void onServerError(NewHYTask task, int failedType) {
onResultShow(failedType);
}
@Override
public void initViews() {
this.titleview = (TitleView) findViewById(R.id.titleview);
this.recycleView = (RecyclerView) findViewById(R.id.rl_list_show);
this.recycleViewFile = (RecyclerView) findViewById(R.id.fujian);
this.banlichengxu = (WebView) findViewById(R.id.wv_banlichegnxu);
this.scroll = (ScrollView) findViewById(R.id.sl_content_show);
this.ll_shenqingbiaoge_content = (LinearLayout) findViewById(R.id.ll_shenqingbiaoge_content);
this.titleview.setOnTitleClik(new TitleView.BackListenner() {
@Override
public void BackSet() {
if (RehabilitationGuidActivity.this.nowType.length() != 0) {
RehabilitationGuidActivity.this.titleview.setTextName("办事指南");
RehabilitationGuidActivity.this.recycleView.setVisibility(0);
RehabilitationGuidActivity.this.scroll.setVisibility(8);
RehabilitationGuidActivity.this.nowType = "";
return;
}
RehabilitationGuidActivity.this.finish();
}
}, null);
LinearLayoutManager manager = new LinearLayoutManager(this);
LinearLayoutManager manager2 = new LinearLayoutManager(this);
this.recycleView.setLayoutManager(manager);
this.recycleViewFile.setLayoutManager(manager2);
this.dataList = new ArrayList();
this.fileList = new ArrayList();
this.photoList = new ArrayList<>();
this.adapter = new CommonAdapter<WorkGuideBean>(this.mContext, R.layout.item_list_text_view2, this.dataList) {
@Override
public void convert(ViewHolder holder, WorkGuideBean workGuideBean, int position) {
holder.setText(2131689891, workGuideBean.serviceProject);
}
};
this.recycleView.setAdapter(this.adapter);
this.adapterFile = new CommonAdapter<FuJianBean>(this.mContext, 2130968718, this.fileList) {
@Override
public void convert(ViewHolder holder, FuJianBean fuJianBean, int position) {
holder.setText(2131689891, fuJianBean.fileName);
holder.setTextColor(2131689891, 2131624067);
}
};
this.recycleViewFile.setAdapter(this.adapterFile);
}
@Override
public void setListener() {
this.adapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) {
RehabilitationGuidActivity.this.nowType = ((WorkGuideBean) RehabilitationGuidActivity.this.dataList.get(position)).serviceProject;
RehabilitationGuidActivity.this.titleview.setTextName(((WorkGuideBean) RehabilitationGuidActivity.this.dataList.get(position)).serviceProject);
RehabilitationGuidActivity.this.recycleView.setVisibility(8);
RehabilitationGuidActivity.this.scroll.setVisibility(0);
RehabilitationGuidActivity.this.initFormData((WorkGuideBean) RehabilitationGuidActivity.this.dataList.get(position));
RehabilitationGuidActivity.this.getFileList(((WorkGuideBean) RehabilitationGuidActivity.this.dataList.get(position)).style, ((WorkGuideBean) RehabilitationGuidActivity.this.dataList.get(position)).id);
}
@Override
public boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position) {
return false;
}
});
this.adapterFile.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) {
if (((FuJianBean) RehabilitationGuidActivity.this.fileList.get(position)).fileExt == null || !NewHYConfig.photoStyle.contains(((FuJianBean) RehabilitationGuidActivity.this.fileList.get(position)).fileExt)) {
if (((FuJianBean) RehabilitationGuidActivity.this.fileList.get(position)).fileExt != null && NewHYConfig.fileStyle.contains(((FuJianBean) RehabilitationGuidActivity.this.fileList.get(position)).fileExt)) {
FileDownloadUtil fileDownload = new FileDownloadUtil(RehabilitationGuidActivity.this.mContext);
fileDownload.startDownLoadFile(NewHYConfig.ROOT + ((FuJianBean) RehabilitationGuidActivity.this.fileList.get(position)).filePath, ((FuJianBean) RehabilitationGuidActivity.this.fileList.get(position)).fileName);
return;
}
return;
}
int pageNo = -1;
RehabilitationGuidActivity.this.photoList.clear();
((FuJianBean) RehabilitationGuidActivity.this.fileList.get(position)).checked = true;
for (int i = 0; i < RehabilitationGuidActivity.this.fileList.size(); i++) {
FuJianBean fuJianBean = (FuJianBean) RehabilitationGuidActivity.this.fileList.get(i);
if (fuJianBean.fileExt != null && NewHYConfig.photoStyle.contains(fuJianBean.fileExt)) {
RehabilitationGuidActivity.this.photoList.add(new AvatarBean(NewHYConfig.ROOT + fuJianBean.filePath));
}
if (fuJianBean.checked) {
pageNo = i;
}
}
Intent intent = new Intent(RehabilitationGuidActivity.this.mContext, (Class<?>) ShowLargerPhotoActivity.class);
intent.putExtra("photos", RehabilitationGuidActivity.this.photoList);
if (pageNo != -1) {
intent.putExtra("position", pageNo);
RehabilitationGuidActivity.this.startActivity(intent);
}
((FuJianBean) RehabilitationGuidActivity.this.fileList.get(position)).checked = false;
}
@Override
public boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position) {
return false;
}
});
findViewById(R.id.ll_butiebaiozhun).setOnClickListener(this);
findViewById(R.id.ll_shenqingcailiao).setOnClickListener(this);
findViewById(R.id.ll_banlichegnxu).setOnClickListener(this);
findViewById(R.id.ll_shenbaobiaoge).setOnClickListener(this);
findViewById(R.id.tv_tousu_phone).setOnClickListener(this);
findViewById(R.id.tv_zixun_phone).setOnClickListener(this);
findViewById(R.id.tv_work_address).setOnClickListener(this);
this.banlichengxu.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent ev) {
((WebView) v).requestDisallowInterceptTouchEvent(true);
return false;
}
});
}
public void getPolicyList(int pageNo, int pageSize) {
MyApplication.getInstance().getUserInfo();
HashMap<String, String> params = new HashMap<>();
params.put("pageNo", pageNo + "");
params.put("pageSize", pageSize + "");
params.put("areaCode", "3700");
CommonDataListTask<WorkGuideBean> policyListTask = new CommonDataListTask<>(RequestServiceList.BANSHI_GUID, params, WorkGuideBean.class);
executeRequest(policyListTask);
}
public void getFileList(String style, String id) {
HashMap<String, String> params = new HashMap<>();
params.put("style", style);
params.put("relationId", id);
CommonTask fileSeeTask = new CommonTask(RequestServiceList.ATTACHMENT_CALLBACK_CALLBACKNOTOKEN, params);
executeRequest(fileSeeTask);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_work_address:
String string = ((TextView) findViewById(R.id.tv_work_address)).getText().toString();
if (isNull(string)) {
ToastUtils.showShortToast(this.mContext, "未获取到地址信息");
break;
}
break;
case R.id.tv_zixun_phone:
String number1 = ((TextView) findViewById(R.id.tv_zixun_phone)).getText().toString().trim();
if (isNull(number1)) {
ToastUtils.showShortToast(this.mContext, "未获取到联系方式");
break;
} else {
Intent intent1 = new Intent("android.intent.action.DIAL", Uri.parse("tel:" + number1));
intent1.setFlags(268435456);
startActivity(intent1);
break;
}
case R.id.tv_tousu_phone:
String number = ((TextView) findViewById(R.id.tv_tousu_phone)).getText().toString().trim();
if (isNull(number)) {
ToastUtils.showShortToast(this.mContext, "未获取到联系方式");
break;
} else {
Intent intent = new Intent("android.intent.action.DIAL", Uri.parse("tel:" + number));
intent.setFlags(268435456);
startActivity(intent);
break;
}
case R.id.ll_butiebaiozhun:
LinearLayout ll_butiebiaozhun_content = (LinearLayout) findViewById(R.id.ll_butiebiaozhun_content);
if (ll_butiebiaozhun_content.getVisibility() == 0) {
ll_butiebiaozhun_content.setVisibility(8);
((ImageView) findViewById(R.id.iv_butie)).setImageResource(R.drawable.right_btn);
break;
} else {
ll_butiebiaozhun_content.setVisibility(0);
((ImageView) findViewById(R.id.iv_butie)).setImageResource(R.drawable.down_btn);
break;
}
case R.id.ll_shenqingcailiao:
LinearLayout ll_shenqingcailiao_content = (LinearLayout) findViewById(R.id.ll_shenqingcailiao_content);
if (ll_shenqingcailiao_content.getVisibility() == 0) {
ll_shenqingcailiao_content.setVisibility(8);
((ImageView) findViewById(R.id.iv_shenqing)).setImageResource(R.drawable.right_btn);
break;
} else {
ll_shenqingcailiao_content.setVisibility(0);
((ImageView) findViewById(R.id.iv_shenqing)).setImageResource(R.drawable.down_btn);
break;
}
case R.id.ll_banlichegnxu:
LinearLayout ll_banlichengxu_content = (LinearLayout) findViewById(R.id.ll_banlichengxu_content);
if (ll_banlichengxu_content.getVisibility() == 0) {
ll_banlichengxu_content.setVisibility(8);
((ImageView) findViewById(R.id.iv_banli)).setImageResource(R.drawable.right_btn);
break;
} else {
ll_banlichengxu_content.setVisibility(0);
((ImageView) findViewById(R.id.iv_banli)).setImageResource(R.drawable.down_btn);
break;
}
case R.id.ll_shenbaobiaoge:
if (this.ll_shenqingbiaoge_content.getVisibility() == 0) {
this.ll_shenqingbiaoge_content.setVisibility(8);
((ImageView) findViewById(R.id.iv_biaoge)).setImageResource(R.drawable.right_btn);
break;
} else {
this.ll_shenqingbiaoge_content.setVisibility(0);
((ImageView) findViewById(R.id.iv_biaoge)).setImageResource(R.drawable.down_btn);
break;
}
}
}
public void initFormData(WorkGuideBean bean) {
this.workGuideBean = bean;
setTextInfo(R.id.tv_dept, bean.acceptDep);
setTextInfo(R.id.tv_work_address, bean.handleAddress);
setTextInfo(R.id.tv_handle_time, bean.acceptTime);
setTextInfo(R.id.tv_zixun_phone, bean.consultingTel);
setTextInfo(R.id.tv_tousu_phone, bean.complaintTel);
setTextInfo(R.id.tv_policy_depend, bean.policydepend);
setTextInfo(R.id.tv_butie_duixiang, bean.supportObj);
setTextInfo(R.id.tv_guanlifafang, bean.manageSend);
setTextInfo(R.id.tv_butiebiaozhun, bean.supportStandard);
setTextInfo(R.id.tv_shenqingcailiao, bean.applicationMaterials);
setTextInfo(R.id.tv_jiuzhutiaojian, bean.rescueConditions);
if (bean.handleProcess != null) {
this.banlichengxu.loadDataWithBaseURL(null, "<html><meta charset=\"UTF-8\"><head><style>p div{margin:0px;padding:0px} body{background:#ffffff;margin:0px;padding:0px;} .header{background:#ffffff;padding-top:10px} .content{background:#ffffff;text-indent:0px;padding:5px;}</style></head><body><div style='font-size:14px' class='content'>###content###</div></body></html>".replace("###content###", bean.handleProcess), "text/html", Key.STRING_CHARSET_NAME, null);
}
setTextInfo(R.id.tv_biaoge, bean.fujian);
}
public void setTextInfo(int id, String str) {
((TextView) findViewById(id)).setText(str);
}
@Override
public void onBackPressed() {
this.titleview.performClickBack();
}
}