| | |
| | | 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.* |
| | | 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 kotlinx.android.synthetic.main.activity_fill_out_slab.ll_order_top |
| | | import kotlinx.android.synthetic.main.activity_fill_out_slab.tv_sure |
| | | import kotlinx.android.synthetic.main.activity_fill_out_slab.tv_time |
| | | import kotlinx.android.synthetic.main.item_get_order.* |
| | | import kotlinx.android.synthetic.main.item_map_market.view.* |
| | | import org.jetbrains.anko.startActivity |
| | |
| | | intent?.getStringExtra("orderType") |
| | | } |
| | | |
| | | val timeDown by lazy { |
| | | intent?.getIntExtra("time",-1) |
| | | } |
| | | val type by lazy { |
| | | intent?.getIntExtra("type",-1) |
| | | } |
| | | |
| | | lateinit var time: CountDownTimer |
| | | |
| | | |
| | | @SuppressLint("SourceLockedOrientationActivity") |
| | | @SuppressLint("SourceLockedOrientationActivity", "SetTextI18n") |
| | | override fun onCreate(savedInstanceState: Bundle?) { |
| | | super.onCreate(savedInstanceState) |
| | | //设置竖屏显示 |
| | | requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE |
| | | callOrderDetail() |
| | | time = timeOver { |
| | | callVideo() |
| | | var strBtn = "抢单" |
| | | if (type == 2){ |
| | | strBtn = "确定" |
| | | } |
| | | time = timeOver ((timeDown!!.toLong() * 1000L)){ |
| | | if (it == 0) { |
| | | finish() |
| | | } else { |
| | | tv_sure.text = "抢单" + it.toString() + "秒" |
| | | tv_sure.text = strBtn + it.toString() + "秒" |
| | | } |
| | | } |
| | | |
| | | tv_close.clickDelay { |
| | | finish() |
| | | } |
| | | |
| | | tv_sure.clickDelay { |
| | | showGetOrder() |
| | | if (type == 1){ |
| | | showGetOrder() |
| | | }else if (type == 2){ |
| | | onBackPressed() |
| | | this.startActivity<SlabTripActivity>("orderId" to orderId, "orderType" to orderType) |
| | | } |
| | | } |
| | | 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_time.text = data.travelTime |
| | | tv_car_type.text = UiUtil.getNameByType(orderType!!) |
| | | tv_start.text = data.startAddress |
| | | if(data.endAddress.isNullOrEmpty()){ |
| | | tv_end.gone() |
| | | } |
| | | tv_end.text = data.endAddress |
| | | tv_money.text = data.tipMoney.toString() + "元红包" |
| | | tv_reassign.text = data.type |
| | |
| | | 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)) |
| | | } |
| | | }) |
| | | } |
| | |
| | | if (nowTimeBlack){ |
| | | rl_top_back.setBackgroundResource(R.color.black_mode_383838) |
| | | ll_order_top.setBackgroundResource(R.color.black_mode_383838) |
| | | tv_time.textColor(this,R.color.white) |
| | | tv_start.textColor(this,R.color.white) |
| | | tv_end.textColor(this,R.color.white) |
| | | tv_money.textColor(this,R.color.white) |
| | | tv_title.textColor(this,R.color.slab_yellow_zhong) |
| | | }else{ |
| | | rl_top_back.setBackgroundResource(R.color.green_154c49) |
| | | ll_order_top.setBackgroundResource(R.color.green_154c49) |
| | | rl_top_back.setBackgroundResource(R.color.white) |
| | | ll_order_top.setBackgroundResource(R.color.white) |
| | | tv_time.textColor(this,R.color.black) |
| | | tv_start.textColor(this,R.color.black) |
| | | tv_end.textColor(this,R.color.black) |
| | | tv_money.textColor(this,R.color.black) |
| | | tv_title.textColor(this,R.color.yellow_ffa72d) |
| | | } |
| | | } |
| | | |
| | |
| | | map["orderId"] = orderId |
| | | map["orderType"] = orderType |
| | | showDialog() |
| | | callNet(this, Api.grabOrder, map, { |
| | | callNet(this, Api.grabOrder_, map, { |
| | | dismissDialog() |
| | | Toast.create(this).show("抢单成功") |
| | | onBackPressed() |