导航菜单

页面标题

页面副标题

爱心e站 v1.0.0 - MechanismSearchActivity.java 源代码

正在查看: 爱心e站 v1.0.0 应用的 MechanismSearchActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.newheyd.JZKFcanjiren.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.iflytek.cloud.SpeechConstant;
import com.newheyd.JZKFcanjiren.BaseActivity;
import com.newheyd.JZKFcanjiren.R;
import com.newheyd.JZKFcanjiren.Utils.StastisticUtil;
import com.newheyd.JZKFcanjiren.Utils.locationUtil.LocationAddrUtil;
import com.newheyd.JZKFcanjiren.View.Dialog.MyDialog;
import com.newheyd.JZKFcanjiren.View.TitleView;
import com.newheyd.JZKFcanjiren.model.BaseResult;
import com.newheyd.JZKFcanjiren.net.NewHYTask;
import java.util.HashMap;
import org.json.JSONException;
import org.json.JSONObject;

public class MechanismSearchActivity extends BaseActivity implements View.OnClickListener {
    public static final int REQUEST_SEARCH = 1;
    private EditText mEtKeyword;
    private TextView mQuery;
    private TextView mReset;
    private TitleView mTitleview;
    private TextView mTvArea;
    private TextView mTvLevel;
    private TextView mTvType;
    private String[] mType = {"康复服务机构", "康复评估机构", "康复评估服务机构"};
    private String[] mTypeFlag = {"1", "2", "3"};
    private String[] mLevel = {"省级", "地市级", "县级"};
    private String[] mLevelFlag = {"1", "2", "3"};
    private String areaCode = "3700";
    private String areaName = "山东省";
    private String orgType = "";
    private String orgLevel = "";
    private String keyword = "";
    private HashMap<String, String> params = new HashMap<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_org_search);
        super.onCreate(savedInstanceState);
        goStatistics();
    }

    public void goStatistics() {
        HashMap<String, String> map = LocationAddrUtil.getInstance().getLocationParam(this.mContext);
        StastisticUtil.getInstance().onEvent(this.mContext, "MechanismSearchActivity", map);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (-1 == resultCode) {
            switch (requestCode) {
                case 1:
                    this.areaCode = (String) data.getSerializableExtra("areaCode");
                    this.areaName = (String) data.getSerializableExtra("areaName");
                    this.mTvArea.setText(this.areaName);
                    break;
            }
        }
    }

    @Override
    public void onResponseBefore(NewHYTask task) {
    }

    @Override
    public void onResponseAfter(NewHYTask task) {
    }

    @Override
    public void onResponseSuccessful(NewHYTask task, BaseResult object) {
    }

    @Override
    public void onResponseError(NewHYTask task, BaseResult object) {
    }

    @Override
    public void onServerError(NewHYTask task, int failedType) {
    }

    @Override
    public void initViews() {
        this.mTitleview = (TitleView) findViewById(R.id.titleview);
        this.mTvArea = (TextView) findViewById(R.id.tv_area);
        this.mTvType = (TextView) findViewById(R.id.tv_type);
        this.mTvLevel = (TextView) findViewById(R.id.tv_level);
        this.mEtKeyword = (EditText) findViewById(R.id.et_keyword);
        this.mReset = (TextView) findViewById(R.id.reset);
        this.mQuery = (TextView) findViewById(R.id.query);
    }

    @Override
    public void setListener() {
        this.mTvArea.setOnClickListener(this);
        this.mTvType.setOnClickListener(this);
        this.mTvLevel.setOnClickListener(this);
        this.mReset.setOnClickListener(this);
        this.mQuery.setOnClickListener(this);
        this.mTitleview.setOnTitleClik(new TitleView.BackListenner() {
            @Override
            public void BackSet() {
                MechanismSearchActivity.this.finish();
            }
        }, null);
    }

    public void goSearch() {
        Intent intent = new Intent();
        if (!isNull(this.areaCode)) {
            JSONObject jsonObjectCode = new JSONObject();
            try {
                jsonObjectCode.put("code", this.areaCode);
                this.params.put("orgOffice", jsonObjectCode.toString());
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
        this.keyword = this.mEtKeyword.getText().toString();
        this.params.put("orgType", this.orgType);
        this.params.put("orgLevel", this.orgLevel);
        this.params.put("orgName", this.keyword);
        intent.putExtra(SpeechConstant.PARAMS, this.params);
        setResult(-1, intent);
        finish();
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tv_type:
                MyDialog myDialog = new MyDialog(this.mContext, this.mType, "机构类型", "取消", false);
                myDialog.setOnDiaLogListener(new MyDialog.OnDialogListenerD() {
                    @Override
                    public void dialogDanxuanListener(View customView, String select, int which) {
                        MechanismSearchActivity.this.mTvType.setText(MechanismSearchActivity.this.mType[which]);
                        MechanismSearchActivity.this.orgType = MechanismSearchActivity.this.mTypeFlag[which];
                    }
                }, null);
                myDialog.showDialog();
                break;
            case R.id.tv_level:
                MyDialog myDialog2 = new MyDialog(this.mContext, this.mLevel, "机构级别", "取消", false);
                myDialog2.setOnDiaLogListener(new MyDialog.OnDialogListenerD() {
                    @Override
                    public void dialogDanxuanListener(View customView, String select, int which) {
                        MechanismSearchActivity.this.mTvLevel.setText(MechanismSearchActivity.this.mLevel[which]);
                        MechanismSearchActivity.this.orgLevel = MechanismSearchActivity.this.mLevelFlag[which];
                    }
                }, null);
                myDialog2.showDialog();
                break;
            case R.id.tv_area:
                Intent intent = new Intent(this.mContext, (Class<?>) AreaSelectActivity.class);
                startActivityForResult(intent, 1);
                break;
            case R.id.reset:
                this.areaName = "";
                this.areaCode = "";
                this.orgType = "";
                this.orgLevel = "";
                this.keyword = "";
                this.mTvArea.setText("");
                this.mTvType.setText("");
                this.mTvLevel.setText("");
                this.mEtKeyword.setText("");
                this.params.clear();
                break;
            case R.id.query:
                goSearch();
                break;
        }
    }
}