app/src/main/java/com/okgoincar/base/Const.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/okgoincar/base/MyApplication.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/okgoincar/bean/OrderResData.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/okgoincar/slab/MySlabBaseActivity.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/okgoincar/slab/SlabGetOrderFragment.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
app/src/main/java/com/okgoincar/base/Const.java
@@ -63,6 +63,7 @@ public static class SOCKET_METHOD { public final static String OK = "OK"; public final static String ORDER_STATUS = "ORDER_STATUS"; public final static String REASSIGN = "REASSIGN"; } app/src/main/java/com/okgoincar/base/MyApplication.kt
@@ -25,6 +25,7 @@ import com.google.gson.Gson import com.okgoincar.base.gpsnav.util.TTSController import com.okgoincar.bean.CarLocationBean import com.okgoincar.bean.OrderResData import com.okgoincar.bean.OrderSimpleData import com.okgoincar.bean.websocket.HeartBean import com.okgoincar.netUtls.Api @@ -107,7 +108,9 @@ val act = activities[activities.size - 1] (act as MySlabBaseActivity).showOrder( orderSimpleData.orderId.toString(), orderSimpleData.orderType.toString() orderSimpleData.orderType.toString(), orderSimpleData.time, 1 ) } if (orderSimpleData.status == 2) { @@ -117,6 +120,21 @@ orderSimpleData.orderType.toString() ) } } Const.SOCKET_METHOD.REASSIGN -> { val orderSimpleData = Gson().fromJson( data, OrderResData::class.java ) val act = activities[activities.size - 1] (act as MySlabBaseActivity).showOrder( orderSimpleData.orderId.toString(), orderSimpleData.orderType.toString(), 30, 2 ) } } } else { @@ -349,6 +367,7 @@ } private val activities = ArrayList<Activity?>() private var showNum = 0 override fun onActivityPaused(activity: Activity?) { } @@ -357,6 +376,7 @@ } override fun onActivityStarted(activity: Activity?) { showNum++ } override fun onActivityDestroyed(activity: Activity?) { @@ -367,6 +387,13 @@ } override fun onActivityStopped(activity: Activity?) { showNum-- Handler(Looper.getMainLooper()).postDelayed({ if (showNum == 0){ getTTsManager().setVideoText("OK出行司机已置于后台,可能会导致听单异常,里程计费差异,请勿切换。") } },600) } override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) { app/src/main/java/com/okgoincar/bean/OrderResData.java
New file @@ -0,0 +1,20 @@ package com.okgoincar.bean; import com.google.gson.annotations.SerializedName; public class OrderResData { public int orderId; public int orderType; @SerializedName("state") public int time; // { // "code": 200, // "msg": "SUCCESS", // "method": "ORDER_STATUS", // "data": { // "orderId": 21414, #订单id // "orderType": 2, #订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) // "status": 1 #订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=待支付,7=待评价,8=已完成,9=已取消,10=改派中) // } } app/src/main/java/com/okgoincar/slab/MySlabBaseActivity.java
@@ -155,6 +155,24 @@ startActivity(intent); } /*** * type 1:普通单 2:该派单 * @param orderId * @param orderType * @param time * @param type */ public void showOrder(String orderId, String orderType,int time,int type) { // Bundle bundle = creatBundleString("orderId", orderId); // bundle.putString("orderType", orderType); Intent intent = new Intent(this,SlabGetOrderFragment.class); intent.putExtra("orderId",orderId); intent.putExtra("orderType",orderType); intent.putExtra("time",time); intent.putExtra("type",type); startActivity(intent); } @Override app/src/main/java/com/okgoincar/slab/SlabGetOrderFragment.kt
@@ -34,27 +34,43 @@ 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 { 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()) }