| | |
| | | package com.okgoincar.slab |
| | | |
| | | import android.content.Intent |
| | | import android.content.IntentFilter |
| | | import android.os.Bundle |
| | | import android.os.Handler |
| | | import android.os.Looper |
| | | import android.widget.Toast |
| | | import androidx.recyclerview.widget.LinearLayoutManager |
| | | import androidx.recyclerview.widget.RecyclerView |
| | |
| | | override fun setContentView() { |
| | | setContentView(R.layout.slab_activity_main) |
| | | } |
| | | |
| | | |
| | | override fun setBlackMode(b: Boolean?) { |
| | | super.setBlackMode(b) |
| | |
| | | var data = gson.fromJson<HomeDataBean>(it, HomeDataBean::class.java) |
| | | homeDataBean = data |
| | | tv_car.text = if (data.data.work == 1) "收车" else "出车" |
| | | if (data.data.work == 1){ |
| | | MyApplication.getTTsManager().setVideoText("您正在上班中") |
| | | }else{ |
| | | MyApplication.getTTsManager().setVideoText("您已下班") |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | mainFragment.autoRefresh() |
| | | } |
| | | |
| | | tv_name.clickDelay { |
| | | |
| | | } |
| | | |
| | | tv_car_num.clickDelay { |
| | | |
| | | } |
| | | |
| | | tv_star_num.clickDelay { |
| | | |
| | | } |
| | | |
| | | ll_task.clickDelay { |
| | | startActivity<SlabMineEventActivity>() |
| | |
| | | callNet(true, Api.work2, getMapByAny()) { |
| | | homeDataBean?.data?.work = 2 |
| | | tv_car.text = "出车" |
| | | toast("下班成功") |
| | | MyApplication.getTTsManager().setVideoText("您已下班") |
| | | } |
| | | } else { |
| | | var map = getMapByAny() |
| | |
| | | callNet(true, Api.work2, map) { |
| | | homeDataBean?.data?.work = 1 |
| | | tv_car.text = "收车" |
| | | toast("上班成功") |
| | | MyApplication.getTTsManager().setVideoText("您正在上班中") |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | private |
| | | var mBackAppTime: Long = 0 |
| | | |
| | | |
| | | override fun onBackPressed() { |
| | | if (System.currentTimeMillis() - mBackAppTime > 2000) { |
| | |
| | | BaseEvent.START_CAR -> { |
| | | initCall() |
| | | } |
| | | BaseEvent.REQUEST_CAR_INFO -> { |
| | | Handler(Looper.getMainLooper()).post { |
| | | toast("收到显示屏信息") |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | override fun onLocationChanged(p0: AMapLocation?) { |
| | | if (p0?.errorCode == 0) { |
| | | if (p0 == null){ |
| | | toast("高德位置是空的") |
| | | return |
| | | } |
| | | if (p0.errorCode == 0) { |
| | | toast("定位成功") |
| | | MyApplication.aMapLocation = p0 |
| | | CacheKey.putKeyStr("location", Gson().toJson(p0)) |
| | | }else{ |
| | | p0.let { |
| | | toast("定位失败"+it.errorCode.toString()) |
| | | } |
| | | } |
| | | } |
| | | } |