正在查看: 爱心e站 v1.0.0 应用的 ActivityPolicyAdmin.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 爱心e站 v1.0.0 应用的 ActivityPolicyAdmin.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.newheyd.JZKFcanjiren.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.igexin.assist.sdk.AssistPushConsts;
import com.newheyd.JZKFcanjiren.Adapter.PolicyAdapter;
import com.newheyd.JZKFcanjiren.BaseActivity;
import com.newheyd.JZKFcanjiren.Bean.PolicyInfoBean;
import com.newheyd.JZKFcanjiren.Bean.UserInfo;
import com.newheyd.JZKFcanjiren.MyApplication;
import com.newheyd.JZKFcanjiren.R;
import com.newheyd.JZKFcanjiren.Utils.KeyBoardUtil;
import com.newheyd.JZKFcanjiren.Utils.StastisticUtil;
import com.newheyd.JZKFcanjiren.Utils.TextUtil;
import com.newheyd.JZKFcanjiren.Utils.ToastUtils;
import com.newheyd.JZKFcanjiren.Utils.locationUtil.LocationAddrUtil;
import com.newheyd.JZKFcanjiren.View.Dialog.MyDialog;
import com.newheyd.JZKFcanjiren.View.TitleView;
import com.newheyd.JZKFcanjiren.View.refresh.BaseRefreshLoadmoreLayout;
import com.newheyd.JZKFcanjiren.View.refresh.RefreshLoadmoreLayout;
import com.newheyd.JZKFcanjiren.config.NewHYConfig;
import com.newheyd.JZKFcanjiren.model.BaseResult;
import com.newheyd.JZKFcanjiren.model.DataParser;
import com.newheyd.JZKFcanjiren.net.NewHYTask;
import com.newheyd.JZKFcanjiren.net.PolicyListTask;
import com.newheyd.JZKFcanjiren.net.RequestServiceList;
import com.tencent.connect.common.Constants;
import java.util.ArrayList;
import java.util.HashMap;
public class ActivityPolicyAdmin extends BaseActivity implements View.OnClickListener {
private LinearLayout mNextLy;
private ListView mPersonList;
private LinearLayout mPreviousLy;
private TextView mTvPageindext;
private TitleView titleView;
private ArrayList<PolicyInfoBean> data = new ArrayList<>();
private PolicyAdapter policyAdapter = null;
private String workType = "";
private int pageNo = 1;
private int pageSize = 13;
private int totalItem = 0;
private int totalPage = 0;
private RefreshLoadmoreLayout layout = null;
private boolean IS_REFRESHING = true;
private boolean IS_LOADING = false;
private boolean IS_PAGE_TURNING = false;
private LinearLayout llBottomLayout = null;
private HashMap<String, String> paramsSearch = new HashMap<>();
private String keytype = "1";
private UserInfo userInfo = null;
static int access$008(ActivityPolicyAdmin x0) {
int i = x0.pageNo;
x0.pageNo = i + 1;
return i;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
setContentView(R.layout.activity_policy_admin);
super.onCreate(savedInstanceState);
this.userInfo = MyApplication.getInstance().getUserInfo();
String[] queries = getIntent().getStringArrayExtra("query");
if (queries != null && queries[0] != null) {
this.paramsSearch.put("title", queries[0]);
this.pageNo = 1;
requestDataList(this.pageNo, this.pageSize);
} else {
requestDataList(this.pageNo, this.pageSize);
}
goStatistics();
}
public void goStatistics() {
HashMap<String, String> map = LocationAddrUtil.getInstance().getLocationParam(this.mContext);
StastisticUtil.getInstance().onEvent(this.mContext, "ActivityPolicyAdmin", map);
}
@Override
public void onResponseBefore(NewHYTask task) {
switch (task.getService()) {
case SERACHPOLICY:
showProgress(NewHYConfig.LOADING_HINT, false);
break;
}
}
@Override
public void onResponseAfter(NewHYTask task) {
switch (task.getService()) {
case SERACHPOLICY:
cancleProgress();
break;
}
}
@Override
public void onResponseSuccessful(NewHYTask task, BaseResult object) {
switch (task.getService()) {
case SERACHPOLICY:
String p = this.mContext.getResources().getString(R.string.p);
TextView textView = this.mTvPageindext;
Object[] objArr = new Object[2];
objArr[0] = Integer.valueOf(this.pageNo);
objArr[1] = Integer.valueOf(this.totalPage == 0 ? 1 : this.totalPage);
textView.setText(String.format(p, objArr));
DataParser<PolicyInfoBean> mResult = (DataParser) object;
ArrayList<PolicyInfoBean> lists = mResult.getObjects();
this.totalItem = mResult.getCount();
getTotalPage();
showPage();
if (this.IS_REFRESHING || this.IS_PAGE_TURNING) {
this.layout.refreshSuccess();
this.data.clear();
this.IS_REFRESHING = false;
this.IS_PAGE_TURNING = false;
if (this.pageNo == (this.totalPage == 0 ? 1 : this.totalPage)) {
this.layout.setLoadmoreable(false);
} else {
this.layout.setLoadmoreable(true);
}
} else if (this.IS_LOADING) {
this.layout.loadmoreSuccess();
this.IS_LOADING = false;
if (this.pageNo < (this.totalPage == 0 ? 1 : this.totalPage)) {
this.layout.setLoadmoreable(true);
} else {
this.layout.setLoadmoreable(false);
}
}
if (lists != null) {
this.data.addAll(lists);
}
freshData();
break;
case ADAPTATIONPOLICYLIST:
DataParser<PolicyInfoBean> mPolicyResult = (DataParser) object;
this.data.clear();
this.data.addAll(mPolicyResult.getObjects());
freshData();
break;
}
}
@Override
public void onResponseError(NewHYTask task, BaseResult object) {
switch (task.getService()) {
case SERACHPOLICY:
ToastUtils.showShortToast(this.mContext, object.getMsg());
if (this.pageNo == 1) {
this.layout.refreshFailed();
break;
} else {
this.layout.loadmoreFailed();
break;
}
}
}
@Override
public void onServerError(NewHYTask task, int failedType) {
switch (task.getService()) {
case SERACHPOLICY:
onResultShow(failedType);
if (this.pageNo == 1) {
this.layout.refreshFailed();
break;
} else {
this.layout.loadmoreFailed();
break;
}
}
}
public void freshData() {
if (this.policyAdapter == null) {
this.policyAdapter = new PolicyAdapter(this.mContext, this.data, R.layout.item_policy);
this.mPersonList.setAdapter((ListAdapter) this.policyAdapter);
this.policyAdapter.setKeytype(this.keytype);
} else {
this.policyAdapter.setmData(this.data);
this.policyAdapter.notifyDataSetChanged();
}
}
public void query(String params) {
ToastUtils.showLongToast(this.mContext, params);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == -1) {
super.onActivityResult(requestCode, resultCode, data);
}
}
@Override
public void initViews() {
this.titleView = (TitleView) findViewById(R.id.titleview_service);
this.mPersonList = (ListView) findViewById(R.id.person_list);
this.mPreviousLy = (LinearLayout) findViewById(R.id.previous_ly);
this.mTvPageindext = (TextView) findViewById(R.id.tv_pageindext);
this.mNextLy = (LinearLayout) findViewById(R.id.next_ly);
this.layout = (RefreshLoadmoreLayout) findViewById(R.id.layout);
this.llBottomLayout = (LinearLayout) findViewById(R.id.ll_bottom);
this.llBottomLayout.setVisibility(8);
}
@Override
public void getExtraParam() {
this.keytype = getIntent().getStringExtra(Constants.PARAM_KEY_TYPE);
if ("1".equals(this.keytype)) {
this.titleView.setTextName("政策法规列表");
} else if ("2".equals(this.keytype)) {
this.titleView.setTextName("适配政策列表");
}
}
@Override
public void setListener() {
this.titleView.setOnTitleClik(null, null);
this.mPreviousLy.setOnClickListener(this);
this.mTvPageindext.setOnClickListener(this);
this.mNextLy.setOnClickListener(this);
this.layout.setOnStartListener(new BaseRefreshLoadmoreLayout.OnStartListener() {
@Override
public void onStartRefresh(BaseRefreshLoadmoreLayout v) {
ActivityPolicyAdmin.this.pageNo = 1;
ActivityPolicyAdmin.this.IS_REFRESHING = true;
ActivityPolicyAdmin.this.requestDataList(ActivityPolicyAdmin.this.pageNo, ActivityPolicyAdmin.this.pageSize);
}
@Override
public void onStartLoadmore(BaseRefreshLoadmoreLayout v) {
ActivityPolicyAdmin.access$008(ActivityPolicyAdmin.this);
ActivityPolicyAdmin.this.IS_LOADING = true;
ActivityPolicyAdmin.this.requestDataList(ActivityPolicyAdmin.this.pageNo, ActivityPolicyAdmin.this.pageSize);
}
});
if ("1".equals(this.keytype)) {
this.layout.setRefreshable(true);
this.layout.setLoadmoreable(true);
} else if ("2".equals(this.keytype)) {
this.layout.setRefreshable(false);
this.layout.setLoadmoreable(false);
}
}
public void showPage() {
String p = this.mContext.getResources().getString(R.string.p);
TextView textView = this.mTvPageindext;
Object[] objArr = new Object[2];
objArr[0] = Integer.valueOf(this.pageNo);
objArr[1] = Integer.valueOf(this.totalPage == 0 ? 1 : this.totalPage);
textView.setText(String.format(p, objArr));
}
public void getTotalPage() {
this.totalPage = this.totalItem / 20;
if (this.totalItem % 20 != 0) {
this.totalPage++;
}
}
@Override
public void onClick(View v) {
int i;
int i2;
switch (v.getId()) {
case R.id.previous_ly:
if (1 == this.pageNo) {
ToastUtils.showShortToast(this.mContext, "当前已是第一页");
break;
} else {
this.IS_PAGE_TURNING = true;
if (this.pageNo > 1) {
i2 = this.pageNo - 1;
this.pageNo = i2;
} else {
i2 = this.pageNo;
}
this.pageNo = i2;
showPage();
requestDataList(this.pageNo, this.pageSize);
break;
}
case R.id.tv_pageindext:
MyDialog myDialog = new MyDialog(this.mContext, R.layout.item_jump_page, "提示", "确定", "取消", true);
myDialog.setOnDiaLogListener(new MyDialog.OnDialogListenerPN() {
@Override
public void dialogPositiveListener(View customView, DialogInterface dialogInterface, int which) {
EditText viewById = (EditText) customView.findViewById(R.id.et_jumpto);
String string = viewById.getText().toString();
if (string.length() > 0 && string.length() < 8) {
viewById.clearFocus();
KeyBoardUtil.hideKeyBoard(ActivityPolicyAdmin.this.mContext);
if (Integer.valueOf(string).intValue() <= (ActivityPolicyAdmin.this.totalPage == 0 ? 1 : ActivityPolicyAdmin.this.totalPage) && Integer.valueOf(string).intValue() > 0) {
ActivityPolicyAdmin.this.pageNo = Integer.valueOf(string).intValue();
ActivityPolicyAdmin.this.IS_PAGE_TURNING = true;
ActivityPolicyAdmin.this.requestDataList(ActivityPolicyAdmin.this.pageNo, ActivityPolicyAdmin.this.pageSize);
dialogInterface.dismiss();
return;
}
ToastUtils.showShortToast(ActivityPolicyAdmin.this.mContext, "您输入页码超出范围");
}
}
@Override
public void dialogNegativeListener(View customView, DialogInterface dialogInterface, int which) {
EditText viewById = (EditText) customView.findViewById(R.id.et_jumpto);
viewById.clearFocus();
KeyBoardUtil.hideKeyBoard(ActivityPolicyAdmin.this.mContext);
dialogInterface.dismiss();
}
});
myDialog.showDialog();
break;
case R.id.next_ly:
if (this.pageNo == this.totalPage || this.totalPage == 0) {
ChoiceTishiDialog("没有更多数据了,您是否要查看首页数据?", false, new BaseActivity.OnChoiceDialogYes() {
@Override
public void onChoiceDialogYes(DialogInterface dialogInterface, int i3) {
ActivityPolicyAdmin.this.pageNo = 1;
ActivityPolicyAdmin.this.IS_PAGE_TURNING = true;
ActivityPolicyAdmin.this.requestDataList(ActivityPolicyAdmin.this.pageNo, ActivityPolicyAdmin.this.pageSize);
}
}, new BaseActivity.OnChoiceDialogNo() {
@Override
public void onChoiceDialogNo(DialogInterface dialogInterface, int i3) {
dialogInterface.cancel();
}
});
break;
} else {
this.IS_PAGE_TURNING = true;
if (this.pageNo < this.totalPage) {
i = this.pageNo + 1;
this.pageNo = i;
} else {
i = this.pageNo;
}
this.pageNo = i;
showPage();
requestDataList(this.pageNo, this.pageSize);
break;
}
break;
}
}
public void query(HashMap<String, String> params) {
this.paramsSearch = params;
this.pageNo = 1;
this.IS_REFRESHING = true;
requestDataList(this.pageNo, this.pageSize);
}
public void requestDataList(int pageNo, int pageSize) {
UserInfo userInfo = MyApplication.getInstance().getUserInfo();
String code = "3700";
if (userInfo != null) {
code = userInfo.getJiedaoCode();
if (!TextUtil.isEmpty(code) && code.length() > 4) {
code = code.substring(0, 4);
}
}
HashMap<String, String> params = new HashMap<>();
params.put("areaCode", code);
params.put("pageSize", String.valueOf(20));
params.put("pageNo", String.valueOf(pageNo));
RequestServiceList method = null;
if ("1".equals(this.keytype)) {
method = RequestServiceList.SERACHPOLICY;
} else if ("2".equals(this.keytype)) {
method = RequestServiceList.ADAPTATIONPOLICYLIST;
params.put(AssistPushConsts.MSG_TYPE_TOKEN, userInfo == null ? "" : userInfo.getToken());
}
this.paramsSearch.putAll(params);
NewHYTask task = new PolicyListTask(method, this.paramsSearch);
executeRequest(task);
}
}