导航菜单

页面标题

页面副标题

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

正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 TempSettingActivity.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.text.Editable;
import android.text.TextWatcher;
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 cn.neoprint.padmonitor.R;
import cn.neoprint.padmonitor.app.AppGlobal;
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;

public class TempSettingActivity extends Activity implements KeyboardUtilInterface {
    private TextView TempAlarmHigh;
    private LinearLayout TempAlarmItem;
    private TextView TempAlarmLow;
    private TextView TempAlarmMid;
    private Switch Tempalarmswitch;
    private SharedPreferences gzj;
    private ImageView ima_top;
    private KeyboardView keyboard;
    private KeyboardUtil keyboardUtil;
    private RelativeLayout.LayoutParams layoutParams;
    public boolean m_Tempalarmswitch;
    private float m_tempAlarmHigh;
    private float m_tempAlarmHighinit;
    private float m_tempAlarmLow;
    private float m_tempAlarmLowinit;
    private float m_tempHigh_C;
    private float m_tempHigh_F;
    private float m_tempLow_C;
    private float m_tempLow_F;
    private int m_tempalarmlevel;
    private RelativeLayout relativeLayout;
    private EditText tempAlarmHigh;
    private EditText tempAlarmLow;
    private TextView temp_cancle;
    private TextView temp_default;
    private TextView temp_goback;
    public TextView tempalarmlevel;
    private int tempinit;
    private int tempunit;
    private RadioButton tempunit_C;
    private RadioButton tempunit_F;
    private RadioGroup tempunit_rgp;
    private boolean m_TempAlarmItemshow = false;
    private OnTouchListenerMpl mTouchListenerMpl = new OnTouchListenerMpl();
    AppGlobal myApp = null;

    @Override
    public void initLeftKeyboard(EditText editText) {
    }

    public void judge(float f, float f2, float f3) {
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.gzj = getSharedPreferences("gzj", 0);
        systemSettings();
        getViewId();
        initData();
        setAllListeners();
        shield();
    }

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

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

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

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    public void systemSettings() {
        setTitleColor(-16777216);
        requestWindowFeature(1);
        AppGlobal appGlobal = (AppGlobal) getApplication();
        this.myApp = appGlobal;
        appGlobal.setSystemBarVisible(this, false);
        setContentView(R.layout.tempsetting);
        this.myApp.SetBackgroundLight(this, -255, 52, false);
        setFinishOnTouchOutside(false);
        FontManager.changeFonts((ViewGroup) getWindow().getDecorView(), this, Typeface.createFromAsset(getAssets(), "fonts/MSBlack.ttf"));
    }

    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 getViewId() {
        this.Tempalarmswitch = (Switch) findViewById(R.id.tempalarmswitch);
        this.tempalarmlevel = (TextView) findViewById(R.id.SpinnertempAlarmLevel);
        LinearLayout linearLayout = (LinearLayout) findViewById(R.id.SpinnerTempAlarmItem);
        this.TempAlarmItem = linearLayout;
        linearLayout.setVisibility(4);
        this.TempAlarmHigh = (TextView) findViewById(R.id.SpinnerTempHighAlarmItem);
        this.TempAlarmMid = (TextView) findViewById(R.id.SpinnerTempMidAlarmItem);
        this.TempAlarmLow = (TextView) findViewById(R.id.SpinnerTempLowAlarmItem);
        this.tempunit_rgp = (RadioGroup) findViewById(R.id.tempunit_rgp);
        this.tempunit_C = (RadioButton) findViewById(R.id.tempunit_1);
        this.tempunit_F = (RadioButton) findViewById(R.id.tempunit_2);
        this.tempAlarmHigh = (EditText) findViewById(R.id.temp_high);
        this.tempAlarmLow = (EditText) findViewById(R.id.temp_low);
        this.temp_default = (TextView) findViewById(R.id.temp_default);
        this.temp_goback = (TextView) findViewById(R.id.temp_goback);
        this.temp_cancle = (TextView) findViewById(R.id.temp_cancle);
    }

    public void setAllListeners() {
        this.tempalarmlevel.setOnTouchListener(this.mTouchListenerMpl);
        this.TempAlarmHigh.setOnTouchListener(this.mTouchListenerMpl);
        this.TempAlarmMid.setOnTouchListener(this.mTouchListenerMpl);
        this.TempAlarmLow.setOnTouchListener(this.mTouchListenerMpl);
        this.tempunit_rgp.setOnCheckedChangeListener(new OnCheckedChangeListenerMpl());
        this.tempAlarmHigh.setOnTouchListener(this.mTouchListenerMpl);
        this.tempAlarmLow.setOnTouchListener(this.mTouchListenerMpl);
        this.tempAlarmHigh.addTextChangedListener(new mTextWatcher(R.id.temp_high, this));
        this.tempAlarmLow.addTextChangedListener(new mTextWatcher(R.id.temp_low, this));
        this.temp_default.setOnTouchListener(this.mTouchListenerMpl);
        this.temp_goback.setOnTouchListener(this.mTouchListenerMpl);
        this.temp_cancle.setOnTouchListener(this.mTouchListenerMpl);
        this.Tempalarmswitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                if (TempSettingActivity.this.myApp.m_ALMPermission) {
                    TempSettingActivity.this.m_Tempalarmswitch = z;
                } else {
                    TempSettingActivity.this.showMessage(R.string.AlarmTip);
                    TempSettingActivity.this.Tempalarmswitch.setChecked(TempSettingActivity.this.m_Tempalarmswitch);
                }
            }
        });
    }

    public void initData() {
        boolean z = this.gzj.getBoolean("tempalarmswitch", false);
        this.m_Tempalarmswitch = z;
        this.Tempalarmswitch.setChecked(z);
        int i = this.gzj.getInt("tempalarmlevel", 1);
        this.m_tempalarmlevel = i;
        SetAlarmLevelText(i);
        this.m_TempAlarmItemshow = false;
        int i2 = this.gzj.getInt("tempunit", 0);
        this.tempunit = i2;
        this.tempinit = i2;
        if (i2 == 0) {
            this.tempunit_C.setChecked(true);
            float f = this.gzj.getFloat("m_tempHigh_C", 39.0f);
            this.m_tempAlarmHigh = f;
            this.m_tempAlarmHighinit = f;
            float f2 = this.gzj.getFloat("m_tempLow_C", 36.0f);
            this.m_tempAlarmLow = f2;
            this.m_tempAlarmLowinit = f2;
        } else if (i2 == 1) {
            this.tempunit_F.setChecked(true);
            float f3 = this.gzj.getFloat("m_tempHigh_F", 102.2f);
            this.m_tempAlarmHigh = f3;
            this.m_tempAlarmHighinit = f3;
            float f4 = this.gzj.getFloat("m_tempLow_F", 96.8f);
            this.m_tempAlarmLow = f4;
            this.m_tempAlarmLowinit = f4;
        }
        this.m_tempHigh_C = this.gzj.getFloat("m_tempHigh_C", 39.0f);
        this.m_tempLow_C = this.gzj.getFloat("m_tempLow_C", 36.0f);
        this.m_tempHigh_F = this.gzj.getFloat("m_tempHigh_F", 102.2f);
        this.m_tempLow_F = this.gzj.getFloat("m_tempLow_F", 96.8f);
        this.tempAlarmHigh.setText(this.m_tempAlarmHigh + "");
        this.tempAlarmLow.setText(this.m_tempAlarmLow + "");
    }

    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 boolean SaveTemppara() {
        throw new UnsupportedOperationException("Method not decompiled: cn.neoprint.padmonitor.ui.TempSettingActivity.SaveTemppara():boolean");
    }

    public void ResetParaExcu() {
        this.m_Tempalarmswitch = true;
        this.m_tempalarmlevel = 1;
        SetAlarmLevelText(1);
        this.tempunit = 0;
        this.tempunit_C.setChecked(true);
        this.m_tempAlarmLow = 36.0f;
        this.m_tempAlarmHigh = 39.0f;
        this.tempAlarmHigh.setText(this.m_tempAlarmHigh + "");
        this.tempAlarmLow.setText(this.m_tempAlarmLow + "");
        SaveTemppara();
        finish();
    }

    public void reset() {
        this.gzj.edit().putInt("tempunit", this.tempinit).commit();
        this.gzj.edit().putFloat("tempAlarmLow", this.m_tempAlarmLowinit).commit();
        this.gzj.edit().putFloat("tempAlarmHigh", this.m_tempAlarmHighinit).commit();
    }

    @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.tempAlarmHigh, false);
            method.invoke(this.tempAlarmLow, false);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void unit_FtoC() {
        if (this.gzj.getInt("tempunit", 0) == 0) {
            return;
        }
        if (!this.tempAlarmHigh.getText().toString().equals("") && !this.tempAlarmLow.getText().toString().equals("")) {
            this.tempunit = 0;
            this.tempAlarmHigh.setText(this.m_tempHigh_C + "");
            this.tempAlarmLow.setText(this.m_tempLow_C + "");
            this.gzj.edit().putInt("tempunit", this.tempunit).commit();
            return;
        }
        this.tempunit = 1;
        this.gzj.edit().putInt("tempunit", this.tempunit).commit();
        this.tempunit_F.setChecked(true);
    }

    public void unit_CtoF() {
        if (this.gzj.getInt("tempunit", 0) == 1) {
            return;
        }
        if (!this.tempAlarmHigh.getText().toString().equals("") && !this.tempAlarmLow.getText().toString().equals("")) {
            this.tempunit = 1;
            this.tempAlarmHigh.setText(this.m_tempHigh_F + "");
            this.tempAlarmLow.setText(this.m_tempLow_F + "");
            this.gzj.edit().putInt("tempunit", this.tempunit).commit();
            return;
        }
        this.tempunit = 0;
        this.gzj.edit().putInt("tempunit", this.tempunit).commit();
        this.tempunit_C.setChecked(true);
    }

    public void high_CTohigh_F() {
        float parseFloat = Float.parseFloat(((this.m_tempHigh_C * 1.8d) + 32.0d) + "");
        this.m_tempHigh_F = parseFloat;
        if (parseFloat >= 100.0f) {
            this.m_tempHigh_F = Float.parseFloat((((this.m_tempHigh_C * 1.8d) + 32.0d) + "").substring(0, 5));
        } else if (parseFloat < 10.0f) {
            this.m_tempHigh_F = Float.parseFloat((((this.m_tempHigh_C * 1.8d) + 32.0d) + "").substring(0, 3));
        } else {
            this.m_tempHigh_F = Float.parseFloat((((this.m_tempHigh_C * 1.8d) + 32.0d) + "").substring(0, 4));
        }
    }

    public void high_FTohigh_C() {
        float parseFloat = Float.parseFloat(((this.m_tempHigh_F - 32.0f) / 1.8d) + "");
        this.m_tempHigh_C = parseFloat;
        if (parseFloat >= 100.0f) {
            this.m_tempHigh_C = Float.parseFloat((((this.m_tempHigh_F - 32.0f) / 1.8d) + "").substring(0, 5));
        } else if (parseFloat < 10.0f) {
            this.m_tempHigh_C = Float.parseFloat((((this.m_tempHigh_F - 32.0f) / 1.8d) + "").substring(0, 3));
        } else {
            this.m_tempHigh_C = Float.parseFloat((((this.m_tempHigh_F - 32.0f) / 1.8d) + "").substring(0, 4));
        }
    }

    public void low_CTolow_F() {
        float parseFloat = Float.parseFloat(((this.m_tempLow_C * 1.8d) + 32.0d) + "");
        this.m_tempLow_F = parseFloat;
        if (parseFloat >= 100.0f) {
            this.m_tempLow_F = Float.parseFloat((((this.m_tempLow_C * 1.8d) + 32.0d) + "").substring(0, 5));
        } else if (parseFloat < 10.0f) {
            this.m_tempLow_F = Float.parseFloat((((this.m_tempLow_C * 1.8d) + 32.0d) + "").substring(0, 3));
        } else {
            this.m_tempLow_F = Float.parseFloat((((this.m_tempLow_C * 1.8d) + 32.0d) + "").substring(0, 4));
        }
    }

    public void low_FTolow_C() {
        float parseFloat = Float.parseFloat(((this.m_tempLow_F - 32.0f) / 1.8d) + "");
        this.m_tempLow_C = parseFloat;
        if (parseFloat >= 100.0f) {
            this.m_tempLow_C = Float.parseFloat((((this.m_tempLow_F - 32.0f) / 1.8d) + "").substring(0, 5));
        } else if (parseFloat < 10.0f) {
            this.m_tempLow_C = Float.parseFloat((((this.m_tempLow_F - 32.0f) / 1.8d) + "").substring(0, 3));
        } else {
            this.m_tempLow_C = Float.parseFloat((((this.m_tempLow_F - 32.0f) / 1.8d) + "").substring(0, 4));
        }
    }

    class mTextWatcher implements TextWatcher {
        public int ID;
        public TempSettingActivity activity;

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        public mTextWatcher(int i, TempSettingActivity tempSettingActivity) {
            this.ID = i;
            this.activity = tempSettingActivity;
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (editable.toString().equals("") || editable.toString().equals(".")) {
                return;
            }
            if (editable.toString().substring(0, 1).equals(".")) {
                if (!editable.toString().substring(0, 1).equals(".") || editable.toString().length() <= 1) {
                    if (editable.toString().equals("") || editable.toString().equals(".")) {
                        return;
                    }
                } else if (Float.parseFloat(editable.toString()) >= 100.0f && editable.toString().length() > 4) {
                    editable = editable.delete(4, editable.toString().length());
                } else if (Float.parseFloat(editable.toString()) < 10.0f && editable.toString().length() > 2) {
                    editable = editable.delete(2, editable.toString().length());
                } else if (Float.parseFloat(editable.toString()) < 100.0f && Float.parseFloat(editable.toString()) >= 10.0f && editable.toString().length() > 3) {
                    editable = editable.delete(3, editable.toString().length());
                }
            } else if (Float.parseFloat(editable.toString()) >= 100.0f && editable.toString().length() > 5) {
                editable = editable.delete(5, editable.toString().length());
            } else if (Float.parseFloat(editable.toString()) < 10.0f && editable.toString().length() > 3) {
                editable = editable.delete(3, editable.toString().length());
            } else if (Float.parseFloat(editable.toString()) < 100.0f && Float.parseFloat(editable.toString()) >= 10.0f && editable.toString().length() > 4) {
                editable = editable.delete(4, editable.toString().length());
            }
            if (this.activity.tempunit != 0) {
                if (this.activity.tempunit == 1) {
                    int i = this.ID;
                    if (i == 2131363511) {
                        if ((TempSettingActivity.this.m_tempHigh_F + "").equals(editable.toString())) {
                            return;
                        }
                        TempSettingActivity.this.m_tempHigh_F = Float.parseFloat(editable.toString());
                        TempSettingActivity.this.high_FTohigh_C();
                        return;
                    }
                    if (i != 2131363512 || (TempSettingActivity.this.m_tempLow_F + "").equals(editable.toString())) {
                        return;
                    }
                    TempSettingActivity.this.m_tempLow_F = Float.parseFloat(editable.toString());
                    TempSettingActivity.this.low_FTolow_C();
                    return;
                }
                return;
            }
            int i2 = this.ID;
            if (i2 == 2131363511) {
                if ((TempSettingActivity.this.m_tempHigh_C + "").equals(editable.toString())) {
                    return;
                }
                TempSettingActivity.this.m_tempHigh_C = Float.parseFloat(editable.toString());
                TempSettingActivity.this.high_CTohigh_F();
                return;
            }
            if (i2 != 2131363512 || (TempSettingActivity.this.m_tempLow_C + "").equals(editable.toString())) {
                return;
            }
            TempSettingActivity.this.m_tempLow_C = Float.parseFloat(editable.toString());
            TempSettingActivity.this.low_CTolow_F();
        }
    }

    class OnCheckedChangeListenerMpl implements RadioGroup.OnCheckedChangeListener {
        OnCheckedChangeListenerMpl() {
        }

        @Override
        public void onCheckedChanged(RadioGroup radioGroup, int i) {
            switch (i) {
                case R.id.tempunit_1:
                    TempSettingActivity.this.unit_FtoC();
                    break;
                case R.id.tempunit_2:
                    TempSettingActivity.this.unit_CtoF();
                    break;
            }
        }
    }

    class OnTouchListenerMpl implements View.OnTouchListener {
        OnTouchListenerMpl() {
        }

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            int id = view.getId();
            if (id != 2131362023) {
                switch (id) {
                    case R.id.SpinnerTempHighAlarmItem:
                        TempSettingActivity.this.m_tempalarmlevel = 0;
                        TempSettingActivity tempSettingActivity = TempSettingActivity.this;
                        tempSettingActivity.SetAlarmLevelText(tempSettingActivity.m_tempalarmlevel);
                        TempSettingActivity.this.TempAlarmItem.setVisibility(4);
                        TempSettingActivity.this.m_TempAlarmItemshow = false;
                        break;
                    case R.id.SpinnerTempLowAlarmItem:
                        TempSettingActivity.this.m_tempalarmlevel = 2;
                        TempSettingActivity tempSettingActivity2 = TempSettingActivity.this;
                        tempSettingActivity2.SetAlarmLevelText(tempSettingActivity2.m_tempalarmlevel);
                        TempSettingActivity.this.TempAlarmItem.setVisibility(4);
                        TempSettingActivity.this.m_TempAlarmItemshow = false;
                        break;
                    case R.id.SpinnerTempMidAlarmItem:
                        TempSettingActivity.this.m_tempalarmlevel = 1;
                        TempSettingActivity tempSettingActivity3 = TempSettingActivity.this;
                        tempSettingActivity3.SetAlarmLevelText(tempSettingActivity3.m_tempalarmlevel);
                        TempSettingActivity.this.TempAlarmItem.setVisibility(4);
                        TempSettingActivity.this.m_TempAlarmItemshow = false;
                        break;
                    default:
                        switch (id) {
                            case R.id.temp_cancle:
                                TempSettingActivity.this.reset();
                                TempSettingActivity.this.finish();
                                break;
                            case R.id.temp_default:
                                Bundle bundle = new Bundle();
                                bundle.putInt("popuptextview", R.string.dialog_tempParaSetting);
                                Intent intent = new Intent();
                                intent.putExtras(bundle);
                                intent.setClass(TempSettingActivity.this, PopUpParaDefaultActivity.class);
                                TempSettingActivity.this.startActivityForResult(intent, 1);
                                break;
                            case R.id.temp_goback:
                                if (TempSettingActivity.this.SaveTemppara()) {
                                    TempSettingActivity.this.finish();
                                    break;
                                }
                                break;
                            case R.id.temp_high:
                                TempSettingActivity tempSettingActivity4 = TempSettingActivity.this;
                                tempSettingActivity4.initTopKeyboard(tempSettingActivity4.tempAlarmHigh);
                                TempSettingActivity.this.setlayoutParams(160, 305, 0, 0);
                                break;
                            case R.id.temp_low:
                                TempSettingActivity tempSettingActivity5 = TempSettingActivity.this;
                                tempSettingActivity5.initTopKeyboard(tempSettingActivity5.tempAlarmLow);
                                TempSettingActivity.this.setlayoutParams(490, 305, 0, 0);
                                break;
                        }
                }
            } else {
                if (TempSettingActivity.this.m_TempAlarmItemshow) {
                    TempSettingActivity.this.TempAlarmItem.setVisibility(4);
                } else {
                    TempSettingActivity.this.TempAlarmItem.setVisibility(0);
                }
                TempSettingActivity.this.m_TempAlarmItemshow = !r4.m_TempAlarmItemshow;
            }
            return false;
        }
    }
}