|
@@ -336,10 +336,13 @@ class MainActivity : AppCompatActivity(), ScannerFragment.OnDeviceSelectedListen
|
|
|
findViewById<TextView>(R.id.head_status).text =
|
|
findViewById<TextView>(R.id.head_status).text =
|
|
|
"心率带已连接 电量" + getString(R.string.battery, batteryLevel)
|
|
"心率带已连接 电量" + getString(R.string.battery, batteryLevel)
|
|
|
}
|
|
}
|
|
|
-// 卡路里和全部卡路里
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 卡路里和全部卡路里以及CK
|
|
|
override fun onSportReceived(device: BluetoothDevice, step: Int, distance: Int, calorie: Int) {
|
|
override fun onSportReceived(device: BluetoothDevice, step: Int, distance: Int, calorie: Int) {
|
|
|
findViewById<TextView>(R.id.sportNum).text = calorie.toString()
|
|
findViewById<TextView>(R.id.sportNum).text = calorie.toString()
|
|
|
- findViewById<TextView>(R.id.calNum).text = (calorie*1.25).toInt().toString()
|
|
|
|
|
|
|
+ findViewById<TextView>(R.id.calNum).text = (calorie * 1.25).toInt().toString()
|
|
|
|
|
+ findViewById<TextView>(R.id.ckNum).text = BaseData().calcCk(calorie)
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 连续两次回退
|
|
// 连续两次回退
|
|
@@ -385,14 +388,12 @@ class MainActivity : AppCompatActivity(), ScannerFragment.OnDeviceSelectedListen
|
|
|
// 其中,HR =心率(次/分钟) W =体重(公斤) A=年龄(岁) T =锻炼持续时间的时间(以小时计)
|
|
// 其中,HR =心率(次/分钟) W =体重(公斤) A=年龄(岁) T =锻炼持续时间的时间(以小时计)
|
|
|
this.findViewById<TextView>(R.id.activLevel).text =
|
|
this.findViewById<TextView>(R.id.activLevel).text =
|
|
|
BaseData().calcActivity(heartRate, BaseData().sex, BaseData().weight, BaseData().age, 1)
|
|
BaseData().calcActivity(heartRate, BaseData().sex, BaseData().weight, BaseData().age, 1)
|
|
|
-//// todo 全部卡路里
|
|
|
|
|
|
|
+
|
|
|
|
|
+// 根据运动强度加载不同的背景色,状态栏颜色 和 提示语
|
|
|
|
|
+ headStatus(10)
|
|
|
|
|
+// todo 全部卡路里
|
|
|
// this.findViewById<TextView>(R.id.calNum).text =
|
|
// this.findViewById<TextView>(R.id.calNum).text =
|
|
|
// BaseData().calcSumCalc(heartRate, BaseData().sex, BaseData().weight, BaseData().age, 1)
|
|
// BaseData().calcSumCalc(heartRate, BaseData().sex, BaseData().weight, BaseData().age, 1)
|
|
|
-
|
|
|
|
|
-// todo CK
|
|
|
|
|
- this.findViewById<TextView>(R.id.ckNum).text =
|
|
|
|
|
- BaseData().calcSumCalc(heartRate, BaseData().sex, BaseData().weight, BaseData().age, 1)
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
fun setDeafultData() {
|
|
fun setDeafultData() {
|
|
@@ -419,13 +420,13 @@ class MainActivity : AppCompatActivity(), ScannerFragment.OnDeviceSelectedListen
|
|
|
// 开始运动
|
|
// 开始运动
|
|
|
fun beginSport() {
|
|
fun beginSport() {
|
|
|
// 开始
|
|
// 开始
|
|
|
- var beginBtn = findViewById<Button>(R.id.beginBtn)
|
|
|
|
|
|
|
+ val beginBtn = findViewById<Button>(R.id.beginBtn)
|
|
|
beginBtn.setOnClickListener {
|
|
beginBtn.setOnClickListener {
|
|
|
showToast("运动计时已开")
|
|
showToast("运动计时已开")
|
|
|
timeInter()
|
|
timeInter()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- var reportHr = findViewById<Button>(R.id.reportHr)
|
|
|
|
|
|
|
+ val reportHr = findViewById<Button>(R.id.reportHr)
|
|
|
reportHr.setOnClickListener {
|
|
reportHr.setOnClickListener {
|
|
|
showToast("心率已上报 todo")
|
|
showToast("心率已上报 todo")
|
|
|
}
|
|
}
|
|
@@ -447,13 +448,28 @@ class MainActivity : AppCompatActivity(), ScannerFragment.OnDeviceSelectedListen
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 结束
|
|
// 结束
|
|
|
- var btn_stop = findViewById<Button>(R.id.btn_stop)
|
|
|
|
|
|
|
+ val btn_stop = findViewById<Button>(R.id.btn_stop)
|
|
|
btn_stop.setOnClickListener {
|
|
btn_stop.setOnClickListener {
|
|
|
showToast("运动计时已终止")
|
|
showToast("运动计时已终止")
|
|
|
findViewById<Button>(R.id.beginBtn).text = "开始运动"
|
|
findViewById<Button>(R.id.beginBtn).text = "开始运动"
|
|
|
timer.cancel()
|
|
timer.cancel()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ fun headStatus(activLevel: Int) {
|
|
|
|
|
+ val activLevel = this.findViewById<TextView>(R.id.activLevel)
|
|
|
|
|
+ var levelText = "激活放松"
|
|
|
|
|
+ when (activLevel) {
|
|
|
|
|
+ in 0..39 -> levelText = "激活放松"
|
|
|
|
|
+ in 40..54 -> levelText = "激活放松"
|
|
|
|
|
+ in 55..69 -> levelText = "激活放松"
|
|
|
|
|
+ in 70..79 -> levelText = "激活放松"
|
|
|
|
|
+ in 80..89 -> levelText = "激活放松"
|
|
|
|
|
+ in 90..109 -> levelText = "激活放松"
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|