18034727885
2026-06-11 2e49e9b6bfd9c9242b06ce2621702ecb916f9bbc
代码优化
3个文件已修改
54 ■■■■■ 已修改文件
app/src/main/java/com/liuzhou/callcar/driver/pad/base/MyApplication.kt 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/liuzhou/callcar/driver/pad/slab/SlabOrderOverActivity.kt 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xldUtils/src/main/java/cn/sinata/xldutils/netstatus/NetUtils.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/liuzhou/callcar/driver/pad/base/MyApplication.kt
@@ -356,10 +356,10 @@
                }
            }
            set(value) {
                value?.apply {
                    latitude = 30.59
                    longitude = 104.06
                }
//                value?.apply {
//                    latitude = 30.59
//                    longitude = 104.06
//                }
                field = value
                CacheKey.putKeyStr("location", if (value == null) "" else Gson().toJson(value))
            }
app/src/main/java/com/liuzhou/callcar/driver/pad/slab/SlabOrderOverActivity.kt
@@ -2,6 +2,7 @@
import android.os.CountDownTimer
import android.os.Handler
import android.os.Looper
import android.view.View
import cn.sinata.xldutils.utils.*
import com.google.gson.Gson
@@ -101,12 +102,11 @@
            if (it.data?.orderState == 7) {
                MyApplication.getTTsManager()
                    .setVideoText("请确认乘客车内付款后,再点击返回首页")
                cancelTimer()
                time = timeOver(60000 * 6) {
                    tv_title_slab.text = "待支付($it)"
                    if (it == 0) {
                        if (time != null) {
                            time!!.cancel()
                        }
                        cancelTimer()
                        finish()
                    }
                }
@@ -169,16 +169,12 @@
        }
    }
    var handler: Handler? = null
    var handler: Handler = Handler(Looper.getMainLooper())
    var isPlay = false
    private val checkOrderStatueRunnable = Runnable { checkOrderStatue() }
    fun checkOrderStatue() {
        if (handler == null) {
            handler = Handler(mainLooper)
        }
        handler!!.postDelayed({
            checkOrderStatue()
        }, 3000)
        handler.postDelayed(checkOrderStatueRunnable, 3000)
        var map = getMapByAny()
//        map["orderId"] = orderId
//        map["orderType"] = orderType
@@ -213,13 +209,11 @@
                        tv_to_main.visible()
                        MyApplication.getTTsManager()
                            .setVideoText("乘客已支付" + orderBean?.data?.orderMoney.toString() + "元")
                        time?.cancel()
                        cancelTimer()
                        time = timeOver(20000) {
                            tv_title_slab.text = "已完成($it)"
                            if (it == 0) {
                                if (time != null) {
                                    time!!.cancel()
                                }
                                cancelTimer()
                                finish()
                            }
                        }
@@ -229,11 +223,17 @@
        }
    }
    override fun onDestroy() {
        super.onDestroy()
    //取消倒计时
    private fun cancelTimer() {
        time?.cancel()
        time = null
        handler?.removeCallbacksAndMessages(null)
    }
    override fun onDestroy() {
        super.onDestroy()
        cancelTimer()
        handler.removeCallbacks(checkOrderStatueRunnable)
        handler.removeCallbacksAndMessages(null)
    }
    override fun setTitleText(title: String?) {
xldUtils/src/main/java/cn/sinata/xldutils/netstatus/NetUtils.java
@@ -16,7 +16,7 @@
    }
    public static boolean isNetworkAvailable(Context context) {
        ConnectivityManager mgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        ConnectivityManager mgr = (ConnectivityManager) context.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo[] info = mgr.getAllNetworkInfo();
        if (info != null) {
            for (int i = 0; i < info.length; i++) {
@@ -30,7 +30,7 @@
    public static boolean isNetworkConnected(Context context) {
        if (context != null) {
            ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
            ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
            if (mNetworkInfo != null) {
                return mNetworkInfo.isAvailable();
@@ -41,7 +41,7 @@
    public static boolean isWifiConnected(Context context) {
        if (context != null) {
            ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
            ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo mWiFiNetworkInfo = mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
            if (mWiFiNetworkInfo != null) {
                return mWiFiNetworkInfo.isAvailable();
@@ -52,7 +52,7 @@
    public static boolean isMobileConnected(Context context) {
        if (context != null) {
            ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
            ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo mMobileNetworkInfo = mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
            if (mMobileNetworkInfo != null) {
                return mMobileNetworkInfo.isAvailable();
@@ -63,7 +63,7 @@
    public static int getConnectedType(Context context) {
        if (context != null) {
            ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
            ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
            if (mNetworkInfo != null && mNetworkInfo.isAvailable()) {
                return mNetworkInfo.getType();
@@ -73,7 +73,7 @@
    }
    public static NetType getAPNType(Context context) {
        ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        ConnectivityManager connMgr = (ConnectivityManager) context.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
        if (networkInfo == null) {
            return NetType.NONE;