[*]将电磁版本的唤醒心跳改成两秒,唤醒之后回到30一次心跳
[*]整体版本页面显示的绝对安全换成了安全
[*]自定义语音修改和优化,添加了无声的选择
5 files added
31 files modified
1023 ■■■■ changed files
.gradle/4.1/fileHashes/fileHashes.bin patch | view | raw | blame | history
.gradle/4.1/fileHashes/fileHashes.lock patch | view | raw | blame | history
.gradle/4.1/fileHashes/resourceHashesCache.bin patch | view | raw | blame | history
.gradle/4.1/javaCompile/classAnalysis.bin patch | view | raw | blame | history
.gradle/4.1/javaCompile/jarAnalysis.bin patch | view | raw | blame | history
.gradle/4.1/javaCompile/javaCompile.lock patch | view | raw | blame | history
.gradle/4.1/javaCompile/taskHistory.bin patch | view | raw | blame | history
.gradle/4.1/javaCompile/taskJars.bin patch | view | raw | blame | history
.gradle/4.1/taskHistory/fileSnapshots.bin patch | view | raw | blame | history
.gradle/4.1/taskHistory/taskHistory.bin patch | view | raw | blame | history
.gradle/4.1/taskHistory/taskHistory.lock patch | view | raw | blame | history
FastBleLib/FastBleLib.iml 70 ●●●●● patch | view | raw | blame | history
FastBleLib/src/main/java/com/clj/fastble/bluetooth/BleBluetooth.java 2 ●●● patch | view | raw | blame | history
FastBleLib/src/main/java/com/clj/fastble/conn/BleConnector.java 23 ●●●●● patch | view | raw | blame | history
andbrickslib/andbrickslib.iml 81 ●●●●● patch | view | raw | blame | history
andbrickslib/src/main/java/com/moral/andbrickslib/utils/StringUtils.java 2 ●●● patch | view | raw | blame | history
app/app.iml 83 ●●●●● patch | view | raw | blame | history
app/build.gradle 42 ●●●● patch | view | raw | blame | history
app/src/main/java/com/moral/yunfushao/MainActivity.java 19 ●●●● patch | view | raw | blame | history
app/src/main/java/com/moral/yunfushao/activity/BLESearchActivity.java 9 ●●●●● patch | view | raw | blame | history
app/src/main/java/com/moral/yunfushao/activity/ChooseSongActivity.java 52 ●●●●● patch | view | raw | blame | history
app/src/main/java/com/moral/yunfushao/activity/VoiceSetActivity.java 11 ●●●● patch | view | raw | blame | history
app/src/main/java/com/moral/yunfushao/adapter/BleDeviceAdapter.java 1 ●●●● patch | view | raw | blame | history
app/src/main/java/com/moral/yunfushao/ble/BLECommon.java 3 ●●●● patch | view | raw | blame | history
app/src/main/java/com/moral/yunfushao/ble/BluetoothService.java 15 ●●●●● patch | view | raw | blame | history
app/src/main/java/com/moral/yunfushao/fragment/FragmentMonitor.java 242 ●●●●● patch | view | raw | blame | history
app/src/main/java/com/moral/yunfushao/fragment/FragmentSettings.java 175 ●●●● patch | view | raw | blame | history
app/src/main/java/com/moral/yunfushao/ui/PanelView.java 4 ●●● patch | view | raw | blame | history
app/src/main/java/com/moral/yunfushao/utils/PermissionUtil.java 37 ●●●●● patch | view | raw | blame | history
app/src/main/res/anim/progress.xml 13 ●●●●● patch | view | raw | blame | history
app/src/main/res/layout/ac_ble_search_layout.xml 76 ●●●●● patch | view | raw | blame | history
app/src/main/res/layout/fragment_monitor_layout.xml 12 ●●●●● patch | view | raw | blame | history
app/src/main/res/layout/fragment_setting_layout.xml 51 ●●●●● patch | view | raw | blame | history
app/src/main/res/mipmap-hdpi/tips.png patch | view | raw | blame | history
app/src/main/res/mipmap-xxhdpi/tips.png patch | view | raw | blame | history
key.jks patch | view | raw | blame | history
.gradle/4.1/fileHashes/fileHashes.bin
Binary files differ
.gradle/4.1/fileHashes/fileHashes.lock
Binary files differ
.gradle/4.1/fileHashes/resourceHashesCache.bin
Binary files differ
.gradle/4.1/javaCompile/classAnalysis.bin
Binary files differ
.gradle/4.1/javaCompile/jarAnalysis.bin
Binary files differ
.gradle/4.1/javaCompile/javaCompile.lock
Binary files differ
.gradle/4.1/javaCompile/taskHistory.bin
Binary files differ
.gradle/4.1/javaCompile/taskJars.bin
Binary files differ
.gradle/4.1/taskHistory/fileSnapshots.bin
Binary files differ
.gradle/4.1/taskHistory/taskHistory.bin
Binary files differ
.gradle/4.1/taskHistory/taskHistory.lock
Binary files differ
FastBleLib/FastBleLib.iml
@@ -8,11 +8,11 @@
    </facet>
    <facet type="android" name="Android">
      <configuration>
        <option name="SELECTED_BUILD_VARIANT" value="debug" />
        <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
        <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
        <option name="SELECTED_BUILD_VARIANT" value="release" />
        <option name="ASSEMBLE_TASK_NAME" value="assembleRelease" />
        <option name="COMPILE_JAVA_TASK_NAME" value="compileReleaseSources" />
        <afterSyncTasks>
          <task>generateDebugSources</task>
          <task>generateReleaseSources</task>
        </afterSyncTasks>
        <option name="ALLOW_USER_CONFIGURATION" value="false" />
        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
@@ -24,46 +24,32 @@
    </facet>
  </component>
  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
    <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
    <output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
    <output url="file://$MODULE_DIR$/build/intermediates/classes/release" />
    <output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/release" />
    <exclude-output />
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/release" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/release" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/release" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/res" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/resources" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/assets" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/aidl" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/java" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/rs" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/shaders" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/res" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/resources" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/assets" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/aidl" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/java" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/rs" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/shaders" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
FastBleLib/src/main/java/com/clj/fastble/bluetooth/BleBluetooth.java
@@ -449,7 +449,6 @@
        @Override
        public void onServicesDiscovered(BluetoothGatt gatt, int status) {
            BleLog.i("BleGattCallback:onServicesDiscovered " + mtu);
            bluetoothGatt.requestMtu(mtu);
            connectionState = STATE_SERVICES_DISCOVERED;
            Iterator iterator = callbackHashMap.entrySet().iterator();
            while (iterator.hasNext()) {
@@ -459,6 +458,7 @@
                    ((BluetoothGattCallback) call).onServicesDiscovered(gatt, status);
                }
            }
            bluetoothGatt.requestMtu(mtu);
        }
        @Override
FastBleLib/src/main/java/com/clj/fastble/conn/BleConnector.java
@@ -130,6 +130,8 @@
                && (getCharacteristic().getProperties() | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) {
            BleLog.w(TAG, "characteristic.getProperties():" + getCharacteristic().getProperties());
            System.out.println("chenqi enableCharacteristicNotify =>" + uuid_notify);
            handleCharacteristicNotificationCallback(bleCallback, uuid_notify);
            return setCharacteristicNotification(getBluetoothGatt(), getCharacteristic(), true, bleCallback);
@@ -342,18 +344,8 @@
                                                          final String uuid_notify) {
        if (bleCallback != null) {
//            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//                bluetoothGatt.requestMtu(10);
//            }
            listenAndTimer(bleCallback, MSG_NOTIFY_CHA, uuid_notify, new BluetoothGattCallback() {
                AtomicBoolean msgRemoved = new AtomicBoolean(false);
                @Override
                public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
                    super.onConnectionStateChange(gatt, status, newState);
                }
                @Override
                public void onCharacteristicChanged(BluetoothGatt gatt,
                                                    BluetoothGattCharacteristic characteristic) {
@@ -361,10 +353,9 @@
                        handler.removeMessages(MSG_NOTIFY_CHA, this);
                    }
                    System.out.println("chenqi Notify Hex ->" + BleBluetooth.dumpHex(characteristic.getValue()));
                    if (characteristic.getUuid().equals(UUID.fromString(uuid_notify))) {
                        System.out.println("chenqi Notify ->" + characteristic.getValue().length);
                        System.out.println("chenqi Notify Hex ->" + BleBluetooth.dumpHex(characteristic.getValue()));
                        bleCallback.onSuccess(characteristic);
                    }
                }
@@ -387,6 +378,7 @@
                @Override
                public void onCharacteristicChanged(BluetoothGatt gatt,
                                                    BluetoothGattCharacteristic characteristic) {
                    System.out.println("chenqi Notify Hex indicate->" + BleBluetooth.dumpHex(characteristic.getValue()));
                    if (!msgRemoved.getAndSet(true)) {
                        handler.removeMessages(MSG_INDICATE_DES, this);
                    }
@@ -410,6 +402,8 @@
                public void onCharacteristicWrite(BluetoothGatt gatt,
                                                  BluetoothGattCharacteristic characteristic, int status) {
                    handler.removeMessages(MSG_WRITE_CHA, this);
                    System.out.println("chenqi Notify Hex write->" + BleBluetooth.dumpHex(characteristic.getValue()));
                    if (status == BluetoothGatt.GATT_SUCCESS) {
                        if (characteristic.getUuid().equals(UUID.fromString(uuid_write))) {
@@ -435,6 +429,8 @@
                @Override
                public void onCharacteristicRead(BluetoothGatt gatt,
                                                 BluetoothGattCharacteristic characteristic, int status) {
                    System.out.println("chenqi Notify Hex indicate read->" + BleBluetooth.dumpHex(characteristic.getValue()));
                    if (!msgRemoved.getAndSet(true)) {
                        handler.removeMessages(MSG_READ_CHA, this);
                    }
@@ -460,6 +456,8 @@
                @Override
                public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) {
                    handler.removeMessages(MSG_READ_RSSI, this);
                    System.out.println("chenqi Notify Hex rssi->" + BleBluetooth.dumpHex(characteristic.getValue()));
                    if (status == BluetoothGatt.GATT_SUCCESS) {
                        bleCallback.onSuccess(rssi);
                    } else {
@@ -487,7 +485,6 @@
    private void listenAndTimer(BleCallback bleCallback, int what, String uuid, BluetoothGattCallback callback) {
        bleCallback.setBluetoothGattCallback(callback);
        bleBluetooth.addGattCallback(uuid, callback);
        Message msg = handler.obtainMessage(what, bleCallback);
        handler.sendMessageDelayed(msg, timeOutMillis);
    }
andbrickslib/andbrickslib.iml
@@ -8,11 +8,11 @@
    </facet>
    <facet type="android" name="Android">
      <configuration>
        <option name="SELECTED_BUILD_VARIANT" value="debug" />
        <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
        <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
        <option name="SELECTED_BUILD_VARIANT" value="release" />
        <option name="ASSEMBLE_TASK_NAME" value="assembleRelease" />
        <option name="COMPILE_JAVA_TASK_NAME" value="compileReleaseSources" />
        <afterSyncTasks>
          <task>generateDebugSources</task>
          <task>generateReleaseSources</task>
        </afterSyncTasks>
        <option name="ALLOW_USER_CONFIGURATION" value="false" />
        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
@@ -24,46 +24,32 @@
    </facet>
  </component>
  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
    <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
    <output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
    <output url="file://$MODULE_DIR$/build/intermediates/classes/release" />
    <output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/release" />
    <exclude-output />
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/release" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/release" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/release" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/res" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/resources" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/assets" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/aidl" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/java" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/rs" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/shaders" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/res" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/resources" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/assets" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/aidl" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/java" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/rs" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/shaders" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
@@ -130,16 +116,5 @@
    <orderEntry type="library" name="Gradle: com.android.support:support-core-utils-25.3.1" level="project" />
    <orderEntry type="library" name="Gradle: com.squareup.okio:okio:1.9.0@jar" level="project" />
    <orderEntry type="library" name="Gradle: com.afollestad.material-dialogs:commons-0.9.4.4" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-idling-resource-2.2.2" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: javax.annotation:javax.annotation-api:1.2@jar" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-core-2.2.2" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:rules-0.5" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1@jar" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:runner-0.5" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:exposed-instrumentation-api-publish-0.5" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-library:1.3@jar" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-integration:1.3@jar" level="project" />
  </component>
</module>
andbrickslib/src/main/java/com/moral/andbrickslib/utils/StringUtils.java
@@ -453,6 +453,6 @@
        for (int i = start; i <= end; i++) {
            buffer.append(strings[i]);
        }
        return buffer.toString();
        return buffer.toString().trim();
    }
}
app/app.iml
@@ -8,11 +8,11 @@
    </facet>
    <facet type="android" name="Android">
      <configuration>
        <option name="SELECTED_BUILD_VARIANT" value="debug" />
        <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
        <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
        <option name="SELECTED_BUILD_VARIANT" value="release" />
        <option name="ASSEMBLE_TASK_NAME" value="assembleRelease" />
        <option name="COMPILE_JAVA_TASK_NAME" value="compileReleaseSources" />
        <afterSyncTasks>
          <task>generateDebugSources</task>
          <task>generateReleaseSources</task>
        </afterSyncTasks>
        <option name="ALLOW_USER_CONFIGURATION" value="false" />
        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
@@ -23,46 +23,32 @@
    </facet>
  </component>
  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
    <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
    <output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
    <output url="file://$MODULE_DIR$/build/intermediates/classes/release" />
    <output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/release" />
    <exclude-output />
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/release" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/release" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/release" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/release" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/res" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/resources" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/assets" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/aidl" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/java" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/rs" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/release/shaders" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/res" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/resources" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/assets" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/aidl" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/java" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/rs" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/testRelease/shaders" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
@@ -140,19 +126,6 @@
    <orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable-25.3.1" level="project" />
    <orderEntry type="library" name="Gradle: com.squareup.okio:okio:1.9.0@jar" level="project" />
    <orderEntry type="library" name="Gradle: com.android.support:support-core-utils-25.3.1" level="project" />
    <orderEntry type="module" module-name="andbrickslib" />
    <orderEntry type="module" module-name="FastBleLib" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-idling-resource-2.2.2" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: javax.annotation:javax.annotation-api:1.2@jar" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-core-2.2.2" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:rules-0.5" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1@jar" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:runner-0.5" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:exposed-instrumentation-api-publish-0.5" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-library:1.3@jar" level="project" />
    <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-integration:1.3@jar" level="project" />
    <orderEntry type="module" module-name="andbrickslib" />
    <orderEntry type="module" module-name="FastBleLib" />
  </component>
app/build.gradle
@@ -8,16 +8,18 @@
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 2
        versionName "1.0.2_sp3"
        versionName "1.0.2_sp10"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        signingConfig signingConfigs.debug
    }
    signingConfigs {
        key {
            keyAlias 'qxpc'
            keyPassword '123456'
            storeFile file('../pregnancy_guard_android/qixingpiaochong')
            storePassword '123456'
            keyAlias 'moral'
            keyPassword 'moral123456'
            storeFile file('../pregnancy_guard_android/key.jks')
            storePassword 'moral123456'
        }
    }
    sourceSets {
@@ -54,22 +56,22 @@
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:cardview-v7:25.3.1'
    testCompile 'junit:junit:4.12'
    compile project(':andbrickslib')
    compile project(':FastBleLib')
    implementation 'com.android.support:appcompat-v7:25.3.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:cardview-v7:25.3.1'
    testImplementation 'junit:junit:4.12'
    implementation project(':andbrickslib')
    implementation project(':FastBleLib')
    //下拉刷新
    compile 'in.srain.cube:ultra-ptr:1.0.11'
    implementation 'in.srain.cube:ultra-ptr:1.0.11'
    //图片加载
    compile 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    //网络请求
    compile 'com.lzy.net:okgo:2.1.4'
    compile files('libs/BaiduLBS_Android.jar')
    compile 'pub.devrel:easypermissions:0.4.0'
    compile 'com.daimajia.numberprogressbar:library:1.4@aar'
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.github.lecho:hellocharts-library:1.5.8@aar'
    compile 'com.contrarywind:Android-PickerView:3.1.2'
    implementation 'com.lzy.net:okgo:2.1.4'
    implementation files('libs/BaiduLBS_Android.jar')
    implementation 'pub.devrel:easypermissions:0.4.0'
    implementation 'com.daimajia.numberprogressbar:library:1.4@aar'
    implementation 'org.greenrobot:eventbus:3.0.0'
    implementation 'com.github.lecho:hellocharts-library:1.5.8@aar'
    implementation 'com.contrarywind:Android-PickerView:3.1.2'
}
app/src/main/java/com/moral/yunfushao/MainActivity.java
@@ -6,6 +6,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask;
@@ -43,6 +44,7 @@
import com.moral.yunfushao.model.EventMessage;
import com.moral.yunfushao.model.User;
import com.moral.yunfushao.update.UpdateManager;
import com.moral.yunfushao.utils.PermissionUtil;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONException;
@@ -86,6 +88,7 @@
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        bindService();
        PermissionUtil.verifyStoragePermissions(this);
    }
    @Override
@@ -213,6 +216,20 @@
        }
    }
    @Override
    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if (requestCode == 1) {
            for (int i = 0; i < permissions.length; i++) {
                if (grantResults[i] != PackageManager.PERMISSION_GRANTED) {
                    //申请失败
                    PermissionUtil.verifyStoragePermissions(this);
                }
            }
        }
    }
    UpdateManager manager = new UpdateManager(MainActivity.this);
    private class checkUpdateTask extends AsyncTask<String, Void, String> {
@@ -307,8 +324,6 @@
        public void onServiceDisconnected(ComponentName name) {
            mBluetoothService = null;
        }
    };
    private BluetoothService.Callback callback = new BluetoothService.Callback() {
app/src/main/java/com/moral/yunfushao/activity/BLESearchActivity.java
@@ -105,10 +105,10 @@
                    if (MainApp.theApp.bleManager != null) {
                        MainApp.theApp.bleManager.closeBluetoothGatt();
                    }
                    mBluetoothService.connectDevice(scanResultList.get(position));
                    EventMessage eventMessage = new EventMessage();
                    eventMessage.setType(AppConfig.BLUETOOCH_CHANGE_CONNECT);
                    EventBus.getDefault().post(eventMessage);
                    mBluetoothService.connectDevice(scanResultList.get(position));
                }
            }
@@ -121,7 +121,8 @@
    @Override
    protected void initListener() {
        iv_search.setOnClickListener(this);
//        iv_search.setOnClickListener(this);
        iv_searchpic.setOnClickListener(this);
    }
    @Override
@@ -132,7 +133,8 @@
    @Override
    protected void processClick(View view) {
        switch (view.getId()) {
            case R.id.iv_search:
            case R.id.iv_searchpic:
                mBluetoothService.openBlueTooth();
                if (isScan) {
                    if (mBluetoothService != null) {
                        mBluetoothService.cancelScan();
@@ -249,7 +251,6 @@
                progressDialog.dismiss();
                finish();
            }
        }
    };
app/src/main/java/com/moral/yunfushao/activity/ChooseSongActivity.java
@@ -3,48 +3,38 @@
import android.content.Intent;
import android.content.res.AssetManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import com.lzy.okgo.cache.CacheMode;
import com.moral.andbrickslib.baseadapter.headandfooter.DividerItemDecoration;
import com.moral.andbrickslib.baseadapter.recyclerview.MultiItemTypeAdapter;
import com.moral.yunfushao.MainApp;
import com.moral.yunfushao.R;
import com.moral.yunfushao.adapter.SongAdapter;
import com.moral.yunfushao.adapter.VoiceAdapter;
import com.moral.yunfushao.base.BaseListActivity;
import com.moral.yunfushao.common.API;
import com.moral.yunfushao.httputils.HttpCallBack;
import com.moral.yunfushao.httputils.HttpUtils;
import com.moral.yunfushao.model.Song;
import com.moral.yunfushao.model.VoiceBean;
import com.moral.yunfushao.utils.AudioUtils;
import com.moral.yunfushao.utils.PermissionUtil;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by haijiang on 2017/7/12.
 */
public class ChooseSongActivity extends BaseListActivity implements SongAdapter.OnBtnClickListener{
public class ChooseSongActivity extends BaseListActivity implements SongAdapter.OnBtnClickListener {
    private SongAdapter adapter;
    private ArrayList<Song> voiceList = new ArrayList<>();
    AssetManager am;
    MediaPlayer mp;
    Handler mHandler = new Handler(){
    Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            if(msg.what == 1){
            if (msg.what == 1) {
                setNormalView();
                mPtrFrame.refreshComplete();
                adapter.notifyDataSetChanged();
@@ -52,9 +42,11 @@
        }
    };
    private int index;
    @Override
    protected void initOtherView() {
        index = getIntent().getIntExtra("position",0);
        PermissionUtil.verifyStoragePermissions(this);
        index = getIntent().getIntExtra("position", 0);
        tv_title.setText("本地铃声");
        DividerItemDecoration line = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST);
        mRecyclerView.addItemDecoration(line);
@@ -78,7 +70,6 @@
    protected void onLoadMore() {
    }
    @Override
@@ -89,7 +80,7 @@
    @Override
    protected void onDestroy() {
        super.onDestroy();
        if(mp!=null&&mp.isPlaying()){
        if (mp != null && mp.isPlaying()) {
            mp.stop();
            mp.release();
        }
@@ -104,18 +95,21 @@
    protected void initListener() {
    }
     Thread mThread;
    Thread mThread;
    @Override
    protected void initData() {
        getData();
    }
    private void  getData(){
    private void getData() {
        setLoadingView();
        mThread = new Thread(new Runnable() {
            @Override
            public void run() {
                ArrayList<Song> temp = AudioUtils.getAllSongs(ChooseSongActivity.this);
                if(temp!=null){
                if (temp != null) {
                    voiceList.clear();
                    voiceList.addAll(temp);
                    mHandler.sendEmptyMessage(1);
@@ -127,7 +121,7 @@
    @Override
    protected void processClick(View view) {
        switch (view.getId()){
        switch (view.getId()) {
            case R.id.tv_left:
                finish();
                break;
@@ -143,14 +137,14 @@
    @Override
    public void playClick(int position) {
        Song voiceBean = voiceList.get(position);
        if(voiceBean.isPlay()){
        if (voiceBean.isPlay()) {
            mp.stop();
            voiceBean.setPlay(false);
        }else{
            if(mp!=null&&mp.isPlaying()){
        } else {
            if (mp != null && mp.isPlaying()) {
                mp.stop();
                mp.release();
                for (Song voice :voiceList){
                for (Song voice : voiceList) {
                    voice.setPlay(false);
                }
                adapter.notifyDataSetChanged();
@@ -171,10 +165,10 @@
    @Override
    public void setClick(int position) {
        Intent intent = new Intent();
        intent.putExtra("position",index);
        intent.putExtra("url",voiceList.get(position).getFileUrl());
        intent.putExtra("name",voiceList.get(position).getTitle());
        setResult(RESULT_OK,intent);
        intent.putExtra("position", index);
        intent.putExtra("url", voiceList.get(position).getFileUrl());
        intent.putExtra("name", voiceList.get(position).getTitle());
        setResult(RESULT_OK, intent);
        finish();
    }
}
app/src/main/java/com/moral/yunfushao/activity/VoiceSetActivity.java
@@ -20,7 +20,6 @@
import com.moral.yunfushao.R;
import com.moral.yunfushao.adapter.VoiceAdapter;
import com.moral.yunfushao.base.BaseListActivity;
import com.moral.yunfushao.ble.BLECommon;
import com.moral.yunfushao.common.API;
import com.moral.yunfushao.common.AppConfig;
import com.moral.yunfushao.httputils.HttpCallBack;
@@ -46,6 +45,7 @@
    MediaPlayer mp;
    private MaterialDialog resetDialog;
    private int oldType = 0;
    private void showReset() {
        resetDialog = MaterialDialogUtils.showCallBaclDialog(this, "温馨提示", "是否重置为默认铃声?", new MaterialDialog.SingleButtonCallback() {
@@ -101,6 +101,8 @@
                MainApp.theApp.sharedPreferencesUtil.saveVideoList(FastJsonTools.toJson(voiceList));
                adapter.notifyDataSetChanged();
                mToatUtils.showSingleLongToast("铃声设置成功");
                oldType = MainApp.theApp.sharedPreferencesUtil.getVoiceType();
                MainApp.theApp.sharedPreferencesUtil.saveVoiceType(3);
                EventMessage eventMessage = new EventMessage();
                eventMessage.setType(AppConfig.SET_VOICE);
                EventBus.getDefault().post(eventMessage);
@@ -184,8 +186,10 @@
                adapter.notifyDataSetChanged();
            }
            if (voiceBean.isDefaultMusic()) {
                mp = MediaPlayer.create(this, Uri.parse(voiceBean.getRes()));
                mp.start();
                if (voiceBean.getRes() != null) {
                    mp = MediaPlayer.create(this, Uri.parse(voiceBean.getRes()));
                    mp.start();
                }
            } else {
                mp = new MediaPlayer();
                try {
@@ -269,6 +273,7 @@
        voiceBean.setVoiceName("默认");
        voiceList.add(voiceBean);
        MainApp.theApp.sharedPreferencesUtil.saveVideoList(FastJsonTools.toJson(voiceList));
        MainApp.theApp.sharedPreferencesUtil.saveVoiceType(oldType);
        adapter.notifyDataSetChanged();
        EventMessage eventMessage = new EventMessage();
        eventMessage.setType(AppConfig.SET_VOICE);
app/src/main/java/com/moral/yunfushao/adapter/BleDeviceAdapter.java
@@ -15,7 +15,6 @@
/**
 * Created by haijiang on 2017/7/6.
 */
public class BleDeviceAdapter extends CommonAdapter<ScanResult> {
    public BleDeviceAdapter(RecyclerView v, int layoutId, List<ScanResult> datas) {
        super(v, layoutId, datas);
app/src/main/java/com/moral/yunfushao/ble/BLECommon.java
@@ -10,7 +10,8 @@
    public final static String USR_SERVICE = "0003cdd0-0000-1000-8000-00805f9b0131";
    public final static String BLE_SEARCH = "6A09010002006B";
    public final static String BLE_CLEAR = "6A09010001006B";
    public final static String BLE_HEART =  "6A09010005006B";//心跳3分钟发一次
    public final static String BLE_HEART =  "6A070100050D6B";//心跳3分钟发一次
    //0x6A    0x07    0x01    0x00    0x05    0x0d    0x6B
    public final static String BLE_HOUR_REC =  "7A7B";//心跳3分钟发一次
    //接收到7A开头的数据后会发给蓝牙设备的确认信号
app/src/main/java/com/moral/yunfushao/ble/BluetoothService.java
@@ -154,6 +154,12 @@
            mCallback.onConnecting();
        }
        System.out.println("chenqi blename old = "+ MainApp.theApp.sharedPreferencesUtil.getBLE());
        System.out.println("chenqi blename = "+ scanResult.getDevice().getAddress());
        openBlueTooth();
        bleManager.connectDevice(scanResult, false, new BleGattCallback() {
            @Override
@@ -561,6 +567,8 @@
            mCallback.onStartScan();
        }
        openBlueTooth();
        bleManager.scanMacAndConnect(mac, 5000, false, new BleGattCallback() {
            @Override
            public void onFoundDevice(ScanResult scanResult) {
@@ -590,6 +598,7 @@
            @Override
            public void onConnectError(BleException exception) {
                System.out.println("chenqi chenqi" + exception.getDescription()) ;
                runOnMainThread(new Runnable() {
                    @Override
                    public void run() {
@@ -731,5 +740,9 @@
        }
    }
    public void openBlueTooth() {
        if (bleManager != null) {
            bleManager.enableBluetooth();
        }
    }
}
app/src/main/java/com/moral/yunfushao/fragment/FragmentMonitor.java
@@ -2,7 +2,6 @@
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattService;
@@ -13,7 +12,6 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
@@ -75,6 +73,7 @@
 */
public class FragmentMonitor extends BaseFragment {
    private String TGA = getClass().getSimpleName();
    /**
     * 报警铃声
     */
@@ -96,39 +95,65 @@
    //临时存储上传数据
    private ArrayList<RecData> submitTempResult = new ArrayList<>();
    private Timer heartTimer, resTimer, chonglianTimer;
    //心跳时间
    private int HEARTTIMES = 2;
    //重连时间
    private int RECONNECTTIMES = 8000;
    //handler管理线程
    private Handler handler = new Handler();
    private Runnable runnable = new Runnable() {
    private Runnable heartRunnable = new Runnable() {
        @Override
        public void run() {
            checkTime();
            checkTimeCount++;
            handler.postDelayed(this, 5000);
            if (MainApp.theApp.bleManager == null) {
                return;
            }
            if (!MainApp.theApp.bleManager.isConnectingOrConnected()) {
                return;
            }
            //发送心跳
            if (FragmentMonitor.this.mBluetoothService == null) {
                return;
            }
            if (FragmentMonitor.this.mBluetoothService.getWirteCharacteristic() == null) {
                return;
            }
            if (FragmentMonitor.this.mBluetoothService.getWirteCharacteristic().getService() == null) {
                return;
            }
            FragmentMonitor.this.mBluetoothService.write(FragmentMonitor.this.mBluetoothService.getWirteCharacteristic().getService().getUuid().toString(),
                    FragmentMonitor.this.mBluetoothService.getWirteCharacteristic().getUuid().toString(),
                    BLECommon.BLE_HEART, null);
            Log.d(TGA, "发送心跳");
            heart();
        }
    };
    private Runnable reconnectRunnable = new Runnable() {
        @Override
        public void run() {
            //重连
            if (FragmentMonitor.this.mBluetoothService == null) {
                return;
            }
            String mac = MainApp.theApp.sharedPreferencesUtil.getBLE();
            if (!TextUtils.isEmpty(mac) && MainApp.theApp.bleManager.isBlueEnable()) {
                if (MainApp.theApp.bleManager.isConnectingOrConnected()) {
                    return;
                }
                Log.d(TGA, "正在重连");
                FragmentMonitor.this.mBluetoothService.scanAndConnect5(mac);
            }
            reconnect();
        }
    };
    private int checkTimeCount = 0;
    private void doHandleData(String result) {
        if (StringUtils.isEmpty(result)) {
            return;
        }
        //如果包含"时间校准成功确认信号"或重试5次以上则停止继续校准时间操作
        if (result.startsWith(BLECommon.BLE_REC_TIME) || checkTimeCount > 5) {
            DebugUtils.sendData("data", result);
            handler.removeCallbacks(runnable);
            checkTimeCount = 0;
            if (result.length() > 14) {
                result = result.substring(14);
                doHandleData(result);
            }
        }
        if (result.startsWith("3A")) {
            if (result.length() >= 16) {
                DebugUtils.sendData("data", result);
@@ -171,12 +196,8 @@
     */
    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
    public void eventComing(EventMessage msg) {
        System.out.println("chenqi msge -> " + msg.getType());
        if (msg.getType() == AppConfig.GET_BLE_SERVICE) {
            if (chonglianTimer != null) {
                chonglianTimer.cancel();
                chonglianTimer = null;
            }
            resetHandler();
            pv.setStatusStr("检测中");
            //发现服务
            mBluetoothService = ((MainActivity) getActivity()).getBluetoothService();
@@ -203,7 +224,6 @@
                            mBluetoothService.setCharacteristic(characteristic);
                        }
                    }
                }
                /**
@@ -221,43 +241,30 @@
                                        String result = StringUtils.byteArrayToHexStr(characteristic.getValue());
                                        stringResult.append(result);
                                        doHandleData(result);
                                        stringResult = new StringBuilder();
                                    }
                                });
                                HEARTTIMES = 30;
                            }
                            @Override
                            public void onFailure(final BleException exception) {
                            }
                            @Override
                            public void onInitiatedResult(boolean result) {
                            }
                        });
                /**
                 * 发送时间校准
                 */
                handler.postDelayed(runnable, 5000);
                /**
                 * 一连上先发数据包
                 */
                if (mBluetoothService == null) {
                    return;
                }
                if (mBluetoothService.getWirteCharacteristic() == null) {
                    return;
                }
                mBluetoothService.write(mBluetoothService.getWirteCharacteristic().getService().getUuid().toString(), mBluetoothService.getWirteCharacteristic().getUuid().toString(), BLECommon.BLE_HEART, null);
//                handler.postDelayed(runnable, 5000);
                heart();
            }
        } else if (msg.getType() == AppConfig.GET_BLE_DISCONNECT) {
            preLevel = -1;
            showStatus(-1);
            chonglian();
            handler.postDelayed(reconnectRunnable, RECONNECTTIMES);
            stop();
            isVirating = false;
            AudioUtils.virateCancle(getActivity());
@@ -336,21 +343,20 @@
    }
    @Override
    public void onResume() {
        super.onResume();
        textShowMac();
    }
    @Override
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
        if (heartTimer != null) {
            heartTimer.cancel();
            heartTimer = null;
        }
        if (timer != null) {
            timer.cancel();
            timer = null;
        }
        if (chonglianTimer != null) {
            chonglianTimer.cancel();
            chonglianTimer = null;
        }
        handler.removeCallbacksAndMessages(null);
        stop();
        isVirating = false;
        AudioUtils.virateCancle(getActivity());
@@ -492,79 +498,18 @@
        }, 0, submitTime * 1000);
    }
    /**
     * 发送心跳包,每3分钟
     */
    @SuppressLint("HandlerLeak")
    Handler heartHandler = new Handler() {
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case 1:
                    if (MainApp.theApp.bleManager == null) {
                        return;
                    }
                    if (!MainApp.theApp.bleManager.isConnectingOrConnected()) {
                        return;
                    }
                    //发送心跳
                    if (FragmentMonitor.this.mBluetoothService == null) {
                        return;
                    }
                    if (FragmentMonitor.this.mBluetoothService.getWirteCharacteristic() == null) {
                        return;
                    }
                    if (FragmentMonitor.this.mBluetoothService.getWirteCharacteristic().getService() == null) {
                        return;
                    }
                    FragmentMonitor.this.mBluetoothService.write(FragmentMonitor.this.mBluetoothService.getWirteCharacteristic().getService().getUuid().toString(), FragmentMonitor.this.mBluetoothService.getWirteCharacteristic().getUuid().toString(), BLECommon.BLE_HEART, null);
                    Log.d("xintiao", "发送心跳");
                    break;
                case 2:
                    //重连
                    if (FragmentMonitor.this.mBluetoothService == null) {
                        return;
                    }
                    String mac = MainApp.theApp.sharedPreferencesUtil.getBLE();
                    if (!TextUtils.isEmpty(mac) && MainApp.theApp.bleManager.isBlueEnable()) {
                        if (MainApp.theApp.bleManager.isConnectingOrConnected()) {
                            return;
                        }
                        Log.d("chonglian", "正在重连");
                        FragmentMonitor.this.mBluetoothService.scanAndConnect5(mac);
                    }
                    break;
            }
            super.handleMessage(msg);
        }
    };
    private void heart() {
        if (heartTimer == null) {
            heartTimer = new Timer();
            heartTimer.schedule(new TimerTask() {
                @Override
                public void run() {
                    Message message = new Message();
                    message.what = 1;
                    heartHandler.sendMessage(message);
                }
            }, 0, 1000 * 30);
        }
        handler.postDelayed(heartRunnable, 1000 * HEARTTIMES);
    }
    private void chonglian() {
        if (chonglianTimer == null) {
            chonglianTimer = new Timer();
            chonglianTimer.schedule(new TimerTask() {
                @Override
                public void run() {
                    Message message = new Message();
                    message.what = 2;
                    heartHandler.sendMessage(message);
                }
            }, 0, 1000 * 8);
        }
    private void reconnect() {
        handler.postDelayed(reconnectRunnable, RECONNECTTIMES);
    }
    private void resetHandler() {
        handler.removeCallbacks(reconnectRunnable);
        handler.removeCallbacks(heartRunnable);
        HEARTTIMES = 2;
    }
    private void submitData() {
@@ -608,6 +553,7 @@
    private void showStatus(int level) {
        int yanzhang = R.mipmap.icon_yanzhong;
        int danger = R.mipmap.icon_danger;
        iv_dianliang.setVisibility(View.VISIBLE);
        if (type == 1) {
            //电离
            yanzhang = R.mipmap.icon_yanzhong;
@@ -661,6 +607,7 @@
            tv_status.setTextColor(getResources().getColor(R.color.red_txt));
            ll_status.setBackgroundResource(R.mipmap.bg_conner_red);
        } else if (level == -1) {
            iv_dianliang.setVisibility(View.GONE);
            tv_tishi.setText("当前设备离线");
            tv_tishi.setBackgroundResource(R.mipmap.bt_offline);
            iv_bottom_status.setImageResource(R.mipmap.icon_offline);
@@ -682,9 +629,29 @@
            tv_status.setText("充电中");
            ll_status.setBackgroundResource(R.mipmap.bg_corner_gray);
            pv.setPercent(0);
            pv.setStatusStr("连接中");
            pv.setStatusStr("充电中");
            tv_ljjl.setText("0");
            tv_shishi.setText("0");
        }
    }
    private void textShowMac() {
        if (BuildConfig.BUILD_TYPE.equals(VersionConstants.DEBUG)) {
            final TextView tv_text_mac = (TextView) findView(R.id.tv_text_mac);
            tv_desc.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    tv_text_mac.setText("Mac: " + MainApp.theApp.sharedPreferencesUtil.getBLE());
                    FlipAnimatorXViewShow(tv_desc, tv_text_mac, 100L);
                }
            });
            tv_text_mac.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    FlipAnimatorXViewShow(tv_text_mac, tv_desc, 100L);
                }
            });
        }
    }
@@ -776,13 +743,13 @@
        }
    }
    /**
     * 7A开头的是电离
     * 7A0024010002D8B04CE90E6300000003000003EE0000000000000EC6000000000017347B0D0A
     * 电磁辐射显示
     */
    private void parseHoutData(String nowResult) {
        System.out.println("chenqi elec parseHoutData" + nowResult);
        if (TextUtils.isEmpty(nowResult)) {
            return;
        }
@@ -791,13 +758,11 @@
        if (strings[0].startsWith("7A") && strings[35].endsWith("7B")) {
            String realString = StringUtils.subStrings(strings, 21, 23);
            int electric_field = Integer.parseInt(realString, 16);
            int b1 = Integer.parseInt(strings[24], 16);
            int b2 = Integer.parseInt(strings[25], 16);
            int baojing = Integer.parseInt(strings[29], 16);
            int elec = Integer.parseInt(StringUtils.subStrings(strings, 13, 15));
//            T.show("bl = " + strings[24] + " -- b2 = " + strings[25]);
//
//            System.out.println("bl = " + b1 + " -- b2 = " + b2);
            int b1 = Integer.parseInt(strings[24].trim(), 16);
            int b2 = Integer.parseInt(strings[25].trim(), 16);
            int baojing = Integer.parseInt(strings[29].trim(), 16);
            double elec = Integer.parseInt(StringUtils.subStrings(strings, 13, 15), 16);
            double electricFieldValue = (electric_field) / 100.0;
            double elecValue = (elec) / 100.0;
@@ -869,13 +834,11 @@
                    AudioUtils.vibrate(getActivity(), new long[]{1000, 1000, 1000, 1000}, 0);
                }
            }
            System.out.println("chenqi elec B-- " + b2);
            /**
             * 电量显示
             */
            showPower(b1, b2);
            submitResult.add(data);
            //            realResult.clear();
        }
    }
@@ -985,6 +948,11 @@
        }
    }
    /**
     * 播放警告声音
     *
     * @param level
     */
    public void play(int level) {
        Log.d("music", "preLevel:" + preLevel + "----level:" + level);
        if (preLevel == level) {
@@ -996,9 +964,11 @@
        }
        VoiceBean voiceBean = voiceList.get(level);
        if (voiceBean.isDefaultMusic()) {
            mp = MediaPlayer.create(getActivity(), Uri.parse(voiceBean.getRes()));
            mp.start();
            mp.setLooping(true);
            if (voiceBean.getRes() != null) {
                mp = MediaPlayer.create(getActivity(), Uri.parse(voiceBean.getRes()));
                mp.start();
                mp.setLooping(true);
            }
        } else {
            mp = new MediaPlayer();
            try {
app/src/main/java/com/moral/yunfushao/fragment/FragmentSettings.java
@@ -1,12 +1,16 @@
package com.moral.yunfushao.fragment;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.support.v7.widget.SwitchCompat;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -27,7 +31,6 @@
import com.moral.yunfushao.httputils.HttpUtils;
import com.moral.yunfushao.model.EventMessage;
import com.moral.yunfushao.model.VoiceBean;
import com.moral.yunfushao.utils.DebugUtils;
import org.greenrobot.eventbus.EventBus;
@@ -42,11 +45,12 @@
public class FragmentSettings extends BaseFragment {
    private TextView tv_version;
    private RelativeLayout rl_setvoice,rl_refresh;
    private RelativeLayout rl_setvoice, rl_refresh;
    private Button bt_sure;
    private Button bt_look;
    private SwitchCompat sc_open,sc_male;
    private int refreshIndex=0;
    private Button bt_look, sc_male;
    private SwitchCompat sc_open;
    private int refreshIndex = 0;
    @Override
    protected int getLayoutId() {
        return R.layout.fragment_setting_layout;
@@ -61,17 +65,11 @@
        sc_open = findView(R.id.sc_open);
        sc_male = findView(R.id.sc_male);
        tv_version = findView(R.id.tv_version);
        tv_version.setText("当前版本V"+getVersion());
        tv_version.setText("当前版本V" + getVersion());
//        bt_look.setVisibility(DebugUtils.debug_mode ? View.VISIBLE : View.GONE);
        bt_look.setVisibility(View.GONE);
        if (MainApp.theApp.sharedPreferencesUtil.getVoiceType() == 0) {
            sc_male.setChecked(false);
            sc_male.setText("男");
        }else{
            sc_male.setChecked(true);
            sc_male.setText("女");
        }
    }
    @Override
@@ -82,40 +80,123 @@
        sc_open.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(sc_open.isChecked()){
                    update("is_open_upload","1");
                }else{
                    update("is_open_upload","0");
                if (sc_open.isChecked()) {
                    update("is_open_upload", "1");
                } else {
                    update("is_open_upload", "0");
                }
            }
        });
        sc_male.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        sc_male.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                if(b){
                    sc_male.setText("女");
                    MainApp.theApp.sharedPreferencesUtil.saveVoiceType(1);
                    AppConfig.voideUrl1 = "http://yfsapi.7drlb.com/video/girl/music.mp3";
                    AppConfig.voideUrl2 = "http://yfsapi.7drlb.com/video/girl/music1.mp3";
                    AppConfig.voideUrl3 = "http://yfsapi.7drlb.com/video/girl/music2.mp3";
                }else{
                    sc_male.setText("男");
                    MainApp.theApp.sharedPreferencesUtil.saveVoiceType(0);
                    AppConfig.voideUrl1 = "http://yfsapi.7drlb.com/video/boy/music.mp3";
                    AppConfig.voideUrl2 = "http://yfsapi.7drlb.com/video/boy/music1.mp3";
                    AppConfig.voideUrl3 = "http://yfsapi.7drlb.com/video/boy/music2.mp3";
                }
                reset();
            public void onClick(View v) {
                chooseSoundCategory();
            }
        });
        bt_look.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                  Intent intent = new Intent(getActivity(), TestActivity.class);
                  startActivity(intent);
                Intent intent = new Intent(getActivity(), TestActivity.class);
                startActivity(intent);
            }
        });
    }
    @Override
    public void onResume() {
        super.onResume();
        switch (MainApp.theApp.sharedPreferencesUtil.getVoiceType()) {
            case 0:
                sc_male.setText("男声");
                break;
            case 1:
                sc_male.setText("女声");
                break;
            case 2:
                sc_male.setText("无声");
                break;
            case 3:
                sc_male.setText("自定义");
                break;
        }
    }
    /**
     * 选择声音弹出框
     */
    private void chooseSoundCategory() {
        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        ListView listView = new ListView(getActivity());
        ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getActivity(),
                android.R.layout.simple_expandable_list_item_1,
                new String[]{"男声", "女声", "无声"});
        listView.setAdapter(arrayAdapter);
        builder.setTitle("选择默认铃声!");
        builder.setIcon(R.mipmap.icon_voice);
        builder.setView(listView);
        final AlertDialog alertDialog = builder.create();
        alertDialog.show();
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                alertDialog.dismiss();
                ejectTips(position);
            }
        });
    }
    /**
     * 温馨提示弹出框
     */
    private void ejectTips(final int position) {
        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle("温馨提示!");
        builder.setIcon(R.mipmap.tips);
        builder.setMessage("将会覆盖之前自定义或者默认的声音,确定这么做么?");
        builder.setNegativeButton("确定", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                setUpDefaultRingtone(position);
            }
        });
        builder.setPositiveButton("取消", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        final AlertDialog alertDialog = builder.create();
        alertDialog.show();
    }
    private void setUpDefaultRingtone(int type) {
        switch (type) {
            case 0:
                sc_male.setText("男声");
                MainApp.theApp.sharedPreferencesUtil.saveVoiceType(0);
                AppConfig.voideUrl1 = "http://yfsapi.7drlb.com/video/boy/music.mp3";
                AppConfig.voideUrl2 = "http://yfsapi.7drlb.com/video/boy/music1.mp3";
                AppConfig.voideUrl3 = "http://yfsapi.7drlb.com/video/boy/music2.mp3";
                break;
            case 1:
                sc_male.setText("女声");
                MainApp.theApp.sharedPreferencesUtil.saveVoiceType(1);
                AppConfig.voideUrl1 = "http://yfsapi.7drlb.com/video/girl/music.mp3";
                AppConfig.voideUrl2 = "http://yfsapi.7drlb.com/video/girl/music1.mp3";
                AppConfig.voideUrl3 = "http://yfsapi.7drlb.com/video/girl/music2.mp3";
                break;
            case 2:
                sc_male.setText("无声");
                MainApp.theApp.sharedPreferencesUtil.saveVoiceType(2);
                AppConfig.voideUrl1 = null;
                AppConfig.voideUrl2 = null;
                AppConfig.voideUrl3 = null;
                break;
        }
        reset();
    }
    @Override
@@ -124,17 +205,17 @@
        timeList.add("20s");
        timeList.add("30s");
        int open = MainApp.theApp.sharedPreferencesUtil.getLoginInfo().getIs_open_upload();
        if(open == 0){
        if (open == 0) {
            sc_open.setChecked(false);
        }else{
        } else {
            sc_open.setChecked(true);
        }
        int refresh = MainApp.theApp.sharedPreferencesUtil.getLoginInfo().getRefresh_frequency();
        if(refresh == 10){
        if (refresh == 10) {
            refreshIndex = 0;
        }else if(refresh == 20){
        } else if (refresh == 20) {
            refreshIndex = 1;
        }else if(refresh == 30){
        } else if (refresh == 30) {
            refreshIndex = 2;
        }
    }
@@ -172,7 +253,7 @@
            @Override
            public void onOptionsSelect(int options1, int options2, int options3, View v) {
                refreshIndex = options1;
                update("refresh_frequency",(options1+1)*10+"");
                update("refresh_frequency", (options1 + 1) * 10 + "");
            }
        }).setOutSideCancelable(true).build();
        sexView.setSelectOptions(refreshIndex);
@@ -182,6 +263,7 @@
    /**
     * 字段名称,目前仅支持修改['refresh_frequency', 'video', 'is_open_upload']
     *
     * @param field
     * @param value
     */
@@ -195,9 +277,9 @@
            @Override
            public void onSuccess(String res, String msg) {
                mToatUtils.showSingletonToast(msg);
                if("refresh_frequency".equals(field)){
                if ("refresh_frequency".equals(field)) {
                    MainApp.theApp.sharedPreferencesUtil.setRefreh(Integer.parseInt(value));
                }else if("is_open_upload".equals(field)){
                } else if ("is_open_upload".equals(field)) {
                    MainApp.theApp.sharedPreferencesUtil.setUpload(Integer.parseInt(value));
                }
                EventMessage event = new EventMessage();
@@ -215,7 +297,7 @@
            }
            @Override
            public void onFail(int errno,String s) {
            public void onFail(int errno, String s) {
                mToatUtils.showSingletonToast(s);
                if (progressDialog.isShowing()) {
                    progressDialog.dismiss();
@@ -226,6 +308,7 @@
    /**
     * 获取版本号
     *
     * @return 当前应用的版本号
     */
    public String getVersion() {
@@ -241,6 +324,7 @@
    }
    private ArrayList<VoiceBean> voiceList = new ArrayList<>();
    private void reset() {
        voiceList.clear();
        VoiceBean voiceBean = new VoiceBean();
@@ -265,5 +349,6 @@
        EventMessage eventMessage = new EventMessage();
        eventMessage.setType(AppConfig.SET_VOICE);
        EventBus.getDefault().post(eventMessage);
        mToatUtils.showSingleLongToast("铃声设置成功");
    }
}
app/src/main/java/com/moral/yunfushao/ui/PanelView.java
@@ -60,7 +60,7 @@
    private Paint drawTextPaint;
    private int textColor = Color.GRAY;
    private int textSize = 36;
    private String[] level = {"绝对安全", "建议回避", "及时闪躲", "紧急撤离"};
    private String[] level = {"安全", "建议回避", "及时闪躲", "紧急撤离"};
    //内进度圆
    private Paint mCirclePaint;
@@ -225,8 +225,6 @@
        float bitH = circleR;
        float bitW = bitH * 0.448f;
        canvas.save();
        System.out.println("chenqi percent connect" + percent);
        canvas.rotate(percent * 300 - 150, mWidth / 2, mWidth / 2);
        RectF btmRect = new RectF((float) (cirlcleRect.left + bitH - bitW * 0.535), (float) (cirlcleRect.top + mCircleWidth * 0.68), (float) (cirlcleRect.left + bitH + bitW * 0.465), (float) (cirlcleRect.top + bitH + mCircleWidth * 0.68));
//        Log.d("haijiang","left="+btmRect.left);
app/src/main/java/com/moral/yunfushao/utils/PermissionUtil.java
New file
@@ -0,0 +1,37 @@
package com.moral.yunfushao.utils;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.v4.app.ActivityCompat;
/**
 * @author : chenqi.
 * @e_mail : 1650699704@163.com.
 * @create_time : 2018/11/5.
 * @Package_name: pregnancy_guard_android
 */
public class PermissionUtil {
    private static final int REQUEST_EXTERNAL_STORAGE = 1;
    private static String[] PERMISSIONS_STORAGE = {
            "android.permission.READ_EXTERNAL_STORAGE",
            "android.permission.WRITE_EXTERNAL_STORAGE"};
    public static void verifyStoragePermissions(Activity activity) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
            return;
        }
        try {
            //检测是否有写的权限
            int permission = ActivityCompat.checkSelfPermission(activity,
                    "android.permission.WRITE_EXTERNAL_STORAGE");
            if (permission != PackageManager.PERMISSION_GRANTED) {
                // 没有写的权限,去申请写的权限,会弹出对话框
                ActivityCompat.requestPermissions(activity, PERMISSIONS_STORAGE, REQUEST_EXTERNAL_STORAGE);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
app/src/main/res/anim/progress.xml
New file
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <rotate
        android:interpolator="@android:anim/linear_interpolator"
        android:pivotX="50%"
        android:pivotY="50%"
        android:fromDegrees="0"
        android:toDegrees="+360"
        android:duration="1500"
        android:startOffset="-1"
        android:repeatMode="restart"
        android:repeatCount="-1"/>
</set>
app/src/main/res/layout/ac_ble_search_layout.xml
@@ -16,18 +16,20 @@
        android:padding="@dimen/x16">
        <ImageView
            android:id="@+id/iv_searchpic"
            android:layout_width="@dimen/x140"
            android:layout_height="@dimen/x140"
            android:scaleType="centerCrop"
            android:src="@mipmap/bg_start" />
        <ImageView
            android:id="@+id/iv_search"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/x8"
            android:src="@mipmap/bt_start" />
            android:layout_marginBottom="@dimen/x10"
            android:src="@mipmap/bt_start"
            android:visibility="visible" />
        <ImageView
            android:id="@+id/iv_searchpic"
            android:layout_width="@dimen/x70"
            android:layout_height="@dimen/x70"
            android:scaleType="centerCrop"
            android:src="@mipmap/bg_start" />
    </LinearLayout>
    <LinearLayout
@@ -35,74 +37,84 @@
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="@dimen/x10"
            android:textColor="@color/dark_gray_txt"
            android:text="@string/caozuo"/>
            android:text="@string/caozuo"
            android:textColor="@color/dark_gray_txt" />
        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginLeft="@dimen/x10"
            android:background="@color/gray_line"/>
            android:background="@color/gray_line" />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="@dimen/x10"
            android:drawablePadding="@dimen/x8"
            android:drawableLeft="@mipmap/icon1"
            android:textColor="@color/dark_gray_txt"
            android:text="@string/caozuo1"/>
            android:drawablePadding="@dimen/x8"
            android:padding="@dimen/x10"
            android:text="@string/caozuo1"
            android:textColor="@color/dark_gray_txt" />
        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginLeft="@dimen/x10"
            android:background="@color/gray_line"/>
            android:background="@color/gray_line" />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="@dimen/x10"
            android:drawablePadding="@dimen/x8"
            android:drawableLeft="@mipmap/icon2"
            android:textColor="@color/dark_gray_txt"
            android:text="@string/caozuo2"/>
            android:drawablePadding="@dimen/x8"
            android:padding="@dimen/x10"
            android:text="@string/caozuo2"
            android:textColor="@color/dark_gray_txt" />
        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginLeft="@dimen/x10"
            android:background="@color/gray_line"/>
            android:background="@color/gray_line" />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="@dimen/x10"
            android:drawablePadding="@dimen/x8"
            android:drawableLeft="@mipmap/icon3"
            android:textColor="@color/dark_gray_txt"
            android:text="@string/caozuo3"/>
            android:drawablePadding="@dimen/x8"
            android:padding="@dimen/x10"
            android:text="@string/caozuo3"
            android:textColor="@color/dark_gray_txt" />
        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginLeft="@dimen/x10"
            android:background="@color/gray_line"/>
            android:background="@color/gray_line" />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="@dimen/x10"
            android:drawablePadding="@dimen/x8"
            android:drawableLeft="@mipmap/icon4"
            android:textColor="@color/dark_gray_txt"
            android:text="@string/caozuo4"/>
            android:drawablePadding="@dimen/x8"
            android:padding="@dimen/x10"
            android:text="@string/caozuo4"
            android:textColor="@color/dark_gray_txt" />
        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginLeft="@dimen/x10"
            android:background="@color/gray_line"/>
            android:background="@color/gray_line" />
    </LinearLayout>
    <android.support.v7.widget.RecyclerView
        android:id="@+id/rv_ble"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="gone"/>
        android:visibility="gone" />
</LinearLayout>
app/src/main/res/layout/fragment_monitor_layout.xml
@@ -199,6 +199,17 @@
                        android:orientation="vertical">
                        <TextView
                            android:id="@+id/tv_text_mac"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_marginTop="@dimen/x15"
                            android:background="@color/white"
                            android:gravity="center"
                            android:padding="@dimen/x15"
                            android:text="未连接,无mac。"
                            android:textColor="#ae8082" />
                        <TextView
                            android:id="@+id/tv_desc"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
@@ -209,6 +220,7 @@
                            android:text="您所处位置辐射安全\n您处于安全区域,可以长时间逗留!"
                            android:textColor="#ae8082" />
                        <ImageView
                            android:id="@+id/iv_bottom_status"
                            android:layout_width="@dimen/x30"
app/src/main/res/layout/fragment_setting_layout.xml
@@ -43,17 +43,19 @@
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="设置时间"
            android:layout_alignParentRight="true"
            android:textColor="@color/dark_gray_txt"
            android:drawableRight="@mipmap/icon_jiantou"
            android:drawablePadding="@dimen/x6"
            android:text="设置时间"
            android:textColor="@color/dark_gray_txt"
            android:textSize="16sp" />
    </RelativeLayout>
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@color/gray_line"/>
        android:background="@color/gray_line" />
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
@@ -79,12 +81,14 @@
            android:id="@+id/sc_open"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"/>
            android:layout_alignParentRight="true" />
    </RelativeLayout>
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@color/gray_line"/>
        android:background="@color/gray_line" />
    <RelativeLayout
        android:id="@+id/rl_setvoice"
        android:layout_width="match_parent"
@@ -103,33 +107,39 @@
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/x10"
            android:layout_toRightOf="@+id/iv3"
            android:text="设置铃声"
            android:textColor="@color/dark_gray_txt"
            android:drawableRight="@mipmap/icon_jiantou"
            android:text="设置自定义铃声"
            android:textColor="@color/dark_gray_txt"
            android:textSize="16sp" />
        <android.support.v7.widget.SwitchCompat
        <Button
            android:id="@+id/sc_male"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="@dimen/x20"
            android:text="男"
            android:layout_height="@dimen/x30"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_alignParentRight="true"/>
            android:layout_marginRight="@dimen/x20"
            android:background="@drawable/choose_button"
            android:stateListAnimator="@anim/progress"
            android:textColor="@color/dark_gray_txt"
            android:text="无声" />
    </RelativeLayout>
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@color/gray_line"/>
        android:background="@color/gray_line" />
    <Button
        android:id="@+id/bt_sure"
        android:layout_width="match_parent"
        android:layout_height="@dimen/x40"
        android:layout_marginLeft="@dimen/x40"
        android:layout_marginRight="@dimen/x40"
        android:layout_marginTop="@dimen/x24"
        android:layout_marginRight="@dimen/x40"
        android:background="@mipmap/bt_blue"
        android:text="退出登录"
        android:gravity="center"
        android:text="退出登录"
        android:textColor="@color/white"
        android:textSize="16sp" />
@@ -138,20 +148,21 @@
        android:layout_width="match_parent"
        android:layout_height="@dimen/x40"
        android:layout_marginLeft="@dimen/x40"
        android:layout_marginRight="@dimen/x40"
        android:layout_marginTop="@dimen/x24"
        android:layout_marginRight="@dimen/x40"
        android:background="@mipmap/bt_blue"
        android:text="查看数据"
        android:visibility="gone"
        android:gravity="center"
        android:text="查看数据"
        android:textColor="@color/white"
        android:textSize="16sp" />
        android:textSize="16sp"
        android:visibility="gone" />
    <TextView
        android:id="@+id/tv_version"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_horizontal|bottom"
        android:layout_marginBottom="30dp"
        android:gravity="center_horizontal|bottom"
        android:text="当前版本V1.0"
        android:textColor="@color/dark_gray_txt"
        android:textSize="18sp" />
app/src/main/res/mipmap-hdpi/tips.png
app/src/main/res/mipmap-xxhdpi/tips.png
key.jks
Binary files differ