导航菜单

页面标题

页面副标题

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

正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 IPset.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.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 IPset extends Activity implements View.OnTouchListener, KeyboardUtilInterface {
    private static final int CONTROLIP = 1;
    private static final int SERVERIP = 0;
    private static final int SERVERIP_CONTROLIP = 2;
    private TextView controlIP;
    private TextView controlPort;
    private EditText controlTxtIP;
    private EditText controlTxtPort;
    private TextView duankouView;
    RadioButton gwbox;
    RadioButton gwserver;
    public SharedPreferences gzj;
    ImageView ima_top;
    KeyboardView keyboard;
    KeyboardUtil keyboardUtil;
    private TextView serverIpView;
    private RadioGroup srcgroup;
    private EditText txtIP;
    private EditText txtPort;
    private RadioButton unup;
    private RadioButton up2Control;
    private RadioButton up2Server;
    private TextView updataView;
    private RadioGroup uploadData;
    AppGlobal myApp = null;
    public int ifuploaddata = 0;
    public int tempIfuploaddata = 0;
    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.ipsetting);
        this.myApp.SetBackgroundLight(this, -255, 78, true);
        setFinishOnTouchOutside(false);
        FontManager.changeFonts((ViewGroup) getWindow().getDecorView(), this, Typeface.createFromAsset(getAssets(), "fonts/MSBlack.ttf"));
        this.gzj = getSharedPreferences("gzj", 0);
        ((TextView) findViewById(R.id.Btn_confirm)).setOnTouchListener(this);
        ((TextView) findViewById(R.id.Btn_back)).setOnTouchListener(this);
        this.updataView = (TextView) findViewById(R.id.updata);
        this.duankouView = (TextView) findViewById(R.id.duankou);
        this.serverIpView = (TextView) findViewById(R.id.serverip);
        this.srcgroup = (RadioGroup) findViewById(R.id.datasrc);
        this.uploadData = (RadioGroup) findViewById(R.id.upDa);
        this.unup = (RadioButton) findViewById(R.id.unup);
        this.up2Server = (RadioButton) findViewById(R.id.uptoserver);
        this.up2Control = (RadioButton) findViewById(R.id.uptocontrol);
        this.controlIP = (TextView) findViewById(R.id.controlip);
        this.controlPort = (TextView) findViewById(R.id.controlPort);
        this.controlTxtIP = (EditText) findViewById(R.id.controltxtIP);
        this.controlTxtPort = (EditText) findViewById(R.id.controltxtPort);
        this.txtIP = (EditText) findViewById(R.id.txtIP);
        this.txtPort = (EditText) findViewById(R.id.txtPort);
        this.gwbox = (RadioButton) findViewById(R.id.gwbox);
        this.gwserver = (RadioButton) findViewById(R.id.gwserver);
        int i = this.gzj.getInt("ifuploaddata", 0);
        this.ifuploaddata = i;
        this.tempIfuploaddata = i;
        if (i == 1) {
            this.uploadData.check(R.id.uptoserver);
            this.srcgroup.check(R.id.gwbox);
            frozenIP(true, 0);
        } else if (i == 0) {
            this.uploadData.check(R.id.unup);
            frozenIP(false, 2);
        }
        int i2 = this.ifuploaddata;
        if (i2 == 2) {
            this.uploadData.check(R.id.unup);
            this.srcgroup.check(R.id.gwserver);
            frozenIP(true, 0);
            frozenDataload(false);
        } else if (i2 == 3) {
            this.uploadData.check(R.id.uptocontrol);
            this.srcgroup.check(R.id.gwbox);
            frozenIP(true, 2);
        }
        this.uploadData.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i3) {
                if (IPset.this.srcgroup.getCheckedRadioButtonId() == 2131362641) {
                    IPset.this.GetDeviceStatus(i3);
                }
            }
        });
        this.txtIP.setOnTouchListener(this);
        this.txtPort.setOnTouchListener(this);
        this.controlTxtIP.setOnTouchListener(this);
        this.controlTxtPort.setOnTouchListener(this);
        this.txtIP.setText(this.gzj.getString("serverip", "192.168.0.86"));
        this.txtPort.setText(Integer.toString(this.gzj.getInt("serverport", 9876)));
        this.controlTxtIP.setText(this.gzj.getString("controlTxtIP", "192.168.0.86"));
        this.controlTxtPort.setText(Integer.toString(this.gzj.getInt("Bedno", 1) + 6000));
        shield();
        this.srcgroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i3) {
                int checkedRadioButtonId = IPset.this.uploadData.getCheckedRadioButtonId();
                if (i3 == 2131362641) {
                    IPset.this.frozenDataload(true);
                    IPset.this.GetDeviceStatus(checkedRadioButtonId);
                } else if (i3 == 2131362642) {
                    IPset.this.frozenDataload(false);
                    IPset.this.frozenIP(false, 2);
                    IPset.this.unup.isChecked();
                    IPset.this.frozenServerIP(true);
                    IPset.this.ifuploaddata = 2;
                }
            }
        });
        if (this.myApp.isconnect) {
            frozenIP(false, 2);
            this.srcgroup.setEnabled(false);
            this.gwbox.setEnabled(false);
            this.gwserver.setEnabled(false);
            frozenDataload(false);
        }
    }

    public void GetDeviceStatus(int i) {
        if (i == 2131363742) {
            this.ifuploaddata = 0;
            this.gwserver.setEnabled(true);
            this.gwserver.setTextColor(-1);
            frozenIP(false, 2);
            return;
        }
        if (i == 2131363748) {
            this.ifuploaddata = 1;
            this.gwbox.isChecked();
            this.gwserver.setEnabled(false);
            this.gwserver.setTextColor(-7829368);
            frozenIP(true, 0);
            return;
        }
        if (i == 2131363747) {
            this.ifuploaddata = 3;
            this.gwbox.isChecked();
            this.gwserver.setEnabled(false);
            this.gwserver.setTextColor(-7829368);
            frozenIP(true, 2);
        }
    }

    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();
    }

    public boolean UpdateNetInfo() {
        SharedPreferences.Editor edit = this.gzj.edit();
        edit.putString("serverip", this.txtIP.getText().toString());
        edit.putInt("serverport", Integer.parseInt(this.txtPort.getText().toString()));
        edit.putString("controlTxtIP", this.controlTxtIP.getText().toString());
        int parseInt = Integer.parseInt(this.controlTxtPort.getText().toString());
        if (parseInt < 6001 || parseInt > 6064) {
            ShowMessage(R.string.CenterPortError);
            return false;
        }
        edit.putInt("controlTxtPort", parseInt);
        edit.putInt("ifuploaddata", this.ifuploaddata);
        edit.putInt("Bedno", Integer.parseInt(this.controlTxtPort.getText().toString()) - 6000);
        edit.commit();
        return true;
    }

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

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

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

    public void StartConfirmActivity() {
        if (UpdateNetInfo()) {
            Bundle bundle = new Bundle();
            bundle.putBoolean("UpdatePatient", true);
            Intent intent = new Intent();
            intent.putExtras(bundle);
            setResult(10, intent);
            finish();
        }
    }

    @Override
    public boolean onTouchEvent(MotionEvent motionEvent) {
        motionEvent.getAction();
        return true;
    }

    @Override
    public void initTopKeyboard(EditText editText) {
        KeyboardUtil keyboardUtil = this.keyboardUtil;
        if (keyboardUtil == null) {
            this.keyboardUtil = new KeyboardUtil(this, this, editText, true, false, true);
        } else {
            keyboardUtil.hideKeyboard();
            this.keyboardUtil = null;
            this.keyboardUtil = new KeyboardUtil(this, this, editText, true, false, true);
        }
        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);
        layoutParams.leftMargin = i;
        layoutParams.topMargin = i2;
        layoutParams.rightMargin = i3;
        layoutParams.bottomMargin = i4;
        ((RelativeLayout) findViewById(R.id.rel)).setLayoutParams(layoutParams);
    }

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

    class OnCheckedChangeListenerMpl implements RadioGroup.OnCheckedChangeListener {
        @Override
        public void onCheckedChanged(RadioGroup radioGroup, int i) {
        }

        OnCheckedChangeListenerMpl() {
        }
    }

    public void frozenIP(boolean z, int i) {
        if (i == 0) {
            frozenServerIP(z);
            frozenControlIP(!z);
        } else if (i == 1) {
            frozenServerIP(!z);
            frozenControlIP(z);
        } else if (i == 2) {
            frozenServerIP(z);
            frozenControlIP(z);
        }
    }

    private void frozenControlIP(boolean z) {
        this.controlTxtIP.setEnabled(z);
        this.controlTxtPort.setEnabled(z);
        if (!z) {
            this.controlIP.setTextColor(-7829368);
            this.controlPort.setTextColor(-7829368);
            this.controlTxtIP.setTextColor(-7829368);
            this.controlTxtPort.setTextColor(-7829368);
            return;
        }
        this.controlIP.setTextColor(-1);
        this.controlPort.setTextColor(-1);
        this.controlTxtIP.setTextColor(-1);
        this.controlTxtPort.setTextColor(-1);
    }

    public void frozenServerIP(boolean z) {
        this.txtIP.setEnabled(z);
        this.txtPort.setEnabled(z);
        if (!z) {
            this.txtIP.setTextColor(-7829368);
            this.txtPort.setTextColor(-7829368);
            this.serverIpView.setTextColor(-7829368);
            this.duankouView.setTextColor(-7829368);
            return;
        }
        this.txtIP.setTextColor(-1);
        this.txtPort.setTextColor(-1);
        this.serverIpView.setTextColor(-1);
        this.duankouView.setTextColor(-1);
    }

    public void frozenDataload(boolean z) {
        this.uploadData.setEnabled(z);
        this.unup.setEnabled(z);
        this.up2Server.setEnabled(z);
        this.up2Control.setEnabled(z);
        if (z) {
            this.unup.setTextColor(-1);
            this.up2Server.setTextColor(-1);
            this.up2Control.setTextColor(-1);
            this.updataView.setTextColor(-1);
            return;
        }
        this.unup.setTextColor(-7829368);
        this.up2Server.setTextColor(-7829368);
        this.up2Control.setTextColor(-7829368);
        this.updataView.setTextColor(-7829368);
    }

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

    @Override
    public boolean onTouch(android.view.View r5, android.view.MotionEvent r6) {
        throw new UnsupportedOperationException("Method not decompiled: cn.neoprint.padmonitor.ui.IPset.onTouch(android.view.View, android.view.MotionEvent):boolean");
    }
}