| | |
| | | import android.os.Bundle |
| | | import android.os.CountDownTimer |
| | | import cn.sinata.xldutils.activitys.DialogActivity |
| | | import cn.sinata.xldutils.utils.Toast |
| | | import cn.sinata.xldutils.utils.clickDelay |
| | | import cn.sinata.xldutils.utils.getNowTimeBlack |
| | | import cn.sinata.xldutils.utils.textColor |
| | | import cn.sinata.xldutils.utils.* |
| | | import com.amap.api.maps.model.LatLng |
| | | import com.okgoincar.netUtls.* |
| | | import com.okgoincar.slab.util.UiUtil |
| | |
| | | import com.okgoincar.base.AMapKit |
| | | import com.okgoincar.base.MyApplication |
| | | import com.okgoincar.bean.OrderBean |
| | | import com.okgoincar.bean.ServerVoiceBean |
| | | import com.okgoincar.netUtls.Api |
| | | import com.okgoincar.slab.cargo.CargoActivity |
| | | import kotlinx.android.synthetic.main.item_get_order.* |
| | | import kotlinx.android.synthetic.main.item_map_market.view.* |
| | | import org.jetbrains.anko.startActivity |
| | |
| | | //设置竖屏显示 |
| | | requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE |
| | | callOrderDetail() |
| | | callVideo() |
| | | var strBtn = "抢单" |
| | | if (type == 2){ |
| | | strBtn = "确定" |
| | |
| | | tv_sure.text = strBtn + it.toString() + "秒" |
| | | } |
| | | } |
| | | |
| | | tv_close.clickDelay { |
| | | finish() |
| | | } |
| | | |
| | | tv_sure.clickDelay { |
| | | if (type == 1){ |
| | | showGetOrder() |
| | |
| | | } |
| | | } |
| | | setblack(getNowTimeBlack()) |
| | | } |
| | | |
| | | private fun callVideo() { |
| | | var map = getMapByAny() |
| | | map["orderId"] = orderId |
| | | map["orderType"] = orderType |
| | | map["lat"] = MyApplication.getLocation().latitude |
| | | map["lon"] = MyApplication.getLocation().longitude |
| | | callNet(this,Api.queryVoiceBroadcast,map){ |
| | | var bean = Gson().fromJson<ServerVoiceBean>(it,ServerVoiceBean::class.java) |
| | | if (!bean.data.isNullOrEmpty()){ |
| | | MyApplication.getTTsManager().setVideoText(bean.data) |
| | | var str = bean.data |
| | | str = str.substring(7,str.indexOf("公里,")) |
| | | tv_title.text = "距您约"+str+"公里" |
| | | } |
| | | } |
| | | } |
| | | |
| | | override fun initView() { |
| | |
| | | tv_end.text = data.endAddress |
| | | tv_money.text = data.tipMoney.toString() + "元红包" |
| | | tv_reassign.text = data.type |
| | | if (orderType == "5" || orderType == "4"){ |
| | | toast("确少货物数量") |
| | | tv_name.visible() |
| | | tv_cargo_num.visible() |
| | | tv_money.visible() |
| | | tv_money.setDrawableLeft(R.mipmap.rocket_cargo) |
| | | tv_name.text = data.nickName+"-"+data.phone |
| | | var cargoStrType = if (data.cargoType == "1") "普通小件X" else "贵重小件X" |
| | | tv_cargo_num.text = cargoStrType+data.peopleNumber |
| | | if (data.tipMoney != null && data.tipMoney > 0.0){ |
| | | tv_money.text = doubleTwo(data.tipMoney)+"元加急费" |
| | | }else{ |
| | | tv_money.gone() |
| | | } |
| | | } |
| | | AMapKit.initRouteLine( |
| | | this, |
| | | LatLng(MyApplication.getLocation().latitude, MyApplication.getLocation().longitude), |
| | |
| | | lineTance: Float, |
| | | lineTime: Long |
| | | ) { |
| | | MyApplication.getTTsManager().setVideoText("收到新的"+UiUtil.getNameByType(orderType!!)+"订单,"+"从"+data.startAddress+"出发,距您约"+AMapKit.getTance(lineTance)) |
| | | tv_title.text = "距您约" + AMapKit.getTance(lineTance) |
| | | // MyApplication.getTTsManager().setVideoText("收到新的"+ |
| | | // UiUtil.getNameByType(orderType!!)+"订单,"+"从"+data.startAddress+"出发,距您约"+AMapKit.getTance(lineTance)) |
| | | } |
| | | }) |
| | | } |
| | |
| | | tv_start.textColor(this,R.color.white) |
| | | tv_end.textColor(this,R.color.white) |
| | | tv_money.textColor(this,R.color.white) |
| | | tv_name.textColor(this,R.color.white) |
| | | tv_cargo_num.textColor(this,R.color.white) |
| | | tv_title.textColor(this,R.color.slab_yellow_zhong) |
| | | }else{ |
| | | rl_top_back.setBackgroundResource(R.color.white) |
| | |
| | | tv_start.textColor(this,R.color.black) |
| | | tv_end.textColor(this,R.color.black) |
| | | tv_money.textColor(this,R.color.black) |
| | | tv_name.textColor(this,R.color.black) |
| | | tv_cargo_num.textColor(this,R.color.black) |
| | | tv_title.textColor(this,R.color.yellow_ffa72d) |
| | | } |
| | | } |
| | |
| | | dismissDialog() |
| | | Toast.create(this).show("抢单成功") |
| | | onBackPressed() |
| | | this.startActivity<SlabTripActivity>("orderId" to orderId, "orderType" to orderType) |
| | | when(orderType){ |
| | | "1","2","3" -> { |
| | | this.startActivity<SlabTripActivity>("orderId" to orderId, "orderType" to orderType) |
| | | } |
| | | "4","5" -> { |
| | | this.startActivity<CargoActivity>("orderId" to orderId, "orderType" to orderType) |
| | | } |
| | | } |
| | | },{ |
| | | toast(it!!) |
| | | dismissDialog() |