导航菜单

页面标题

页面副标题

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

正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 PatientsInfo.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.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
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 PatientsInfo extends Activity implements View.OnClickListener, KeyboardUtilInterface {
    private RadioButton PatientAdult;
    private RadioButton PatientChild;
    private RadioButton PatientMan;
    private RadioGroup PatientSex_rgp;
    private RadioGroup PatientType_rgp;
    private RadioButton PatientWoman;
    public SharedPreferences gzj;
    ImageView ima_top;
    KeyboardView keyboard;
    KeyboardUtil keyboardUtil;
    EditText m_BedNo;
    EditText m_patientname;
    TextView m_txBedno;
    TextView m_txpatientname;
    AppGlobal myApp = null;
    private int m_patientsex = -1;
    private int m_patienttype = -1;
    OnCheckedChangeListenerMpl mOnCheckedChangeListenerMpl = new OnCheckedChangeListenerMpl();

    @Override
    public void initLeftKeyboard(EditText editText) {
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        requestWindowFeature(1);
        AppGlobal appGlobal = (AppGlobal) getApplication();
        this.myApp = appGlobal;
        appGlobal.setSystemBarVisible(this, false);
        setContentView(R.layout.patients_info);
        this.myApp.SetBackgroundLight(this, -255, 78, true);
        setFinishOnTouchOutside(false);
        FontManager.changeFonts((ViewGroup) getWindow().getDecorView(), this, Typeface.createFromAsset(getAssets(), "fonts/MSBlack.ttf"));
        ((TextView) findViewById(R.id.Btn_UpdatePatient)).setOnClickListener(this);
        ((TextView) findViewById(R.id.Btn_back)).setOnClickListener(this);
        this.m_patientname = (EditText) findViewById(R.id.patient_name);
        EditText editText = (EditText) findViewById(R.id.BedNo);
        this.m_BedNo = editText;
        editText.setOnClickListener(this);
        shield();
        this.PatientType_rgp = (RadioGroup) findViewById(R.id.patient_type);
        this.PatientAdult = (RadioButton) findViewById(R.id.adult);
        this.PatientChild = (RadioButton) findViewById(R.id.child);
        SharedPreferences sharedPreferences = getSharedPreferences("gzj", 0);
        this.gzj = sharedPreferences;
        int i = sharedPreferences.getInt("PatientType", 0);
        this.m_patienttype = i;
        if (i == 0) {
            this.PatientAdult.setChecked(true);
        } else {
            this.PatientChild.setChecked(true);
        }
        this.PatientType_rgp.setOnCheckedChangeListener(this.mOnCheckedChangeListenerMpl);
        this.PatientSex_rgp = (RadioGroup) findViewById(R.id.PatientSex_rgp);
        this.PatientMan = (RadioButton) findViewById(R.id.PatientMan);
        this.PatientWoman = (RadioButton) findViewById(R.id.PatientWoman);
        int i2 = this.gzj.getInt("PatientSex", 0);
        this.m_patientsex = i2;
        if (i2 == 0) {
            this.PatientMan.setChecked(true);
        } else {
            this.PatientWoman.setChecked(true);
        }
        this.PatientSex_rgp.setOnCheckedChangeListener(this.mOnCheckedChangeListenerMpl);
        this.m_BedNo.setText(this.gzj.getInt("Bedno", 1) + "");
        this.m_patientname.setText(this.gzj.getString("PatientName", "Rose"));
    }

    public void UpdatePatientInfo() {
        SharedPreferences.Editor edit = this.gzj.edit();
        edit.putInt("PatientType", this.m_patienttype);
        edit.putInt("PatientSex", this.m_patientsex);
        int parseInt = Integer.parseInt(this.m_BedNo.getText().toString());
        edit.putInt("Bedno", parseInt);
        if (parseInt < 1 || parseInt > 64) {
            ShowMessage(R.string.CenterPortError);
        }
        edit.putInt("controlTxtPort", parseInt + 6000);
        edit.putString("PatientName", this.m_patientname.getText().toString());
        edit.commit();
    }

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

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

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

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.BedNo:
                initTopKeyboard(this.m_BedNo);
                setlayoutParams(340, 170, 0, 0);
                break;
            case R.id.Btn_UpdatePatient:
                StartConfirmActivity();
                break;
            case R.id.Btn_back:
                finish();
                break;
        }
    }

    @Override
    protected void onActivityResult(int i, int i2, Intent intent) {
        if (i == 1 && intent != null && intent.getExtras().getBoolean("popupresult")) {
            UpdatePatientInfo();
            Bundle bundle = new Bundle();
            bundle.putBoolean("UpdatePatient", true);
            Intent intent2 = new Intent();
            intent2.putExtras(bundle);
            setResult(10, intent2);
            finish();
        }
    }

    public void StartConfirmActivity() {
        Bundle bundle = new Bundle();
        bundle.putInt("popuptextview", R.string.ClearDatabase);
        Intent intent = new Intent();
        intent.putExtras(bundle);
        intent.setClass(this, PopUpParaDefaultActivity.class);
        startActivityForResult(intent, 1);
    }

    @Override
    public boolean onTouchEvent(MotionEvent motionEvent) {
        if (motionEvent.getAction() == 1) {
            ((InputMethodManager) getSystemService("input_method")).hideSoftInputFromWindow(this.m_patientname.getWindowToken(), 0);
        }
        return true;
    }

    @Override
    public void initTopKeyboard(EditText editText) {
        if (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);
            return;
        }
        if (this.keyboard.getVisibility() == 0) {
            this.keyboard.setVisibility(4);
            this.ima_top.setVisibility(4);
        } else if (this.keyboard.getVisibility() == 4) {
            this.keyboard.setVisibility(0);
            this.ima_top.setVisibility(0);
        }
    }

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

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

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

        @Override
        public void onCheckedChanged(RadioGroup radioGroup, int i) {
            switch (i) {
                case R.id.PatientMan:
                    PatientsInfo.this.m_patientsex = 0;
                    break;
                case R.id.PatientWoman:
                    PatientsInfo.this.m_patientsex = 1;
                    break;
                case R.id.adult:
                    PatientsInfo.this.m_patienttype = 0;
                    break;
                case R.id.child:
                    PatientsInfo.this.m_patienttype = 1;
                    break;
            }
        }
    }
}