| | |
| | | package com.okgoincar.slab |
| | | |
| | | import android.content.Context |
| | | import android.content.Intent |
| | | import android.os.Bundle |
| | | import android.os.Handler |
| | | import android.os.Looper |
| | |
| | | import com.okgoincar.base.AMapKit.initMap |
| | | import com.okgoincar.base.AMapKit.moveCamera |
| | | import com.okgoincar.base.BaseEvent |
| | | import com.okgoincar.base.MoneyBroadCastReceiver |
| | | import com.okgoincar.base.MyApplication |
| | | import com.okgoincar.base.gpsnav.GPSNaviActivity |
| | | import com.okgoincar.bean.OrderBean |
| | |
| | | import kotlinx.android.synthetic.main.dialog_select_pay_type.view.* |
| | | import kotlinx.android.synthetic.main.dialog_sure_and_del_slab.view.* |
| | | import kotlinx.android.synthetic.main.item_map_market.view.* |
| | | import org.greenrobot.eventbus.EventBus |
| | | import org.jetbrains.anko.startActivity |
| | | import org.jetbrains.anko.toast |
| | | import java.lang.Exception |
| | | import java.util.concurrent.TimeUnit |
| | | |
| | | |
| | | class SlabTripActivity : MySlabBaseActivity() { |
| | | |
| | | private fun callOver(contexts: Context, travelFee: Double) { |
| | | MoneyBroadCastReceiver.callOver(contexts, travelFee) |
| | | } |
| | | |
| | | private fun callStatue(contexts: Context, i: Int) { |
| | | MoneyBroadCastReceiver.callStatue(contexts, i) |
| | | } |
| | | |
| | | /*** |
| | | * // 流程操作状态(3=开始出发预约点,4=到达预约点,5=开始服务,6=服务结束) |
| | |
| | | ll_order_top.setBackgroundResource(R.drawable.bg_slab_main_8_bottom_blacl) |
| | | ll_info_top.setBackgroundResource(R.drawable.bg_slab_main_8_black) |
| | | rl_back.setBackgroundResource(R.color.black_191919) |
| | | iv_back_slab.setImageResource(R.mipmap.icon_back_slab) |
| | | tv_title_slab.textColor(this, R.color.write) |
| | | tv_name.textColor(this, R.color.write) |
| | | tv_car_num.textColor(this, R.color.write) |
| | | tv_phone.textColor(this, R.color.write) |
| | | tv_phone.setDrawableLeft(R.mipmap.icon_dial_slab) |
| | | tv_time.textColor(this, R.color.write) |
| | | tv_start_address.textColor(this, R.color.write) |
| | | tv_end_address.textColor(this, R.color.write) |
| | | tv_red_money.textColor(this, R.color.write) |
| | | tv_end_address.textColor(this, R.color.write) |
| | | |
| | | tv_code_num.textColor(this, R.color.write) |
| | | tv_name_car_man.textColor(this, R.color.write) |
| | | tv_car_num_var.textColor(this, R.color.write) |
| | | tv_star_num.textColor(this, R.color.write) |
| | | tv_company.textColor(this, R.color.write) |
| | | tv_time_send_prove.textColor(this, R.color.write) |
| | | tv_current_time.textColor(this, R.color.write) |
| | | } else { |
| | | ll_order_top.setBackgroundResource(R.drawable.bg_slab_main_8_bottom) |
| | | ll_info_top.setBackgroundResource(R.drawable.bg_slab_main_8) |
| | | rl_back.setBackgroundResource(R.drawable.bg_slab_main) |
| | | ll_order_top.setBackgroundResource(R.drawable.write_bottom_10) |
| | | ll_info_top.setBackgroundResource(R.drawable.write_top_10) |
| | | rl_back.setBackgroundResource(R.drawable.write) |
| | | iv_back_slab.setImageResource(R.mipmap.icon_back_black) |
| | | tv_title_slab.textColor(this, R.color.black) |
| | | tv_name.textColor(this, R.color.black) |
| | | tv_car_num.textColor(this, R.color.black) |
| | | tv_phone.textColor(this, R.color.black) |
| | | tv_phone.setDrawableLeft(R.mipmap.car_phone_bkack) |
| | | tv_time.textColor(this, R.color.black) |
| | | tv_start_address.textColor(this, R.color.black) |
| | | tv_end_address.textColor(this, R.color.black) |
| | | tv_red_money.textColor(this, R.color.black) |
| | | tv_end_address.textColor(this, R.color.black) |
| | | |
| | | tv_code_num.textColor(this, R.color.black) |
| | | tv_name_car_man.textColor(this, R.color.black) |
| | | tv_car_num_var.textColor(this, R.color.black) |
| | | tv_star_num.textColor(this, R.color.black) |
| | | tv_company.textColor(this, R.color.black) |
| | | tv_time_send_prove.textColor(this, R.color.black) |
| | | tv_current_time.textColor(this, R.color.black) |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | initMineLocation() |
| | | onclick() |
| | | addSockectCancel() |
| | | changeMode() |
| | | MyApplication.getInstance()!!.initUpPoint() |
| | | } |
| | | |
| | |
| | | if (it.status == 10 || it.status == 12) { |
| | | Handler(Looper.getMainLooper()).post { |
| | | toast("用户已取消订单") |
| | | MyApplication.getTTsManager().setVideoText("用户已取消订单") |
| | | MyApplication.currentOrderType = "" |
| | | MyApplication.currentOrderId = "" |
| | | finish() |
| | |
| | | super.onBackPressed() |
| | | } |
| | | |
| | | fun changeMode() { |
| | | if (tv_change.text == "收起") { |
| | | rl_map.invisible() |
| | | rl_persion_info.visible() |
| | | tv_change.text = "地图" |
| | | tv_change.textColor(this, R.color.main_yellow) |
| | | tv_change.setBackgroundResource(R.drawable.bg_orange_slab_line_4) |
| | | } else { |
| | | rl_map.visible() |
| | | rl_persion_info.invisible() |
| | | tv_change.text = "收起" |
| | | tv_change.textColor(this, R.color.white) |
| | | tv_change.setBackgroundResource(R.drawable.bg_login) |
| | | } |
| | | } |
| | | |
| | | |
| | | private fun onclick() { |
| | | btn_start.clickDelay { |
| | | callStatue(this, 5) |
| | | } |
| | | |
| | | btn_end.clickDelay { |
| | | callOver(this, 10.0) |
| | | } |
| | | |
| | | tv_change.clickDelay { |
| | | if (tv_change.text == "收起") { |
| | | rl_map.invisible() |
| | | rl_persion_info.visible() |
| | | tv_change.text = "地图" |
| | | tv_change.textColor(this, R.color.main_yellow) |
| | | tv_change.setBackgroundResource(R.drawable.bg_orange_slab_line_4) |
| | | } else { |
| | | rl_map.visible() |
| | | rl_persion_info.invisible() |
| | | tv_change.text = "收起" |
| | | tv_change.textColor(this, R.color.white) |
| | | tv_change.setBackgroundResource(R.drawable.bg_login) |
| | | } |
| | | changeMode() |
| | | } |
| | | iv_move.setOnClickListener { |
| | | orderBean.let { |
| | |
| | | var payType = 1 //支付方式(1=OK平台收款,2=其他方式收款) |
| | | if (getNowTimeBlack()) { |
| | | pop.contentView.rl_back_pop.setBackgroundResource(R.drawable.bg_slab_main_8_black) |
| | | pop.contentView.tv_cancel.textColor(this, R.color.white) |
| | | pop.contentView.tv_ok.textColor(this, R.color.white) |
| | | } else { |
| | | pop.contentView.rl_back_pop.setBackgroundResource(R.drawable.bg_slab_main_8) |
| | | pop.contentView.rl_back_pop.setBackgroundResource(R.drawable.bg_white_round_2) |
| | | pop.contentView.tv_cancel.textColor(this, R.color.black) |
| | | pop.contentView.tv_ok.textColor(this, R.color.black) |
| | | } |
| | | pop.showDown(window.decorView) |
| | | pop.contentView.tv_cancel.setOnClickListener { |
| | |
| | | }) |
| | | if (getNowTimeBlack()) { |
| | | pop.contentView.rl_top_slab.setBackgroundResource(R.drawable.bg_green_4_black) |
| | | pop.contentView.tv_view_two_base.textColor(this, R.color.white) |
| | | } else { |
| | | pop.contentView.rl_top_slab.setBackgroundResource(R.drawable.bg_green_4) |
| | | pop.contentView.rl_top_slab.setBackgroundResource(R.drawable.bg_white_round_2) |
| | | pop.contentView.tv_view_two_base.textColor(this, R.color.black) |
| | | } |
| | | pop.showCenter(window.decorView) |
| | | } |
| | |
| | | private fun initMineLocation() { |
| | | AMapKit.initLocation(this, AMapLocationListener { |
| | | it?.let { |
| | | MyApplication.aMapLocation = it |
| | | carMarker!!.position = LatLng(it.latitude, it.longitude) |
| | | // toast("errorCode=="+it.errorCode.toString()+"latitude=="+it.latitude.toString()) |
| | | if (it.errorCode == 0) { |
| | | MyApplication.aMapLocation = it |
| | | carMarker!!.position = LatLng(it.latitude, it.longitude) |
| | | } |
| | | } |
| | | orderBean.let { |
| | | when (it.data.orderState) { |
| | |
| | | callNet(this, Api.queryOrderInfo, map) { |
| | | orderBean = gson.fromJson(it, OrderBean::class.java) |
| | | showUi(orderBean) |
| | | // Handler(Looper.getMainLooper()).postDelayed({ |
| | | // startActivity<SlabOrderOverActivity>("orderId" to orderBean.data.orderId.toString() , "orderType" to orderBean.data.type.toString()) |
| | | // },1000) |
| | | } |
| | | callPersion() |
| | | } |
| | |
| | | |
| | | private fun showDriverUI(data: UserInfoBean?) { |
| | | data?.let { |
| | | tv_code_num.text = "证号:" + data.taxiAptitudeCard |
| | | if (data.taxiAptitudeCard.length > 7){ |
| | | tv_code_num.text = "资格证号:"+data.taxiAptitudeCard.substring(0,3)+"*******"+data.taxiAptitudeCard.substring(data.taxiAptitudeCard.length-4,data.taxiAptitudeCard.length) |
| | | }else{ |
| | | tv_code_num.text = "资格证号:" + data.taxiAptitudeCard |
| | | } |
| | | tv_name_car_man.text = "姓名:" + it.name |
| | | tv_car_num_var.text = "车牌:" + it.licensePlate |
| | | recycler_view_start.layoutManager = |
| | |
| | | recycler_view_start.adapter = SlabStartAdapter(it.score.toDouble()) |
| | | tv_company.text = "公司:" + it.company |
| | | tv_time_send_prove.text = "发证日期:" + it.networkCarlssueDate |
| | | GlideUtil.load(this, it.avatar, iv_head, 1) |
| | | GlideUtil.load(this, it.avatar, iv_head, 8) |
| | | tv_current_time.text = DateUtil.getTime( |
| | | DateUtil.TYPE7, |
| | | System.currentTimeMillis() |
| | | ) + "\n" + DateUtil.getWeek(System.currentTimeMillis()) |
| | | ) + DateUtil.getWeek(System.currentTimeMillis()) |
| | | } |
| | | } |
| | | |
| | |
| | | getAllMark(it) |
| | | when (it.data.orderState) { |
| | | 2, 3 -> { |
| | | clickBroad() |
| | | iv_to_gd.visible() |
| | | makeMarker?.isVisible = true |
| | | carMarker?.isVisible = true |
| | |
| | | } |
| | | } |
| | | 4 -> { |
| | | clickBroad() |
| | | iv_to_gd.gone() |
| | | closeLine() |
| | | carMarker?.isVisible = true |
| | |
| | | } |
| | | } |
| | | |
| | | fun clickBroad() { |
| | | var intent = Intent(); |
| | | intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK; |
| | | intent.action = "wisdom.intent.action.topLight"; |
| | | intent.putExtra("state", 0) |
| | | sendBroadcast(intent); |
| | | } |
| | | |
| | | private fun startTimeStart(waitTime: Int) { |
| | | if (!isTimeStart) { |
| | |
| | | override fun onEventMainThread(event: BaseEvent?) { |
| | | super.onEventMainThread(event) |
| | | when (event!!.code) { |
| | | BaseEvent.REAGASSIGN_SUCCESS -> { |
| | | MyApplication.currentOrderId = "" |
| | | MyApplication.currentOrderType = "" |
| | | // BaseEvent.REAGASSIGN_SUCCESS -> { |
| | | // MyApplication.currentOrderId = "" |
| | | // MyApplication.currentOrderType = "" |
| | | // finish() |
| | | // } |
| | | BaseEvent.UP_TRIP -> { |
| | | callOrder() |
| | | } |
| | | |
| | | BaseEvent.SURE_MONEY -> { |
| | | startActivity<SlabOrderOverActivity>( |
| | | "orderId" to orderBean.data.orderId.toString(), |
| | | "orderType" to "2" |
| | | ) |
| | | finish() |
| | | } |
| | | BaseEvent.ERROR_INFO -> { |
| | | onBackPressed() |
| | | } |
| | | } |
| | | } |
| | | } |