导航菜单

页面标题

页面副标题

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

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

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


package cn.neoprint.padmonitor.ui;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.inputmethodservice.KeyboardView;
import android.os.Bundle;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
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.ui.view.STGridChart;
import cn.neoprint.padmonitor.utils.FontManager;
import cn.neoprint.padmonitor.utils.keyboard.KeyboardUtil;
import cn.neoprint.padmonitor.utils.keyboard.KeyboardUtilInterface;
import java.lang.reflect.Method;
import java.util.ArrayList;

public class STSettingActivity extends Activity implements View.OnClickListener, KeyboardUtilInterface {
    private EditText STAlarmHigh;
    private TextView STAlarmHighItem;
    private LinearLayout STAlarmItem;
    private EditText STAlarmLow;
    private TextView STAlarmLowItem;
    private TextView STAlarmMidItem;
    private Switch STAlarmSwitch;
    private STGridChart STGrid;
    private EditText STISO;
    private Switch STShowSwitch;
    private EditText STValue;
    private Button ST_cancle;
    private Button ST_default;
    private Button ST_goback;
    public SharedPreferences gzj;
    private ImageView ima_top;
    private KeyboardView keyboard;
    private KeyboardUtil keyboardUtil;
    RelativeLayout.LayoutParams layoutParams;
    private float m_STAlarmHigh;
    private float m_STAlarmLow;
    private int m_STISO;
    private int m_STValue;
    private TextView m_stalarmlevel;
    RelativeLayout relativeLayout;
    private int stalarmlevel;
    private int tempstalarmlevel;
    private boolean m_STShowSwitch = false;
    private boolean m_tempSTShowSwitch = false;
    private boolean m_STAlarmSwitch = false;
    private boolean m_tempSTAlarmSwitch = false;
    private boolean m_stalarmlevelshow = false;
    public Handler mSTHandler = new Handler();
    public AppGlobal myApp = null;
    Runnable STrunnable = new Runnable() {
        @Override
        public void run() {
            AppGlobal appGlobal = (AppGlobal) STSettingActivity.this.getApplication();
            if (appGlobal.GetSTflag1() && appGlobal.GetSTflag2()) {
                STSettingActivity.this.STGrid.DrawSTLine1(appGlobal.stList1);
                STSettingActivity.this.STGrid.DrawSTLine2(appGlobal.stList2);
                appGlobal.SetSTflag1(false);
                appGlobal.SetSTflag2(false);
            }
            STSettingActivity.this.mSTHandler.postDelayed(STSettingActivity.this.STrunnable, 200L);
        }
    };

    @Override
    public void initLeftKeyboard(EditText editText) {
    }

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

    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 InitSTPara() {
        this.STShowSwitch = (Switch) findViewById(R.id.STSwitch);
        this.m_STShowSwitch = this.gzj.getBoolean("STShowSwitch", false);
        this.mSTHandler.postDelayed(this.STrunnable, 200L);
        boolean z = this.m_STShowSwitch;
        this.m_tempSTShowSwitch = z;
        this.STShowSwitch.setChecked(z);
        this.STShowSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean z2) {
                STSettingActivity.this.m_tempSTShowSwitch = z2;
            }
        });
        this.STAlarmSwitch = (Switch) findViewById(R.id.STalarmSwitch);
        boolean z2 = this.gzj.getBoolean("STAlarmSwitch", false);
        this.m_STAlarmSwitch = z2;
        this.STAlarmSwitch.setChecked(z2);
        this.m_tempSTAlarmSwitch = this.m_STAlarmSwitch;
        this.STAlarmSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean z3) {
                if (STSettingActivity.this.myApp.m_ALMPermission) {
                    STSettingActivity.this.m_tempSTAlarmSwitch = z3;
                } else {
                    STSettingActivity.this.showMessage(R.string.AlarmTip);
                    STSettingActivity.this.STAlarmSwitch.setChecked(STSettingActivity.this.m_tempSTAlarmSwitch);
                }
            }
        });
        int i = this.gzj.getInt("stalarmlevel", 1);
        this.stalarmlevel = i;
        this.tempstalarmlevel = i;
        this.m_stalarmlevel = (TextView) findViewById(R.id.SpinnerSTalarm);
        SetAlarmLevelText(this.stalarmlevel);
        this.m_stalarmlevel.setOnClickListener(this);
        LinearLayout linearLayout = (LinearLayout) findViewById(R.id.SpinnerSTAlarmItem);
        this.STAlarmItem = linearLayout;
        linearLayout.setVisibility(4);
        TextView textView = (TextView) findViewById(R.id.SpinnerSTHighAlarmItem);
        this.STAlarmHighItem = textView;
        textView.setOnClickListener(this);
        TextView textView2 = (TextView) findViewById(R.id.SpinnerSTMidAlarmItem);
        this.STAlarmMidItem = textView2;
        textView2.setOnClickListener(this);
        TextView textView3 = (TextView) findViewById(R.id.SpinnerSTLowAlarmItem);
        this.STAlarmLowItem = textView3;
        textView3.setOnClickListener(this);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        float f = displayMetrics.xdpi;
        float f2 = displayMetrics.ydpi;
        this.STGrid = (STGridChart) findViewById(R.id.ST_Stream);
        Resources resources = getResources();
        this.STGrid.Init(f, f2, resources.getColor(R.color.SPo2clor), resources.getColor(R.color.Respclor));
        ArrayList arrayList = new ArrayList();
        arrayList.add(" ");
        arrayList.add(" ");
        arrayList.add(" ");
        arrayList.add(" ");
        arrayList.add(" ");
        ArrayList arrayList2 = new ArrayList();
        arrayList2.add(" ");
        arrayList2.add(" ");
        arrayList2.add(" ");
        arrayList2.add(" ");
        arrayList2.add(" ");
        arrayList2.add(" ");
        arrayList2.add(" ");
        this.STGrid.setAxisYTitles(arrayList);
        this.STGrid.setAxisXTitles(arrayList2);
        EditText editText = (EditText) findViewById(R.id.STalarmhigh);
        this.STAlarmHigh = editText;
        editText.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                STSettingActivity sTSettingActivity = STSettingActivity.this;
                sTSettingActivity.initTopKeyboard(sTSettingActivity.STAlarmHigh);
                STSettingActivity.this.setlayoutParams(150, 180, 0, 0);
                return false;
            }
        });
        EditText editText2 = (EditText) findViewById(R.id.STalarmlow);
        this.STAlarmLow = editText2;
        editText2.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                STSettingActivity sTSettingActivity = STSettingActivity.this;
                sTSettingActivity.initTopKeyboard(sTSettingActivity.STAlarmLow);
                STSettingActivity.this.setlayoutParams(450, 180, 0, 0);
                return false;
            }
        });
        EditText editText3 = (EditText) findViewById(R.id.STiso);
        this.STISO = editText3;
        editText3.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                STSettingActivity sTSettingActivity = STSettingActivity.this;
                sTSettingActivity.initTopKeyboard(sTSettingActivity.STISO);
                STSettingActivity.this.setlayoutParams(220, 200, 0, 0);
                return false;
            }
        });
        EditText editText4 = (EditText) findViewById(R.id.stvalue);
        this.STValue = editText4;
        editText4.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                STSettingActivity sTSettingActivity = STSettingActivity.this;
                sTSettingActivity.initTopKeyboard(sTSettingActivity.STValue);
                STSettingActivity.this.setlayoutParams(430, 200, 0, 0);
                return false;
            }
        });
        this.m_STAlarmHigh = this.gzj.getFloat("STAlarmHigh", 0.02f);
        this.m_STAlarmLow = this.gzj.getFloat("STAlarmLow", -0.02f);
        this.m_STISO = this.gzj.getInt("STISO", 80);
        this.m_STValue = this.gzj.getInt("STValue", 108);
        this.STAlarmHigh.setText("" + this.m_STAlarmHigh);
        this.STAlarmLow.setText("" + this.m_STAlarmLow);
        this.STISO.setText("" + this.m_STISO);
        this.STValue.setText("" + this.m_STValue);
        Button button = (Button) findViewById(R.id.ST_goback);
        this.ST_goback = button;
        button.setOnClickListener(this);
        Button button2 = (Button) findViewById(R.id.ST_default);
        this.ST_default = button2;
        button2.setOnClickListener(this);
        Button button3 = (Button) findViewById(R.id.ST_cancle);
        this.ST_cancle = button3;
        button3.setOnClickListener(this);
    }

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

    public void ResetSTParaExcu() {
        this.m_tempSTShowSwitch = false;
        this.STShowSwitch.setChecked(false);
        this.m_tempSTAlarmSwitch = false;
        this.STAlarmSwitch.setChecked(false);
        this.tempstalarmlevel = 1;
        SetAlarmLevelText(1);
        this.m_STAlarmHigh = 0.02f;
        this.m_STAlarmLow = -0.02f;
        this.STAlarmHigh.setText("" + this.m_STAlarmHigh);
        this.STAlarmLow.setText("" + this.m_STAlarmLow);
        this.STISO.setText("80");
        this.STValue.setText("108");
        SaveSTPara();
        finish();
    }

    public boolean SaveSTPara() {
        String str = (this.STAlarmHigh.getText() == null || this.STAlarmHigh.getText().toString().equals("")) ? "" + getString(R.string.STalarmhigh) + " " : "";
        if (this.STAlarmLow.getText() == null || this.STAlarmLow.getText().toString().equals("")) {
            str = str + getString(R.string.STalarmlow) + " ";
        }
        if (this.STISO.getText() == null || this.STISO.getText().toString().equals("")) {
            str = str + "ISO ";
        }
        if (this.STValue.getText() == null || this.STValue.getText().toString().equals("")) {
            str = str + "ST";
        }
        boolean z = false;
        if (!str.equals("")) {
            ShowAlertDialog(str);
            return false;
        }
        SharedPreferences.Editor edit = this.gzj.edit();
        edit.putBoolean("STShowSwitch", this.m_tempSTShowSwitch);
        edit.putBoolean("STAlarmSwitch", this.m_tempSTAlarmSwitch);
        edit.putInt("stalarmlevel", this.tempstalarmlevel);
        edit.putFloat("STAlarmHigh", Float.parseFloat(this.STAlarmHigh.getText().toString()));
        edit.putFloat("STAlarmLow", Float.parseFloat(this.STAlarmLow.getText().toString()));
        int parseInt = Integer.parseInt(this.STISO.getText().toString());
        int parseInt2 = Integer.parseInt(this.STValue.getText().toString());
        edit.putInt("STISO", parseInt);
        edit.putInt("STValue", parseInt2);
        edit.commit();
        if (parseInt != this.m_STISO || parseInt2 != this.m_STValue) {
            AppGlobal appGlobal = (AppGlobal) getApplication();
            appGlobal.paraList.clear();
            appGlobal.paraList.add((byte) 6);
            appGlobal.paraList.add(Byte.valueOf((byte) ((parseInt & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8)));
            appGlobal.paraList.add(Byte.valueOf((byte) (parseInt & 255)));
            appGlobal.paraList.add(Byte.valueOf((byte) ((parseInt2 & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8)));
            appGlobal.paraList.add(Byte.valueOf((byte) (parseInt2 & 255)));
            z = true;
        }
        Bundle bundle = new Bundle();
        bundle.putBoolean("bcgparaset", z);
        Intent intent = new Intent();
        intent.putExtras(bundle);
        setResult(10, intent);
        return true;
    }

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

    @Override
    public void onClick(View view) {
        int id = view.getId();
        switch (id) {
            case R.id.ST_cancle:
                finish();
                break;
            case R.id.ST_default:
                Bundle bundle = new Bundle();
                bundle.putInt("popuptextview", R.string.dialog_STParaSetting);
                Intent intent = new Intent();
                intent.putExtras(bundle);
                intent.setClass(this, PopUpParaDefaultActivity.class);
                startActivityForResult(intent, 1);
                break;
            case R.id.ST_goback:
                if (SaveSTPara()) {
                    finish();
                    break;
                }
                break;
            default:
                switch (id) {
                    case R.id.SpinnerSTHighAlarmItem:
                        SetAlarmLevelText(0);
                        this.STAlarmItem.setVisibility(4);
                        this.tempstalarmlevel = 0;
                        this.m_stalarmlevelshow = false;
                        break;
                    case R.id.SpinnerSTLowAlarmItem:
                        SetAlarmLevelText(2);
                        this.STAlarmItem.setVisibility(4);
                        this.tempstalarmlevel = 2;
                        this.m_stalarmlevelshow = false;
                        break;
                    case R.id.SpinnerSTMidAlarmItem:
                        SetAlarmLevelText(1);
                        this.STAlarmItem.setVisibility(4);
                        this.tempstalarmlevel = 1;
                        this.m_stalarmlevelshow = false;
                        break;
                    case R.id.SpinnerSTalarm:
                        if (this.m_stalarmlevelshow) {
                            this.STAlarmItem.setVisibility(4);
                        } else {
                            this.STAlarmItem.setVisibility(0);
                        }
                        this.m_stalarmlevelshow = !this.m_stalarmlevelshow;
                        break;
                }
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        this.mSTHandler.removeCallbacks(this.STrunnable);
    }

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

    @Override
    public void initTopKeyboard(EditText editText) {
        KeyboardUtil keyboardUtil = this.keyboardUtil;
        if (keyboardUtil == null) {
            this.keyboardUtil = new KeyboardUtil(this, this, editText, true, false);
        } else {
            keyboardUtil.hideKeyboard();
            this.keyboardUtil = null;
            this.keyboardUtil = new KeyboardUtil(this, this, editText, true, 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.STAlarmHigh, false);
            method.invoke(this.STAlarmLow, false);
            method.invoke(this.STValue, false);
            method.invoke(this.STISO, false);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}