正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 SPOSettingActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 SPOSettingActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package cn.neoprint.padmonitor.ui;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.inputmethodservice.KeyboardView;
import android.media.AudioManager;
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.SeekBar;
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 SPOSettingActivity extends Activity implements View.OnClickListener, KeyboardUtilInterface, SeekBar.OnSeekBarChangeListener {
private EditText PRAlarmHigh;
private EditText PRAlarmLow;
private TextView SpO2AlarmHigh;
private LinearLayout SpO2AlarmItem;
private TextView SpO2AlarmLow;
private TextView SpO2AlarmMid;
private TextView SpO2_cancle;
private TextView SpO2_default;
private TextView SpO2_goback;
private int SpO2alarmlevel;
private EditText Spo2AlarmHigh;
private EditText Spo2AlarmLow;
private Activity act;
private AudioManager audiomanage;
private Context ctx;
private int currentVolume;
public SharedPreferences gzj;
private ImageView ima_top;
private KeyboardView keyboard;
private KeyboardUtil keyboardUtil;
private RelativeLayout.LayoutParams layoutParams;
private int m_PRAlarmHigh;
private int m_PRAlarmLow;
public TextView m_SpO2alarmlevel;
private int m_Spo2AlarmHigh;
private int m_Spo2AlarmLow;
private int m_tempcurrentVolume;
private int maxvol;
private RelativeLayout relativeLayout;
private SeekBar seekBar;
private Switch spo2alarmswitch;
private int spo2speed;
private RadioButton spo2speed1;
private RadioButton spo2speed2;
private RadioGroup spo2speed_rgp;
private boolean m_spo2alarmswitch = false;
private boolean m_SpO2AlarmItemshow = false;
AppGlobal myApp = null;
@Override
public void initLeftKeyboard(EditText editText) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@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);
this.myApp.SetBackgroundLight(this, -255, 52, false);
setContentView(R.layout.sposetting);
setFinishOnTouchOutside(false);
FontManager.changeFonts((ViewGroup) getWindow().getDecorView(), this, Typeface.createFromAsset(getAssets(), "fonts/MSBlack.ttf"));
this.ctx = this;
this.act = this;
SeekBar seekBar = (SeekBar) findViewById(R.id.SeekBarPRVOL);
this.seekBar = seekBar;
seekBar.setOnSeekBarChangeListener(this);
setVolumeControlStream(2);
AudioManager audioManager = (AudioManager) getSystemService("audio");
this.audiomanage = audioManager;
this.maxvol = audioManager.getStreamMaxVolume(2);
int i = getSharedPreferences("gzj", 0).getInt("HRCurrentVolume", 7);
this.currentVolume = i;
this.m_tempcurrentVolume = i;
this.seekBar.setMax(this.maxvol);
this.seekBar.setProgress(this.currentVolume);
InitSpo2Setting();
}
@Override
public void finish() {
super.finish();
overridePendingTransition(0, R.anim.zoomout);
}
public void SetAlarmLevelText(int i) {
if (i == 0) {
this.m_SpO2alarmlevel.setText(R.string.ECGalarmhigh);
return;
}
if (i == 1) {
this.m_SpO2alarmlevel.setText(R.string.ECGalarmMid);
} else if (i == 2) {
this.m_SpO2alarmlevel.setText(R.string.ECGalarmhlow);
} else {
this.m_SpO2alarmlevel.setText(R.string.ECGalarmMid);
}
}
public void InitSpo2Setting() {
this.SpO2alarmlevel = this.gzj.getInt("SpO2alarmlevel", 1);
TextView textView = (TextView) findViewById(R.id.SpinnerSpo2alarm);
this.m_SpO2alarmlevel = textView;
textView.setOnClickListener(this);
this.SpO2AlarmItem = (LinearLayout) findViewById(R.id.SpinnerSPO2AlarmItem);
SetAlarmLevelText(this.SpO2alarmlevel);
this.m_SpO2alarmlevel.setOnClickListener(this);
this.SpO2AlarmItem.setVisibility(4);
this.m_SpO2AlarmItemshow = false;
TextView textView2 = (TextView) findViewById(R.id.SpinnerSPO2HighAlarmItem);
this.SpO2AlarmHigh = textView2;
textView2.setOnClickListener(this);
TextView textView3 = (TextView) findViewById(R.id.SpinnerSPO2MidAlarmItem);
this.SpO2AlarmMid = textView3;
textView3.setOnClickListener(this);
TextView textView4 = (TextView) findViewById(R.id.SpinnerSPO2LowAlarmItem);
this.SpO2AlarmLow = textView4;
textView4.setOnClickListener(this);
this.spo2speed_rgp = (RadioGroup) findViewById(R.id.spo2speed_rgp);
this.spo2speed1 = (RadioButton) findViewById(R.id.Spo2speed_1);
this.spo2speed2 = (RadioButton) findViewById(R.id.Spo2speed_2);
int i = this.gzj.getInt("spo2speed", 1);
this.spo2speed = i;
if (i == 0) {
this.spo2speed1.setChecked(true);
} else if (i == 1) {
this.spo2speed2.setChecked(true);
}
this.spo2speed_rgp.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i2) {
switch (i2) {
case R.id.Spo2speed_1:
SPOSettingActivity.this.spo2speed = 0;
break;
case R.id.Spo2speed_2:
SPOSettingActivity.this.spo2speed = 1;
break;
}
}
});
this.spo2alarmswitch = (Switch) findViewById(R.id.spo2alarmswitch);
boolean z = this.gzj.getBoolean("spo2alarmswitch", true);
this.m_spo2alarmswitch = z;
this.spo2alarmswitch.setChecked(z);
this.spo2alarmswitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean z2) {
if (SPOSettingActivity.this.myApp.m_ALMPermission) {
SPOSettingActivity.this.m_spo2alarmswitch = z2;
} else {
SPOSettingActivity.this.showMessage(R.string.AlarmTip);
SPOSettingActivity.this.spo2alarmswitch.setChecked(SPOSettingActivity.this.m_spo2alarmswitch);
}
}
});
this.Spo2AlarmHigh = (EditText) findViewById(R.id.spo2_high);
this.m_Spo2AlarmHigh = this.gzj.getInt("Spo2AlarmHigh", 100);
this.Spo2AlarmHigh.setText("" + this.m_Spo2AlarmHigh);
this.Spo2AlarmHigh.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
SPOSettingActivity sPOSettingActivity = SPOSettingActivity.this;
sPOSettingActivity.initTopKeyboard(sPOSettingActivity.Spo2AlarmHigh);
SPOSettingActivity.this.setlayoutParams(170, 270, 0, 0);
return false;
}
});
this.Spo2AlarmLow = (EditText) findViewById(R.id.spo2_low);
this.m_Spo2AlarmLow = this.gzj.getInt(GzjSharePref.KEY_SPO2_ALARM_LOW, 90);
this.Spo2AlarmLow.setText("" + this.m_Spo2AlarmLow);
this.Spo2AlarmLow.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
SPOSettingActivity sPOSettingActivity = SPOSettingActivity.this;
sPOSettingActivity.initTopKeyboard(sPOSettingActivity.Spo2AlarmLow);
SPOSettingActivity.this.setlayoutParams(460, 270, 0, 0);
return false;
}
});
this.PRAlarmHigh = (EditText) findViewById(R.id.pr_high);
this.m_PRAlarmHigh = this.gzj.getInt("PRAlarmHigh", 120);
this.PRAlarmHigh.setText("" + this.m_PRAlarmHigh);
this.PRAlarmHigh.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
SPOSettingActivity sPOSettingActivity = SPOSettingActivity.this;
sPOSettingActivity.initTopKeyboard(sPOSettingActivity.PRAlarmHigh);
SPOSettingActivity.this.setlayoutParams(170, 320, 0, 0);
return false;
}
});
this.PRAlarmLow = (EditText) findViewById(R.id.pr_low);
this.m_PRAlarmLow = this.gzj.getInt("PRAlarmLow", 50);
this.PRAlarmLow.setText("" + this.m_PRAlarmLow);
this.PRAlarmLow.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
SPOSettingActivity sPOSettingActivity = SPOSettingActivity.this;
sPOSettingActivity.initTopKeyboard(sPOSettingActivity.PRAlarmLow);
SPOSettingActivity.this.setlayoutParams(460, 320, 0, 0);
return false;
}
});
shield();
TextView textView5 = (TextView) findViewById(R.id.spo2_goback);
this.SpO2_goback = textView5;
textView5.setOnClickListener(this);
TextView textView6 = (TextView) findViewById(R.id.spo2_default);
this.SpO2_default = textView6;
textView6.setOnClickListener(this);
TextView textView7 = (TextView) findViewById(R.id.spo2_cancle);
this.SpO2_cancle = textView7;
textView7.setOnClickListener(this);
}
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 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 Savepara() {
boolean z;
String str = (this.Spo2AlarmHigh.getText() == null || this.Spo2AlarmHigh.getText().toString().equals("")) ? "" + getString(R.string.spo2_2) + " " : "";
if (this.Spo2AlarmLow.getText() == null || this.Spo2AlarmLow.getText().toString().equals("")) {
str = str + getString(R.string.spo2_3) + " ";
}
if (this.PRAlarmHigh.getText() == null || this.PRAlarmHigh.getText().toString().equals("")) {
str = str + getString(R.string.PR_alarmhigh) + " ";
}
if (this.PRAlarmLow.getText() == null || this.PRAlarmLow.getText().toString().equals("")) {
str = str + getString(R.string.PR_alarmlow) + " ";
}
if (!str.equals("")) {
ShowAlertDialog(str, 0);
return false;
}
int parseInt = Integer.parseInt(this.Spo2AlarmHigh.getText().toString());
int parseInt2 = Integer.parseInt(this.Spo2AlarmLow.getText().toString());
String str2 = (parseInt > 100 || parseInt < 0 || parseInt2 > 100 || parseInt2 < 0) ? " 0--100" : "";
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();
if (parseInt == this.gzj.getInt("Spo2AlarmHigh", 100) && parseInt2 == this.gzj.getInt(GzjSharePref.KEY_SPO2_ALARM_LOW, 90)) {
z = false;
} else {
this.myApp.OtherparaList.add((byte) 14);
this.myApp.OtherparaList.add((byte) 1);
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;
}
int parseInt3 = Integer.parseInt(this.PRAlarmHigh.getText().toString());
int parseInt4 = Integer.parseInt(this.PRAlarmLow.getText().toString());
String str3 = (parseInt3 > 250 || parseInt3 < 30 || parseInt4 > 250 || parseInt4 < 30) ? " 30--250bpm" : "";
if (!str3.equals("")) {
ShowAlertDialog(str3, 1);
return false;
}
if (str3.equals("") && parseInt3 < parseInt4) {
ShowAlertDialog(getString(R.string.RangeOfdataError), 1);
return false;
}
if (parseInt3 != this.gzj.getInt("PRAlarmHigh", 120) || parseInt4 != this.gzj.getInt("PRAlarmLow", 50)) {
this.myApp.OtherparaList.add((byte) 14);
this.myApp.OtherparaList.add((byte) 0);
this.myApp.OtherparaList.add(Byte.valueOf((byte) (parseInt3 & 255)));
this.myApp.OtherparaList.add(Byte.valueOf((byte) ((parseInt3 & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8)));
this.myApp.OtherparaList.add(Byte.valueOf((byte) (parseInt4 & 255)));
this.myApp.OtherparaList.add(Byte.valueOf((byte) ((parseInt4 & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8)));
z = true;
}
if (this.SpO2alarmlevel != this.gzj.getInt("SpO2alarmlevel", 1)) {
this.myApp.OtherparaList.add((byte) 13);
this.myApp.OtherparaList.add(Byte.valueOf((byte) (this.SpO2alarmlevel | 16)));
z = true;
}
if (this.m_spo2alarmswitch != this.gzj.getBoolean("spo2alarmswitch", true)) {
this.myApp.OtherparaList.add((byte) 15);
if (this.m_spo2alarmswitch) {
this.myApp.OtherparaList.add(Byte.valueOf(ConstDefine.msg_RemoteOffLine));
} else {
this.myApp.OtherparaList.add((byte) 16);
}
z = true;
}
SharedPreferences.Editor edit = this.gzj.edit();
edit.putInt("Spo2AlarmHigh", Integer.parseInt(this.Spo2AlarmHigh.getText().toString()));
edit.putInt(GzjSharePref.KEY_SPO2_ALARM_LOW, Integer.parseInt(this.Spo2AlarmLow.getText().toString()));
edit.putInt("PRAlarmHigh", Integer.parseInt(this.PRAlarmHigh.getText().toString()));
edit.putInt("PRAlarmLow", Integer.parseInt(this.PRAlarmLow.getText().toString()));
edit.putInt(GzjSharePref.KEY_HR_ALARM_HIGH, Integer.parseInt(this.PRAlarmHigh.getText().toString()));
edit.putInt(GzjSharePref.KEY_HR_ALARM_LOW, Integer.parseInt(this.PRAlarmLow.getText().toString()));
edit.putInt("spo2speed", this.spo2speed);
edit.putBoolean("spo2alarmswitch", this.m_spo2alarmswitch);
edit.putInt("SpO2alarmlevel", this.SpO2alarmlevel);
int i = this.m_tempcurrentVolume;
if (i != this.currentVolume) {
edit.putInt("HRCurrentVolume", i);
this.currentVolume = this.m_tempcurrentVolume;
}
edit.commit();
Bundle bundle = new Bundle();
bundle.putBoolean("netparaset", z);
Intent intent = new Intent();
intent.putExtras(bundle);
setResult(10, intent);
return true;
}
public void ResetParaExcu() {
this.spo2speed = 1;
this.m_spo2alarmswitch = true;
this.SpO2alarmlevel = 1;
this.Spo2AlarmHigh.setText("100");
this.Spo2AlarmLow.setText("90");
this.PRAlarmHigh.setText("120");
this.PRAlarmLow.setText("50");
Savepara();
finish();
}
@Override
protected void onActivityResult(int i, int i2, Intent intent) {
if (i == 1 && intent != null && intent.getExtras().getBoolean("popupresult")) {
ResetParaExcu();
}
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.SpinnerSPO2HighAlarmItem:
this.SpO2alarmlevel = 0;
SetAlarmLevelText(0);
this.SpO2AlarmItem.setVisibility(4);
this.m_SpO2AlarmItemshow = false;
break;
case R.id.SpinnerSPO2LowAlarmItem:
this.SpO2alarmlevel = 2;
SetAlarmLevelText(2);
this.SpO2AlarmItem.setVisibility(4);
this.m_SpO2AlarmItemshow = false;
break;
case R.id.SpinnerSPO2MidAlarmItem:
this.SpO2alarmlevel = 1;
SetAlarmLevelText(1);
this.SpO2AlarmItem.setVisibility(4);
this.m_SpO2AlarmItemshow = false;
break;
case R.id.SpinnerSpo2alarm:
if (this.m_SpO2AlarmItemshow) {
this.SpO2AlarmItem.setVisibility(4);
} else {
this.SpO2AlarmItem.setVisibility(0);
}
this.m_SpO2AlarmItemshow = !this.m_SpO2AlarmItemshow;
break;
case R.id.spo2_cancle:
finish();
break;
case R.id.spo2_default:
Bundle bundle = new Bundle();
bundle.putInt("popuptextview", R.string.dialog_SpO2ParaSetting);
Intent intent = new Intent();
intent.putExtras(bundle);
intent.setClass(this, PopUpParaDefaultActivity.class);
startActivityForResult(intent, 1);
break;
case R.id.spo2_goback:
if (Savepara()) {
finish();
break;
}
break;
}
}
@Override
public void initTopKeyboard(EditText editText) {
KeyboardUtil keyboardUtil = this.keyboardUtil;
if (keyboardUtil == null) {
this.keyboardUtil = new KeyboardUtil(this.act, this.ctx, editText, false, false);
} else {
keyboardUtil.hideKeyboard();
this.keyboardUtil = null;
this.keyboardUtil = new KeyboardUtil(this.act, this.ctx, editText, false, false);
}
KeyboardView keyboardView = (KeyboardView) this.act.findViewById(R.id.keyboard_view);
this.keyboard = keyboardView;
keyboardView.setVisibility(0);
ImageView imageView = (ImageView) this.act.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) this.act.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.Spo2AlarmHigh, false);
method.invoke(this.Spo2AlarmLow, false);
method.invoke(this.PRAlarmHigh, false);
method.invoke(this.PRAlarmLow, false);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean z) {
this.audiomanage.setStreamVolume(2, i, 4);
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
this.m_tempcurrentVolume = this.audiomanage.getStreamVolume(2);
}
}