| | |
| | | package com.lotaai.canguiayw; |
| | | |
| | | import android.app.AlarmManager; |
| | | import android.app.PendingIntent; |
| | | import android.content.ComponentName; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.graphics.Canvas; |
| | | import android.graphics.Color; |
| | | import android.graphics.Paint; |
| | |
| | | jihuoBtn.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | String code = deviceCode.getText().toString().trim(); |
| | | /* String code = deviceCode.getText().toString().trim(); |
| | | String pwd = devicePwd.getText().toString().trim(); |
| | | if ("".equals(code) || "".equals(pwd)) { |
| | | DynamicToast.makeError(context, "设备号和设备秘钥必填", 3).show(); |
| | | return; |
| | | } |
| | | active(); |
| | | active();*/ |
| | | } |
| | | }); |
| | | saveBtn.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View view) { |
| | | DynamicToast.Config.getInstance().setTextSize(30).apply(); |
| | | String code = deviceCode.getText().toString().trim(); |
| | | String pwd = devicePwd.getText().toString().trim(); |
| | | /* String code = deviceCode.getText().toString().trim(); |
| | | String pwd = devicePwd.getText().toString().trim();*/ |
| | | String tty = list.get(chuanKouSpinner.getSelectedIndex()); |
| | | if ("".equals(code)) { |
| | | if ("".equals(tty)) { |
| | | DynamicToast.makeError(context, "设备号必填", 3).show(); |
| | | } else { |
| | | CacheDiskUtils.getInstance().put(SettingConfig.getInstance().Cache_Device_Code, code); |
| | | //CacheDiskUtils.getInstance().put(SettingConfig.getInstance().Cache_Device_Code, code); |
| | | // CacheDiskUtils.getInstance().put(SettingConfig.getInstance().Cache_Device_Pwd,pwd); |
| | | CacheDiskUtils.getInstance().put(SettingConfig.getInstance().Cache_Device_Tty, tty); |
| | | DynamicToast.makeSuccess(context, "保存成功", 3).show(); |
| | | restartApp(); |
| | | } |
| | | } |
| | | }); |
| | | return root; |
| | | } |
| | | |
| | | public void restartApp() { |
| | | Intent intent =getActivity().getPackageManager().getLaunchIntentForPackage(getActivity().getPackageName()); |
| | | ComponentName componentName = intent.getComponent(); |
| | | Intent mainIntent = Intent.makeRestartActivityTask(componentName); |
| | | startActivity(mainIntent); |
| | | Runtime.getRuntime().exit(0); |
| | | } |
| | | |
| | | public void active() { |
| | | HttpLoggerInterceptor loggingInterceptor = new HttpLoggerInterceptor(true); |