| | |
| | | package com.okgoincar.slab |
| | | |
| | | import android.content.Context |
| | | import android.content.Intent |
| | | import android.content.IntentFilter |
| | | import android.os.Bundle |
| | | import android.os.Handler |
| | | import android.os.Looper |
| | | import android.view.Gravity |
| | | import android.view.KeyEvent |
| | | import android.view.ViewGroup |
| | | import android.widget.PopupWindow |
| | | import android.widget.Toast |
| | | import androidx.recyclerview.widget.LinearLayoutManager |
| | | import androidx.recyclerview.widget.RecyclerView |
| | | import cn.sinata.rxnetty.Cache.CacheUtil |
| | | import cn.sinata.rxnetty.NettyClient |
| | | import cn.sinata.xldutils.netstatus.NetUtils |
| | | import cn.sinata.xldutils.utils.* |
| | | import com.amap.api.location.AMapLocation |
| | | import com.amap.api.location.AMapLocationListener |
| | | import com.okgoincar.netUtls.callNet |
| | | import com.okgoincar.netUtls.getMapByAny |
| | | import com.okgoincar.ui.adapter.SlabStartAdapter |
| | | import com.okgoincar.utils.Cache.CacheKey |
| | | import com.google.gson.Gson |
| | | import com.okgoincar.R |
| | | import com.okgoincar.base.AMapKit |
| | |
| | | import com.okgoincar.base.MyApplication |
| | | import com.okgoincar.bean.* |
| | | import com.okgoincar.netUtls.Api |
| | | import com.okgoincar.netUtls.sendAudio |
| | | import com.okgoincar.netUtls.callNet |
| | | import com.okgoincar.netUtls.createView |
| | | import com.okgoincar.netUtls.getMapByAny |
| | | import com.okgoincar.slab.event.SlabMineEventActivity |
| | | import com.okgoincar.slab.util.DialogUtil |
| | | import com.okgoincar.ui.adapter.SlabStartAdapter |
| | | import com.okgoincar.utils.Cache.CacheKey |
| | | import com.okgoincar.utils.DateUtil |
| | | import com.okgoincar.utils.EasePopup.EasyPopup |
| | | import com.okgoincar.utils.PackageUtil |
| | | import com.okgoincar.utils.download.DownloadUtil |
| | | import com.okgoincar.utils.glide.GlideUtil |
| | | import kotlinx.android.synthetic.main.dialog_sure_and_del_slab.view.* |
| | | import kotlinx.android.synthetic.main.slab_activity_login.* |
| | | import kotlinx.android.synthetic.main.slab_activity_main.* |
| | | import kotlinx.android.synthetic.main.slab_activity_main.tv_name |
| | | import org.greenrobot.eventbus.EventBus |
| | | import org.jetbrains.anko.startActivity |
| | | import org.jetbrains.anko.toast |
| | | import java.lang.Exception |
| | | |
| | | class SlabMainActivity : MySlabBaseActivity(), AMapLocationListener { |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | private fun callPersion() { |
| | | callNet(true, Api.queryInfo, getMapByAny()) { |
| | | var user = gson.fromJson<UserBean>(it, UserBean::class.java) |
| | |
| | | } |
| | | } |
| | | |
| | | var popup:EasyPopup? = null |
| | | var popup: PopupWindow? = null |
| | | |
| | | override fun onResume() { |
| | | super.onResume() |
| | |
| | | } |
| | | } |
| | | window.decorView.post { |
| | | popup?.showCenter(window.decorView) |
| | | popup?.showAtLocation(window.decorView, Gravity.CENTER, 0, 0); |
| | | // popup?.showCenter(window.decorView) |
| | | } |
| | | } |
| | | } |
| | | |
| | | fun getSlabDelAndSurePopWindow(context: Context,sureStr:String,cancelStr:String,content:String,clickClose :() -> Unit,clickSure:() -> Unit): EasyPopup { |
| | | var dialog = DialogUtil.getPopupwindow(context, R.layout.dialog_sure_and_del_slab) |
| | | fun getSlabDelAndSurePopWindow( |
| | | context: Context, |
| | | sureStr: String, |
| | | cancelStr: String, |
| | | content: String, |
| | | clickClose: () -> Unit, |
| | | clickSure: () -> Unit |
| | | ): PopupWindow { |
| | | var dialog = PopupWindow(createView(R.layout.dialog_sure_and_del_slab,context)) |
| | | dialog.width = ViewGroup.LayoutParams.MATCH_PARENT |
| | | dialog.height = ViewGroup.LayoutParams.MATCH_PARENT |
| | | |
| | | var view = dialog.contentView |
| | | view.tv_close_base.text = cancelStr |
| | | view.tv_sure_base.text = sureStr |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | private fun showUI(data: UserInfoBean?) { |
| | | data?.let { |
| | | textView_version.text ="版本-V"+PackageUtil.getVersionName(this) |
| | | tv_title_top.text = "服 务 监 督 卡" |
| | | if (data.taxiAptitudeCard.length > 7){ |
| | | tv_code_num.text = "资格证号:"+data.taxiAptitudeCard.substring(0,3)+"*******"+data.taxiAptitudeCard.substring(data.taxiAptitudeCard.length-4,data.taxiAptitudeCard.length) |
| | | 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 |
| | | } |
| | |
| | | var mBackAppTime: Long = 0 |
| | | |
| | | override fun onBackPressed() { |
| | | if (popup != null && popup!!.isShowing) { |
| | | return |
| | | } |
| | | if (System.currentTimeMillis() - mBackAppTime > 2000) { |
| | | Toast.makeText(this, "再按一次退出程序", Toast.LENGTH_SHORT) |
| | | .show() |
| | |
| | | } else { |
| | | moveTaskToBack(true) |
| | | } |
| | | } |
| | | |
| | | override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { |
| | | if (popup != null && popup!!.isShowing) { |
| | | return false |
| | | } |
| | | return super.onKeyDown(keyCode, event) |
| | | } |
| | | |
| | | override fun onEventMainThread(event: BaseEvent?) { |
| | |
| | | if (bean.data.version != "" && bean.data.version != Utils.getAppVersion(this)) { |
| | | if (bean.data.mandatory == 0) { |
| | | var pop = |
| | | DialogUtil.getSlabDelAndSurePopWindow(true,this, "确定", "取消", "有新版本是否更新", {}) { |
| | | DialogUtil.getSlabDelAndSurePopWindow( |
| | | true, |
| | | this, |
| | | "确定", |
| | | "取消", |
| | | "有新版本是否更新", |
| | | {}) { |
| | | DownloadUtil(this).downloadAPK(bean.data.url, "ok出行车载端") |
| | | } |
| | | pop.showCenter(window.decorView) |