|
@@ -46,6 +46,8 @@ import org.greenrobot.eventbus.EventBus;
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
import org.greenrobot.eventbus.ThreadMode;
|
|
|
|
|
|
+import java.io.CharArrayWriter;
|
|
|
+
|
|
|
/**
|
|
|
* 其他页界面 fragment
|
|
|
* 1.4G和wifi的切换的功能
|
|
@@ -82,6 +84,9 @@ public class OtherFragment extends MvpFragment<OtherPresenter> implements OtherV
|
|
|
private EditText etRestorationcontract;
|
|
|
private EditText etRestorationwayContacts;
|
|
|
private Button btRrestorationcontractUpdate;
|
|
|
+ private Button btnContractUpdate;
|
|
|
+ private EditText etWayContacts;
|
|
|
+ private EditText etContract;
|
|
|
|
|
|
@Nullable
|
|
|
@Override
|
|
@@ -117,6 +122,7 @@ public class OtherFragment extends MvpFragment<OtherPresenter> implements OtherV
|
|
|
btnSquattingContentUdate.setOnClickListener(this);
|
|
|
btnCheckUpdate.setOnClickListener(this);
|
|
|
btRrestorationcontractUpdate.setOnClickListener(this);
|
|
|
+ btnContractUpdate.setOnClickListener(this);
|
|
|
}
|
|
|
|
|
|
private void initView(View inflate) {
|
|
@@ -129,56 +135,61 @@ public class OtherFragment extends MvpFragment<OtherPresenter> implements OtherV
|
|
|
btnSquattingContentUdate = inflate.findViewById(R.id.btn_squatting_content_udate);
|
|
|
etPlcContent = inflate.findViewById(R.id.et_plc_content);
|
|
|
etSquattingContent = inflate.findViewById(R.id.et_squatting_content);
|
|
|
- etPlcContent.setText(Hawk.get(Name.SERIALNUMBER, "4"));
|
|
|
- etSquattingContent.setText(Hawk.get(Name.TOILETSNUMBER,2)+"");
|
|
|
- llCheckBox = inflate.findViewById(R.id.ll_toiletcheckBox);
|
|
|
- btnPCheckUpdate = inflate.findViewById(R.id.btn_pcheckupdate);
|
|
|
- llPeopleCheckBox = inflate.findViewById(R.id.ll_peoplecheckBox);
|
|
|
- appCompatCheckBoxes = new AppCompatCheckBox[MyService.TOTAL_SUM];
|
|
|
- appCompatPeopleCheckBoxes = new AppCompatCheckBox[MyService.TOTAL_SUM];
|
|
|
etCleanCountContent = inflate.findViewById(R.id.et_cleancount_content);
|
|
|
- etCleanCountContent.setText(Hawk.get(Name.CLEANCOUNT,10)+"");
|
|
|
btnCleanCount = inflate.findViewById(R.id.btn_cleancount);
|
|
|
etRestorationcontract = inflate.findViewById(R.id.et_restorationway_contacts);
|
|
|
etRestorationwayContacts = inflate.findViewById(R.id.et_restorationcontract);
|
|
|
btRrestorationcontractUpdate = inflate.findViewById(R.id.btn_restorationcontract_update);
|
|
|
- etRestorationcontract.setText(Hawk.get(Name.NEXTTIME,"456"));
|
|
|
- etRestorationwayContacts.setText(Hawk.get(Name.LASTTIME,"123"));
|
|
|
+ llCheckBox = inflate.findViewById(R.id.ll_toiletcheckBox);
|
|
|
+ btnPCheckUpdate = inflate.findViewById(R.id.btn_pcheckupdate);
|
|
|
+ llPeopleCheckBox = inflate.findViewById(R.id.ll_peoplecheckBox);
|
|
|
+ btnContractUpdate = inflate.findViewById(R.id.btn_contract_update);
|
|
|
+ etWayContacts = inflate.findViewById(R.id.et_way_contacts);
|
|
|
+ etContract = inflate.findViewById(R.id.et_contract);
|
|
|
|
|
|
+
|
|
|
+ appCompatCheckBoxes = new AppCompatCheckBox[MyService.TOTAL_SUM];
|
|
|
+ appCompatPeopleCheckBoxes = new AppCompatCheckBox[MyService.TOTAL_SUM];
|
|
|
+ etPlcContent.setText(Hawk.get(Name.SERIALNUMBER, "4"));
|
|
|
+ etSquattingContent.setText(Hawk.get(Name.TOILETSNUMBER, 2) + "");
|
|
|
+ etCleanCountContent.setText(Hawk.get(Name.CLEANCOUNT, 10) + "");
|
|
|
+ etRestorationcontract.setText(Hawk.get(Name.NEXTTIME, "456"));
|
|
|
+ etRestorationwayContacts.setText(Hawk.get(Name.LASTTIME, "123"));
|
|
|
//如果没有监听,那么我们默认赋值为true
|
|
|
- isSelectCheckBox = Hawk.get(Name.ISSELECTCHECKBOX,null);
|
|
|
- isSelectPeopleCheckbox = Hawk.get(Name.ISSELECTPEOPLECHECKBOX,null);
|
|
|
- if (isSelectPeopleCheckbox==null) {//如果之前没有存储,那么我们重新创建,并初始化值。
|
|
|
+ isSelectCheckBox = Hawk.get(Name.ISSELECTCHECKBOX, null);
|
|
|
+ isSelectPeopleCheckbox = Hawk.get(Name.ISSELECTPEOPLECHECKBOX, null);
|
|
|
+ etContract.setText(Hawk.get(Name.COMPANY,""));
|
|
|
+ etWayContacts.setText(Hawk.get(Name.WAYCONTACTS,""));
|
|
|
+ if (isSelectPeopleCheckbox == null) {//如果之前没有存储,那么我们重新创建,并初始化值。
|
|
|
isSelectPeopleCheckbox = initTotileCheckBox();
|
|
|
- }else{
|
|
|
- if (isSelectPeopleCheckbox.length!= MyService.TOTAL_SUM) {
|
|
|
- isSelectPeopleCheckbox = initTotileCheckBox();
|
|
|
+ } else {
|
|
|
+ if (isSelectPeopleCheckbox.length != MyService.TOTAL_SUM) {
|
|
|
+ isSelectPeopleCheckbox = initTotileCheckBox();
|
|
|
}
|
|
|
}
|
|
|
for (int i = 0; i < MyService.TOTAL_SUM; i++) {
|
|
|
//生成一个厕所状态checkbox按钮
|
|
|
- AppCompatCheckBox aCheckBox = getAppCompatCheckBox(i,isSelectPeopleCheckbox[i]);
|
|
|
+ AppCompatCheckBox aCheckBox = getAppCompatCheckBox(i, isSelectPeopleCheckbox[i]);
|
|
|
//生成一个人体感应的checkbox按钮
|
|
|
|
|
|
- appCompatPeopleCheckBoxes[i]=aCheckBox;
|
|
|
+ appCompatPeopleCheckBoxes[i] = aCheckBox;
|
|
|
llPeopleCheckBox.addView(aCheckBox);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
- if (isSelectCheckBox==null) {//如果之前没有存储,那么我们重新创建,并初始化值。
|
|
|
+ if (isSelectCheckBox == null) {//如果之前没有存储,那么我们重新创建,并初始化值。
|
|
|
isSelectCheckBox = initTotileCheckBox();
|
|
|
- }else{
|
|
|
- if (isSelectCheckBox.length!= MyService.TOTAL_SUM) {
|
|
|
+ } else {
|
|
|
+ if (isSelectCheckBox.length != MyService.TOTAL_SUM) {
|
|
|
isSelectCheckBox = initTotileCheckBox();
|
|
|
}
|
|
|
}
|
|
|
for (int i = 0; i < MyService.TOTAL_SUM; i++) {
|
|
|
//生成一个厕所状态checkbox按钮
|
|
|
- AppCompatCheckBox aCheckBox = getAppCompatCheckBox(i,isSelectCheckBox[i]);
|
|
|
+ AppCompatCheckBox aCheckBox = getAppCompatCheckBox(i, isSelectCheckBox[i]);
|
|
|
//生成一个人体感应的checkbox按钮
|
|
|
|
|
|
- appCompatCheckBoxes[i]=aCheckBox;
|
|
|
+ appCompatCheckBoxes[i] = aCheckBox;
|
|
|
llCheckBox.addView(aCheckBox);
|
|
|
}
|
|
|
|
|
@@ -186,9 +197,9 @@ public class OtherFragment extends MvpFragment<OtherPresenter> implements OtherV
|
|
|
|
|
|
}
|
|
|
|
|
|
- private AppCompatCheckBox getAppCompatCheckBox(int i,boolean isSelectCheckBox) {
|
|
|
- AppCompatCheckBox aCheckBox =new AppCompatCheckBox(getContext());
|
|
|
- aCheckBox.setText(i+1+"号");
|
|
|
+ private AppCompatCheckBox getAppCompatCheckBox(int i, boolean isSelectCheckBox) {
|
|
|
+ AppCompatCheckBox aCheckBox = new AppCompatCheckBox(getContext());
|
|
|
+ aCheckBox.setText(i + 1 + "号");
|
|
|
aCheckBox.setChecked(isSelectCheckBox);
|
|
|
aCheckBox.setTextColor(UiUtil.getColorRes(R.color.logo_blue));
|
|
|
aCheckBox.setTextSize(UiUtil.getDimensionRes(R.dimen.sp_8));//不能直接写R.dimen.sp_7,否则直接获取60000多,而不是7sp
|
|
@@ -423,7 +434,7 @@ public class OtherFragment extends MvpFragment<OtherPresenter> implements OtherV
|
|
|
ToastUtil.showToast("请输入串口号");
|
|
|
break;
|
|
|
}
|
|
|
- Hawk.put(Name.SERIALNUMBER,plcContent);
|
|
|
+ Hawk.put(Name.SERIALNUMBER, plcContent);
|
|
|
ToastUtil.showToast(UiUtil.getStringRes(R.string.update_success));
|
|
|
break;
|
|
|
case R.id.btn_squatting_content_udate:
|
|
@@ -433,29 +444,29 @@ public class OtherFragment extends MvpFragment<OtherPresenter> implements OtherV
|
|
|
break;
|
|
|
}
|
|
|
MyService.TOTAL_SUM = Integer.valueOf(squattingContent);
|
|
|
- Hawk.put(Name.TOILETSNUMBER,Integer.valueOf(squattingContent));
|
|
|
- ToastUtil.showToast(UiUtil.getStringRes(R.string.update_success)+",重启触摸屏后生效");
|
|
|
+ Hawk.put(Name.TOILETSNUMBER, Integer.valueOf(squattingContent));
|
|
|
+ ToastUtil.showToast(UiUtil.getStringRes(R.string.update_success) + ",重启触摸屏后生效");
|
|
|
break;
|
|
|
case R.id.btn_tcheckupdate:
|
|
|
for (int i = 0; i < appCompatCheckBoxes.length; i++) {
|
|
|
//我们需要将状态存储起来,进来的时候需要读取,清洗的时候需要读取。
|
|
|
- isSelectCheckBox[i]= appCompatCheckBoxes[i].isChecked();
|
|
|
+ isSelectCheckBox[i] = appCompatCheckBoxes[i].isChecked();
|
|
|
}
|
|
|
- Hawk.put(Name.ISSELECTCHECKBOX,isSelectCheckBox);
|
|
|
- ToastUtil.showToast(UiUtil.getStringRes(R.string.update_success)+",重启触摸屏后生效");
|
|
|
+ Hawk.put(Name.ISSELECTCHECKBOX, isSelectCheckBox);
|
|
|
+ ToastUtil.showToast(UiUtil.getStringRes(R.string.update_success) + ",重启触摸屏后生效");
|
|
|
break;
|
|
|
case R.id.btn_pcheckupdate:
|
|
|
for (int i = 0; i < appCompatPeopleCheckBoxes.length; i++) {
|
|
|
//我们需要将状态存储起来,进来的时候需要读取,清洗的时候需要读取。
|
|
|
- isSelectPeopleCheckbox[i] = appCompatPeopleCheckBoxes[i].isChecked();
|
|
|
+ isSelectPeopleCheckbox[i] = appCompatPeopleCheckBoxes[i].isChecked();
|
|
|
}
|
|
|
- Hawk.put(Name.ISSELECTPEOPLECHECKBOX,isSelectPeopleCheckbox);
|
|
|
- ToastUtil.showToast(UiUtil.getStringRes(R.string.update_success)+",重启触摸屏后生效");
|
|
|
+ Hawk.put(Name.ISSELECTPEOPLECHECKBOX, isSelectPeopleCheckbox);
|
|
|
+ ToastUtil.showToast(UiUtil.getStringRes(R.string.update_success) + ",重启触摸屏后生效");
|
|
|
break;
|
|
|
case R.id.btn_cleancount:
|
|
|
String trim = etCleanCountContent.getText().toString().trim();
|
|
|
if (trim != null && !("".equals(trim))) {
|
|
|
- Hawk.put(Name.CLEANCOUNT,Integer.valueOf(trim));
|
|
|
+ Hawk.put(Name.CLEANCOUNT, Integer.valueOf(trim));
|
|
|
}
|
|
|
ToastUtil.showToast(UiUtil.getStringRes(R.string.update_success));
|
|
|
break;
|
|
@@ -464,34 +475,21 @@ public class OtherFragment extends MvpFragment<OtherPresenter> implements OtherV
|
|
|
String lastTime = etRestorationwayContacts.getText().toString().trim();//右边
|
|
|
//456
|
|
|
String nextTime = etRestorationcontract.getText().toString().trim();//左边
|
|
|
- if ("".equals(lastTime) &&"".equals(nextTime)) {
|
|
|
+ if ("".equals(lastTime) && "".equals(nextTime)) {
|
|
|
ToastUtil.showToast("修改失败");
|
|
|
return;
|
|
|
}
|
|
|
- Hawk.put(Name.LASTTIME,lastTime);
|
|
|
- Hawk.put(Name.NEXTTIME,nextTime);
|
|
|
- ToastUtil.showToast(UiUtil.getStringRes(R.string.update_success)+",重启触摸屏后生效");
|
|
|
- /*String[] lastTimeSplit = lastTime.split("");
|
|
|
- String[] nextTimeSplit = nextTime.split("");
|
|
|
- Log.d(TAG, "SplitonClick1: "+lastTimeSplit.length);
|
|
|
- Log.d(TAG, "SplitonClick1:"+nextTimeSplit.length);
|
|
|
- boolean isLastTime = false;
|
|
|
- boolean isNextTime = false;
|
|
|
- for (int i = 1; i < lastTimeSplit.length; i++) {
|
|
|
- Log.d(TAG, "lastTimeSplitonClick: "+lastTimeSplit[i]);
|
|
|
- if (10==Integer.valueOf(lastTimeSplit[i])){
|
|
|
- isLastTime=true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- for (int i = 1; i < nextTimeSplit.length; i++) {
|
|
|
- Log.d(TAG, "nextTimeSplitonClick: "+nextTimeSplit[i]);
|
|
|
-
|
|
|
- if (21==Integer.valueOf(nextTimeSplit[i])){
|
|
|
- isNextTime=true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }*/
|
|
|
+ Hawk.put(Name.LASTTIME, lastTime);
|
|
|
+ Hawk.put(Name.NEXTTIME, nextTime);
|
|
|
+ ToastUtil.showToast(UiUtil.getStringRes(R.string.update_success) + ",重启触摸屏后生效");
|
|
|
+ break;
|
|
|
+ case R.id.btn_contract_update:
|
|
|
+ String contract = etContract.getText().toString().trim();
|
|
|
+ String wayContacts = etWayContacts.getText().toString().trim();
|
|
|
+ Hawk.put(Name.COMPANY, contract);
|
|
|
+ Hawk.put(Name.WAYCONTACTS, wayContacts);
|
|
|
+ Log.d(TAG, "btn_contract_updateonClick: " + contract + ":" + wayContacts);
|
|
|
+ ToastUtil.showToast(UiUtil.getStringRes(R.string.update_success));
|
|
|
break;
|
|
|
}
|
|
|
}
|