From 51f8633b379efab41a8b19a375d5e41785a15ee6 Mon Sep 17 00:00:00 2001
From: 张海江 <181069201@qq.com>
Date: Fri, 11 Aug 2017 09:14:40 +0800
Subject: [PATCH] 提交代码

---
 app/src/main/java/com/moral/yunfushao/fragment/FragmentMonitor.java |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/app/src/main/java/com/moral/yunfushao/fragment/FragmentMonitor.java b/app/src/main/java/com/moral/yunfushao/fragment/FragmentMonitor.java
index c87006a..978a126 100644
--- a/app/src/main/java/com/moral/yunfushao/fragment/FragmentMonitor.java
+++ b/app/src/main/java/com/moral/yunfushao/fragment/FragmentMonitor.java
@@ -197,6 +197,14 @@
             pv.setPercent(0);
             tv_ljjl.setText("0");
             tv_shishi.setText("0");
+        }else if(msg.getType() == AppConfig.CHANGE_SETTING){
+            if(timer!=null){
+                timer.cancel();
+                timer = null;
+            }
+            submitTime = MainApp.theApp.sharedPreferencesUtil.getLoginInfo().getRefresh_frequency();
+            isupLoad  = MainApp.theApp.sharedPreferencesUtil.getLoginInfo().getIs_open_upload();
+            doTask();
         }
     }
 
@@ -242,11 +250,13 @@
         iv_his.setOnClickListener(this);
         iv_search.setOnClickListener(this);
     }
-
+    int submitTime;
+    int isupLoad;
     @Override
     protected void initData() {
+        submitTime = MainApp.theApp.sharedPreferencesUtil.getLoginInfo().getRefresh_frequency();
+        isupLoad  = MainApp.theApp.sharedPreferencesUtil.getLoginInfo().getIs_open_upload();
         doTask();
-
     }
 
     @Override
@@ -268,7 +278,7 @@
                 if(mBluetoothService==null){
                     return;
                 }
-                mBluetoothService.write(mBluetoothService.getWirteCharacteristic().getService().getUuid().toString(),mBluetoothService.getWirteCharacteristic().getUuid().toString(),"5A0014010001000000000000004600000000005B",null);
+                mBluetoothService.write(mBluetoothService.getWirteCharacteristic().getService().getUuid().toString(),mBluetoothService.getWirteCharacteristic().getUuid().toString(),BLECommon.BLE_SEARCH,null);
                 break;
         }
 
@@ -278,8 +288,6 @@
     protected void onErrorPagerClick() {
 
     }
-
-    private boolean isFinish = false;
     Timer timer;
 
     private void doTask() {
@@ -287,12 +295,12 @@
         timer.schedule(new TimerTask() {
             @Override
             public void run() {
-                if (!isFinish) {
+                if (isupLoad == 1) {
                     //������������
                     submitData();
                 }
             }
-        }, 0, 10000);
+        }, 0, submitTime);
     }
 
     private void submitData() {

--
Gitblit v1.8.0