| | |
| | | */ |
| | | class MoneyBroadCastReceiver : BroadcastReceiver() { |
| | | override fun onReceive(contexts: Context?, intent: Intent?) { |
| | | if (intent == null && contexts == null) { |
| | | toast("内容获取为空,广播接收消息错误") |
| | | return |
| | | } |
| | | try { |
| | | Handler(Looper.getMainLooper()).post { |
| | | when (intent!!.action) { |
| | | "wisdom.intent.action.ledLight" -> { |
| | | val isHeavy = intent!!.getBooleanExtra("isHeavy", true) |
| | | if (isHeavy) { |
| | | callStatue(contexts!!, 5) //代表让订单到进行中 |
| | | } |
| | | } |
| | | |
| | | "wisdom.intent.action.priceDevice" -> { |
| | | var price = intent.getDoubleExtra("price", 0.0) //计价器价格,单位为元 |
| | | var mileage = intent.getDoubleExtra("mileage", 0.0) //里程,单位为km |
| | | callOver(contexts!!, price) |
| | | } |
| | | } |
| | | } |
| | | } catch (e: Exception) { |
| | | |
| | | } |
| | | // if (intent == null && contexts == null) { |
| | | // toast("内容获取为空,广播接收消息错误") |
| | | // return |
| | | // } |
| | | // try { |
| | | // Handler(Looper.getMainLooper()).post { |
| | | // when (intent!!.action) { |
| | | // "wisdom.intent.action.ledLight" -> { |
| | | // val isHeavy = intent!!.getBooleanExtra("isHeavy", true) |
| | | // if (isHeavy) { |
| | | // callStatue(contexts!!, 5) //代表让订单到进行中 |
| | | // } |
| | | // } |
| | | // |
| | | // "wisdom.intent.action.priceDevice" -> { |
| | | // var price = intent.getDoubleExtra("price", 0.0) //计价器价格,单位为元 |
| | | // var mileage = intent.getDoubleExtra("mileage", 0.0) //里程,单位为km |
| | | // callOver(contexts!!, price) |
| | | // } |
| | | // } |
| | | // } |
| | | // } catch (e: Exception) { |
| | | // |
| | | // } |
| | | } |
| | | |
| | | companion object { |