| | |
| | | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| | | ndk { |
| | | // 设置支持的SO库架构,第三方给的so库哪几种架构,就配置这几种架构 |
| | | abiFilters 'armeabi' |
| | | abiFilters "armeabi-v7a" |
| | | } |
| | | |
| | | manifestPlaceholders = [ |
| | |
| | | implementation 'cn.jzvd:jiaozivideoplayer:7.3.0' |
| | | //http日志拦截器 |
| | | implementation 'com.squareup.okhttp3:logging-interceptor:3.8.1' |
| | | //融云 云录制使用 |
| | | implementation 'cn.rongcloud.sdk:im_lib:5.1.9.7' // 即时通讯基础能力库 |
| | | implementation 'cn.rongcloud.sdk:rtc_lib:5.1.17.1' // 音视频通话基础能力库 |
| | | |
| | | } |
| | |
| | | import androidx.annotation.RequiresApi |
| | | import cn.jpush.android.api.JPushInterface |
| | | import cn.jpush.android.api.TagAliasCallback |
| | | import cn.rongcloud.rtc.api.RCRTCConfig |
| | | import cn.rongcloud.rtc.api.RCRTCEngine |
| | | import cn.rongcloud.rtc.api.RCRTCRoom |
| | | import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback |
| | | import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback |
| | | import cn.rongcloud.rtc.api.stream.RCRTCInputStream |
| | | import cn.rongcloud.rtc.base.RTCErrorCode |
| | | import cn.sinata.rxnetty.NettyClient |
| | | import cn.sinata.xldutils.BaseApplication |
| | | import cn.sinata.xldutils.utils.sysErr |
| | |
| | | import com.umeng.commonsdk.UMConfigure |
| | | import com.umeng.socialize.PlatformConfig |
| | | import com.xuexiang.xui.XUI |
| | | import io.rong.imlib.RongIMClient |
| | | import org.greenrobot.eventbus.EventBus |
| | | import org.jetbrains.anko.toast |
| | | import org.json.JSONObject |
| | |
| | | registerActivityLifecycleCallbacks(this) |
| | | initUpPoint() |
| | | initSocket() |
| | | initRong() |
| | | } |
| | | |
| | | fun initPersionDate(){ |
| | |
| | | setAlisa() |
| | | LogUtils.OpenLog(true) |
| | | // CrashReport.initCrashReport(getApplicationContext(), "444bb776ed", false); |
| | | } |
| | | |
| | | private fun initRong() { |
| | | // IMLib 初始化 |
| | | RongIMClient.init(this, "0vnjpoad01rwz") |
| | | // RTCLib 初始化 |
| | | val config = RCRTCConfig.Builder.create() |
| | | RCRTCEngine.getInstance().init(this, config.build()) |
| | | } |
| | | |
| | | public fun setAlisa() { |
| | |
| | | val act = activities[activities.size - 1] |
| | | // MyApplication.getTTsManager().setVideoText("收到新的订单") |
| | | when (orderSimpleData.orderType) { |
| | | 1,2 -> { |
| | | 1,2,10 -> { |
| | | (act as MyBaseActivity).showOrder( |
| | | orderSimpleData.orderId.toString(), |
| | | orderSimpleData.orderType.toString(), |
| | |
| | | var aMapLocation: AMapLocation? = null |
| | | var currentOrderId: String = "" |
| | | var currentOrderType: String = "" |
| | | var recordRoomId: String = "" |
| | | var orderStatueViews: MutableList<OrderStatueView> = |
| | | mutableListOf() |
| | | var testHeartNunm = 0 |
| | |
| | | fun removeOrderView(view: OrderStatueView?) { |
| | | orderStatueViews.remove(view) |
| | | } |
| | | |
| | | |
| | | fun startRecord(){ |
| | | if (recordRoomId.isNotEmpty()){ |
| | | RCRTCEngine.getInstance() |
| | | .joinRoom(recordRoomId, object : IRCRTCResultDataCallback<RCRTCRoom?>() { |
| | | override fun onSuccess(rcrtcRoom: RCRTCRoom?) { |
| | | Log.e("RongLog", "开始录制======》当前房间号:${recordRoomId}") |
| | | // rcrtcRoom?.registerRoomListener(object :IRCRTCRoomEventsListener(){}) |
| | | //step1:推流 |
| | | rcrtcRoom?.localUser?.publishDefaultStreams(object : |
| | | IRCRTCResultCallback() { |
| | | override fun onSuccess() { |
| | | Log.e("RongLog", "发布资源成功") |
| | | } |
| | | |
| | | override fun onFailed(errorCode: RTCErrorCode) { |
| | | Log.e("RongLog", "发布资源失败:${errorCode.reason}") |
| | | } |
| | | }) |
| | | |
| | | //step2:订阅远端 |
| | | val inputStreams: MutableList<RCRTCInputStream> = ArrayList() |
| | | for (remoteUser in rcrtcRoom?.remoteUsers ?: arrayListOf()) { |
| | | if (remoteUser.streams.size == 0) { |
| | | continue |
| | | } |
| | | inputStreams.addAll(remoteUser.streams) |
| | | } |
| | | |
| | | if (inputStreams.size == 0) { |
| | | return |
| | | } |
| | | rcrtcRoom?.localUser?.subscribeStreams( |
| | | inputStreams, |
| | | object : IRCRTCResultCallback() { |
| | | override fun onFailed(errorCode: RTCErrorCode?) { |
| | | Log.e("RongLog", "订阅资源失败:${errorCode}") |
| | | } |
| | | |
| | | override fun onSuccess() { |
| | | Log.e("RongLog", "订阅资源成功") |
| | | } |
| | | }) |
| | | } |
| | | |
| | | override fun onFailed(rtcErrorCode: RTCErrorCode) { |
| | | Log.e("RongLog", "录制失败======》${rtcErrorCode}") |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | fun finishRecord(){ |
| | | RCRTCEngine.getInstance().leaveRoom(object : IRCRTCResultCallback() { |
| | | override fun onFailed(errorCode: RTCErrorCode?) { |
| | | Log.e("RongLog", "结束录制失败") |
| | | } |
| | | |
| | | override fun onSuccess() { |
| | | Log.e("RongLog", "结束录制成功") |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | private val activities = ArrayList<Activity?>() |
| | |
| | | /** |
| | | * todo 请替换您自己申请的ID。 |
| | | */ |
| | | private final String appId = "c368b2ff"; |
| | | private final String appId = "df57aa12"; |
| | | |
| | | public static IFlyTTS getInstance(Context context) { |
| | | if (iflyTTS == null) { |
| | |
| | | private String serverId; |
| | | private String terminalId; |
| | | private String state; |
| | | public String rongYunToken; |
| | | |
| | | public String getState() { |
| | | return state; |
| | |
| | | private String startAddress; |
| | | private int state; |
| | | private String time; |
| | | public String orderNumber; |
| | | private int type; |
| | | private String remark; |
| | | private String peopleNumber; |
| | |
| | | package com.kuanzhai.driver.ui |
| | | |
| | | import android.util.Log |
| | | import android.view.View |
| | | import android.widget.Toast |
| | | import cn.sinata.xldutils.utils.* |
| | | import cn.sinata.xldutils.utils.clickDelay |
| | | import cn.sinata.xldutils.utils.setDrawableTop |
| | | import cn.sinata.xldutils.utils.textColor |
| | | import com.kuanzhai.driver.R |
| | | import com.kuanzhai.driver.base.MyBaseActivity |
| | | import com.kuanzhai.driver.bean.ModuleBean |
| | |
| | | import com.kuanzhai.driver.ui.main.MainPubFragment |
| | | import com.kuanzhai.driver.ui.mine.MineActivity |
| | | import com.kuanzhai.driver.utils.Cache.CacheKey |
| | | import com.kuanzhai.driver.utils.Cache.CacheKey.getKeyStr |
| | | import io.rong.imlib.RongIMClient |
| | | import kotlinx.android.synthetic.main.activity_main_tab.* |
| | | |
| | | class MainTabActivity: MyBaseActivity() { |
| | |
| | | override fun initView() { |
| | | showHeader(false) |
| | | showTitle(false) |
| | | |
| | | RongIMClient.connect(getKeyStr("rongToken"), object : RongIMClient.ConnectCallback() { |
| | | override fun onSuccess(s: String) { |
| | | Log.e("RongTag", "融云服务已连接") |
| | | } |
| | | |
| | | override fun onError(connectionErrorCode: RongIMClient.ConnectionErrorCode) { |
| | | Log.e("RongTag", "融云服务连接失败:$connectionErrorCode") |
| | | } |
| | | |
| | | override fun onDatabaseOpened(databaseOpenStatus: RongIMClient.DatabaseOpenStatus) {} |
| | | }) |
| | | |
| | | allGray() |
| | | callMine() |
| | | tv_main.textColor(this,R.color.main_yellow_shen) |
| | | tv_main.textColor(this, R.color.main_yellow_shen) |
| | | tv_main.setDrawableTop(R.mipmap.tab_home_green) |
| | | addFragment(mainFragment,R.id.container) |
| | | addFragment(mainFragment, R.id.container) |
| | | callModule() |
| | | } |
| | | |
| | |
| | | |
| | | private fun callMine() { |
| | | var map = getMapByAny() |
| | | callNet(false,Api.queryInfo, map) { |
| | | callNet(false, Api.queryInfo, map) { |
| | | var user = gson.fromJson<UserBean>(it, UserBean::class.java) |
| | | CacheKey.saveUserInfo(user.data) |
| | | } |
| | |
| | | override fun setOnclick() { |
| | | tv_main.clickDelay { |
| | | allGray() |
| | | tv_main.textColor(this,R.color.main_yellow_shen) |
| | | tv_main.textColor(this, R.color.main_yellow_shen) |
| | | tv_main.setDrawableTop(R.mipmap.tab_home_green) |
| | | addFragment(mainFragment,R.id.container) |
| | | addFragment(mainFragment, R.id.container) |
| | | // showOrder("1323","1",100,1) |
| | | } |
| | | tv_driver.clickDelay { |
| | | allGray() |
| | | tv_driver.textColor(this,R.color.main_yellow_shen) |
| | | tv_driver.textColor(this, R.color.main_yellow_shen) |
| | | tv_driver.setDrawableTop(R.mipmap.tab_driver_server_yes) |
| | | addFragment(driverServerFragment,R.id.container) |
| | | addFragment(driverServerFragment, R.id.container) |
| | | } |
| | | tv_mine.clickDelay { |
| | | allGray() |
| | | tv_mine.textColor(this,R.color.main_yellow_shen) |
| | | tv_mine.textColor(this, R.color.main_yellow_shen) |
| | | tv_mine.setDrawableTop(R.mipmap.tab_user_green) |
| | | addFragment(mineFragment,R.id.container) |
| | | addFragment(mineFragment, R.id.container) |
| | | } |
| | | } |
| | | |
| | | private fun allGray() { |
| | | tv_main.textColor(this,R.color.tab_gray) |
| | | tv_driver.textColor(this,R.color.tab_gray) |
| | | tv_mine.textColor(this,R.color.tab_gray) |
| | | tv_main.textColor(this, R.color.tab_gray) |
| | | tv_driver.textColor(this, R.color.tab_gray) |
| | | tv_mine.textColor(this, R.color.tab_gray) |
| | | tv_main.setDrawableTop(R.mipmap.tab_home_gray) |
| | | tv_driver.setDrawableTop(R.mipmap.tab_driver_server_null) |
| | | tv_mine.setDrawableTop(R.mipmap.tab_user_gray) |
| | |
| | | */ |
| | | private fun callModule() { |
| | | var map = getMapByAny() |
| | | callNet(Api.getShowModular,map){ |
| | | callNet(Api.getShowModular, map){ |
| | | var module = gson.fromJson<ModuleBean>(it, ModuleBean::class.java) |
| | | tv_driver.visibility = if (module.data.filter { it.driverShow == 1 }.isNotEmpty()) View.VISIBLE else View.GONE //如果子菜单全隐藏,则整个模块隐藏 |
| | | } |
| | |
| | | } |
| | | it.itemView.tv_people_num.text = "乘车人数" + item.peopleNumber + "人" |
| | | } |
| | | 10->{ |
| | | it.itemView.tv_remark.gone() |
| | | it.itemView.tv_people_num.text = "乘车人数" + item.peopleNumber + "人" |
| | | } |
| | | 4, 5 -> { |
| | | it.itemView.rl_overtime.visible() |
| | | if (item.arriveTimeExpect.isNotEmpty()) { |
| | |
| | | |
| | | return@clickDelay |
| | | } |
| | | if (item.type == 2 || (item.type == 1 && item.rideType != "3")) { //订单类型(1=快车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) |
| | | if (item.type == 10||item.type == 2 || (item.type == 1 && item.rideType != "3")) { //订单类型(1=快车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) |
| | | when (item.state) { |
| | | 2, 3, 4, 5 -> { |
| | | context.startActivity<TripActivity>( |
| | |
| | | // } |
| | | // } |
| | | } |
| | | if (item.type == 3||item.type == 7) { |
| | | if (item.type == 3||item.type == 8||item.type == 9) { |
| | | if (item.state < 6) { |
| | | context.startActivity<TripCityActivity>( |
| | | "orderId" to item.id.toString(), |
| | |
| | | tv_name.visible() |
| | | } |
| | | } |
| | | if (orderType == "10") { |
| | | tv_money.gone() |
| | | tv_name.visible() |
| | | tv_name.text = "${data.peopleNumber}人" |
| | | } |
| | | if (orderType == "5" || orderType == "4") { |
| | | if (data.arriveTimeExpect.isNotEmpty()){ |
| | | tv_expect_time.text = "要求送达时间:"+data.arriveTimeExpect |
| | |
| | | package com.kuanzhai.driver.ui.main |
| | | |
| | | import android.view.View |
| | | import com.beloo.widget.chipslayoutmanager.util.log.Log |
| | | import com.driver.emanagercar.ui.base.BaseRecyclerFragment |
| | | import com.kuanzhai.driver.base.MyApplication |
| | | import com.kuanzhai.driver.bean.OrderListBean |
| | | import com.kuanzhai.driver.netUtls.Api |
| | | import com.kuanzhai.driver.netUtls.getMapByAny |
| | |
| | | |
| | | override fun getDatas(t: String?): List<OrderListBean.DataBean> { |
| | | var data = gson.fromJson<OrderListBean>(t,OrderListBean::class.java) |
| | | val inOrder = data.data.filter { it.state == 5 }.firstOrNull() |
| | | if (inOrder!=null){ |
| | | MyApplication.currentOrderId = inOrder.id.toString() |
| | | MyApplication.recordRoomId = if (inOrder.type == 3||inOrder.type == 8||inOrder.type == 9) inOrder.orderNumber else inOrder.id.toString() |
| | | Log.e("Rong","当前进行中的订单id==========》${MyApplication.currentOrderId}") |
| | | MyApplication.startRecord() |
| | | } |
| | | return data.data |
| | | } |
| | | |
| | |
| | | if(orderType == "1"){ |
| | | tv_red_money.gone() |
| | | } |
| | | if(orderType == "10"){ |
| | | tv_red_money.setCompoundDrawablesRelativeWithIntrinsicBounds(R.mipmap.icon_people_gray,0,0,0) |
| | | tv_red_money.text = "${it.data.peopleNumber}人" |
| | | } |
| | | when (orderBean.data.orderState) { |
| | | 10, 11 -> { |
| | | ll_order_cancel.visible() |
| | |
| | | lateinit var aMap: AMap |
| | | lateinit var orderBean: OrderBean |
| | | |
| | | |
| | | override fun setContentView() { |
| | | setContentView(R.layout.activity_trip) |
| | | } |
| | |
| | | } |
| | | } |
| | | 5, 6 -> { |
| | | MyApplication.finishRecord() |
| | | it.data.orderState = 6 |
| | | when(orderType){ |
| | | "2" -> { |
| | | showMoneyTypeDialog() |
| | | } |
| | | "1" -> { |
| | | "1","10" -> { |
| | | callStatue(6,{ |
| | | startActivity<MajorSureMoneyActivity>( |
| | | "orderId" to orderId, |
| | |
| | | |
| | | private fun callOrder() { |
| | | MyApplication.currentOrderId = orderId |
| | | MyApplication.recordRoomId = orderId |
| | | MyApplication.currentOrderType = orderType |
| | | var map = getMapByAny() |
| | | map["orderId"] = orderId |
| | |
| | | tv_red_money.gone() |
| | | } |
| | | tv_red_money.text = it.data.tipMoney.toString() + "元红包" |
| | | if (orderType == "10"){//公务出行 |
| | | tv_red_money.text = "${it.data.peopleNumber}人" |
| | | tv_red_money.setCompoundDrawablesRelativeWithIntrinsicBounds(R.mipmap.icon_people_gray,0,0,0) |
| | | } |
| | | showStatueMapUI(it) |
| | | } |
| | | } |
| | |
| | | slide_btn.changeButtonText("乘客已上车") |
| | | } |
| | | 5, 6 -> { |
| | | if (it.data.orderState == 5) |
| | | MyApplication.startRecord() |
| | | closeTimeStart() |
| | | iv_to_gd.visible() |
| | | tv_Right.gone() |
| | |
| | | } |
| | | } |
| | | 5, 6 -> { |
| | | MyApplication.finishRecord() |
| | | it.data.orderState = 6 |
| | | when (orderType) { |
| | | "2" -> { |
| | |
| | | |
| | | private fun callOrder() { |
| | | MyApplication.currentOrderId = orderId |
| | | MyApplication.recordRoomId = orderId |
| | | MyApplication.currentOrderType = orderType |
| | | var map = getMapByAny() |
| | | map["orderId"] = orderId |
| | |
| | | slide_btn.changeButtonText("乘客已上车") |
| | | } |
| | | 5, 6 -> { |
| | | if (it.data.orderState == 5) |
| | | MyApplication.startRecord() |
| | | closeTimeStart() |
| | | iv_to_gd.visible() |
| | | tv_Right.gone() |
| | |
| | | map["startLon"] = startLon |
| | | map["totalSeat"] = totalSeat |
| | | map["travelMode"] = travelMode |
| | | map["type"] = orderType |
| | | map["travelTime"] = DateUtil.getTime(DateUtil.TYPE0, System.currentTimeMillis()) |
| | | if (majorSureMoneyAdapter.data.isNotEmpty()){ |
| | | map["additionalFee"] = gson.toJson(majorSureMoneyAdapter.data) |
| | |
| | | ): Boolean { |
| | | tv_order_type.text = list[options1] |
| | | orderType = if (options1 == 0) 3 else if (options1 == 1) 8 else 9 |
| | | clearByType(0) |
| | | return false |
| | | } |
| | | }) |
| | |
| | | toast("请先选择起点") |
| | | return@clickDelay |
| | | } |
| | | startActivity<SelectCityStartActivity>("startCityId" to startCityId) |
| | | startActivity<SelectCityStartActivity>("startCityId" to startCityId,"orderType" to orderType) |
| | | } |
| | | |
| | | ll_select_city_start.clickDelay { |
| | | selectCityLocation = 1 |
| | | startActivity<SelectCityStartActivity>() |
| | | if (orderType == 0){ |
| | | toast("请选择订单类型") |
| | | }else{ |
| | | selectCityLocation = 1 |
| | | startActivity<SelectCityStartActivity>("orderType" to orderType) |
| | | } |
| | | } |
| | | |
| | | ll_select_car_num.clickDelay { |
| | |
| | | private fun downOrder(paytype: String, orderId: String,function: () -> Unit) { |
| | | var map = getMapByAny() |
| | | map["orderId"] = orderId |
| | | map["orderType"] = "3" |
| | | map["orderType"] = orderType |
| | | map["payType"] = paytype |
| | | map["type"] = "2" |
| | | callNet(Api.payTaxiOrder, map) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | private fun callMoney(function: (QueryOrderMoneyBean.DataBean) -> Unit) { |
| | | var map = getMapByAny() |
| | | map["endLonLat"] = "$endLon,$endLat" |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | // /*** |
| | | // * 根据排班id获取最大出行人数 |
| | | // */ |
| | | // private fun callPeopleNum() { |
| | | // var map = getMapByAny() |
| | | // map["id"] = lineShiftDriverId |
| | | // callNet(Api.querySeat,map){ |
| | | // var bean = gson.fromJson<PeopleNumBean>(it,PeopleNumBean::class.java) |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | |
| | | override fun onEventMainThread(event: BaseEvent?) { |
| | | super.onEventMainThread(event) |
| | |
| | | startLon = "" |
| | | tv_up_point.text = "" |
| | | } |
| | | if(i < 1){ |
| | | startCityName = "" |
| | | startCityId = "" |
| | | tv_start_point.text = "" |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | intent.getStringExtra("startCityId") //1 选择起点城市 2 选择终点城市 |
| | | } |
| | | |
| | | private val orderType by lazy { intent.getIntExtra("orderType",3) } |
| | | |
| | | var letterAdapter = LetterAdapter() |
| | | |
| | | var cityAdapter = CitySelectAdapter() |
| | |
| | | var map = getMapByAny() |
| | | if (!startSiteId.isNullOrEmpty()){ |
| | | map["startSiteId"] = startSiteId |
| | | } |
| | | }else |
| | | map["type"] = orderType |
| | | |
| | | callNet(Api.queryOpenCity, map) { |
| | | var bean = gson.fromJson<SitePointBean>(it, SitePointBean::class.java) |
| | | initLetter(bean.data) |
| | |
| | | CacheKey.putKeyStr("userId", bean.data.id.toString()) |
| | | CacheKey.putKeyStr("serverId", bean.data.serverId.toString()) |
| | | CacheKey.putKeyStr("terminalName", bean.data.terminalId.toString()) |
| | | CacheKey.putKeyStr("rongToken", bean.data.rongYunToken) |
| | | toast("登录成功") |
| | | MyApplication.getInstance()!!.setAlisa() |
| | | startActivity<MainTabActivity>() |
| | |
| | | override fun orderInfo(data: OrderSimpleData?) { |
| | | data?.let { |
| | | when(it.orderType){ |
| | | 1,2,3 -> { |
| | | 1,2,3,8,9,10 -> { |
| | | if (it.status == 10 || it.status == 12) { |
| | | removeItem(it.orderId.toString()) |
| | | Handler(Looper.getMainLooper()).post { |
| | |
| | | tripItemAdapter.data[currentPositionOrder].orderState = 6 |
| | | tripItemAdapter.notifyDataSetChanged() |
| | | when (orderType) { |
| | | "3" -> { |
| | | "3","8","9" -> { |
| | | var isAllOver = getIsOver() //是否所有子订单都完成了 |
| | | if (isAllOver) { |
| | | MyApplication.finishRecord() |
| | | //去订单完成页面 |
| | | callStatue(it.orderState,{ |
| | | allOver() |
| | |
| | | callNet(Api.queryCityOrderInfo, map) { |
| | | orderBean = gson.fromJson(it, OrderCityBean::class.java) |
| | | // orderBean.data.orders.sortWith(MyComparator()) |
| | | MyApplication.recordRoomId = orderBean.data.orderNumber |
| | | tv_line.text = orderBean.data.line |
| | | tv_people_num.text = orderBean.data.peopleNumber.toString() + "人" |
| | | tripItemAdapter.data.clear() |
| | |
| | | |
| | | } |
| | | 5, 6 -> { |
| | | MyApplication.startRecord() |
| | | closeTimeStart() |
| | | iv_to_gd.visible() |
| | | allStartVisible() |