导航菜单

页面标题

页面副标题

六分钟步行测试管理软件 v1.1.0.2112120029 - RespSettingActivity.java 源代码

正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 RespSettingActivity.java JAVA 源代码文件

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


package cn.neoprint.padmonitor.ui;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.inputmethodservice.KeyboardView;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
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.Switch;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.view.MotionEventCompat;
import cn.neoprint.padmonitor.R;
import cn.neoprint.padmonitor.app.AppGlobal;
import cn.neoprint.padmonitor.utils.FontManager;
import cn.neoprint.padmonitor.utils.constant.ConstDefine;
import cn.neoprint.padmonitor.utils.constant.GzjSharePref;
import cn.neoprint.padmonitor.utils.keyboard.KeyboardUtil;
import cn.neoprint.padmonitor.utils.keyboard.KeyboardUtilInterface;
import java.lang.reflect.Method;

public class RespSettingActivity extends Activity implements View.OnClickListener, KeyboardUtilInterface {
    private TextView RespAlarmHigh;
    private LinearLayout RespAlarmItem;
    private TextView RespAlarmLow;
    private TextView RespAlarmMid;
    private LinearLayout ZhixiAlarmItem;
    public SharedPreferences gzj;
    private ImageView ima_top;
    private KeyboardView keyboard;
    private KeyboardUtil keyboardUtil;
    private RelativeLayout.LayoutParams layoutParams;
    private int m_respAlarmHigh;
    private int m_respAlarmLow;
    private int m_respalarmlevel;
    private boolean m_respalarmswitch;
    public int m_tempZhixialarm;
    private int m_temprespgain;
    private int m_zhixialarm;
    private RelativeLayout relativeLayout;
    private EditText respAlarmHigh;
    private EditText respAlarmLow;
    private TextView resp_cancle;
    private TextView resp_default;
    private TextView resp_goback;
    public TextView respalarmlevel;
    private Switch respalarmswitch;
    private int respgain;
    private RadioButton respgain_1;
    private RadioButton respgain_2;
    private RadioButton respgain_3;
    private RadioButton respgain_4;
    private RadioButton respgain_5;
    private RadioGroup respgain_rgp;
    private int respspeed;
    private RadioButton respspeed1;
    private RadioButton respspeed2;
    private RadioButton respspeed3;
    private RadioGroup respspeed_rgp;
    private TextView zhixiAlarm10;
    private TextView zhixiAlarm20;
    private TextView zhixiAlarm30;
    private TextView zhixiAlarm40;
    public TextView zhixialarm;
    private TextView zhixinotAlarm;
    private boolean m_respAlarmItemshow = false;
    private boolean m_ZhixiAlarmItemshow = false;
    AppGlobal myApp = null;

    @Override
    public void initLeftKeyboard(EditText editText) {
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.gzj = getSharedPreferences("gzj", 0);
        setTitleColor(-16777216);
        requestWindowFeature(1);
        AppGlobal appGlobal = (AppGlobal) getApplication();
        this.myApp = appGlobal;
        appGlobal.setSystemBarVisible(this, false);
        setContentView(R.layout.respsetting);
        this.myApp.SetBackgroundLight(this, -255, 52, false);
        setFinishOnTouchOutside(false);
        InitRespSetting();
        FontManager.changeFonts((ViewGroup) getWindow().getDecorView(), this, Typeface.createFromAsset(getAssets(), "fonts/MSBlack.ttf"));
    }

    @Override
    public void finish() {
        super.finish();
        overridePendingTransition(0, R.anim.zoomout);
    }

    public void showMessage(int i) {
        View inflate = getLayoutInflater().inflate(R.layout.mytoast, (ViewGroup) null);
        Toast toast = new Toast(this);
        toast.setView(inflate);
        toast.setGravity(17, -150, 0);
        ((TextView) inflate.findViewById(R.id.toastInfo)).setText(i);
        toast.show();
    }

    public void InitRespSetting() {
        this.respspeed_rgp = (RadioGroup) findViewById(R.id.respspeed_rgp);
        this.respspeed1 = (RadioButton) findViewById(R.id.respspeed_1);
        this.respspeed2 = (RadioButton) findViewById(R.id.respspeed_2);
        this.respspeed3 = (RadioButton) findViewById(R.id.respspeed_3);
        int i = this.gzj.getInt("respspeed", 0);
        this.respspeed = i;
        if (i == 0) {
            this.respspeed1.setChecked(true);
        } else if (i == 1) {
            this.respspeed2.setChecked(true);
        } else if (i == 2) {
            this.respspeed3.setChecked(true);
        }
        this.respspeed_rgp.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i2) {
                switch (i2) {
                    case R.id.respspeed_1:
                        RespSettingActivity.this.respspeed = 0;
                        break;
                    case R.id.respspeed_2:
                        RespSettingActivity.this.respspeed = 1;
                        break;
                    case R.id.respspeed_3:
                        RespSettingActivity.this.respspeed = 2;
                        break;
                }
            }
        });
        this.respgain_rgp = (RadioGroup) findViewById(R.id.respgain_rgp);
        this.respgain_1 = (RadioButton) findViewById(R.id.respgain_1);
        this.respgain_2 = (RadioButton) findViewById(R.id.respgain_2);
        this.respgain_3 = (RadioButton) findViewById(R.id.respgain_3);
        this.respgain_4 = (RadioButton) findViewById(R.id.respgain_4);
        this.respgain_5 = (RadioButton) findViewById(R.id.respgain_5);
        int i2 = this.gzj.getInt("respgain", 2);
        this.respgain = i2;
        this.m_temprespgain = i2;
        if (i2 == 0) {
            this.respgain_1.setChecked(true);
        } else if (i2 == 1) {
            this.respgain_2.setChecked(true);
        } else if (i2 == 2) {
            this.respgain_3.setChecked(true);
        } else if (i2 == 3) {
            this.respgain_4.setChecked(true);
        } else if (i2 == 4) {
            this.respgain_5.setChecked(true);
        }
        this.respgain_rgp.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i3) {
                switch (i3) {
                    case R.id.respgain_1:
                        RespSettingActivity.this.respgain = 0;
                        break;
                    case R.id.respgain_2:
                        RespSettingActivity.this.respgain = 1;
                        break;
                    case R.id.respgain_3:
                        RespSettingActivity.this.respgain = 2;
                        break;
                    case R.id.respgain_4:
                        RespSettingActivity.this.respgain = 3;
                        break;
                    case R.id.respgain_5:
                        RespSettingActivity.this.respgain = 4;
                        break;
                }
            }
        });
        this.respalarmswitch = (Switch) findViewById(R.id.respalarmswitch);
        boolean z = this.gzj.getBoolean("respalarmswitch", true);
        this.m_respalarmswitch = z;
        this.respalarmswitch.setChecked(z);
        this.respalarmswitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean z2) {
                if (RespSettingActivity.this.myApp.m_ALMPermission) {
                    RespSettingActivity.this.m_respalarmswitch = z2;
                } else {
                    RespSettingActivity.this.showMessage(R.string.AlarmTip);
                    RespSettingActivity.this.respalarmswitch.setChecked(RespSettingActivity.this.m_respalarmswitch);
                }
            }
        });
        this.m_respalarmlevel = this.gzj.getInt("respalarmlevel", 1);
        TextView textView = (TextView) findViewById(R.id.SpinnerRespAlarmLevel);
        this.respalarmlevel = textView;
        textView.setOnClickListener(this);
        SetAlarmLevelText(this.m_respalarmlevel);
        LinearLayout linearLayout = (LinearLayout) findViewById(R.id.SpinnerRespAlarmItem);
        this.RespAlarmItem = linearLayout;
        linearLayout.setVisibility(4);
        this.m_respAlarmItemshow = false;
        TextView textView2 = (TextView) findViewById(R.id.SpinnerRespHighAlarmItem);
        this.RespAlarmHigh = textView2;
        textView2.setOnClickListener(this);
        TextView textView3 = (TextView) findViewById(R.id.SpinnerRespMidAlarmItem);
        this.RespAlarmMid = textView3;
        textView3.setOnClickListener(this);
        TextView textView4 = (TextView) findViewById(R.id.SpinnerRespLowAlarmItem);
        this.RespAlarmLow = textView4;
        textView4.setOnClickListener(this);
        int i3 = this.gzj.getInt("zhixialarm", 20);
        this.m_zhixialarm = i3;
        this.m_tempZhixialarm = i3;
        TextView textView5 = (TextView) findViewById(R.id.SpinnerRespZhixi);
        this.zhixialarm = textView5;
        textView5.setOnClickListener(this);
        this.zhixialarm.setText(this.m_zhixialarm + "");
        LinearLayout linearLayout2 = (LinearLayout) findViewById(R.id.SpinnerZhixiAlarmItem);
        this.ZhixiAlarmItem = linearLayout2;
        linearLayout2.setVisibility(4);
        this.m_ZhixiAlarmItemshow = false;
        TextView textView6 = (TextView) findViewById(R.id.SpinnerZhixi10AlarmItem);
        this.zhixiAlarm10 = textView6;
        textView6.setOnClickListener(this);
        TextView textView7 = (TextView) findViewById(R.id.SpinnerZhixi20AlarmItem);
        this.zhixiAlarm20 = textView7;
        textView7.setOnClickListener(this);
        TextView textView8 = (TextView) findViewById(R.id.SpinnerZhixi30AlarmItem);
        this.zhixiAlarm30 = textView8;
        textView8.setOnClickListener(this);
        TextView textView9 = (TextView) findViewById(R.id.SpinnerZhixi40AlarmItem);
        this.zhixiAlarm40 = textView9;
        textView9.setOnClickListener(this);
        this.respAlarmHigh = (EditText) findViewById(R.id.resp_high);
        this.m_respAlarmHigh = this.gzj.getInt(GzjSharePref.KEY_RESP_ALARM_HIGH, 30);
        this.respAlarmHigh.setText("" + this.m_respAlarmHigh);
        this.respAlarmHigh.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                RespSettingActivity respSettingActivity = RespSettingActivity.this;
                respSettingActivity.initTopKeyboard(respSettingActivity.respAlarmHigh);
                RespSettingActivity.this.setlayoutParams(170, 250, 0, 0);
                return false;
            }
        });
        this.respAlarmLow = (EditText) findViewById(R.id.resp_low);
        this.m_respAlarmLow = this.gzj.getInt(GzjSharePref.KEY_RESP_ALARM_LOW, 8);
        this.respAlarmLow.setText("" + this.m_respAlarmLow);
        this.respAlarmLow.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                RespSettingActivity respSettingActivity = RespSettingActivity.this;
                respSettingActivity.initTopKeyboard(respSettingActivity.respAlarmLow);
                RespSettingActivity.this.setlayoutParams(460, 250, 0, 0);
                return false;
            }
        });
        shield();
        TextView textView10 = (TextView) findViewById(R.id.resp_goback);
        this.resp_goback = textView10;
        textView10.setOnClickListener(this);
        TextView textView11 = (TextView) findViewById(R.id.resp_default);
        this.resp_default = textView11;
        textView11.setOnClickListener(this);
        TextView textView12 = (TextView) findViewById(R.id.resp_cancle);
        this.resp_cancle = textView12;
        textView12.setOnClickListener(this);
    }

    public boolean SaveRespPara() {
        boolean z;
        String str = (this.respAlarmHigh.getText() == null || this.respAlarmHigh.getText().toString().equals("")) ? "" + getString(R.string.resp3) + " " : "";
        if (this.respAlarmLow.getText() == null || this.respAlarmLow.getText().toString().equals("")) {
            str = str + getString(R.string.resp4) + " ";
        }
        boolean z2 = false;
        if (!str.equals("")) {
            ShowAlertDialog(str, 0);
            return false;
        }
        int i = this.gzj.getInt("PatientType", 0);
        int parseInt = Integer.parseInt(this.respAlarmHigh.getText().toString());
        int parseInt2 = Integer.parseInt(this.respAlarmLow.getText().toString());
        String str2 = (i != 0 || (parseInt <= 120 && parseInt >= 7 && parseInt2 <= 120 && parseInt2 >= 7)) ? "" : " 7--120bpm";
        if (i == 1 && (parseInt > 150 || parseInt < 7 || parseInt2 > 350 || parseInt2 < 15)) {
            str2 = " 7--150bpm";
        }
        if (!str2.equals("")) {
            ShowAlertDialog(str2, 1);
            return false;
        }
        if (str2.equals("") && parseInt < parseInt2) {
            ShowAlertDialog(getString(R.string.RangeOfdataError), 1);
            return false;
        }
        this.myApp.OtherparaList.clear();
        SharedPreferences.Editor edit = this.gzj.edit();
        edit.putInt("respspeed", this.respspeed);
        if (this.respspeed != this.gzj.getInt("respspeed", 0)) {
            this.myApp.OtherparaList.add((byte) 20);
            if (this.respspeed == 0) {
                this.myApp.OtherparaList.add((byte) 19);
            }
            if (this.respspeed == 1) {
                this.myApp.OtherparaList.add((byte) 16);
            }
            if (this.respspeed == 2) {
                this.myApp.OtherparaList.add(Byte.valueOf(ConstDefine.msg_RemoteOffLine));
            }
            z = true;
        } else {
            z = false;
        }
        this.myApp.paraList.clear();
        int i2 = this.m_temprespgain;
        int i3 = this.respgain;
        if (i2 != i3) {
            edit.putInt("respgain", i3);
            this.myApp.paraList.add((byte) 8);
            this.myApp.paraList.add(Byte.valueOf((byte) this.respgain));
            this.myApp.OtherparaList.add((byte) 8);
            this.myApp.OtherparaList.add(Byte.valueOf((byte) this.respgain));
            z = true;
            z2 = true;
        }
        edit.putBoolean("respalarmswitch", this.m_respalarmswitch);
        if (this.m_respalarmswitch != this.gzj.getBoolean("respalarmswitch", true)) {
            this.myApp.OtherparaList.add((byte) 15);
            if (this.m_respalarmswitch) {
                this.myApp.OtherparaList.add((byte) 33);
            } else {
                this.myApp.OtherparaList.add((byte) 32);
            }
            z = true;
        }
        edit.putInt("respalarmlevel", this.m_respalarmlevel);
        if (this.m_respalarmlevel != this.gzj.getInt("respalarmlevel", 1)) {
            this.myApp.OtherparaList.add((byte) 13);
            this.myApp.OtherparaList.add(Byte.valueOf((byte) (this.m_respalarmlevel | 32)));
            z = true;
        }
        int i4 = this.m_tempZhixialarm;
        if (i4 != this.m_zhixialarm) {
            edit.putInt("zhixialarm", i4);
            this.myApp.paraList.add((byte) 9);
            this.myApp.paraList.add(Byte.valueOf((byte) this.m_tempZhixialarm));
            this.myApp.OtherparaList.add((byte) 9);
            this.myApp.OtherparaList.add(Byte.valueOf((byte) this.m_tempZhixialarm));
            z = true;
            z2 = true;
        }
        if (parseInt != this.m_respAlarmHigh || parseInt2 != this.m_respAlarmLow) {
            this.myApp.OtherparaList.add((byte) 14);
            this.myApp.OtherparaList.add((byte) 8);
            this.myApp.OtherparaList.add(Byte.valueOf((byte) (parseInt & 255)));
            this.myApp.OtherparaList.add(Byte.valueOf((byte) ((parseInt & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8)));
            this.myApp.OtherparaList.add(Byte.valueOf((byte) (parseInt2 & 255)));
            this.myApp.OtherparaList.add(Byte.valueOf((byte) ((parseInt2 & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8)));
            z = true;
        }
        edit.putInt(GzjSharePref.KEY_RESP_ALARM_HIGH, Integer.parseInt(this.respAlarmHigh.getText().toString()));
        edit.putInt(GzjSharePref.KEY_RESP_ALARM_LOW, Integer.parseInt(this.respAlarmLow.getText().toString()));
        edit.commit();
        Bundle bundle = new Bundle();
        bundle.putBoolean("bcgparaset", z2);
        bundle.putBoolean("netparaset", z);
        Intent intent = new Intent();
        intent.putExtras(bundle);
        setResult(10, intent);
        return true;
    }

    public void ResetRespParaExcu() {
        this.respspeed = 2;
        this.respspeed3.setChecked(true);
        this.respgain = 2;
        this.respgain_3.setChecked(true);
        this.m_respalarmswitch = true;
        this.respalarmswitch.setChecked(true);
        this.m_respalarmlevel = 1;
        SetAlarmLevelText(1);
        this.m_zhixialarm = 2;
        SetZhixiAlarmTime(2);
        this.respAlarmHigh.setText("30");
        this.respAlarmLow.setText("8");
        SaveRespPara();
        finish();
    }

    public void ShowAlertDialog(String str, int i) {
        String str2;
        View inflate = getLayoutInflater().inflate(R.layout.mytoast, (ViewGroup) null);
        Toast toast = new Toast(getApplicationContext());
        toast.setView(inflate);
        toast.setGravity(17, 0, 0);
        TextView textView = (TextView) inflate.findViewById(R.id.toastInfo);
        if (i == 0) {
            str2 = getString(R.string.dialog_04) + "   " + str + "!";
        } else {
            str2 = i == 1 ? getString(R.string.AlarmDataRangeError) + "   " + str + "!" : "";
        }
        textView.setText(str2);
        toast.show();
    }

    public void SetAlarmLevelText(int i) {
        if (i == 0) {
            this.respalarmlevel.setText(R.string.ECGalarmhigh);
            return;
        }
        if (i == 1) {
            this.respalarmlevel.setText(R.string.ECGalarmMid);
        } else if (i == 2) {
            this.respalarmlevel.setText(R.string.ECGalarmhlow);
        } else {
            this.respalarmlevel.setText(R.string.ECGalarmMid);
        }
    }

    public void SetNowZhixiAlarmTime(int i) {
        SetZhixiAlarmTime(i);
        this.ZhixiAlarmItem.setVisibility(4);
        this.m_ZhixiAlarmItemshow = false;
    }

    public void SetZhixiAlarmTime(int i) {
        if (i == 0) {
            this.m_tempZhixialarm = 0;
            this.zhixialarm.setText(R.string.notalarm);
            return;
        }
        if (i == 1) {
            this.m_tempZhixialarm = 10;
            this.zhixialarm.setText("10");
            return;
        }
        if (i == 2) {
            this.m_tempZhixialarm = 20;
            this.zhixialarm.setText("20");
        } else if (i == 3) {
            this.m_tempZhixialarm = 30;
            this.zhixialarm.setText("30");
        } else if (i == 4) {
            this.m_tempZhixialarm = 40;
            this.zhixialarm.setText("40");
        } else {
            this.m_tempZhixialarm = 20;
            this.zhixialarm.setText("20");
        }
    }

    public void SetNowAlarmLevelText(int i) {
        this.m_respalarmlevel = i;
        SetAlarmLevelText(i);
        this.RespAlarmItem.setVisibility(4);
        this.m_respAlarmItemshow = false;
    }

    @Override
    protected void onActivityResult(int i, int i2, Intent intent) {
        if (i == 1 && intent != null && intent.getExtras().getBoolean("popupresult")) {
            ResetRespParaExcu();
        }
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == 2131363184) {
            finish();
            return;
        }
        if (id == 2131363186) {
            Bundle bundle = new Bundle();
            bundle.putInt("popuptextview", R.string.dialog_respParaSetting);
            Intent intent = new Intent();
            intent.putExtras(bundle);
            intent.setClass(this, PopUpParaDefaultActivity.class);
            startActivityForResult(intent, 1);
            return;
        }
        if (id != 2131363188) {
            switch (id) {
                case R.id.SpinnerRespAlarmLevel:
                    if (this.m_respAlarmItemshow) {
                        this.RespAlarmItem.setVisibility(4);
                    } else {
                        this.RespAlarmItem.setVisibility(0);
                    }
                    this.m_respAlarmItemshow = !this.m_respAlarmItemshow;
                    break;
                case R.id.SpinnerRespHighAlarmItem:
                    SetNowAlarmLevelText(0);
                    break;
                case R.id.SpinnerRespLowAlarmItem:
                    SetNowAlarmLevelText(2);
                    break;
                case R.id.SpinnerRespMidAlarmItem:
                    SetNowAlarmLevelText(1);
                    break;
                case R.id.SpinnerRespZhixi:
                    if (this.m_ZhixiAlarmItemshow) {
                        this.ZhixiAlarmItem.setVisibility(4);
                    } else {
                        this.ZhixiAlarmItem.setVisibility(0);
                    }
                    this.m_ZhixiAlarmItemshow = !this.m_ZhixiAlarmItemshow;
                    break;
                default:
                    switch (id) {
                        case R.id.SpinnerZhixi10AlarmItem:
                            SetNowZhixiAlarmTime(1);
                            break;
                        case R.id.SpinnerZhixi20AlarmItem:
                            SetNowZhixiAlarmTime(2);
                            break;
                        case R.id.SpinnerZhixi30AlarmItem:
                            SetNowZhixiAlarmTime(3);
                            break;
                        case R.id.SpinnerZhixi40AlarmItem:
                            SetNowZhixiAlarmTime(4);
                            break;
                    }
            }
            return;
        }
        if (SaveRespPara()) {
            finish();
        }
    }

    @Override
    public void initTopKeyboard(EditText editText) {
        KeyboardUtil keyboardUtil = this.keyboardUtil;
        if (keyboardUtil == null) {
            this.keyboardUtil = new KeyboardUtil(this, this, editText, false, false);
        } else {
            keyboardUtil.hideKeyboard();
            this.keyboardUtil = null;
            this.keyboardUtil = new KeyboardUtil(this, this, editText, false, false);
        }
        KeyboardView keyboardView = (KeyboardView) findViewById(R.id.keyboard_view);
        this.keyboard = keyboardView;
        keyboardView.setVisibility(0);
        ImageView imageView = (ImageView) findViewById(R.id.ima_top);
        this.ima_top = imageView;
        imageView.setVisibility(0);
        editText.setInputType(editText.getInputType());
    }

    @Override
    public void setlayoutParams(int i, int i2, int i3, int i4) {
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
        this.layoutParams = layoutParams;
        layoutParams.leftMargin = i;
        this.layoutParams.topMargin = i2;
        this.layoutParams.rightMargin = i3;
        this.layoutParams.bottomMargin = i4;
        RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.rel);
        this.relativeLayout = relativeLayout;
        relativeLayout.setLayoutParams(this.layoutParams);
    }

    @Override
    public void shield() {
        try {
            Method method = EditText.class.getMethod("setShowSoftInputOnFocus", Boolean.TYPE);
            method.setAccessible(true);
            method.invoke(this.respAlarmHigh, false);
            method.invoke(this.respAlarmLow, false);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}