| | |
| | | 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 |
| | | import cn.sinata.rxnetty.NettyClient |
| | | import cn.sinata.xldutils.utils.clickDelay |
| | | import cn.sinata.xldutils.utils.getNowTimeBlack |
| | | import cn.sinata.xldutils.utils.textColor |
| | | import com.amap.api.location.AMapLocation |
| | | import com.amap.api.location.AMapLocationListener |
| | |
| | | setContentView(R.layout.slab_activity_main) |
| | | } |
| | | |
| | | |
| | | override fun setBlackMode(b: Boolean?) { |
| | | super.setBlackMode(b) |
| | | if (b!!) { |
| | | ct_bg.setBackgroundResource(R.color.black_191919) |
| | | ll_top.setBackgroundResource(R.drawable.bg_green_top_black) |
| | | tv_server_ing.textColor(this,R.color.write) |
| | | iv_small.textColor(this,R.color.write) |
| | | tv_wait_server.textColor(this,R.color.write) |
| | | tv_code_num.textColor(this,R.color.write) |
| | | tv_name.textColor(this,R.color.write) |
| | | tv_car_num.textColor(this,R.color.write) |
| | | tv_star_num.textColor(this,R.color.write) |
| | | tv_current_time.textColor(this,R.color.write) |
| | | tv_company.textColor(this,R.color.write) |
| | | tv_time.textColor(this,R.color.write) |
| | | } else { |
| | | ll_top.setBackgroundResource(R.drawable.bg_green_top) |
| | | ct_bg.setBackgroundResource(R.drawable.bg_slab_main) |
| | | ll_top.setBackgroundResource(R.drawable.bg_white_round5) |
| | | ct_bg.setBackgroundResource(R.drawable.write) |
| | | tv_server_ing.textColor(this,R.color.black) |
| | | iv_small.textColor(this,R.color.black) |
| | | tv_wait_server.textColor(this,R.color.black) |
| | | tv_code_num.textColor(this,R.color.black) |
| | | tv_name.textColor(this,R.color.black) |
| | | tv_car_num.textColor(this,R.color.black) |
| | | tv_star_num.textColor(this,R.color.black) |
| | | tv_current_time.textColor(this,R.color.black) |
| | | tv_company.textColor(this,R.color.black) |
| | | tv_time.textColor(this,R.color.black) |
| | | |
| | | } |
| | | } |
| | |
| | | override fun setOnclick() { |
| | | tv_server_ing.setOnClickListener { |
| | | tv_server_ing.textColor(this, R.color.main_yellow) |
| | | tv_wait_server.textColor(this, R.color.white) |
| | | if (getNowTimeBlack()){ |
| | | tv_wait_server.textColor(this, R.color.white) |
| | | }else{ |
| | | tv_wait_server.textColor(this, R.color.black) |
| | | } |
| | | mainFragment.state = 1 |
| | | mainFragment.autoRefresh() |
| | | } |
| | | |
| | | tv_wait_server.setOnClickListener { |
| | | tv_server_ing.textColor(this, R.color.white) |
| | | tv_wait_server.textColor(this, R.color.main_yellow) |
| | | if (getNowTimeBlack()){ |
| | | tv_server_ing.textColor(this, R.color.white) |
| | | }else{ |
| | | tv_server_ing.textColor(this, R.color.black) |
| | | } |
| | | mainFragment.state = 2 |
| | | mainFragment.autoRefresh() |
| | | } |
| | | |
| | | tv_name.clickDelay { |
| | | toast("点亮网约") |
| | | } |
| | | |
| | | tv_car_num.clickDelay { |
| | | |
| | | } |
| | | |
| | | tv_star_num.clickDelay { |
| | | |
| | | } |
| | | |
| | | ll_task.clickDelay { |
| | | startActivity<SlabMineEventActivity>() |
| | |
| | | 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()) |
| | | } |
| | | } |
| | | } |
| | | } |