血压检测APP 初始化
authorkfl_614 <kfl_614@163.com>
Mon, 23 Mar 2020 12:52:30 +0000 (20:52 +0800)
committerkfl_614 <kfl_614@163.com>
Mon, 23 Mar 2020 12:52:30 +0000 (20:52 +0800)
55 files changed:
.gitignore [new file with mode: 0644]
.idea/codeStyles/Project.xml [new file with mode: 0644]
.idea/gradle.xml [new file with mode: 0644]
.idea/misc.xml [new file with mode: 0644]
.idea/runConfigurations.xml [new file with mode: 0644]
.idea/vcs.xml [new file with mode: 0644]
app/.gitignore [new file with mode: 0644]
app/EQC_G5.jks [new file with mode: 0644]
app/build.gradle [new file with mode: 0644]
app/proguard-rules.pro [new file with mode: 0644]
app/src/androidTest/java/com/ic/blood/ExampleInstrumentedTest.java [new file with mode: 0644]
app/src/main/AndroidManifest.xml [new file with mode: 0644]
app/src/main/aidl/com/ic/aidl/blood/BloodState.java [new file with mode: 0644]
app/src/main/aidl/com/ic/aidl/blood/IBloodAidlInterface.aidl [new file with mode: 0644]
app/src/main/aidl/com/ic/aidl/blood/IBloodRemoteService.aidl [new file with mode: 0644]
app/src/main/assets/fonts/Baloo2-SemiBold.ttf [new file with mode: 0644]
app/src/main/assets/only_hr_check.gif [new file with mode: 0644]
app/src/main/java/com/ic/blood/BloodActivity.java [new file with mode: 0644]
app/src/main/java/com/ic/blood/BloodApp.java [new file with mode: 0644]
app/src/main/java/com/ic/blood/fragment/BloodFragment.java [new file with mode: 0644]
app/src/main/java/com/ic/blood/model/BloodCheckModel.java [new file with mode: 0644]
app/src/main/java/com/ic/blood/presenter/BloodPresenter.java [new file with mode: 0644]
app/src/main/java/com/ic/blood/util/CrashHandler.java [new file with mode: 0644]
app/src/main/java/com/ic/blood/util/IcLog.java [new file with mode: 0644]
app/src/main/java/com/ic/blood/util/SPUtils.java [new file with mode: 0644]
app/src/main/java/com/ic/blood/util/ServiceUtil.java [new file with mode: 0644]
app/src/main/res/drawable-v24/ic_launcher_foreground.xml [new file with mode: 0644]
app/src/main/res/drawable/ic_launcher_background.xml [new file with mode: 0644]
app/src/main/res/layout/activity_blood.xml [new file with mode: 0644]
app/src/main/res/layout/activity_main.xml [new file with mode: 0644]
app/src/main/res/layout/fragment_blood.xml [new file with mode: 0644]
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml [new file with mode: 0644]
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml [new file with mode: 0644]
app/src/main/res/mipmap-hdpi/ic_launcher.png [new file with mode: 0644]
app/src/main/res/mipmap-hdpi/ic_launcher_round.png [new file with mode: 0644]
app/src/main/res/mipmap-mdpi/ic_launcher.png [new file with mode: 0644]
app/src/main/res/mipmap-mdpi/ic_launcher_round.png [new file with mode: 0644]
app/src/main/res/mipmap-xhdpi/ic_launcher.png [new file with mode: 0644]
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png [new file with mode: 0644]
app/src/main/res/mipmap-xxhdpi/ic_launcher.png [new file with mode: 0644]
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png [new file with mode: 0644]
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png [new file with mode: 0644]
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png [new file with mode: 0644]
app/src/main/res/values/colors.xml [new file with mode: 0644]
app/src/main/res/values/strings.xml [new file with mode: 0644]
app/src/main/res/values/styles.xml [new file with mode: 0644]
app/src/test/java/com/ic/blood/ExampleUnitTest.java [new file with mode: 0644]
app/version_code.properties [new file with mode: 0644]
build.gradle [new file with mode: 0644]
gradle.properties [new file with mode: 0644]
gradle/wrapper/gradle-wrapper.jar [new file with mode: 0644]
gradle/wrapper/gradle-wrapper.properties [new file with mode: 0644]
gradlew [new file with mode: 0644]
gradlew.bat [new file with mode: 0644]
settings.gradle [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..603b140
--- /dev/null
@@ -0,0 +1,14 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644 (file)
index 0000000..681f41a
--- /dev/null
@@ -0,0 +1,116 @@
+<component name="ProjectCodeStyleConfiguration">
+  <code_scheme name="Project" version="173">
+    <codeStyleSettings language="XML">
+      <indentOptions>
+        <option name="CONTINUATION_INDENT_SIZE" value="4" />
+      </indentOptions>
+      <arrangement>
+        <rules>
+          <section>
+            <rule>
+              <match>
+                <AND>
+                  <NAME>xmlns:android</NAME>
+                  <XML_ATTRIBUTE />
+                  <XML_NAMESPACE>^$</XML_NAMESPACE>
+                </AND>
+              </match>
+            </rule>
+          </section>
+          <section>
+            <rule>
+              <match>
+                <AND>
+                  <NAME>xmlns:.*</NAME>
+                  <XML_ATTRIBUTE />
+                  <XML_NAMESPACE>^$</XML_NAMESPACE>
+                </AND>
+              </match>
+              <order>BY_NAME</order>
+            </rule>
+          </section>
+          <section>
+            <rule>
+              <match>
+                <AND>
+                  <NAME>.*:id</NAME>
+                  <XML_ATTRIBUTE />
+                  <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+                </AND>
+              </match>
+            </rule>
+          </section>
+          <section>
+            <rule>
+              <match>
+                <AND>
+                  <NAME>.*:name</NAME>
+                  <XML_ATTRIBUTE />
+                  <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+                </AND>
+              </match>
+            </rule>
+          </section>
+          <section>
+            <rule>
+              <match>
+                <AND>
+                  <NAME>name</NAME>
+                  <XML_ATTRIBUTE />
+                  <XML_NAMESPACE>^$</XML_NAMESPACE>
+                </AND>
+              </match>
+            </rule>
+          </section>
+          <section>
+            <rule>
+              <match>
+                <AND>
+                  <NAME>style</NAME>
+                  <XML_ATTRIBUTE />
+                  <XML_NAMESPACE>^$</XML_NAMESPACE>
+                </AND>
+              </match>
+            </rule>
+          </section>
+          <section>
+            <rule>
+              <match>
+                <AND>
+                  <NAME>.*</NAME>
+                  <XML_ATTRIBUTE />
+                  <XML_NAMESPACE>^$</XML_NAMESPACE>
+                </AND>
+              </match>
+              <order>BY_NAME</order>
+            </rule>
+          </section>
+          <section>
+            <rule>
+              <match>
+                <AND>
+                  <NAME>.*</NAME>
+                  <XML_ATTRIBUTE />
+                  <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+                </AND>
+              </match>
+              <order>ANDROID_ATTRIBUTE_ORDER</order>
+            </rule>
+          </section>
+          <section>
+            <rule>
+              <match>
+                <AND>
+                  <NAME>.*</NAME>
+                  <XML_ATTRIBUTE />
+                  <XML_NAMESPACE>.*</XML_NAMESPACE>
+                </AND>
+              </match>
+              <order>BY_NAME</order>
+            </rule>
+          </section>
+        </rules>
+      </arrangement>
+    </codeStyleSettings>
+  </code_scheme>
+</component>
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644 (file)
index 0000000..d291b3d
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="GradleSettings">
+    <option name="linkedExternalProjectsSettings">
+      <GradleProjectSettings>
+        <compositeConfiguration>
+          <compositeBuild compositeDefinitionSource="SCRIPT" />
+        </compositeConfiguration>
+        <option name="distributionType" value="DEFAULT_WRAPPED" />
+        <option name="externalProjectPath" value="$PROJECT_DIR$" />
+        <option name="resolveModulePerSourceSet" value="false" />
+        <option name="testRunner" value="PLATFORM" />
+      </GradleProjectSettings>
+    </option>
+  </component>
+</project>
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644 (file)
index 0000000..7bfef59
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/build/classes" />
+  </component>
+  <component name="ProjectType">
+    <option name="id" value="Android" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644 (file)
index 0000000..7f68460
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RunConfigurationProducerService">
+    <option name="ignoredProducers">
+      <set>
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
+      </set>
+    </option>
+  </component>
+</project>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644 (file)
index 0000000..35eb1dd
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644 (file)
index 0000000..796b96d
--- /dev/null
@@ -0,0 +1 @@
+/build
diff --git a/app/EQC_G5.jks b/app/EQC_G5.jks
new file mode 100644 (file)
index 0000000..2229d46
Binary files /dev/null and b/app/EQC_G5.jks differ
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644 (file)
index 0000000..77af4be
--- /dev/null
@@ -0,0 +1,133 @@
+apply plugin: 'com.android.application'
+
+static def getL02ApkBaseName() {
+    return "ICL02Blood"
+}
+
+android {
+    def currentVersionCode = getVersionCode()
+    def currentVersionName = releaseTime()
+
+    compileSdkVersion 29
+    buildToolsVersion "29.0.2"
+    defaultConfig {
+        applicationId "com.ic.blood"
+        minSdkVersion 19
+        targetSdkVersion 29
+        versionCode currentVersionCode
+        versionName "${currentVersionName}"
+        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+    }
+    //使用JDK1.8
+    compileOptions {
+        targetCompatibility JavaVersion.VERSION_1_8
+        sourceCompatibility JavaVersion.VERSION_1_8
+    }
+
+    dataBinding {
+        enabled = true
+    }
+
+    sourceSets {
+        main {
+            jni.srcDirs = []
+            manifest.srcFile 'src/main/AndroidManifest.xml'
+            java.srcDirs = ['src/main/java', 'src/main/aidl']
+            resources.srcDirs = ['src/main/java', 'src/main/aidl']
+            aidl.srcDirs = ['src/main/aidl']
+            res.srcDirs = ['src/main/res']
+            assets.srcDirs = ['src/main/assets']
+        }
+    }
+
+    signingConfigs {
+        key {
+            storeFile file("EQC_G5.jks")
+            storePassword "123456"
+            keyAlias "watch_g5"
+            keyPassword "123456"
+        }
+    }
+
+    buildTypes {
+        release {
+            zipAlignEnabled true     // zip 对齐优化
+            shrinkResources true       // 移除未使用的资源文件
+            signingConfig signingConfigs.key
+            minifyEnabled true
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+            renderscriptDebuggable = false
+            debuggable = false
+            jniDebuggable = false
+            manifestPlaceholders = [:]
+        }
+
+        debug {
+            signingConfig signingConfigs.key
+        }
+    }
+
+    android.applicationVariants.all { variant ->
+        variant.outputs.all {
+            if (variant.buildType.name == "release") {
+                outputFileName = "${getL02ApkBaseName()}_V${currentVersionCode}_${currentVersionName}_release.apk"
+            } else {
+                outputFileName = "${getL02ApkBaseName()}_V${currentVersionCode}_${currentVersionName}_debug.apk"
+            }
+        }
+    }
+}
+
+def getVersionCode() {
+    def versionCodeFile = file('version_code.properties')
+    if (versionCodeFile.canRead()) {
+        Properties properties = new Properties()
+        properties.load(new FileInputStream(versionCodeFile))
+        def versionCode = properties['VERSION_CODE'].toInteger()//读取version_code.properties文件存放的版本号。
+        def runTasks = gradle.startParameter.taskNames
+        def task = ':app:assembleRelease'
+        if (task in runTasks) {
+            properties['VERSION_CODE'] = (++versionCode).toString()
+            properties.store(versionCodeFile.newWriter(), null)
+        }
+
+        return versionCode
+    } else {
+        throw new GradleException("无法读取version_code.properties文件!")
+    }
+}
+
+def releaseTime() {
+    return new Date().format("yyyyMMddHHmm", TimeZone.getTimeZone("GMT+08:00"))
+}
+
+dependencies {
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
+    implementation 'androidx.appcompat:appcompat:1.1.0'
+    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+    testImplementation 'junit:junit:4.12'
+    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+
+    // ViewModel
+    implementation "androidx.lifecycle:lifecycle-viewmodel:2.2.0"
+    // LiveData
+    implementation "androidx.lifecycle:lifecycle-livedata:2.2.0"
+    // Saved state module for ViewModel
+    implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0"
+    // alternately - if using Java8, use the following instead of lifecycle-compiler
+    implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0"
+    // optional - ReactiveStreams support for LiveData
+    implementation "androidx.lifecycle:lifecycle-reactivestreams:2.2.0"
+
+    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
+
+    //recyclerview
+    implementation "androidx.recyclerview:recyclerview:1.1.0"
+    implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
+
+    implementation 'com.google.android.material:material:1.2.0-alpha05'
+
+    implementation 'com.jakewharton.threetenabp:threetenabp:1.2.2'
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644 (file)
index 0000000..3d345d9
--- /dev/null
@@ -0,0 +1,133 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
+-dontoptimize                           # 混合时不使用大小写混合,混合后的类名为小写
+-dontusemixedcaseclassnames             # 混合时不使用大小写混合,混合后的类名为小写
+-dontskipnonpubliclibraryclasses        # 不跳过library中的非public的类
+-dontskipnonpubliclibraryclassmembers   # 不跳过library中的非public的类成员
+-dontpreverify                          # 不做预校验,preverify是proguard的四个步骤之一,Android平台不需要preverify,去掉这一步能够加快混淆速度
+-verbose                                # 在处理时打印冗长的信息
+
+# 保留异常表,以便编译器知道哪些异常可能被抛出
+# 保留InnerClasses,否则外部无法引用内部类
+# 保留Signature,否则无法访问泛型
+-keepattributes Exceptions,SourceFile,LineNumberTable,EnclosingMethod,Signature,*Annotation*,InnerClasses,Deprecated
+
+################################## 需要保留的公共部分 ##################################
+# 保留四大组件,自定义的Application等等这些类不被混淆
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
+-keep public class * extends android.view.View
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keep class android.support.** { *; }
+-keep public class * extends android.support.v4.**
+-keep public class * extends android.support.v7.**
+-keep public class * extends android.support.annotation.**
+-keep public class * extends android.app.Fragment
+-keep class com.google.** { *; }
+
+# 保留R下面的资源
+-keep class **.R$* {*;}
+-keepclassmembers class **.R$* {
+    public static <fields>;
+}
+
+# 保留本地native方法不被混淆
+-keepclasseswithmembernames class * {
+    native <methods>;
+}
+
+# 保留在Activity中的方法参数是view的方法,
+# 这样以来我们在layout中写的onClick就不会被影响
+-keepclassmembers class * extends android.app.Activity{
+    public void *(android.view.View);
+}
+
+# 保留我们自定义控件(继承自View)不被混淆
+-keep public class * extends android.view.View{
+    *** get*();
+    void set*(***);
+    public <init>(android.content.Context);
+    public <init>(android.content.Context, android.util.AttributeSet);
+    public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclasseswithmembernames class * {
+    public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembernames class * {
+    public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+# 保留枚举类不被混淆
+-keepclassmembers enum * {
+    public static **[] values();
+    public static ** valueOf(java.lang.String);
+}
+
+-keep public interface com.ic.aidl.blood.IBloodAidlInterface
+-keep public abstract interface com.ic.aidl.blood.IBloodAidlInterface{
+public protected <methods>;
+}
+
+-keep public interface com.ic.aidl.blood.IBloodRemoteService
+-keep public abstract interface com.ic.aidl.blood.IBloodRemoteService{
+public protected <methods>;
+}
+
+# 保留Parcelable序列化类不被混淆
+-keep class * implements android.os.Parcelable {
+  public static final android.os.Parcelable$Creator *;
+}
+
+# 保留Serializable序列化的类不被混淆
+-keepclassmembers class * implements java.io.Serializable {
+    static final long serialVersionUID;
+    private static final java.io.ObjectStreamField[] serialPersistentFields;
+    !static !transient <fields>;
+    !private <fields>;
+    !private <methods>;
+    private void writeObject(java.io.ObjectOutputStream);
+    private void readObject(java.io.ObjectInputStream);
+    java.lang.Object writeReplace();
+    java.lang.Object readResolve();
+}
+
+# 对于带有回调函数的onXXEvent、**On*Listener的,不能被混淆
+-keepclassmembers class * {
+    void *(**On*Event);
+    void *(**On*Listener);
+}
+
+
+-keep class com.sun.jna.** { *; }
+-dontwarn com.sun.jna.**
+
+-keep public class com.android.support.a
+-keep public class com.android.support.b
+-keep public class rx.internal.util
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/ic/blood/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/ic/blood/ExampleInstrumentedTest.java
new file mode 100644 (file)
index 0000000..b40acc3
--- /dev/null
@@ -0,0 +1,27 @@
+package com.ic.blood;
+
+import android.content.Context;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+    @Test
+    public void useAppContext() {
+        // Context of the app under test.
+        Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+
+        assertEquals("com.ic.blood", appContext.getPackageName());
+    }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..742cfb2
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.ic.blood">
+
+    <uses-permission android:name="android.permission.WAKE_LOCK" />
+    <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
+
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+
+    <application
+        android:name=".BloodApp"
+        android:allowBackup="true"
+        android:icon="@mipmap/ic_launcher"
+        android:label="@string/app_name"
+        android:roundIcon="@mipmap/ic_launcher_round"
+        android:supportsRtl="true"
+        android:theme="@style/AppTheme">
+        <activity android:name=".BloodActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <action android:name="android.intent.action.VIEW"/>
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+
+</manifest>
\ No newline at end of file
diff --git a/app/src/main/aidl/com/ic/aidl/blood/BloodState.java b/app/src/main/aidl/com/ic/aidl/blood/BloodState.java
new file mode 100644 (file)
index 0000000..82ed7f7
--- /dev/null
@@ -0,0 +1,16 @@
+package com.ic.aidl.blood;
+
+public class BloodState {
+
+    public static final int BLOOD_NULL_TIPS = -1;
+    public static final int BLOOD_NOT_DEVICE = 1001;
+
+    public static final int BLOOD_PLEASE_QUIET = 1002;
+    public static final int BLOOD_START_CHECK= 1003;
+
+    public static final int BLOOD_NOT_WEAR=1004;
+    public static final int BLOOD_ING_CHECK=1005;
+
+    public static final int BLOOD_STOP_CHECK=1006;
+    public static final int BLOOD_NOT_DATA_CHECK=1007;
+}
diff --git a/app/src/main/aidl/com/ic/aidl/blood/IBloodAidlInterface.aidl b/app/src/main/aidl/com/ic/aidl/blood/IBloodAidlInterface.aidl
new file mode 100644 (file)
index 0000000..0723be4
--- /dev/null
@@ -0,0 +1,13 @@
+package com.ic.aidl.blood;
+
+// Declare any non-default types here with import statements
+
+interface IBloodAidlInterface {
+    /**
+     * Demonstrates some basic types that you can use as parameters
+     * and return values in AIDL.
+     */
+
+     void updateBloodCheckResult(int high,int low,int heart);
+     void updateBloodCheckTips(int top,int bottom);
+}
diff --git a/app/src/main/aidl/com/ic/aidl/blood/IBloodRemoteService.aidl b/app/src/main/aidl/com/ic/aidl/blood/IBloodRemoteService.aidl
new file mode 100644 (file)
index 0000000..c141e08
--- /dev/null
@@ -0,0 +1,17 @@
+package com.ic.aidl.blood;
+
+// Declare any non-default types here with import statements
+
+import com.ic.aidl.blood.IBloodAidlInterface;
+
+interface IBloodRemoteService {
+    /**
+     * Demonstrates some basic types that you can use as parameters
+     * and return values in AIDL.
+     */
+    void registerCallback(IBloodAidlInterface cb);
+    void unregisterCallback(IBloodAidlInterface cb);
+
+    void startCheckBlood();
+    void stopCheckBlood();
+}
diff --git a/app/src/main/assets/fonts/Baloo2-SemiBold.ttf b/app/src/main/assets/fonts/Baloo2-SemiBold.ttf
new file mode 100644 (file)
index 0000000..fe3453d
Binary files /dev/null and b/app/src/main/assets/fonts/Baloo2-SemiBold.ttf differ
diff --git a/app/src/main/assets/only_hr_check.gif b/app/src/main/assets/only_hr_check.gif
new file mode 100644 (file)
index 0000000..67011c6
Binary files /dev/null and b/app/src/main/assets/only_hr_check.gif differ
diff --git a/app/src/main/java/com/ic/blood/BloodActivity.java b/app/src/main/java/com/ic/blood/BloodActivity.java
new file mode 100644 (file)
index 0000000..3dab665
--- /dev/null
@@ -0,0 +1,31 @@
+package com.ic.blood;
+
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentTransaction;
+
+import android.os.Bundle;
+
+import com.ic.blood.fragment.BloodFragment;
+
+public class BloodActivity extends AppCompatActivity {
+
+    private FragmentManager fragmentManager;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_blood);
+        fragmentManager = getSupportFragmentManager();
+        commitFragment(BloodFragment.newInstance());
+    }
+
+    private void commitFragment(Fragment fragment) {
+        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
+        fragmentTransaction.replace(R.id.main_content_fl, fragment);
+        fragmentTransaction.commit();
+    }
+
+
+}
diff --git a/app/src/main/java/com/ic/blood/BloodApp.java b/app/src/main/java/com/ic/blood/BloodApp.java
new file mode 100644 (file)
index 0000000..ceedc99
--- /dev/null
@@ -0,0 +1,18 @@
+package com.ic.blood;
+
+import android.app.Application;
+
+import com.ic.blood.util.CrashHandler;
+import com.ic.blood.util.IcLog;
+
+public class BloodApp extends Application {
+
+    @Override
+    public void onCreate() {
+        super.onCreate();
+        IcLog.setLogHead("IcBlood");
+
+        CrashHandler crashHandler = CrashHandler.getInstance();
+        crashHandler.init(getApplicationContext());
+    }
+}
diff --git a/app/src/main/java/com/ic/blood/fragment/BloodFragment.java b/app/src/main/java/com/ic/blood/fragment/BloodFragment.java
new file mode 100644 (file)
index 0000000..8bae956
--- /dev/null
@@ -0,0 +1,163 @@
+package com.ic.blood.fragment;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.os.Bundle;
+
+import androidx.annotation.NonNull;
+import androidx.fragment.app.Fragment;
+import androidx.lifecycle.ViewModelProvider;
+
+import android.os.PowerManager;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+
+import com.ic.blood.BloodActivity;
+import com.ic.blood.BloodApp;
+import com.ic.blood.databinding.FragmentBloodBinding;
+import com.ic.blood.model.BloodCheckModel;
+import com.ic.blood.util.IcLog;
+
+import java.io.IOException;
+
+import pl.droidsonroids.gif.GifDrawable;
+import pl.droidsonroids.gif.GifImageView;
+
+import static android.content.Context.POWER_SERVICE;
+
+
+public class BloodFragment extends Fragment {
+
+    private static final String TAG = "BloodFragment";
+
+    private Context mContext;
+    private BloodApp mApp;
+
+    private FragmentBloodBinding bloodBinding;
+
+    private PowerManager.WakeLock mWakeLock = null;
+    private BloodCheckModel bloodModel;
+
+    private GifDrawable gifFromAssets;
+
+    public static BloodFragment newInstance() {
+        return new BloodFragment();
+    }
+
+    @Override
+    public void onAttach(@NonNull Context context) {
+        super.onAttach(context);
+        this.mContext = context;
+    }
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mApp = (BloodApp) mContext.getApplicationContext();
+        initWakeLock(mContext);
+    }
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+                             Bundle savedInstanceState) {
+        bloodBinding = FragmentBloodBinding.inflate(inflater, container, false);
+
+        bloodBinding.setIsShowTips(true);
+
+        initBloodModel();
+        setGifDrawable();
+        bloodModel.registerScreenReceiver();
+        return bloodBinding.getRoot();
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        if (mWakeLock != null) {
+            mWakeLock.acquire();
+        }
+
+        //bloodModel.startCheckBlood();
+
+        gifFromAssets.start();
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
+        bloodModel.stopCheckBlood();
+        gifFromAssets.stop();
+
+        releaseWakeLock();
+    }
+
+    private void initBloodModel() {
+        BloodCheckModel.Factory factory = new BloodCheckModel.Factory(mApp);
+        bloodModel= new ViewModelProvider(this, factory).get(BloodCheckModel.class);
+        bloodModel.getObsBloodValue().observe(getViewLifecycleOwner(), value -> {
+            bloodBinding.setIsShowTips(false);
+            bloodBinding.setHighValue(value[0]);
+            bloodBinding.setLowValue(value[1]);
+            bloodBinding.setHeartValue(value[2]);
+        });
+
+        bloodModel.getObsTipsInfo().observe(getViewLifecycleOwner(),tips ->{
+            bloodBinding.setIsShowTips(true);
+            bloodBinding.setTopTips(tips[0]);
+            bloodBinding.setBottomTips(tips[1]);
+        });
+
+        bloodModel.getObsCheckEnd().observe(getViewLifecycleOwner(),end ->{
+            switch (end){
+                case 1:
+                    IcLog.i(TAG,"Release WakeLock");
+                    releaseWakeLock();
+                    break;
+                case 2:
+                    ((BloodActivity)mContext).finish();
+                    break;
+            }
+        });
+    }
+
+    @SuppressLint("InvalidWakeLockTag")
+    private void initWakeLock(Context context) {
+        PowerManager powerManager = (PowerManager) context.getSystemService(POWER_SERVICE);
+        if (powerManager != null) {
+            mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "BloodWakeLock");
+        }
+    }
+
+    private void releaseWakeLock() {
+        if (mWakeLock != null) {
+            mWakeLock.release();
+        }
+        mWakeLock = null;
+    }
+
+    private void setGifDrawable() {
+        GifImageView gifImageView = bloodBinding.icHeartGif;
+        gifImageView.setScaleType(ImageView.ScaleType.CENTER);
+        try {
+            gifFromAssets = new GifDrawable(mContext.getAssets(), "only_hr_check.gif");
+            gifImageView.setImageDrawable(gifFromAssets);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        IcLog.i(TAG,"onDestroy");
+
+        bloodModel.unregisterScreenReceiver();
+        bloodModel = null;
+
+        if (gifFromAssets != null) {
+            gifFromAssets.recycle();
+        }
+    }
+}
diff --git a/app/src/main/java/com/ic/blood/model/BloodCheckModel.java b/app/src/main/java/com/ic/blood/model/BloodCheckModel.java
new file mode 100644 (file)
index 0000000..7b8b24e
--- /dev/null
@@ -0,0 +1,74 @@
+package com.ic.blood.model;
+
+import android.app.Application;
+
+import androidx.annotation.NonNull;
+import androidx.lifecycle.AndroidViewModel;
+import androidx.lifecycle.LiveData;
+import androidx.lifecycle.ViewModel;
+import androidx.lifecycle.ViewModelProvider;
+
+import com.ic.blood.presenter.BloodPresenter;
+
+
+public class BloodCheckModel extends AndroidViewModel {
+
+    private final BloodPresenter bloodPresenter;
+
+    private LiveData<String[]> mObsBloodValue;
+    private LiveData<String[]> mObsTipsInfo;
+    private LiveData<Integer> mObsCheckEnd;
+
+    private BloodCheckModel(@NonNull Application application) {
+        super(application);
+        this.bloodPresenter = new BloodPresenter(application.getApplicationContext());
+        mObsBloodValue = bloodPresenter.getObsBloodValue();
+        mObsTipsInfo = bloodPresenter.getObsTipsInfo();
+        mObsCheckEnd = bloodPresenter.getObsCheckEnd();
+    }
+
+    public LiveData<String[]> getObsBloodValue() {
+        return mObsBloodValue;
+    }
+
+    public LiveData<String[]> getObsTipsInfo() {
+        return mObsTipsInfo;
+    }
+
+    public LiveData<Integer> getObsCheckEnd() {
+        return mObsCheckEnd;
+    }
+
+    public void startCheckBlood(){
+        bloodPresenter.startCheckBlood();
+    }
+
+    public void stopCheckBlood(){
+        bloodPresenter.stopCheckBlood();
+    }
+
+    public void registerScreenReceiver(){
+        bloodPresenter.registerScreenReceiver();
+    }
+
+    public void unregisterScreenReceiver(){
+        bloodPresenter.unregisterScreenReceiver();
+    }
+
+    public static class Factory extends ViewModelProvider.NewInstanceFactory {
+
+        @NonNull
+        private final Application mApplication;
+
+        public Factory(@NonNull Application application) {
+            mApplication = application;
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        @NonNull
+        public <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
+            return (T) new BloodCheckModel(mApplication);
+        }
+    }
+}
diff --git a/app/src/main/java/com/ic/blood/presenter/BloodPresenter.java b/app/src/main/java/com/ic/blood/presenter/BloodPresenter.java
new file mode 100644 (file)
index 0000000..d0288f9
--- /dev/null
@@ -0,0 +1,177 @@
+package com.ic.blood.presenter;
+
+
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.util.SparseArray;
+
+import androidx.lifecycle.MutableLiveData;
+
+import com.ic.aidl.blood.BloodState;
+import com.ic.aidl.blood.IBloodAidlInterface;
+import com.ic.aidl.blood.IBloodRemoteService;
+import com.ic.blood.R;
+import com.ic.blood.util.IcLog;
+import com.ic.blood.util.ServiceUtil;
+
+
+public class BloodPresenter {
+
+    private static final String TAG = "BloodPresenter";
+
+    private Context mContext;
+
+    private MutableLiveData<String[]> mObsBloodValue;
+    private MutableLiveData<String[]> mObsTipsInfo;
+    private MutableLiveData<Integer> mObsCheckEnd;
+
+    private IBloodRemoteService mService;
+
+    private SparseArray<String> mTipsSpares;
+
+    private Handler mHandler;
+
+    public BloodPresenter(Context context) {
+        this.mContext = context;
+        mTipsSpares = new SparseArray<String>();
+        mTipsSpares.put(BloodState.BLOOD_NULL_TIPS, "");
+        mTipsSpares.put(BloodState.BLOOD_NOT_DEVICE, context.getString(R.string.tips_not_device));
+        mTipsSpares.put(BloodState.BLOOD_PLEASE_QUIET, context.getString(R.string.tips_quiet_please));
+        mTipsSpares.put(BloodState.BLOOD_START_CHECK, context.getString(R.string.tips_start_check));
+        mTipsSpares.put(BloodState.BLOOD_NOT_WEAR, context.getString(R.string.tips_not_wear));
+        mTipsSpares.put(BloodState.BLOOD_ING_CHECK, context.getString(R.string.tips_ing_check));
+        mTipsSpares.put(BloodState.BLOOD_STOP_CHECK, context.getString(R.string.tips_stop_check));
+        mTipsSpares.put(BloodState.BLOOD_NOT_DATA_CHECK, context.getString(R.string.tips_not_data_check));
+
+        mObsBloodValue = new MutableLiveData<>();
+        mObsTipsInfo = new MutableLiveData<>();
+        mObsCheckEnd = new MutableLiveData<>();
+
+        mHandler = new Handler();
+    }
+
+    public MutableLiveData<String[]> getObsBloodValue() {
+        return mObsBloodValue;
+    }
+
+    public MutableLiveData<String[]> getObsTipsInfo() {
+        return mObsTipsInfo;
+    }
+
+    public MutableLiveData<Integer> getObsCheckEnd() {
+        return mObsCheckEnd;
+    }
+
+    public void registerScreenReceiver() {
+
+        ServiceUtil.bindServiceUtil(mContext, "com.ic.action.WORK_SERVICE", connection, mContext.getPackageName());
+
+        IntentFilter intentFilter = new IntentFilter();
+        intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
+        mContext.registerReceiver(screenOnOffReceiver, intentFilter);
+    }
+
+    public void unregisterScreenReceiver() {
+
+        mContext.unregisterReceiver(screenOnOffReceiver);
+
+        try {
+            mService.unregisterCallback(bloodInterface);
+            ServiceUtil.unBindServiceUtil(mContext, connection);
+        } catch (Exception e) {
+            IcLog.e(TAG, e.getMessage());
+        }finally {
+            mService=null;
+            bloodInterface=null;
+        }
+
+        connection = null;
+        mHandler = null;
+    }
+
+    public void startCheckBlood() {
+        if (mService != null) {
+            try {
+                mService.startCheckBlood();
+            } catch (Exception e) {
+                IcLog.e(TAG, e.getMessage());
+            }
+        }
+    }
+
+    public void stopCheckBlood() {
+        if (mService != null) {
+            try {
+                mService.stopCheckBlood();
+            } catch (Exception e) {
+                IcLog.e(TAG, e.getMessage());
+            }
+        }
+    }
+
+
+    private void updateTipsInfo(String t, String b) {
+        if (mObsTipsInfo != null) {
+            mObsTipsInfo.postValue(new String[]{t, b});
+        }
+    }
+
+    private void updateBoolValue(int lv, int hv, int hh) {
+        if (mObsBloodValue != null) {
+            mObsBloodValue.postValue(new String[]{
+                    String.valueOf(hv),
+                    String.valueOf(lv),
+                    String.valueOf(hh)});
+        }
+    }
+
+    private BroadcastReceiver screenOnOffReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) {
+                IcLog.i(TAG, "灭屏了");
+                mObsCheckEnd.setValue(2);
+            }
+        }
+    };
+
+
+    private ServiceConnection connection = new ServiceConnection() {
+        @Override
+        public void onServiceConnected(ComponentName name, IBinder service) {
+            try {
+                mService = IBloodRemoteService.Stub.asInterface(service);
+                mService.registerCallback(bloodInterface);
+                startCheckBlood();
+            } catch (Exception e) {
+                IcLog.e(TAG, e.getMessage());
+            }
+        }
+
+        @Override
+        public void onServiceDisconnected(ComponentName name) {
+        }
+    };
+
+    private IBloodAidlInterface.Stub bloodInterface = new IBloodAidlInterface.Stub() {
+        @Override
+        public void updateBloodCheckResult(int high, int low, int heart) throws RemoteException {
+            updateBoolValue(high, low, heart);
+            mHandler.postDelayed(() -> mObsCheckEnd.postValue(1), 10 * 1000);
+        }
+
+        @Override
+        public void updateBloodCheckTips(int top, int bottom) throws RemoteException {
+            updateTipsInfo(mTipsSpares.get(top), mTipsSpares.get(bottom));
+        }
+    };
+
+
+}
diff --git a/app/src/main/java/com/ic/blood/util/CrashHandler.java b/app/src/main/java/com/ic/blood/util/CrashHandler.java
new file mode 100644 (file)
index 0000000..6272aae
--- /dev/null
@@ -0,0 +1,214 @@
+package com.ic.blood.util;
+
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Environment;
+import android.os.Looper;
+import android.util.Log;
+import android.widget.Toast;
+
+
+import com.ic.blood.R;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.lang.reflect.Field;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * Created by Administrator on 2017/5/18.
+ */
+
+public class CrashHandler implements Thread.UncaughtExceptionHandler {
+    public static final String TAG = CrashHandler.class.getName();
+
+    // 系统默认的UncaughtException处理类
+    private Thread.UncaughtExceptionHandler mDefaultHandler;
+    // CrashHandler实例
+    private static CrashHandler INSTANCE = new CrashHandler();
+    // 程序的Context对象
+    private Context mContext;
+    // 用来存储设备信息和异常信息
+    private Map<String, String> infos = new HashMap<String, String>();
+    // 用于格式化日期,作为日志文件名的一部分
+    private DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS", Locale.getDefault());
+    private DateFormat dateFormatDate = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
+
+    /**
+     * 保证只有一个CrashHandler实例
+     */
+    private CrashHandler() {
+    }
+
+    /**
+     * 获取CrashHandler实例 ,单例模式
+     */
+    public static CrashHandler getInstance() {
+        return INSTANCE;
+    }
+
+    /**
+     * 初始化
+     *
+     * @param context
+     */
+    public void init(Context context) {
+        mContext = context;
+        // 获取系统默认的UncaughtException处理器
+        mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
+        // 设置该CrashHandler为程序的默认处理器
+        Thread.setDefaultUncaughtExceptionHandler(this);
+    }
+
+    /**
+     * 当UncaughtException发生时会转入该函数来处理
+     */
+    @Override
+    public void uncaughtException(Thread thread, Throwable ex) {
+        if (!handleException(ex) && mDefaultHandler != null) {
+            // 如果用户没有处理则让系统默认的异常处理器来处理
+            mDefaultHandler.uncaughtException(thread, ex);
+        } else {
+            try {
+                Thread.sleep(3000);
+            } catch (InterruptedException e) {
+//                Log.e(TAG, "error : " + e);
+                e.printStackTrace();
+            }
+        }
+
+        // 退出程序
+        ex.printStackTrace();
+        android.os.Process.killProcess(android.os.Process.myPid());
+        System.exit(1);
+    }
+
+    /**
+     * 自定义错误处理,收集错误信息 发送错误报告等操作均在此完成.
+     *
+     * @param ex
+     * @return true:如果处理了该异常信息;否则返回false.
+     */
+    private boolean handleException(Throwable ex) {
+        if (ex == null) {
+            return false;
+        }
+        // 使用Toast来显示异常信息
+        new Thread() {
+            @Override
+            public void run() {
+                Looper.prepare();
+                if (mContext != null) {
+                    Toast.makeText(mContext, R.string.program_abnormal, Toast.LENGTH_LONG)
+                            .show();
+                    Looper.loop();
+                }
+            }
+        }.start();
+        // 收集设备参数信息
+        collectDeviceInfo(mContext);
+        // 保存日志文件
+        saveCrashInfo2File(ex);
+        return true;
+    }
+
+    /**
+     * 收集设备参数信息
+     *
+     * @param ctx
+     */
+    public void collectDeviceInfo(Context ctx) {
+        infos.clear();
+        infos.put("===", " PackageInfo ===");
+        try {
+            PackageManager pm = ctx.getPackageManager();
+            PackageInfo pi = pm.getPackageInfo(ctx.getPackageName(), PackageManager.GET_ACTIVITIES);
+
+            if (pi != null) {
+                String versionName = pi.versionName;
+                String versionCode = pi.versionCode + "";
+                infos.put("versionName", versionName);
+                infos.put("versionCode", versionCode);
+            }
+        } catch (PackageManager.NameNotFoundException e) {
+            Log.e(TAG, "an error occured when collect package info " + e);
+        }
+
+        infos.put("===", " Build ===");
+        Field[] fields = Build.class.getDeclaredFields();
+        for (Field field : fields) {
+            try {
+                field.setAccessible(true);
+                infos.put(field.getName(), field.get(null).toString());
+                Log.d(TAG, field.getName() + ":" + field.get(null));
+            } catch (Exception e) {
+                Log.e(TAG, "an error occured when collect crash info," + e);
+            }
+        }
+    }
+
+    /**
+     * 保存错误信息到文件中
+     *
+     * @param ex
+     * @return 返回文件名称, 便于将文件传送到服务器
+     */
+    private String saveCrashInfo2File(Throwable ex) {
+
+        String time = formatter.format(new Date());
+        StringBuilder sb = new StringBuilder();
+        sb.append("=== ").append(time).append(" ===\n");
+
+        Writer writer = new StringWriter();
+        PrintWriter printWriter = new PrintWriter(writer);
+        ex.printStackTrace(printWriter);
+//        ex.printStackTrace();
+        Throwable cause = ex.getCause();
+        while (cause != null) {
+            cause.printStackTrace(printWriter);
+            cause = cause.getCause();
+//            cause.printStackTrace();
+        }
+        printWriter.close();
+        String result = writer.toString();
+        sb.append(result);
+        sb.append("\n");
+
+        sb.append("--- DEVICE INFO ---\n");
+        for (Map.Entry<String, String> entry : infos.entrySet()) {
+            String key = entry.getKey();
+            String value = entry.getValue();
+            sb.append(key).append("=").append(value).append("\n");
+        }
+        sb.append("\n\n");
+
+        try {
+            String fileName = "IcHardware-" + dateFormatDate.format(new Date()) + ".log";
+            if (Environment.getExternalStorageState().equals(
+                    Environment.MEDIA_MOUNTED)) {
+                File dir = new File(Environment.getExternalStorageDirectory().getPath(), "Android/ic/crash/IcHardware");
+                String path = dir.getPath();
+                if (!dir.exists()) {
+                    dir.mkdirs();
+                }
+                FileOutputStream fos = new FileOutputStream(new File(path, fileName), true);
+                fos.write(sb.toString().getBytes());
+                fos.close();
+            }
+            return fileName;
+        } catch (Exception e) {
+            Log.e(TAG, "an error occured while writing file...," + e);
+        }
+        return null;
+    }
+}
diff --git a/app/src/main/java/com/ic/blood/util/IcLog.java b/app/src/main/java/com/ic/blood/util/IcLog.java
new file mode 100644 (file)
index 0000000..84b870e
--- /dev/null
@@ -0,0 +1,57 @@
+package com.ic.blood.util;
+
+import android.util.Log;
+
+/**
+ * @author RyanLee
+ * @date 2018/2/2
+ */
+
+public class IcLog {
+
+    private static final String DOT = ".";
+    private static boolean isDebug = true;
+    private static String tagHead = "";
+
+    public static void v(String tag, String msg) {
+        if (isDebug) {
+            Log.v(mergeHeadTag(tag), msg);
+        }
+    }
+
+    public static void d(String tag, String msg) {
+        if (isDebug) {
+            Log.d(mergeHeadTag(tag), msg);
+        }
+    }
+
+    public static void i(String tag, String msg) {
+        if (isDebug) {
+            Log.i(mergeHeadTag(tag), msg);
+        }
+    }
+
+    public static void w(String tag, String msg) {
+        if (isDebug) {
+            Log.w(mergeHeadTag(tag), msg);
+        }
+    }
+
+    public static void e(String tag, String msg) {
+        if (isDebug) {
+            Log.e(mergeHeadTag(tag), msg);
+        }
+    }
+
+    public static void setDebug(boolean debug) {
+        isDebug = debug;
+    }
+
+    public static void setLogHead(String head) {
+        tagHead = head + DOT;
+    }
+
+    private static String mergeHeadTag(final String tag) {
+        return tagHead + tag;
+    }
+}
diff --git a/app/src/main/java/com/ic/blood/util/SPUtils.java b/app/src/main/java/com/ic/blood/util/SPUtils.java
new file mode 100644 (file)
index 0000000..caf041a
--- /dev/null
@@ -0,0 +1,52 @@
+package com.ic.blood.util;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+public class SPUtils {
+
+    private static final String Ped_Height = "Ped_Height";
+    private static final String Ped_Weight = "Ped_Weight";
+    private static final String Ped_Target = "Ped_Target";
+
+
+    private static SharedPreferences getSp(Context context) {
+        return context.getSharedPreferences("IcHardwarePed", Context.MODE_PRIVATE);
+    }
+
+    public static int getPedHeightSP(Context context) {
+        return getSp(context).getInt(Ped_Height, 170);
+    }
+
+    public static int getPedWighttSP(Context context) {
+        return getSp(context).getInt(Ped_Weight, 75);
+    }
+
+    public static int getPedTargetSP(Context context) {
+        return getSp(context).getInt(Ped_Target, 10000);
+    }
+
+    public static void setPedHeightSP(Context context,int height) {
+        SharedPreferences.Editor editor = getSp(context).edit();
+        if (editor != null) {
+            editor.putInt(Ped_Weight, height);
+            editor.apply();
+        }
+    }
+
+    public static void setPedWighttSP(Context context,int weight) {
+        SharedPreferences.Editor editor = getSp(context).edit();
+        if (editor != null) {
+            editor.putInt(Ped_Weight, weight);
+            editor.apply();
+        }
+    }
+
+    public static void setPedTargetSP(Context context,int target) {
+        SharedPreferences.Editor editor = getSp(context).edit();
+        if (editor != null) {
+            editor.putInt(Ped_Target, target);
+            editor.apply();
+        }
+    }
+}
diff --git a/app/src/main/java/com/ic/blood/util/ServiceUtil.java b/app/src/main/java/com/ic/blood/util/ServiceUtil.java
new file mode 100644 (file)
index 0000000..2acf7a3
--- /dev/null
@@ -0,0 +1,46 @@
+package com.ic.blood.util;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.content.pm.ResolveInfo;
+import android.content.pm.ServiceInfo;
+
+import java.util.List;
+
+public class ServiceUtil {
+
+    public static void startServiceUtil(Context context , String serviceAction, String packageName) {
+        Intent intent = getExplicitIntent(context, new Intent(serviceAction));
+        if(intent != null){
+            intent.setPackage(packageName);
+            context.startService(intent);
+        }
+    }
+
+    public static void bindServiceUtil(Context context , String action, ServiceConnection connection,String pck) {
+        Intent in = getExplicitIntent(context, new Intent(action));
+        if(in != null){
+            in.setPackage(pck);
+            context.bindService(in, connection, 0);
+        }
+    }
+
+    public static void unBindServiceUtil(Context context ,ServiceConnection connection) {
+        context.unbindService(connection);
+    }
+
+    private static Intent getExplicitIntent(Context context, Intent impl) {
+        List<ResolveInfo> resolveInfo = context.getPackageManager().queryIntentServices(impl, 0);
+
+        if (resolveInfo.size() != 1) return null;
+
+        Intent intent = new Intent(impl);
+        ServiceInfo info = resolveInfo.get(0).serviceInfo;
+        if (info == null) return null;
+        intent.setComponent(new ComponentName(info.packageName, info.name));
+
+        return intent;
+    }
+}
diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644 (file)
index 0000000..1f6bb29
--- /dev/null
@@ -0,0 +1,34 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:aapt="http://schemas.android.com/aapt"
+    android:width="108dp"
+    android:height="108dp"
+    android:viewportWidth="108"
+    android:viewportHeight="108">
+    <path
+        android:fillType="evenOdd"
+        android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
+        android:strokeWidth="1"
+        android:strokeColor="#00000000">
+        <aapt:attr name="android:fillColor">
+            <gradient
+                android:endX="78.5885"
+                android:endY="90.9159"
+                android:startX="48.7653"
+                android:startY="61.0927"
+                android:type="linear">
+                <item
+                    android:color="#44000000"
+                    android:offset="0.0" />
+                <item
+                    android:color="#00000000"
+                    android:offset="1.0" />
+            </gradient>
+        </aapt:attr>
+    </path>
+    <path
+        android:fillColor="#FFFFFF"
+        android:fillType="nonZero"
+        android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
+        android:strokeWidth="1"
+        android:strokeColor="#00000000" />
+</vector>
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644 (file)
index 0000000..0d025f9
--- /dev/null
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="108dp"
+    android:height="108dp"
+    android:viewportWidth="108"
+    android:viewportHeight="108">
+    <path
+        android:fillColor="#008577"
+        android:pathData="M0,0h108v108h-108z" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M9,0L9,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,0L19,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M29,0L29,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M39,0L39,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M49,0L49,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M59,0L59,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M69,0L69,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M79,0L79,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M89,0L89,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M99,0L99,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,9L108,9"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,19L108,19"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,29L108,29"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,39L108,39"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,49L108,49"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,59L108,59"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,69L108,69"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,79L108,79"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,89L108,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,99L108,99"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,29L89,29"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,39L89,39"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,49L89,49"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,59L89,59"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,69L89,69"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,79L89,79"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M29,19L29,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M39,19L39,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M49,19L49,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M59,19L59,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M69,19L69,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M79,19L79,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+</vector>
diff --git a/app/src/main/res/layout/activity_blood.xml b/app/src/main/res/layout/activity_blood.xml
new file mode 100644 (file)
index 0000000..1f5824c
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/main_content_fl"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".BloodActivity" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644 (file)
index 0000000..4fc2444
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".MainActivity">
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Hello World!"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_blood.xml b/app/src/main/res/layout/fragment_blood.xml
new file mode 100644 (file)
index 0000000..75747d8
--- /dev/null
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools">
+
+    <data>
+        <import type="android.view.View"/>
+
+        <variable
+            name="topTips"
+            type="String" />
+
+        <variable
+            name="bottomTips"
+            type="String" />
+
+        <variable
+            name="isShowTips"
+            type="boolean" />
+
+        <variable
+            name="heartValue"
+            type="String" />
+
+        <variable
+            name="highValue"
+            type="String" />
+
+        <variable
+            name="lowValue"
+            type="String" />
+    </data>
+
+    <FrameLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="#000000">
+
+        <pl.droidsonroids.gif.GifImageView
+            android:id="@+id/ic_heart_gif"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_gravity="center" />
+
+        <TextView
+            android:id="@+id/ic_tips_top"
+            style="@style/bloodTextStyle"
+            android:layout_gravity="center_horizontal"
+            android:layout_marginTop="10dp"
+            android:text="@{topTips}"
+            android:visibility="@{isShowTips ? View.VISIBLE : View.GONE}"/>
+
+        <TextView
+            android:id="@+id/ic_tips_bottom"
+            style="@style/bloodTextStyle"
+            android:layout_gravity="bottom|center_horizontal"
+            android:layout_marginBottom="10dp"
+            android:text="@{bottomTips}"
+            android:visibility="@{isShowTips ? View.VISIBLE : View.GONE}"/>
+
+        <RelativeLayout
+            android:id="@+id/ic_heart_layout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_horizontal"
+            android:layout_marginTop="20dp"
+            android:visibility="@{isShowTips ? View.GONE : View.VISIBLE}">
+
+            <TextView
+                android:id="@+id/ic_heart_name"
+                style="@style/bloodTextStyle"
+                android:layout_marginEnd="10dp"
+                android:text="@string/ic_heart_rate" />
+
+            <TextView
+                style="@style/bloodTextStyle"
+                android:id="@+id/ic_heart_value"
+                android:layout_marginStart="10dp"
+                android:layout_toEndOf="@id/ic_heart_name"
+                android:text="@{heartValue}"/>
+        </RelativeLayout>
+
+        <RelativeLayout
+            android:id="@+id/ic_high_layout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="bottom"
+            android:layout_marginStart="30dp"
+            android:visibility="@{isShowTips ? View.GONE : View.VISIBLE}">
+
+            <TextView
+                android:id="@+id/ic_high_name"
+                style="@style/bloodTextStyle"
+                android:text="@string/ic_high_pressure" />
+
+            <TextView
+                android:id="@+id/ic_high_value"
+                style="@style/bloodTextStyle"
+                android:layout_below="@id/ic_high_name"
+                android:layout_centerHorizontal="true"
+                android:text="@{highValue}"/>
+        </RelativeLayout>
+
+        <RelativeLayout
+            android:id="@+id/ic_low_layout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="bottom|end"
+            android:layout_marginEnd="30dp"
+            android:visibility="@{isShowTips ? View.GONE : View.VISIBLE}">
+
+            <TextView
+                android:id="@+id/ic_low_name"
+                style="@style/bloodTextStyle"
+                android:text="@string/ic_low_pressure" />
+
+            <TextView
+                android:id="@+id/ic_low_value"
+                style="@style/bloodTextStyle"
+                android:layout_below="@id/ic_low_name"
+                android:layout_centerHorizontal="true"
+                android:text="@{lowValue}"/>
+        </RelativeLayout>
+
+    </FrameLayout>
+
+</layout>
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644 (file)
index 0000000..eca70cf
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+    <background android:drawable="@drawable/ic_launcher_background" />
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon>
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644 (file)
index 0000000..eca70cf
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+    <background android:drawable="@drawable/ic_launcher_background" />
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon>
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..898f3ed
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644 (file)
index 0000000..dffca36
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..64ba76f
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644 (file)
index 0000000..dae5e08
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..e5ed465
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644 (file)
index 0000000..14ed0af
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..b0907ca
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644 (file)
index 0000000..d8ae031
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..2c18de9
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644 (file)
index 0000000..beed3cd
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644 (file)
index 0000000..69b2233
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="colorPrimary">#008577</color>
+    <color name="colorPrimaryDark">#00574B</color>
+    <color name="colorAccent">#D81B60</color>
+</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644 (file)
index 0000000..3b46295
--- /dev/null
@@ -0,0 +1,18 @@
+<resources>
+    <string name="ic_high_pressure">高压</string>
+    <string name="ic_low_pressure">低压</string>
+    <string name="ic_heart_rate">心率</string>
+
+    <string name="tips_not_device">未检测到设备</string>
+    <string name="tips_not_wear">未正确佩戴</string>
+
+    <string name="tips_quiet_please">请保持安静</string>
+    <string name="tips_start_check">准备测量</string>
+    <string name="tips_ing_check">正在测量中</string>
+    <string name="tips_stop_check">已停止测量</string>
+    <string name="tips_not_data_check">未测量到数据</string>
+
+    <string name="program_abnormal">很抱歉,程序出现异常,即将退出</string>
+
+    <string name="app_name">IcBlood</string>
+</resources>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644 (file)
index 0000000..4c68fb7
--- /dev/null
@@ -0,0 +1,17 @@
+<resources>
+
+    <!-- Base application theme. -->
+    <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
+        <!-- Customize your theme here. -->
+        <item name="colorPrimary">@color/colorPrimary</item>
+        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+        <item name="colorAccent">@color/colorAccent</item>
+    </style>
+
+    <style name="bloodTextStyle">
+        <item name="android:layout_width">wrap_content</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:textColor">#FFFFFF</item>
+        <item name="android:textSize">42sp</item>
+    </style>
+</resources>
diff --git a/app/src/test/java/com/ic/blood/ExampleUnitTest.java b/app/src/test/java/com/ic/blood/ExampleUnitTest.java
new file mode 100644 (file)
index 0000000..bc52bd3
--- /dev/null
@@ -0,0 +1,17 @@
+package com.ic.blood;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+public class ExampleUnitTest {
+    @Test
+    public void addition_isCorrect() {
+        assertEquals(4, 2 + 2);
+    }
+}
\ No newline at end of file
diff --git a/app/version_code.properties b/app/version_code.properties
new file mode 100644 (file)
index 0000000..463e77d
--- /dev/null
@@ -0,0 +1,2 @@
+#Mon Mar 23 19:02:46 CST 2020
+VERSION_CODE=13
diff --git a/build.gradle b/build.gradle
new file mode 100644 (file)
index 0000000..fb516be
--- /dev/null
@@ -0,0 +1,27 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+    repositories {
+        google()
+        jcenter()
+        
+    }
+    dependencies {
+        classpath 'com.android.tools.build:gradle:3.5.2'
+        
+        // NOTE: Do not place your application dependencies here; they belong
+        // in the individual module build.gradle files
+    }
+}
+
+allprojects {
+    repositories {
+        google()
+        jcenter()
+        
+    }
+}
+
+task clean(type: Delete) {
+    delete rootProject.buildDir
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644 (file)
index 0000000..199d16e
--- /dev/null
@@ -0,0 +1,20 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
+
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644 (file)
index 0000000..f6b961f
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644 (file)
index 0000000..204da20
--- /dev/null
@@ -0,0 +1,6 @@
+#Mon Mar 23 18:02:32 CST 2020
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644 (file)
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "$*"
+}
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+  cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644 (file)
index 0000000..f955316
--- /dev/null
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644 (file)
index 0000000..85b2263
--- /dev/null
@@ -0,0 +1,2 @@
+include ':app'
+rootProject.name='IcBlood'