|
@@ -14,7 +14,6 @@ import android.os.Handler
|
|
|
import android.os.Looper
|
|
import android.os.Looper
|
|
|
import android.provider.Settings
|
|
import android.provider.Settings
|
|
|
import android.provider.Settings.SettingNotFoundException
|
|
import android.provider.Settings.SettingNotFoundException
|
|
|
-import android.util.Log
|
|
|
|
|
import android.view.KeyEvent
|
|
import android.view.KeyEvent
|
|
|
import android.view.View
|
|
import android.view.View
|
|
|
import android.view.WindowManager
|
|
import android.view.WindowManager
|
|
@@ -333,6 +332,16 @@ class MainActivity : AppCompatActivity(), ScannerFragment.OnDeviceSelectedListen
|
|
|
runOnUiThread { mTvRssi?.setText("Rssi:" + rssi + "dBm") }
|
|
runOnUiThread { mTvRssi?.setText("Rssi:" + rssi + "dBm") }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ override fun onBatteryLevelChanged(device: BluetoothDevice, batteryLevel: Int) {
|
|
|
|
|
+ findViewById<TextView>(R.id.head_status).text =
|
|
|
|
|
+ "心率带已连接 电量" + getString(R.string.battery, batteryLevel)
|
|
|
|
|
+ }
|
|
|
|
|
+// 卡路里和全部卡路里
|
|
|
|
|
+ override fun onSportReceived(device: BluetoothDevice, step: Int, distance: Int, calorie: Int) {
|
|
|
|
|
+ findViewById<TextView>(R.id.sportNum).text = calorie.toString()
|
|
|
|
|
+ findViewById<TextView>(R.id.calNum).text = (calorie*1.25).toInt().toString()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 连续两次回退
|
|
// 连续两次回退
|
|
|
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
|
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
|
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
@@ -367,24 +376,18 @@ class MainActivity : AppCompatActivity(), ScannerFragment.OnDeviceSelectedListen
|
|
|
|
|
|
|
|
//心跳
|
|
//心跳
|
|
|
findViewById<TextView>(R.id.heartReal).text = heartRate.toString()
|
|
findViewById<TextView>(R.id.heartReal).text = heartRate.toString()
|
|
|
|
|
+ if (rrIntervals != null) {
|
|
|
|
|
+ findViewById<TextView>(R.id.rrIntervals).text = rrIntervals.toString()
|
|
|
|
|
+ }
|
|
|
// 运动强度
|
|
// 运动强度
|
|
|
// 男:((-55.0969 +(0.6309×HR)+(0.1988 xW)+(0.2017×A))/ 4.184)×60 xT
|
|
// 男:((-55.0969 +(0.6309×HR)+(0.1988 xW)+(0.2017×A))/ 4.184)×60 xT
|
|
|
// 女:((-20.4022 +(0.4472×HR) - (0.1263 xW)+(0.074×A))/ 4.184)×60 xT
|
|
// 女:((-20.4022 +(0.4472×HR) - (0.1263 xW)+(0.074×A))/ 4.184)×60 xT
|
|
|
// 其中,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 全部卡路里
|
|
|
|
|
- this.findViewById<TextView>(R.id.calNum).text =
|
|
|
|
|
- BaseData().calcSumCalc(heartRate, BaseData().sex, BaseData().weight, BaseData().age, 1)
|
|
|
|
|
-// todo 运动卡路里
|
|
|
|
|
- this.findViewById<TextView>(R.id.sportNum).text =
|
|
|
|
|
- BaseData().calcSportCalc(
|
|
|
|
|
- heartRate,
|
|
|
|
|
- BaseData().sex,
|
|
|
|
|
- BaseData().weight,
|
|
|
|
|
- BaseData().age,
|
|
|
|
|
- 1
|
|
|
|
|
- )
|
|
|
|
|
|
|
+//// todo 全部卡路里
|
|
|
|
|
+// this.findViewById<TextView>(R.id.calNum).text =
|
|
|
|
|
+// BaseData().calcSumCalc(heartRate, BaseData().sex, BaseData().weight, BaseData().age, 1)
|
|
|
|
|
|
|
|
// todo CK
|
|
// todo CK
|
|
|
this.findViewById<TextView>(R.id.ckNum).text =
|
|
this.findViewById<TextView>(R.id.ckNum).text =
|