Parcourir la source

封装include

Signed-off-by: duanchangpeng <838560574@qq.com>
duanchangpeng il y a 5 ans
Parent
commit
9e8bf336ae

+ 5 - 5
app/src/main/java/com/example/watch/ui/activity/BaseData.kt

@@ -8,7 +8,7 @@ class BaseData {
     val age = 4
     val weight = 21
     val head = "123.jpg"
-    val peaceHr = 95
+    val peaceHr = 70
 
     //  运动强度计算
     public fun calcActivity(Hr: Int, Sex: Int, Weight: Int, Age: Int, T: Int): String {
@@ -22,6 +22,7 @@ class BaseData {
         }
 //        强度最大100
         calc = if (calc >= 100.0) 100.0 else calc
+        calc = if (calc <= 0.0) 0.0 else calc
         println(calc)
         val res = calc.toInt().toString()
         return res
@@ -30,7 +31,7 @@ class BaseData {
     //    todo 计算运动消耗
     public fun calcSportCalc(Hr: Int, Sex: Int, Weight: Int, Age: Int, T: Int): String {
         var res = "0"
-        var calc = Hr.toDouble() * 0.98
+        val calc = Hr.toDouble() * 0.98
         if (calc > 1) {
             res = calc.toInt().toString()
         }
@@ -40,7 +41,7 @@ class BaseData {
     //    todo 计算全部消耗
     public fun calcSumCalc(calorie: Int): String {
         var res = "0"
-        var calc = calorie / weight
+        val calc = calorie / weight
         val df = DecimalFormat("######0.00")
         if (calc > 1) {
             res = calc.toInt().toString()
@@ -54,10 +55,9 @@ class BaseData {
     public fun calcCk(Hr: Int): String {
 //        卡路里除以体重
         var res = "0"
-        var calc = Hr.toDouble() / weight
+        val calc = Hr.toDouble() / weight
         if (calc > 1) {
             res = calc.toInt().toString()
-        } else {
         }
         return res
     }

+ 0 - 2
app/src/main/java/com/example/watch/ui/activity/MainActivity.kt

@@ -106,7 +106,6 @@ class MainActivity : AppCompatActivity(), ScannerFragment.OnDeviceSelectedListen
     private fun linkHeartBand() {
         val chainBtn = findViewById<Button>(R.id.chainBtn)
         chainBtn.setOnClickListener {
-
             val dialog = ScannerFragment.getInstance()
             if (dialog == null) {
                 println("1122")
@@ -429,7 +428,6 @@ class MainActivity : AppCompatActivity(), ScannerFragment.OnDeviceSelectedListen
         findViewById<Button>(R.id.chainBtn).setVisibility(View.GONE); // 隐藏
         findViewById<TextView>(R.id.unchain).text = "心率带已连接"
         findViewById<TextView>(R.id.unchain).setTextColor(Color.parseColor("#AACC03"))
-
     }
 
     //    开始运动

+ 12 - 413
app/src/main/res/layout/activity_main.xml

@@ -194,422 +194,21 @@
 
         </LinearLayout>
 
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="70dp"
-            android:gravity="center"
-            android:orientation="vertical">
-
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:background="#fff"
-                android:orientation="horizontal">
-
-                <LinearLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="match_parent"
-                    android:layout_weight="1"
-                    android:orientation="horizontal">
-
-                    <LinearLayout
-                        android:layout_width="match_parent"
-                        android:layout_height="match_parent"
-                        android:orientation="vertical">
-
-                        <TextView
-                            android:id="@+id/height"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            android:gravity="center"
-                            android:text="0"
-                            android:textColor="#000"
-                            android:textSize="29dp" />
-
-                        <TextView
-                            android:id="@+id/textView14"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            android:gravity="center"
-                            android:text="身高cm"
-                            android:textColor="#C4C4C4" />
-                    </LinearLayout>
-                </LinearLayout>
-
-                <View
-                    android:layout_width="1dip"
-                    android:layout_height="40dp"
-                    android:layout_gravity="center"
-                    android:background="#E2E2E2" />
-
-                <LinearLayout
-                    android:id="@+id/main_middle"
-                    android:layout_width="match_parent"
-                    android:layout_height="match_parent"
-                    android:layout_weight="1"
-                    android:orientation="horizontal">
-
-                    <LinearLayout
-                        android:layout_width="match_parent"
-                        android:layout_height="131dp"
-                        android:orientation="vertical">
-
-                        <TextView
-                            android:id="@+id/age"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            android:gravity="center"
-                            android:text="0"
-                            android:textColor="#000"
-                            android:textSize="29dp" />
-
-                        <TextView
-                            android:id="@+id/textView16"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            android:gravity="center"
-                            android:text="年龄"
-                            android:textColor="#C4C4C4" />
-                    </LinearLayout>
-                </LinearLayout>
-
-                <View
-                    android:layout_width="1dip"
-                    android:layout_height="40dp"
-                    android:layout_gravity="center"
-                    android:background="#E2E2E2" />
-
-                <LinearLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="match_parent"
-                    android:layout_weight="1"
-                    android:orientation="horizontal">
-
-                    <LinearLayout
-                        android:layout_width="match_parent"
-                        android:layout_height="match_parent"
-                        android:orientation="vertical">
-
-                        <TextView
-                            android:id="@+id/weight"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            android:gravity="center"
-                            android:text="0"
-                            android:textColor="#000"
-                            android:textSize="29dp" />
-
-                        <TextView
-                            android:id="@+id/textView18"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            android:gravity="center"
-                            android:text="体重kg"
-                            android:textColor="#C4C4C4" />
-                    </LinearLayout>
-                </LinearLayout>
-
-                <View
-                    android:layout_width="1dip"
-                    android:layout_height="40dp"
-                    android:layout_gravity="center"
-                    android:background="#E2E2E2" />
-
-                <LinearLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="match_parent"
-                    android:layout_weight="1"
-                    android:orientation="horizontal">
-
-                    <LinearLayout
-                        android:layout_width="match_parent"
-                        android:layout_height="match_parent"
-                        android:orientation="vertical">
-
-                        <TextView
-                            android:id="@+id/peaceHr"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            android:gravity="center"
-                            android:text="0"
-                            android:textColor="#000"
-                            android:textSize="29dp" />
-
-                        <TextView
-                            android:id="@+id/textView20"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            android:gravity="center"
-                            android:text="静息心率"
-                            android:textColor="#C4C4C4" />
-                    </LinearLayout>
-                </LinearLayout>
-            </LinearLayout>
-
-        </LinearLayout>
-
-        <LinearLayout
-            android:id="@+id/contectPart"
-            android:layout_width="wrap_content"
-            android:layout_height="49dp"
-            android:layout_gravity="center"
-            android:orientation="horizontal">
-
-            <ImageView
-                android:id="@+id/chain"
-                android:layout_width="20dp"
-                android:layout_height="20dp"
-                android:layout_centerHorizontal="true"
-                android:layout_gravity="center"
-                android:gravity="center"
-                android:src="@drawable/chain" />
-
-            <TextView
-                android:id="@+id/unchain"
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:layout_gravity="center"
-                android:layout_marginLeft="15dp"
-                android:gravity="center"
-                android:text="心率带未连接"
-                android:textColor="#FF4040"
-                android:textSize="14dp" />
-
-            <Button
-                android:id="@+id/chainBtn"
-                android:layout_width="90dp"
-                android:layout_height="24dp"
-                android:layout_gravity="center"
-                android:layout_marginLeft="15dp"
-                android:layout_weight="1"
-                android:background="@drawable/btn_contect"
-                android:baselineAligned="false"
-                android:text="点击连接" />
-        </LinearLayout>
-
-        <LinearLayout
-            android:id="@+id/main_bottom"
-            android:layout_width="match_parent"
-            android:layout_height="98dp"
-            android:layout_marginTop="5dp"
-            android:layout_marginBottom="5dp"
-            android:background="#fff"
-            android:orientation="horizontal">
-
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="86dp"
-                android:layout_weight="10"
-                android:orientation="vertical">
-
-                <LinearLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="70dp"
-                    android:orientation="horizontal">
-
-                    <ImageView
-                        android:id="@+id/fire"
-                        android:layout_width="match_parent"
-                        android:layout_height="82dp"
-                        android:layout_gravity="center"
-                        android:layout_weight="1"
-                        android:src="@drawable/icon_sport" />
-
-                    <TextView
-                        android:id="@+id/calNum"
-                        android:layout_width="match_parent"
-                        android:layout_height="82dp"
-                        android:layout_gravity="center"
-                        android:layout_weight="1"
-                        android:gravity="center_vertical|left"
-                        android:text="0"
-                        android:textColor="#333"
-                        android:textSize="20dp" />
-
-                    <View
-                        android:layout_width="1dip"
-                        android:layout_height="40dp"
-                        android:layout_gravity="center"
-                        android:background="#E2E2E2" />
-                </LinearLayout>
-
-                <TextView
-                    android:id="@+id/caltext"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:gravity="center"
-                    android:text="卡路里"
-                    android:textColor="#9A9A9A"
-                    android:textSize="10dp" />
-
-            </LinearLayout>
-
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="90dp"
-                android:layout_weight="10"
-                android:orientation="vertical">
-
-                <LinearLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="70dp"
-                    android:orientation="horizontal">
-
-                    <ImageView
-                        android:id="@+id/redfire"
-                        android:layout_width="match_parent"
-                        android:layout_height="82dp"
-                        android:layout_gravity="center"
-                        android:layout_weight="1"
-                        android:src="@drawable/icon_redsport" />
-
-                    <TextView
-                        android:id="@+id/sportNum"
-                        android:layout_width="match_parent"
-                        android:layout_height="82dp"
-                        android:layout_gravity="center"
-                        android:layout_weight="1"
-                        android:gravity="center_vertical|left"
-                        android:text="0"
-                        android:textColor="#333"
-                        android:textSize="20dp" />
-
-                    <View
-                        android:layout_width="1dip"
-                        android:layout_height="40dp"
-                        android:layout_gravity="center"
-                        android:background="#E2E2E2" />
-                </LinearLayout>
-
-                <TextView
-                    android:id="@+id/sportText"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:gravity="center"
-                    android:text="运动卡路里"
-                    android:textColor="#9A9A9A"
-                    android:textSize="10dp" />
-
-            </LinearLayout>
-
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="89dp"
-                android:layout_weight="10"
-                android:orientation="vertical">
-
-                <LinearLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="match_parent"
-                    android:layout_weight="10"
-                    android:orientation="horizontal">
-
-                    <ImageView
-                        android:id="@+id/ckIcon"
-                        android:layout_width="110dp"
-                        android:layout_height="22dp"
-                        android:layout_gravity="center"
-                        android:layout_weight="1"
-                        android:src="@drawable/ck" />
-
-                    <TextView
-                        android:id="@+id/ckNum"
-                        android:layout_width="match_parent"
-                        android:layout_height="match_parent"
-                        android:layout_gravity="center"
-                        android:layout_weight="1"
-                        android:gravity="center_vertical|left"
-                        android:text="0"
-                        android:textColor="#333"
-                        android:textSize="20dp" />
-                </LinearLayout>
-
-                <TextView
-                    android:id="@+id/textView11"
-                    android:layout_width="match_parent"
-                    android:layout_height="20dp"
-                    android:layout_weight="1"
-                    android:gravity="center"
-                    android:text="CK"
-                    android:textColor="#9A9A9A"
-                    android:textSize="10dp" />
-            </LinearLayout>
-        </LinearLayout>
-
-
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="30dp"
-            android:layout_gravity="center"
-            android:background="#fff"
-            android:gravity="center"
-            android:orientation="horizontal">
-
-            <Button
-                android:id="@+id/btn_stop"
-                android:layout_width="70dp"
-                android:layout_height="30dp"
-                android:layout_marginLeft="20dp"
-                android:background="@drawable/gary_btn"
-                android:gravity="center"
-                android:textColor="@color/red"
-                android:text="停止运动" />
-
-            <Button
-                android:id="@+id/beginBtn"
-                android:layout_width="210dp"
-                android:layout_height="30dp"
-                android:layout_marginLeft="15dp"
-                android:layout_marginRight="15dp"
-                android:background="@drawable/round_btn"
-                android:gravity="center"
-                android:text="开始运动"
-                android:textColor="@color/green" />
-
-            <Button
-                android:id="@+id/reportHr"
-                android:layout_width="70dp"
-                android:layout_height="30dp"
-                android:layout_marginRight="20dp"
-                android:background="@drawable/gary_btn"
-                android:gravity="center"
-                android:text="心率上报"
-                android:textColor="#fff" />
-        </LinearLayout>
-
-        <TextView
-            android:id="@+id/textView12"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:background="#fff"
-            android:gravity="center"
-            android:text="5分钟心率趋势图"
-            android:textColor="#000"
-            android:textSize="20dp" />
-
-        <TextView
-            android:id="@+id/rrIntervals"
+        <include
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:background="#fff"
-            android:gravity="center"
-            android:text="最大心率 : 0      平均心率 : 0"
-            android:textColor="#9A9A9A"
-            android:textSize="15dp" />
+            android:layout_height="match_parent"
+            android:layout_centerHorizontal="true"
+            android:layout_weight="1"
+            android:layout_marginTop="20dp"
+            layout="@layout/main_basic" />
 
-        <LinearLayout
+        <include
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal">
-
-            <com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
-                android:id="@+id/aa_chart_view"
-                android:layout_width="match_parent"
-                android:gravity="center"
-                android:layout_height="180dp">
-            </com.github.aachartmodel.aainfographics.aachartcreator.AAChartView>
-        </LinearLayout>
+            android:layout_height="match_parent"
+            android:layout_centerHorizontal="true"
+            android:layout_weight="1"
+            android:layout_marginTop="20dp"
+            layout="@layout/main_chart_part" />
     </LinearLayout>
 
     <com.google.android.material.bottomnavigation.BottomNavigationView

+ 393 - 0
app/src/main/res/layout/main_basic.xml

@@ -0,0 +1,393 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        >
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="70dp"
+            android:gravity="center"
+            android:orientation="vertical">
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:background="#fff"
+                android:orientation="horizontal">
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
+                    android:orientation="horizontal">
+
+                    <LinearLayout
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:orientation="vertical">
+
+                        <TextView
+                            android:id="@+id/height"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:gravity="center"
+                            android:text="0"
+                            android:textColor="#000"
+                            android:textSize="29dp" />
+
+                        <TextView
+                            android:id="@+id/textView14"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:gravity="center"
+                            android:text="身高cm"
+                            android:textColor="#C4C4C4" />
+                    </LinearLayout>
+                </LinearLayout>
+
+                <View
+                    android:layout_width="1dip"
+                    android:layout_height="40dp"
+                    android:layout_gravity="center"
+                    android:background="#E2E2E2" />
+
+                <LinearLayout
+                    android:id="@+id/main_middle"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
+                    android:orientation="horizontal">
+
+                    <LinearLayout
+                        android:layout_width="match_parent"
+                        android:layout_height="131dp"
+                        android:orientation="vertical">
+
+                        <TextView
+                            android:id="@+id/age"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:gravity="center"
+                            android:text="0"
+                            android:textColor="#000"
+                            android:textSize="29dp" />
+
+                        <TextView
+                            android:id="@+id/textView16"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:gravity="center"
+                            android:text="年龄"
+                            android:textColor="#C4C4C4" />
+                    </LinearLayout>
+                </LinearLayout>
+
+                <View
+                    android:layout_width="1dip"
+                    android:layout_height="40dp"
+                    android:layout_gravity="center"
+                    android:background="#E2E2E2" />
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
+                    android:orientation="horizontal">
+
+                    <LinearLayout
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:orientation="vertical">
+
+                        <TextView
+                            android:id="@+id/weight"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:gravity="center"
+                            android:text="0"
+                            android:textColor="#000"
+                            android:textSize="29dp" />
+
+                        <TextView
+                            android:id="@+id/textView18"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:gravity="center"
+                            android:text="体重kg"
+                            android:textColor="#C4C4C4" />
+                    </LinearLayout>
+                </LinearLayout>
+
+                <View
+                    android:layout_width="1dip"
+                    android:layout_height="40dp"
+                    android:layout_gravity="center"
+                    android:background="#E2E2E2" />
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
+                    android:orientation="horizontal">
+
+                    <LinearLayout
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:orientation="vertical">
+
+                        <TextView
+                            android:id="@+id/peaceHr"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:gravity="center"
+                            android:text="0"
+                            android:textColor="#000"
+                            android:textSize="29dp" />
+
+                        <TextView
+                            android:id="@+id/textView20"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:gravity="center"
+                            android:text="静息心率"
+                            android:textColor="#C4C4C4" />
+                    </LinearLayout>
+                </LinearLayout>
+            </LinearLayout>
+
+        </LinearLayout>
+        <LinearLayout
+            android:id="@+id/contectPart"
+            android:layout_width="wrap_content"
+            android:layout_height="49dp"
+            android:layout_gravity="center"
+            android:orientation="horizontal">
+
+            <ImageView
+                android:id="@+id/chain"
+                android:layout_width="20dp"
+                android:layout_height="20dp"
+                android:layout_centerHorizontal="true"
+                android:layout_gravity="center"
+                android:gravity="center"
+                android:src="@drawable/chain" />
+
+            <TextView
+                android:id="@+id/unchain"
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:layout_gravity="center"
+                android:layout_marginLeft="15dp"
+                android:gravity="center"
+                android:text="心率带未连接"
+                android:textColor="#FF4040"
+                android:textSize="14dp" />
+
+            <Button
+                android:id="@+id/chainBtn"
+                android:layout_width="90dp"
+                android:layout_height="24dp"
+                android:layout_gravity="center"
+                android:layout_marginLeft="15dp"
+                android:layout_weight="1"
+                android:background="@drawable/btn_contect"
+                android:baselineAligned="false"
+                android:text="点击连接" />
+        </LinearLayout>
+        <LinearLayout
+            android:id="@+id/main_bottom"
+            android:layout_width="match_parent"
+            android:layout_height="98dp"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:background="#fff"
+            android:orientation="horizontal">
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="86dp"
+                android:layout_weight="10"
+                android:orientation="vertical">
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="70dp"
+                    android:orientation="horizontal">
+
+                    <ImageView
+                        android:id="@+id/fire"
+                        android:layout_width="match_parent"
+                        android:layout_height="82dp"
+                        android:layout_gravity="center"
+                        android:layout_weight="1"
+                        android:src="@drawable/icon_sport" />
+
+                    <TextView
+                        android:id="@+id/calNum"
+                        android:layout_width="match_parent"
+                        android:layout_height="82dp"
+                        android:layout_gravity="center"
+                        android:layout_weight="1"
+                        android:gravity="center_vertical|left"
+                        android:text="0"
+                        android:textColor="#333"
+                        android:textSize="20dp" />
+
+                    <View
+                        android:layout_width="1dip"
+                        android:layout_height="40dp"
+                        android:layout_gravity="center"
+                        android:background="#E2E2E2" />
+                </LinearLayout>
+
+                <TextView
+                    android:id="@+id/caltext"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:gravity="center"
+                    android:text="卡路里"
+                    android:textColor="#9A9A9A"
+                    android:textSize="10dp" />
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="90dp"
+                android:layout_weight="10"
+                android:orientation="vertical">
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="70dp"
+                    android:orientation="horizontal">
+
+                    <ImageView
+                        android:id="@+id/redfire"
+                        android:layout_width="match_parent"
+                        android:layout_height="82dp"
+                        android:layout_gravity="center"
+                        android:layout_weight="1"
+                        android:src="@drawable/icon_redsport" />
+
+                    <TextView
+                        android:id="@+id/sportNum"
+                        android:layout_width="match_parent"
+                        android:layout_height="82dp"
+                        android:layout_gravity="center"
+                        android:layout_weight="1"
+                        android:gravity="center_vertical|left"
+                        android:text="0"
+                        android:textColor="#333"
+                        android:textSize="20dp" />
+
+                    <View
+                        android:layout_width="1dip"
+                        android:layout_height="40dp"
+                        android:layout_gravity="center"
+                        android:background="#E2E2E2" />
+                </LinearLayout>
+
+                <TextView
+                    android:id="@+id/sportText"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:gravity="center"
+                    android:text="运动卡路里"
+                    android:textColor="#9A9A9A"
+                    android:textSize="10dp" />
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="89dp"
+                android:layout_weight="10"
+                android:orientation="vertical">
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:layout_weight="10"
+                    android:orientation="horizontal">
+
+                    <ImageView
+                        android:id="@+id/ckIcon"
+                        android:layout_width="110dp"
+                        android:layout_height="22dp"
+                        android:layout_gravity="center"
+                        android:layout_weight="1"
+                        android:src="@drawable/ck" />
+
+                    <TextView
+                        android:id="@+id/ckNum"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:layout_gravity="center"
+                        android:layout_weight="1"
+                        android:gravity="center_vertical|left"
+                        android:text="0"
+                        android:textColor="#333"
+                        android:textSize="20dp" />
+                </LinearLayout>
+
+                <TextView
+                    android:id="@+id/textView11"
+                    android:layout_width="match_parent"
+                    android:layout_height="20dp"
+                    android:layout_weight="1"
+                    android:gravity="center"
+                    android:text="CK"
+                    android:textColor="#9A9A9A"
+                    android:textSize="10dp" />
+            </LinearLayout>
+        </LinearLayout>
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="30dp"
+            android:layout_gravity="center"
+            android:background="#fff"
+            android:gravity="center"
+            android:orientation="horizontal">
+
+            <Button
+                android:id="@+id/btn_stop"
+                android:layout_width="70dp"
+                android:layout_height="30dp"
+                android:layout_marginLeft="20dp"
+                android:background="@drawable/gary_btn"
+                android:gravity="center"
+                android:textColor="@color/red"
+                android:text="停止运动" />
+
+            <Button
+                android:id="@+id/beginBtn"
+                android:layout_width="210dp"
+                android:layout_height="30dp"
+                android:layout_marginLeft="15dp"
+                android:layout_marginRight="15dp"
+                android:background="@drawable/round_btn"
+                android:gravity="center"
+                android:text="开始运动"
+                android:textColor="@color/green" />
+
+            <Button
+                android:id="@+id/reportHr"
+                android:layout_width="70dp"
+                android:layout_height="30dp"
+                android:layout_marginRight="20dp"
+                android:background="@drawable/gary_btn"
+                android:gravity="center"
+                android:text="心率上报"
+                android:textColor="#fff" />
+        </LinearLayout>
+    </LinearLayout>
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 43 - 0
app/src/main/res/layout/main_chart_part.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:gravity="top"
+        android:orientation="vertical"
+        android:layout_marginTop="10dp"
+        tools:ignore="MissingConstraints">
+
+        <TextView
+            android:id="@+id/textView12"
+            android:layout_width="match_parent"
+            android:layout_height="30dp"
+            android:background="#fff"
+            android:gravity="center"
+            android:text="5分钟心率趋势图"
+            android:textColor="#000"
+            android:textSize="20dp"
+            tools:ignore="MissingConstraints" />
+
+        <TextView
+            android:id="@+id/rrIntervals"
+            android:layout_width="match_parent"
+            android:layout_height="30dp"
+            android:background="#fff"
+            android:gravity="center"
+            android:text="最大心率 : 0      平均心率 : 0"
+            android:textColor="#9A9A9A"
+            android:textSize="15dp"
+            tools:ignore="MissingConstraints" />
+            <com.github.aachartmodel.aainfographics.aachartcreator.AAChartView
+                android:id="@+id/aa_chart_view"
+                android:layout_width="match_parent"
+                android:layout_height="180dp"
+                android:gravity="center">
+            </com.github.aachartmodel.aainfographics.aachartcreator.AAChartView>
+    </LinearLayout>
+</androidx.constraintlayout.widget.ConstraintLayout>