Kaynağa Gözat

配合测试完成BUG修复

JaycePC 1 ay önce
ebeveyn
işleme
e8c5d38f80
87 değiştirilmiş dosya ile 1711 ekleme ve 4688 silme
  1. 1 25
      app/src/main/AndroidManifest.xml
  2. 0 8
      app/src/main/java/com/rc/core/event/RefreshEvent.kt
  3. 0 71
      app/src/main/java/com/rc/core/ui/ActivityCollector.kt
  4. 147 0
      app/src/main/java/com/rc/core/ui/activity/BaseActivity.java
  5. 96 0
      app/src/main/java/com/rc/core/ui/activity/BaseActivityHelp.java
  6. 0 132
      app/src/main/java/com/rc/core/ui/activity/RcBaseActivity.kt
  7. 0 236
      app/src/main/java/com/rc/core/ui/activity/RcRefreshActivity.kt
  8. 0 39
      app/src/main/java/com/rc/core/ui/common/AbsUIDelegate.kt
  9. 0 27
      app/src/main/java/com/rc/core/ui/common/IUIListener.kt
  10. 0 91
      app/src/main/java/com/rc/core/ui/common/UIDelegateImpl.kt
  11. 0 104
      app/src/main/java/com/rc/core/ui/dialog/LoadingDialog.kt
  12. 0 113
      app/src/main/java/com/rc/core/ui/dialog/RcBaseDialog.kt
  13. 92 0
      app/src/main/java/com/rc/core/ui/fragment/BaseFragment.java
  14. 94 0
      app/src/main/java/com/rc/core/ui/fragment/BaseFragmentHelp.java
  15. 0 88
      app/src/main/java/com/rc/core/ui/fragment/RcBaseFragment.kt
  16. 0 37
      app/src/main/java/com/rc/core/ui/fragment/RcLazyFragment.kt
  17. 0 225
      app/src/main/java/com/rc/core/ui/fragment/RcRefreshFragment.kt
  18. 0 301
      app/src/main/java/com/rc/core/ui/widget/MultipleStatusView.kt
  19. 0 53
      app/src/main/java/com/rc/core/ui/widget/decoration/GridSpacingItemDecoration.java
  20. 0 148
      app/src/main/java/com/rc/core/ui/widget/decoration/NoLastLineItemDecoration.java
  21. 0 195
      app/src/main/java/com/rc/core/util/ApkController.kt
  22. 0 61
      app/src/main/java/com/rc/core/util/ApkUpdater.kt
  23. 0 208
      app/src/main/java/com/rc/core/util/CrashHandler.kt
  24. 0 120
      app/src/main/java/com/rc/core/util/CrashHelper.kt
  25. 0 102
      app/src/main/java/com/rc/core/util/DateUtils.kt
  26. 0 75
      app/src/main/java/com/rc/core/util/DeviceUtils.kt
  27. 0 18
      app/src/main/java/com/rc/core/util/Extension.kt
  28. 0 32
      app/src/main/java/com/rc/core/util/FastClickDelegate.kt
  29. 0 69
      app/src/main/java/com/rc/core/util/Format.kt
  30. 0 162
      app/src/main/java/com/rc/core/util/MediaUtils.kt
  31. 0 35
      app/src/main/java/com/rc/core/util/net/NetChangeListener.kt
  32. 0 20
      app/src/main/java/com/rc/core/util/net/NetConnectedListener.kt
  33. 0 145
      app/src/main/java/com/rc/core/util/net/NetWatchdog.kt
  34. 43 0
      app/src/main/java/com/rc/httpcore/client/HttpTool.java
  35. 0 1
      app/src/main/java/xn/hxp/comm/Constants.kt
  36. 173 167
      app/src/main/java/xn/hxp/ui/MainActivity.kt
  37. 73 74
      app/src/main/java/xn/hxp/ui/SettingActivity.kt
  38. 0 363
      app/src/main/java/xn/hxp/ui/SplashActivity.kt
  39. 177 0
      app/src/main/java/xn/hxp/ui/StartActivity.java
  40. 0 155
      app/src/main/java/xn/hxp/ui/common/BaseCountDownActivity.java
  41. 0 135
      app/src/main/java/xn/hxp/ui/common/BaseCountDownActivity.kt
  42. 0 163
      app/src/main/java/xn/hxp/ui/common/CommonListActivity.kt
  43. 17 9
      app/src/main/java/xn/hxp/ui/discard/ChecklistsActivity.kt
  44. 18 12
      app/src/main/java/xn/hxp/ui/discard/LedgerActivity.kt
  45. 0 14
      app/src/main/java/xn/hxp/ui/discard/ListReturnedActivity.kt
  46. 24 37
      app/src/main/java/xn/hxp/ui/discard/WasteChemicalsActivity.kt
  47. 33 12
      app/src/main/java/xn/hxp/ui/fragments/InventoryIedgerFragment.kt
  48. 25 8
      app/src/main/java/xn/hxp/ui/fragments/QueryOneFragment.kt
  49. 22 10
      app/src/main/java/xn/hxp/ui/fragments/QueryTwoFragment.kt
  50. 23 9
      app/src/main/java/xn/hxp/ui/fragments/UseLedgerFragment.kt
  51. 23 17
      app/src/main/java/xn/hxp/ui/inquiry/InquiryActivity.kt
  52. 17 15
      app/src/main/java/xn/hxp/ui/inquiry/QueryDetailsActivity.kt
  53. 13 18
      app/src/main/java/xn/hxp/ui/login/FacialCardActivity.kt
  54. 14 33
      app/src/main/java/xn/hxp/ui/login/FacialLoginActivity.kt
  55. 58 49
      app/src/main/java/xn/hxp/ui/login/ScanLoginActivity.kt
  56. 13 7
      app/src/main/java/xn/hxp/ui/login/SwipeActivity.kt
  57. 21 15
      app/src/main/java/xn/hxp/ui/plan/PlanAddActivity.java
  58. 2 2
      app/src/main/java/xn/hxp/ui/plan/PlanAddActivityHelp.java
  59. 71 67
      app/src/main/java/xn/hxp/ui/plan/add/AddActivity.java
  60. 3 3
      app/src/main/java/xn/hxp/ui/plan/add/AddActivityHelp.java
  61. 15 20
      app/src/main/java/xn/hxp/ui/plan/change/ChangeCabinetActivity.java
  62. 20 12
      app/src/main/java/xn/hxp/ui/plan/save_list/SaveListActivity.java
  63. 10 9
      app/src/main/java/xn/hxp/ui/plan/save_list/SaveListAdapter.java
  64. 18 10
      app/src/main/java/xn/hxp/ui/plan/unlock/UnlockActivity.java
  65. 2 2
      app/src/main/java/xn/hxp/ui/plan/unlock/UnlockActivityHelp.java
  66. 25 22
      app/src/main/java/xn/hxp/ui/still/ChemicalsAlsoActivity.kt
  67. 0 35
      app/src/main/java/xn/hxp/ui/still/DemonstrateActivity.kt
  68. 14 11
      app/src/main/java/xn/hxp/ui/still/MsdsActivity.kt
  69. 16 10
      app/src/main/java/xn/hxp/ui/still/MsdsScreenActivity.kt
  70. 15 7
      app/src/main/java/xn/hxp/ui/uses/ProcessedActivity.kt
  71. 18 29
      app/src/main/java/xn/hxp/ui/uses/UseActivity.kt
  72. 30 11
      app/src/main/java/xn/hxp/ui/uses/WarningEventsActivity.kt
  73. 14 18
      app/src/main/java/xn/hxp/ui/verify/DoubleVerifyActivity.java
  74. 22 18
      app/src/main/java/xn/hxp/ui/verify/ScanCodeTwoActivity.kt
  75. 16 6
      app/src/main/java/xn/hxp/ui/verify/SwipeCodeTwoActivity.kt
  76. 21 7
      app/src/main/java/xn/hxp/ui/verify/TwoPersonActivity.kt
  77. 14 9
      app/src/main/java/xn/hxp/ui/verify/TwoVerificationActivity.kt
  78. 17 11
      app/src/main/java/xn/hxp/ui/warehousing/ChemicalLabelingActivity.kt
  79. 18 23
      app/src/main/java/xn/hxp/ui/warehousing/ElectronicLedgerActivity.kt
  80. 22 17
      app/src/main/java/xn/hxp/ui/warehousing/WarehousingActivity.kt
  81. 0 32
      app/src/main/java/xn/hxp/utils/NetworkUtils.kt
  82. 3 1
      app/src/main/java/xn/hxp/utils/SharedPreferencesHelper.kt
  83. 2 7
      app/src/main/java/xn/hxp/weidith/BelongingPersonDialog.kt
  84. 2 2
      app/src/main/java/xn/hxp/weidith/TabFragmentPagerAdapter.kt
  85. 60 0
      app/src/main/res/layout/activity_start.xml
  86. 12 12
      serialport/.cxx/Debug/6e5q1f5t/arm64-v8a/configure_fingerprint.bin
  87. 12 12
      serialport/.cxx/Debug/6e5q1f5t/x86/configure_fingerprint.bin

+ 1 - 25
app/src/main/AndroidManifest.xml

@@ -103,12 +103,6 @@
             android:launchMode="singleTask"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustPan" />
-        <activity
-            android:name=".ui.SettingActivity"
-            android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale"
-            android:launchMode="singleTask"
-            android:screenOrientation="landscape"
-            android:windowSoftInputMode="adjustPan" />
         <activity
             android:name=".ui.login.ScanLoginActivity"
             android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale"
@@ -133,12 +127,6 @@
             android:launchMode="singleTask"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustPan" />
-        <activity
-            android:name=".ui.discard.ListReturnedActivity"
-            android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale"
-            android:launchMode="singleTask"
-            android:screenOrientation="landscape"
-            android:windowSoftInputMode="adjustPan" />
         <activity
             android:name=".ui.verify.SwipeCodeTwoActivity"
             android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale"
@@ -181,12 +169,6 @@
             android:launchMode="singleTask"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustPan" />
-        <activity
-            android:name=".ui.still.DemonstrateActivity"
-            android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale"
-            android:launchMode="singleTask"
-            android:screenOrientation="landscape"
-            android:windowSoftInputMode="adjustPan" />
         <activity
             android:name=".ui.uses.WarningEventsActivity"
             android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale"
@@ -235,12 +217,6 @@
             android:launchMode="singleTask"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustPan" />
-        <activity
-            android:name=".ui.newly.AddedChemicalsActivity"
-            android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale"
-            android:launchMode="singleTask"
-            android:screenOrientation="landscape"
-            android:windowSoftInputMode="adjustPan" />
         <activity
             android:name=".ui.login.SwipeActivity"
             android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale"
@@ -252,7 +228,7 @@
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustPan" />
         <activity
-            android:name=".ui.SplashActivity"
+            android:name=".ui.StartActivity"
             android:exported="true"
             android:launchMode="singleTask"
             android:screenOrientation="landscape">

+ 0 - 8
app/src/main/java/com/rc/core/event/RefreshEvent.kt

@@ -1,8 +0,0 @@
-package com.rc.core.event
-
-/**
- * info
- *
- * @author ReiChin_
- */
-data class RefreshEvent(var refresh: Boolean = true, var flag: String)

+ 0 - 71
app/src/main/java/com/rc/core/ui/ActivityCollector.kt

@@ -1,71 +0,0 @@
-package com.rc.core.ui
-
-import android.app.Activity
-import java.util.ArrayList
-
-/**
- * info
- *
- * @author ReiChin_
- */
-object ActivityCollector {
-
-    /**
-     * 存放应用已开启的所有Activity.
-     */
-    private val mActivities by lazy { ArrayList<Activity>() }
-
-    /**
-     * 添加一个Activity到Activity列表中.
-     *
-     * @param activity
-     * : Activity实例.
-     */
-    fun addActivity(activity: Activity) {
-        mActivities.add(activity)
-    }
-
-    /**
-     * 在Activity列表中,从顶部删除一定数量的Activity.
-     * -1表示删除所有的Activity, 如果count大于Activity列表的size, 将删除所有的Activity.
-     *
-     * @param count
-     * : 要删的Activity数量.
-     */
-    fun removeActivity(count: Int) {
-        val listSize = mActivities.size
-        val delCount = if (-1 == count || count > listSize) listSize else count
-        for (i in 0 until delCount) {
-            val activity = mActivities[listSize - i - 1]
-            if (!activity.isFinishing) {
-                activity.finish()
-            }
-            mActivities.remove(activity)
-        }
-    }
-
-    /**
-     * 从Activity列表中删除指定的Activity.
-     *
-     * @param activity
-     * : 要删的Activity.
-     */
-    fun removeActivity(activity: Activity) {
-        if (mActivities.contains(activity)) {
-            mActivities.remove(activity)
-        }
-    }
-
-    /**
-     * 关闭所有的Activity, 退出程序.
-     */
-    fun finishAll() {
-        for (activity in mActivities) {
-            if (!activity.isFinishing) {
-                activity.finish()
-            }
-        }
-        mActivities.clear()
-    }
-
-}

+ 147 - 0
app/src/main/java/com/rc/core/ui/activity/BaseActivity.java

@@ -0,0 +1,147 @@
+package com.rc.core.ui.activity;
+
+import android.os.Bundle;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.viewbinding.ViewBinding;
+
+import com.blankj.utilcode.util.ActivityUtils;
+import com.blankj.utilcode.util.LogUtils;
+import com.blankj.utilcode.util.ThreadUtils;
+import com.rc.core.util.ScreenAdapter;
+import com.rc.httpcore.bean.ConfigBean;
+
+import java.util.concurrent.TimeUnit;
+
+import io.reactivex.rxjava3.disposables.CompositeDisposable;
+import io.reactivex.rxjava3.disposables.Disposable;
+import xn.hxp.app.ChemicalApp;
+import xn.hxp.comm.Constants;
+
+public abstract class BaseActivity extends AppCompatActivity {
+
+    private boolean isCountCdTime = true;
+    private int cdTime = 60;
+    private BaseActivityHelp baseActivityHelp;
+    protected CompositeDisposable compositeDisposable = new CompositeDisposable();
+    private final ThreadUtils.SimpleTask<Object> cdTask = new ThreadUtils.SimpleTask<Object>() {
+        @Override
+        public Object doInBackground() throws Throwable {
+            return null;
+        }
+
+        @Override
+        public void onSuccess(Object result) {
+            if (isCountCdTime) {
+                cdTime(cdTime);
+                cdTime--;
+                if (cdTime <= 0) {
+                    cdFinish();
+                    ThreadUtils.cancel(cdTask);
+                }
+            }
+        }
+    };
+
+    protected abstract void cdFinish();
+
+    protected abstract void cdTime(int cd);
+
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        cdTime = 90;
+        ConfigBean configBean = ChemicalApp.confs;
+        if (null != configBean) {
+            cdTime = configBean.getBackTime();
+            Constants.INSTANCE.setOFFTIME_TIME(configBean.getOffTime());
+        }
+
+        ScreenAdapter.INSTANCE.setCustomDensity(this);
+        setContentView(setViewBinding().getRoot());
+        ThreadUtils.executeByCachedAtFixRate(cdTask, 1, TimeUnit.SECONDS);
+        baseActivityHelp = new BaseActivityHelp(this);
+        onInit();
+    }
+
+
+    protected abstract ViewBinding setViewBinding();
+
+    protected abstract void onInit();
+
+    protected void setCdTime(int cdTime) {
+        this.cdTime = cdTime;
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        LogUtils.d("activity生命周期", ActivityUtils.getActivityList());
+        ScreenAdapter.INSTANCE.setCustomDensity(this);
+        isCountCdTime = true;
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+        isCountCdTime = false;
+    }
+
+    @Override
+    protected void onStop() {
+        super.onStop();
+        isCountCdTime = false;
+    }
+
+    public void showLoading(String msg) {
+        if (null != baseActivityHelp) {
+            baseActivityHelp.showLoading(msg);
+        }
+    }
+
+    public void dismissLoading() {
+        if (null != baseActivityHelp) {
+            baseActivityHelp.dismissLoading();
+        }
+
+    }
+
+    public void showToast(String msg) {
+        if (null != baseActivityHelp) {
+            baseActivityHelp.showToast(msg);
+        }
+
+    }
+
+    public void showNetError(Throwable throwable) {
+        if (null != baseActivityHelp) {
+            baseActivityHelp.showNetError(throwable);
+        }
+
+    }
+
+    public void addDisposable(Disposable disposable) {
+        if (null != baseActivityHelp) {
+            baseActivityHelp.addDisposable(disposable);
+        }
+
+    }
+
+    public void delDisposable(Disposable disposable) {
+        if (null != baseActivityHelp) {
+            baseActivityHelp.delDisposable(disposable);
+        }
+    }
+
+    @Override
+    protected void onDestroy() {
+        if (null != baseActivityHelp) {
+            baseActivityHelp.onDestroy();
+        }
+        super.onDestroy();
+        isCountCdTime = false;
+        ThreadUtils.cancel(cdTask);
+    }
+}

+ 96 - 0
app/src/main/java/com/rc/core/ui/activity/BaseActivityHelp.java

@@ -0,0 +1,96 @@
+package com.rc.core.ui.activity;
+
+import android.text.TextUtils;
+import android.widget.Toast;
+
+import com.blankj.utilcode.util.ThreadUtils;
+import com.kongzue.dialogx.DialogX;
+import com.kongzue.dialogx.dialogs.WaitDialog;
+import com.rc.httpcore.exception.NetException;
+
+import java.net.ConnectException;
+import java.net.SocketTimeoutException;
+import java.util.concurrent.TimeUnit;
+
+import io.reactivex.rxjava3.disposables.Disposable;
+import retrofit2.HttpException;
+
+public class BaseActivityHelp {
+    private BaseActivity baseActivity;
+
+    private ThreadUtils.SimpleTask<Object> cdDismissTask;
+
+    public BaseActivityHelp(BaseActivity baseActivity) {
+        this.baseActivity = baseActivity;
+    }
+
+    public void onDestroy() {
+
+    }
+
+    public void showLoading(String msg) {
+        ThreadUtils.cancel(cdDismissTask);
+        WaitDialog.show(msg).setEnterAnimDuration(0).setExitAnimDuration(0).setCancelable(DialogX.cancelable);
+        ThreadUtils.executeByCachedWithDelay(cdDismissTask = new ThreadUtils.SimpleTask<Object>() {
+            @Override
+            public Object doInBackground() throws Throwable {
+                return null;
+            }
+
+            @Override
+            public void onSuccess(Object result) {
+                WaitDialog.dismiss();
+            }
+        }, 30, TimeUnit.SECONDS);
+    }
+
+    public void dismissLoading() {
+        ThreadUtils.cancel(cdDismissTask);
+        WaitDialog.dismiss();
+    }
+
+    public void showToast(String msg) {
+        Toast.makeText(baseActivity, msg, Toast.LENGTH_SHORT).show();
+    }
+
+    public void showNetError(Throwable throwable) {
+        String message = "";
+        if (throwable instanceof NetException) {
+            message = throwable.getMessage();
+            if (!TextUtils.isEmpty(message)) {
+                message = "接口请求失败(" + ((NetException) throwable).getCode() + ")";
+            }
+        } else if (throwable instanceof SocketTimeoutException) {
+            message = "请求超时,请稍后重试";
+        } else if (throwable instanceof ConnectException) {
+            message = "无法连接服务器,请检查网络";
+        } else if (throwable instanceof HttpException) {
+            message = "服务器繁忙,请稍后重试";
+        } else {
+            if (!TextUtils.isEmpty(message)) {
+                message = throwable.getMessage();
+            }
+        }
+        showToast(message);
+    }
+
+    public void addDisposable(Disposable disposable) {
+        if (null != baseActivity.compositeDisposable && disposable != null && !baseActivity.compositeDisposable.isDisposed()) {
+            baseActivity.compositeDisposable.add(disposable);
+        }
+    }
+
+    public void delDisposable(Disposable disposable) {
+        if (null != baseActivity.compositeDisposable && disposable != null) {
+            baseActivity.compositeDisposable.delete(disposable);
+        }
+    }
+
+    public void clearDisposable() {
+        if (null != baseActivity.compositeDisposable) {
+            baseActivity.compositeDisposable.dispose();
+        }
+    }
+
+
+}

+ 0 - 132
app/src/main/java/com/rc/core/ui/activity/RcBaseActivity.kt

@@ -1,132 +0,0 @@
-package com.rc.core.ui.activity
-
-import android.graphics.Color
-import android.os.Build
-import android.os.Bundle
-import android.view.View
-import android.view.inputmethod.InputMethodManager
-import androidx.annotation.ColorInt
-import androidx.appcompat.app.AppCompatActivity
-import androidx.recyclerview.widget.RecyclerView
-import androidx.viewbinding.ViewBinding
-import com.rc.core.ui.ActivityCollector
-import com.rc.core.ui.common.AbsUIDelegate
-import com.rc.core.ui.common.IUIListener
-import com.rc.core.util.ScreenAdapter
-import io.reactivex.rxjava3.disposables.Disposable
-
-
-/**
- * info
- *
- * @author ReiChin_
- */
-abstract class RcBaseActivity<VB : ViewBinding> : AppCompatActivity(), IUIListener {
-
-    private lateinit var _viewBinding: VB
-
-    protected val viewBinding get() = _viewBinding
-
-    protected lateinit var mUIDelegate: AbsUIDelegate
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        ActivityCollector.addActivity(this)
-        ScreenAdapter.setCustomDensity(this)
-        mUIDelegate = AbsUIDelegate.create()
-        configImmersiveMode()
-        beforeSetContentView()
-        _viewBinding = createViewBinding()
-        setContentView(_viewBinding.root)
-        initViews(savedInstanceState)
-        initListener()
-        initData()
-    }
-
-    override fun onResume() {
-        super.onResume()
-        ScreenAdapter.setCustomDensity(this)
-    }
-
-    protected abstract fun createViewBinding(): VB
-
-    protected open fun configImmersiveMode() {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
-                window.decorView.systemUiVisibility =
-                    View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
-            }
-            window.statusBarColor = statusBarColor()
-        }
-    }
-
-    @ColorInt
-    protected open fun statusBarColor(): Int = Color.WHITE
-
-    protected open fun beforeSetContentView() {
-    }
-
-    protected open fun initViews(savedInstanceState: Bundle?) {
-    }
-
-    protected open fun initListener() {
-    }
-
-    protected open fun initData() {
-    }
-
-    override fun onDestroy() {
-        super.onDestroy()
-        mUIDelegate.clearDisposable()
-        ActivityCollector.removeActivity(this)
-    }
-
-    override fun showLoading(message: String?, cancelable: Boolean) {
-        if (!isDestroyed) {
-            mUIDelegate.showLoading(this, message, cancelable)
-        }
-    }
-
-    override fun dismissLoading() {
-        mUIDelegate.dismissLoading()
-    }
-
-    override fun showToast(message: String) {
-        mUIDelegate.showToast(this, message)
-    }
-
-    override fun showNetError(throwable: Throwable) {
-        mUIDelegate.showNetError(this, throwable)
-    }
-
-    override fun addDisposable(disposable: Disposable) {
-        mUIDelegate.addDisposable(disposable)
-    }
-
-    override fun delDisposable(disposable: Disposable) {
-        mUIDelegate.delDisposable(disposable)
-    }
-
-    override fun createItemDecoration(): RecyclerView.ItemDecoration? {
-        return mUIDelegate.createItemDecoration(this)
-    }
-
-    /**
-     * 关闭软键盘
-     */
-    open fun hintKeyBoard() {
-        //拿到InputMethodManager
-        val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
-        //如果window上view获取焦点 && view不为空
-        if (imm.isActive && currentFocus != null) {
-            //拿到view的token 不为空
-            if (currentFocus!!.windowToken != null) {
-                //表示软键盘窗口总是隐藏,除非开始时以SHOW_FORCED显示。
-                imm.hideSoftInputFromWindow(
-                    currentFocus!!.windowToken,
-                    InputMethodManager.HIDE_NOT_ALWAYS
-                )
-            }
-        }
-    }
-}

+ 0 - 236
app/src/main/java/com/rc/core/ui/activity/RcRefreshActivity.kt

@@ -1,236 +0,0 @@
-package com.rc.core.ui.activity
-
-import android.os.Bundle
-import android.view.View
-import androidx.recyclerview.widget.LinearLayoutManager
-import androidx.recyclerview.widget.RecyclerView
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
-import androidx.viewbinding.ViewBinding
-import com.chad.library.adapter.base.BaseQuickAdapter
-import com.chad.library.adapter.base.listener.OnItemChildClickListener
-import com.chad.library.adapter.base.listener.OnItemClickListener
-import com.chad.library.adapter.base.listener.OnLoadMoreListener
-import com.chad.library.adapter.base.viewholder.BaseViewHolder
-import com.rc.core.event.RefreshEvent
-import com.rc.core.ui.widget.MultipleStatusView
-import com.rc.core.util.net.NetConnectedListener
-import com.rc.core.util.net.NetWatchdog
-import io.reactivex.rxjava3.disposables.Disposable
-import org.greenrobot.eventbus.EventBus
-import org.greenrobot.eventbus.Subscribe
-import org.greenrobot.eventbus.ThreadMode
-import xn.hxp.R
-
-/**
- * info
- *
- * @author ReiChin_
- */
-abstract class RcRefreshActivity<T, VB : ViewBinding>
-constructor(val mAdapter: BaseQuickAdapter<T, BaseViewHolder>) : RcBaseActivity<VB>(),
-    OnLoadMoreListener,
-    OnItemClickListener,
-    OnItemChildClickListener {
-
-    companion object {
-        const val FIRST_PAGE = 1
-        const val PAGE_SIZE = 15
-    }
-
-    protected abstract val mMultipleStatusView: MultipleStatusView?
-    protected abstract val mSrlRefresh: SwipeRefreshLayout
-    protected abstract val mRvContent: RecyclerView
-
-    protected var mCurrentPage = FIRST_PAGE
-    protected var mRefresh = false
-
-    private val mNetWatchdog: NetWatchdog by lazy { NetWatchdog(this) }
-    private var mLoadingData = false
-
-    override fun initListener() {
-        mMultipleStatusView?.setOnRetryClickListener { loadData(true) }
-        mSrlRefresh.setOnRefreshListener { loadData(true) }
-
-        initNetWatchdog()
-    }
-
-    override fun initViews(savedInstanceState: Bundle?) {
-        initRecyclerView()
-    }
-
-    private fun initRecyclerView() {
-        mAdapter.setOnItemClickListener(this)
-        mAdapter.setOnItemChildClickListener(this)
-
-        mRvContent.layoutManager = createLayoutManager()
-//        mAdapter.loadMoreModule.loadMoreView = ItLoadMoreView()
-        mAdapter.loadMoreModule.setOnLoadMoreListener(this)
-        mAdapter.loadMoreModule.isAutoLoadMore = true
-        // 当自动加载开启,同时数据不满一屏时,是否继续执行自动加载更多(默认为true)
-        mAdapter.loadMoreModule.isEnableLoadMoreIfNotFullPage = true
-        mAdapter.animationEnable = true
-        mAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInBottom)
-
-        createItemDecoration()?.let {
-            mRvContent.addItemDecoration(it)
-        }
-
-        mRvContent.adapter = mAdapter
-    }
-
-    protected open fun createLayoutManager(): RecyclerView.LayoutManager {
-        return LinearLayoutManager(this)
-    }
-
-    /**
-     * 初始化网络监听
-     */
-    private fun initNetWatchdog() {
-        mNetWatchdog.startWatch()
-        mNetWatchdog.setNetConnectedListener(object : NetConnectedListener {
-            override fun onReNetConnected(isReconnect: Boolean) {
-                mMultipleStatusView?.let {
-                    if (isReconnect) {
-                        it.showContent()
-                    }
-                }
-                if (mAdapter.data.isEmpty() && !mLoadingData && isReconnect) {
-                    loadData(true)
-                }
-            }
-
-            override fun onNetUnConnected() {
-                if (mAdapter.data.isEmpty()) {
-                    mMultipleStatusView?.showNoNetwork()
-                }
-            }
-        })
-    }
-
-    override fun onDestroy() {
-        super.onDestroy()
-
-        EventBus.getDefault().unregister(this)
-        mNetWatchdog.stopWatch()
-    }
-
-    /**
-     * 数据加载成功的处理逻辑
-     *
-     * @param data 从服务端查询的数据
-     */
-    protected open fun dispatchLoadDataSuccess(data: List<T>?) {
-        mLoadingData = false
-        if (isDestroyed) return
-
-        mMultipleStatusView?.showContent()
-        if (mRefresh) {
-            if (null == data || data.isEmpty()) {
-                if (null == mMultipleStatusView) {
-                    mAdapter.setEmptyView(R.layout.view_list_empty)
-                } else {
-                    mMultipleStatusView!!.showEmpty()
-                }
-            }
-            mAdapter.setNewInstance(data?.toMutableList())
-            mAdapter.loadMoreModule.loadMoreComplete()
-            if (null == data || data.size < PAGE_SIZE) {
-                mAdapter.loadMoreModule.loadMoreEnd(goneLoadMoreView())
-            }
-            mSrlRefresh.isRefreshing = false
-        } else {
-            if (null == data || data.size < PAGE_SIZE) {
-                if (null != data) {
-                    mAdapter.addData(data)
-                }
-                mAdapter.loadMoreModule.loadMoreEnd(goneLoadMoreView())
-            } else {
-                mAdapter.addData(data)
-                mAdapter.loadMoreModule.loadMoreComplete()
-            }
-        }
-    }
-
-    /**
-     * 数据加载失败的处理逻辑
-     */
-    protected open fun dispatchLoadDataFailure(throwable: Throwable) {
-        mLoadingData = false
-        if (isDestroyed) return
-
-        if (mRefresh) {
-            if (null == mMultipleStatusView) {
-                mAdapter.setEmptyView(R.layout.view_list_empty)
-            } else {
-                mMultipleStatusView!!.showError()
-            }
-            mSrlRefresh.isRefreshing = false
-        } else {
-            mCurrentPage = if (mCurrentPage-- < FIRST_PAGE) FIRST_PAGE else mCurrentPage
-            mAdapter.loadMoreModule.loadMoreEnd(goneLoadMoreView())
-        }
-        throwable.printStackTrace()
-        showNetError(throwable)
-    }
-
-    protected open fun goneLoadMoreView() = false
-
-    private fun showLoadingView() {
-        mMultipleStatusView?.let {
-            if (mRefresh) {
-                it.showLoading()
-            }
-        }
-    }
-
-    protected fun loadData(refresh: Boolean) {
-        mLoadingData = true
-        if (refresh) {
-            mCurrentPage = FIRST_PAGE
-        }
-        mRefresh = refresh
-        showLoadingView()
-        queryData()?.let { addDisposable(it) }
-    }
-
-    /**
-     * 查询数据
-     */
-    abstract fun queryData(): Disposable?
-
-    override fun onLoadMore() {
-        val dataSize = mAdapter.data.size
-        if (dataSize < PAGE_SIZE) {
-            mAdapter.loadMoreModule.loadMoreEnd(false)
-        } else {
-            if (dataSize % PAGE_SIZE != 0) {
-                mAdapter.loadMoreModule.loadMoreEnd(false)
-            } else {
-                mCurrentPage++
-                loadData(false)
-            }
-        }
-    }
-
-    override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
-    }
-
-    override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
-    }
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        EventBus.getDefault().register(this)
-    }
-
-    @Subscribe(threadMode = ThreadMode.MAIN)
-    fun onMessageEvent(event: RefreshEvent) {
-        if (event.refresh) {
-            dispatchRefreshEvent(event)
-        }
-    }
-
-    protected open fun dispatchRefreshEvent(event: RefreshEvent) {
-    }
-
-}

+ 0 - 39
app/src/main/java/com/rc/core/ui/common/AbsUIDelegate.kt

@@ -1,39 +0,0 @@
-package com.rc.core.ui.common
-
-import android.content.Context
-import androidx.fragment.app.FragmentManager
-import androidx.recyclerview.widget.RecyclerView
-import io.reactivex.rxjava3.disposables.Disposable
-
-/**
- * info
- *
- * @author ReiChin_
- */
-abstract class AbsUIDelegate {
-
-    companion object {
-        fun create() = UIDelegateImpl()
-    }
-
-    abstract fun showLoading(
-        context: Context,
-        message: String? = null,
-        cancelable: Boolean = false
-    )
-
-    abstract fun dismissLoading()
-
-    abstract fun showToast(context: Context?, message: String)
-
-    abstract fun showNetError(context: Context?, throwable: Throwable)
-
-    abstract fun addDisposable(disposable: Disposable)
-
-    abstract fun delDisposable(disposable: Disposable)
-
-    abstract fun clearDisposable()
-
-    abstract fun createItemDecoration(context: Context?): RecyclerView.ItemDecoration?
-
-}

+ 0 - 27
app/src/main/java/com/rc/core/ui/common/IUIListener.kt

@@ -1,27 +0,0 @@
-package com.rc.core.ui.common
-
-import androidx.recyclerview.widget.RecyclerView
-import io.reactivex.rxjava3.disposables.Disposable
-
-/**
- * info
- *
- * @author ReiChin_
- */
-interface IUIListener {
-
-    fun showLoading(message: String? = null, cancelable: Boolean = false)
-
-    fun dismissLoading()
-
-    fun showToast(message: String)
-
-    fun showNetError(throwable: Throwable)
-
-    fun addDisposable(disposable: Disposable)
-
-    fun delDisposable(disposable: Disposable)
-
-    fun createItemDecoration(): RecyclerView.ItemDecoration?
-
-}

+ 0 - 91
app/src/main/java/com/rc/core/ui/common/UIDelegateImpl.kt

@@ -1,91 +0,0 @@
-package com.rc.core.ui.common
-
-import android.content.Context
-import android.widget.Toast
-import androidx.core.content.ContextCompat
-import androidx.recyclerview.widget.DividerItemDecoration
-import androidx.recyclerview.widget.RecyclerView
-import com.kongzue.dialogx.DialogX
-import com.kongzue.dialogx.dialogs.WaitDialog
-import com.rc.core.ui.widget.decoration.NoLastLineItemDecoration
-import com.rc.httpcore.exception.NetException
-import io.reactivex.rxjava3.disposables.CompositeDisposable
-import io.reactivex.rxjava3.disposables.Disposable
-import retrofit2.HttpException
-import xn.hxp.R
-import java.net.ConnectException
-import java.net.SocketTimeoutException
-
-/**
- * info
- *
- * @author ReiChin_
- */
-class UIDelegateImpl : AbsUIDelegate() {
-
-
-    override fun showLoading(
-        context: Context,
-        message: String?,
-        cancelable: Boolean,
-    ) {
-        WaitDialog.show(message).setEnterAnimDuration(0).setExitAnimDuration(0)
-            .setCancelable(DialogX.cancelable)
-    }
-
-    override fun dismissLoading() {
-        WaitDialog.dismiss()
-    }
-
-    override fun showToast(context: Context?, message: String) {
-        context?.let {
-            Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
-        }
-    }
-
-    override fun showNetError(context: Context?, throwable: Throwable) {
-        when (throwable) {
-            is NetException -> {
-                if (throwable.message.isNullOrEmpty()) {
-                    "接口请求失败(${throwable.code})"
-                } else {
-                    throwable.message!!
-                }
-            }
-
-            is SocketTimeoutException -> "请求超时,请稍后重试"
-            is ConnectException -> "无法连接服务器,请检查网络"
-            is HttpException -> "服务器繁忙,请稍后重试"
-            else -> null
-        }?.let { showToast(context, it) }
-    }
-
-    private var mCompositeDisposable: CompositeDisposable? = null
-
-    override fun addDisposable(disposable: Disposable) {
-        mCompositeDisposable = (mCompositeDisposable ?: CompositeDisposable()).apply {
-            if (!isDisposed) add(disposable)
-        }
-    }
-
-    override fun delDisposable(disposable: Disposable) {
-        mCompositeDisposable = (mCompositeDisposable ?: CompositeDisposable()).apply {
-            if (!isDisposed) remove(disposable)
-        }
-    }
-
-    override fun clearDisposable() {
-        mCompositeDisposable = mCompositeDisposable?.let {
-            it.clear()
-            null
-        }
-    }
-
-    override fun createItemDecoration(context: Context?): RecyclerView.ItemDecoration? {
-        return context?.let {
-            NoLastLineItemDecoration(it, DividerItemDecoration.VERTICAL).apply {
-                setDrawable(ContextCompat.getDrawable(it, R.drawable.shape_item_divider)!!)
-            }
-        }
-    }
-}

+ 0 - 104
app/src/main/java/com/rc/core/ui/dialog/LoadingDialog.kt

@@ -1,104 +0,0 @@
-package com.rc.core.ui.dialog
-
-import android.app.Dialog
-import android.content.Context
-import android.os.Bundle
-import android.os.Handler
-import android.view.*
-import androidx.fragment.app.DialogFragment
-import androidx.fragment.app.FragmentManager
-import xn.hxp.R
-import xn.hxp.databinding.DialogLoadingBinding
-
-/**
- * info
- *
- * @author ReiChin_
- */
-class LoadingDialog(context: Context, private val message: String? = null) :
-    Dialog(context, R.style.LoadingDialog) {
-
-    fun setMessage(message: String?) {
-        viewBinding.message.visibility = if (message.isNullOrEmpty()) View.GONE else View.VISIBLE
-        viewBinding.message.text = message
-    }
-
-    private val viewBinding: DialogLoadingBinding by lazy {
-        DialogLoadingBinding.inflate(LayoutInflater.from(context))
-    }
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-
-        setContentView(viewBinding.root)
-
-        setMessage(message)
-    }
-
-}
-
-//class LoadingDialog : DialogFragment() {
-//
-//    override fun onCreate(savedInstanceState: Bundle?) {
-//        super.onCreate(savedInstanceState)
-//        setStyle(STYLE_NO_TITLE, R.style.LoadingDialog)
-//    }
-//
-//    private lateinit var mViewBinding: DialogLoadingBinding
-//
-//    override fun onCreateView(
-//        inflater: LayoutInflater,
-//        container: ViewGroup?,
-//        savedInstanceState: Bundle?
-//    ): View {
-//        mViewBinding = DialogLoadingBinding.inflate(inflater, container, false)
-//        return mViewBinding.root
-//    }
-//
-//    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
-//        super.onViewCreated(view, savedInstanceState)
-//
-//        mViewBinding.message.visibility = if (mMessage.isNullOrEmpty()) View.GONE else View.VISIBLE
-//        mViewBinding.message.text = mMessage
-//    }
-//
-//    override fun onStart() {
-//        super.onStart()
-//        initWindowConfig()
-//    }
-//
-//    private fun initWindowConfig() {
-//        dialog?.window?.apply {
-//            setWindowAnimations(R.style.PopWindowAnimStyle)
-//            setGravity(Gravity.CENTER)
-//            attributes.width = WindowManager.LayoutParams.MATCH_PARENT
-//            attributes.height = WindowManager.LayoutParams.WRAP_CONTENT
-//        }
-//    }
-//
-//    private var mMessage: CharSequence? = null
-//
-//    fun setMessage(message: CharSequence?): LoadingDialog {
-//        this.mMessage = message
-//        return this
-//    }
-//
-//    private var addTag = false
-//
-//    fun show(manager: FragmentManager): LoadingDialog {
-//        if (addTag) return this
-//        addTag = true
-//
-//        if (this.isAdded || null != manager.findFragmentByTag(LoadingDialog::class.simpleName)) {
-//            manager.beginTransaction().remove(this).commit()
-//        }
-//        show(manager, LoadingDialog::class.simpleName)
-//
-//        Handler().post {
-//            addTag = false
-//        }
-//
-//        return this
-//    }
-//
-//}

+ 0 - 113
app/src/main/java/com/rc/core/ui/dialog/RcBaseDialog.kt

@@ -1,113 +0,0 @@
-package com.rc.core.ui.dialog
-
-import android.os.Bundle
-import android.view.*
-import androidx.fragment.app.DialogFragment
-import androidx.recyclerview.widget.RecyclerView
-import androidx.viewbinding.ViewBinding
-import xn.hxp.R
-import com.rc.core.ui.common.AbsUIDelegate
-import com.rc.core.ui.common.IUIListener
-import io.reactivex.rxjava3.disposables.Disposable
-
-/**
- * info
- *
- * @author ReiChin_
- */
-abstract class RcBaseDialog<VB : ViewBinding> :
-    DialogFragment(), IUIListener {
-
-    private lateinit var _viewBinding: VB
-
-    protected val viewBinding get() = _viewBinding
-
-    private lateinit var mUIDelegate: AbsUIDelegate
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        mUIDelegate = AbsUIDelegate.create()
-
-        setStyle(STYLE_NO_TITLE, R.style.LoadingDialog)
-    }
-
-    override fun onCreateView(
-        inflater: LayoutInflater,
-        container: ViewGroup?,
-        savedInstanceState: Bundle?
-    ): View? {
-        initWindowConfig()
-        _viewBinding = createViewBinding(inflater, container)
-        return _viewBinding.root
-    }
-
-    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
-        super.onViewCreated(view, savedInstanceState)
-        initViews(savedInstanceState)
-    }
-
-    override fun onResume() {
-        super.onResume()
-        initDialogSize()
-    }
-
-    protected open fun initDialogSize() {
-        dialog?.window?.apply {
-            attributes.width = WindowManager.LayoutParams.MATCH_PARENT
-            attributes.height = WindowManager.LayoutParams.WRAP_CONTENT
-        }
-    }
-
-    protected open fun initWindowConfig() {
-//        dialog?.window?.apply {
-//            setWindowAnimations(R.style.BottomDialog_Animation)
-//            setGravity(Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL)
-//        }
-//
-//        dialog?.window?.apply {
-//            attributes.gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL
-//            attributes.windowAnimations = R.style.BottomDialog_Animation
-//            requestFeature(Window.FEATURE_NO_TITLE)
-//            setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
-//        }
-//        dialog?.setCanceledOnTouchOutside(true)
-    }
-
-    protected abstract fun createViewBinding(
-        inflater: LayoutInflater,
-        container: ViewGroup?
-    ): VB
-
-    protected abstract fun initViews(savedInstanceState: Bundle?)
-
-    override fun showLoading(message: String?, cancelable: Boolean) {
-//        mUIDelegate.showLoading(requireContext(), message, cancelable)
-        mUIDelegate.showLoading(requireActivity(), message, cancelable)
-    }
-
-    override fun dismissLoading() {
-        mUIDelegate.dismissLoading()
-    }
-
-    override fun showToast(message: String) {
-        mUIDelegate.showToast(context, message)
-    }
-
-    override fun showNetError(throwable: Throwable) {
-        mUIDelegate.showNetError(context, throwable)
-    }
-
-    override fun addDisposable(disposable: Disposable) {
-        mUIDelegate.addDisposable(disposable)
-    }
-
-    override fun onDestroyView() {
-        mUIDelegate.clearDisposable()
-        super.onDestroyView()
-    }
-
-    override fun createItemDecoration(): RecyclerView.ItemDecoration? {
-        return mUIDelegate.createItemDecoration(context)
-    }
-
-}

+ 92 - 0
app/src/main/java/com/rc/core/ui/fragment/BaseFragment.java

@@ -0,0 +1,92 @@
+package com.rc.core.ui.fragment;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.viewbinding.ViewBinding;
+
+import io.reactivex.rxjava3.disposables.CompositeDisposable;
+import io.reactivex.rxjava3.disposables.Disposable;
+
+public abstract class BaseFragment extends Fragment {
+
+    protected CompositeDisposable compositeDisposable = new CompositeDisposable();
+    protected BaseFragmentHelp baseFragmentHelp;
+
+    @Override
+    public void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+    }
+
+    @Nullable
+    @Override
+    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+        return setViewBinding(inflater,container).getRoot();
+    }
+
+    @Override
+    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
+        baseFragmentHelp = new BaseFragmentHelp(this);
+        onInit();
+    }
+
+    protected abstract ViewBinding setViewBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup container);
+
+    protected abstract void onInit();
+
+    protected void showLoading(String msg) {
+        if (null != baseFragmentHelp) {
+            baseFragmentHelp.showLoading(msg);
+        }
+    }
+
+    protected void dismissLoading() {
+        if (null != baseFragmentHelp) {
+            baseFragmentHelp.dismissLoading();
+        }
+
+    }
+
+    protected void showToast(String msg) {
+        if (null != baseFragmentHelp) {
+            baseFragmentHelp.showToast(msg);
+        }
+
+    }
+
+    protected void showNetError(Throwable throwable) {
+        if (null != baseFragmentHelp) {
+            baseFragmentHelp.showNetError(throwable);
+        }
+
+    }
+
+    protected void addDisposable(Disposable disposable) {
+        if (null != baseFragmentHelp) {
+            baseFragmentHelp.addDisposable(disposable);
+        }
+
+    }
+
+    protected void delDisposable(Disposable disposable) {
+        if (null != baseFragmentHelp) {
+            baseFragmentHelp.delDisposable(disposable);
+        }
+
+    }
+
+    @Override
+    public void onDestroyView() {
+        if (null != baseFragmentHelp) {
+            baseFragmentHelp.onDestroy();
+            baseFragmentHelp = null;
+        }
+        super.onDestroyView();
+    }
+}

+ 94 - 0
app/src/main/java/com/rc/core/ui/fragment/BaseFragmentHelp.java

@@ -0,0 +1,94 @@
+package com.rc.core.ui.fragment;
+
+import android.text.TextUtils;
+import android.widget.Toast;
+
+import com.blankj.utilcode.util.ActivityUtils;
+import com.blankj.utilcode.util.ThreadUtils;
+import com.kongzue.dialogx.DialogX;
+import com.kongzue.dialogx.dialogs.WaitDialog;
+import com.rc.httpcore.exception.NetException;
+
+import java.net.ConnectException;
+import java.net.SocketTimeoutException;
+import java.util.concurrent.TimeUnit;
+
+import io.reactivex.rxjava3.disposables.Disposable;
+import retrofit2.HttpException;
+
+public class BaseFragmentHelp {
+    private BaseFragment baseFragment;
+    private ThreadUtils.SimpleTask<Object> cdDismissTask;
+
+    public BaseFragmentHelp(BaseFragment baseFragment) {
+        this.baseFragment = baseFragment;
+    }
+
+    public void onDestroy() {
+
+    }
+
+    public void showLoading(String msg) {
+        ThreadUtils.cancel(cdDismissTask);
+        WaitDialog.show(msg).setEnterAnimDuration(0).setExitAnimDuration(0).setCancelable(DialogX.cancelable);
+        ThreadUtils.executeByCachedWithDelay(cdDismissTask = new ThreadUtils.SimpleTask<Object>() {
+            @Override
+            public Object doInBackground() throws Throwable {
+                return null;
+            }
+
+            @Override
+            public void onSuccess(Object result) {
+                WaitDialog.dismiss();
+            }
+        }, 30, TimeUnit.SECONDS);
+    }
+
+    public void dismissLoading() {
+        ThreadUtils.cancel(cdDismissTask);
+        WaitDialog.dismiss();
+    }
+
+    public void showToast(String msg) {
+        Toast.makeText(ActivityUtils.getTopActivity(), msg, Toast.LENGTH_SHORT).show();
+    }
+
+    public void showNetError(Throwable throwable) {
+        String message = "";
+        if (throwable instanceof NetException) {
+            message = throwable.getMessage();
+            if (!TextUtils.isEmpty(message)) {
+                message = "接口请求失败(" + ((NetException) throwable).getCode() + ")";
+            }
+        } else if (throwable instanceof SocketTimeoutException) {
+            message = "请求超时,请稍后重试";
+        } else if (throwable instanceof ConnectException) {
+            message = "无法连接服务器,请检查网络";
+        } else if (throwable instanceof HttpException) {
+            message = "服务器繁忙,请稍后重试";
+        } else {
+            if (!TextUtils.isEmpty(message)) {
+                message = throwable.getMessage();
+            }
+        }
+        showToast(message);
+    }
+
+    public void addDisposable(Disposable disposable) {
+        if (null != baseFragment.compositeDisposable && disposable != null && !baseFragment.compositeDisposable.isDisposed()) {
+            baseFragment.compositeDisposable.add(disposable);
+        }
+    }
+
+    public void delDisposable(Disposable disposable) {
+        if (null != baseFragment.compositeDisposable && disposable != null) {
+            baseFragment.compositeDisposable.delete(disposable);
+        }
+    }
+
+    public void clearDisposable() {
+        if (null != baseFragment.compositeDisposable) {
+            baseFragment.compositeDisposable.dispose();
+        }
+    }
+}

+ 0 - 88
app/src/main/java/com/rc/core/ui/fragment/RcBaseFragment.kt

@@ -1,88 +0,0 @@
-package com.rc.core.ui.fragment
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.fragment.app.Fragment
-import androidx.recyclerview.widget.RecyclerView
-import androidx.viewbinding.ViewBinding
-import com.rc.core.ui.common.AbsUIDelegate
-import com.rc.core.ui.common.IUIListener
-import io.reactivex.rxjava3.disposables.Disposable
-
-/**
- * info
- *
- * @author ReiChin_
- */
-abstract class RcBaseFragment<VB : ViewBinding> :
-    Fragment(), IUIListener {
-
-    private lateinit var _viewBinding: VB
-
-    protected val viewBinding get() = _viewBinding
-
-    private lateinit var mUIDelegate: AbsUIDelegate
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        mUIDelegate = AbsUIDelegate.create()
-    }
-
-    override fun onCreateView(
-        inflater: LayoutInflater,
-        container: ViewGroup?,
-        savedInstanceState: Bundle?
-    ): View? {
-        _viewBinding = createViewBinding(inflater, container)
-        return _viewBinding.root
-    }
-
-    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
-        super.onViewCreated(view, savedInstanceState)
-        initViews(savedInstanceState)
-    }
-
-    protected abstract fun createViewBinding(
-        inflater: LayoutInflater,
-        container: ViewGroup?
-    ): VB
-
-    protected abstract fun initViews(savedInstanceState: Bundle?)
-
-    override fun showLoading(message: String?, cancelable: Boolean) {
-//        mUIDelegate.showLoading(requireContext(), message, cancelable)
-        mUIDelegate.showLoading(requireActivity(), message, cancelable)
-    }
-
-    override fun dismissLoading() {
-        mUIDelegate.dismissLoading()
-    }
-
-    override fun showToast(message: String) {
-        mUIDelegate.showToast(context, message)
-    }
-
-    override fun showNetError(throwable: Throwable) {
-        mUIDelegate.showNetError(context, throwable)
-    }
-
-    override fun addDisposable(disposable: Disposable) {
-        mUIDelegate.addDisposable(disposable)
-    }
-
-    override fun delDisposable(disposable: Disposable) {
-        mUIDelegate.delDisposable(disposable)
-    }
-
-    override fun onDestroyView() {
-        mUIDelegate.clearDisposable()
-        super.onDestroyView()
-    }
-
-    override fun createItemDecoration(): RecyclerView.ItemDecoration? {
-        return mUIDelegate.createItemDecoration(context)
-    }
-
-}

+ 0 - 37
app/src/main/java/com/rc/core/ui/fragment/RcLazyFragment.kt

@@ -1,37 +0,0 @@
-package com.rc.core.ui.fragment
-
-import androidx.viewbinding.ViewBinding
-
-/**
- * 懒加载
- *
- * @author ReiChin_
- */
-abstract class RcLazyFragment<VB : ViewBinding> : RcBaseFragment<VB>() {
-
-    override fun onResume() {
-        super.onResume()
-        lazyLoad()
-    }
-
-    private fun lazyLoad() {
-        if (!loadDateCompleted()) {
-            onLoadData()
-        }
-    }
-
-    /**
-     * 加载数据
-     */
-    protected abstract fun onLoadData()
-
-    /**
-     * 数据是否加载完毕,子类可覆写此方法,根据需要返回。
-     * 1) false,每次画面可见时,都会回调[.onLoadData]。
-     * 2) true,每次画面可见时,不会回调[.onLoadData]。
-     *
-     * @return 数据是否加载完成。
-     */
-    protected open fun loadDateCompleted() = false
-
-}

+ 0 - 225
app/src/main/java/com/rc/core/ui/fragment/RcRefreshFragment.kt

@@ -1,225 +0,0 @@
-package com.rc.core.ui.fragment
-
-import android.os.Bundle
-import android.view.View
-import androidx.recyclerview.widget.LinearLayoutManager
-import androidx.recyclerview.widget.RecyclerView
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
-import androidx.viewbinding.ViewBinding
-import com.chad.library.adapter.base.BaseQuickAdapter
-import com.chad.library.adapter.base.listener.OnItemChildClickListener
-import com.chad.library.adapter.base.listener.OnItemClickListener
-import com.chad.library.adapter.base.listener.OnLoadMoreListener
-import com.chad.library.adapter.base.viewholder.BaseViewHolder
-import com.rc.core.event.RefreshEvent
-import com.rc.core.ui.widget.MultipleStatusView
-import com.rc.core.util.net.NetConnectedListener
-import com.rc.core.util.net.NetWatchdog
-import io.reactivex.rxjava3.disposables.Disposable
-import org.greenrobot.eventbus.EventBus
-import org.greenrobot.eventbus.Subscribe
-import org.greenrobot.eventbus.ThreadMode
-
-/**
- * info
- *
- * @author ReiChin_
- */
-abstract class RcRefreshFragment<T, VB : ViewBinding>
-constructor(val mAdapter: BaseQuickAdapter<T, BaseViewHolder>) : RcLazyFragment<VB>(),
-    OnLoadMoreListener,
-    OnItemClickListener,
-    OnItemChildClickListener {
-
-    companion object {
-        protected const val FIRST_PAGE = 1
-        protected const val PAGE_SIZE = 15
-    }
-
-    protected abstract val mMultipleStatusView: MultipleStatusView?
-    protected abstract val mSrlRefresh: SwipeRefreshLayout
-    protected abstract val mRvContent: RecyclerView
-
-    protected var mCurrentPage = FIRST_PAGE
-    protected var mRefresh = false
-
-    private val mNetWatchdog: NetWatchdog by lazy { NetWatchdog(requireContext()) }
-    private var mLoadingData = false
-
-    override fun initViews(savedInstanceState: Bundle?) {
-        initNetWatchdog()
-        initSwipeRecyclerView()
-    }
-
-    private fun initSwipeRecyclerView() {
-        mMultipleStatusView?.setOnRetryClickListener { loadData(true) }
-        mSrlRefresh.setOnRefreshListener { loadData(true) }
-
-        mAdapter.setOnItemClickListener(this)
-        mAdapter.setOnItemChildClickListener(this)
-
-        mRvContent.layoutManager = LinearLayoutManager(context)
-//        mAdapter.loadMoreModule.loadMoreView = ItLoadMoreView()
-        mAdapter.loadMoreModule.setOnLoadMoreListener(this)
-        mAdapter.loadMoreModule.isAutoLoadMore = true
-        // 当自动加载开启,同时数据不满一屏时,是否继续执行自动加载更多(默认为true)
-        mAdapter.loadMoreModule.isEnableLoadMoreIfNotFullPage = true
-        mAdapter.animationEnable = true
-        mAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInBottom)
-
-        createItemDecoration()?.let {
-            mRvContent.addItemDecoration(it)
-        }
-
-        mRvContent.adapter = mAdapter
-    }
-
-    /**
-     * 初始化网络监听
-     */
-    private fun initNetWatchdog() {
-        mNetWatchdog.startWatch()
-        mNetWatchdog.setNetConnectedListener(object : NetConnectedListener {
-            override fun onReNetConnected(isReconnect: Boolean) {
-                mMultipleStatusView?.let {
-                    if (isReconnect) {
-                        it.showContent()
-                    }
-                }
-                if (mAdapter.data.isEmpty() && !mLoadingData && isReconnect) {
-                    loadData(true)
-                }
-            }
-
-            override fun onNetUnConnected() {
-                if (mAdapter.data.isEmpty()) {
-                    mMultipleStatusView?.showNoNetwork()
-                }
-            }
-        })
-    }
-
-    override fun onDestroyView() {
-        mNetWatchdog.stopWatch()
-        super.onDestroyView()
-    }
-
-    protected fun loadData(refresh: Boolean) {
-        mLoadingData = true
-        if (refresh) {
-            mCurrentPage = FIRST_PAGE
-        }
-        mRefresh = refresh
-        showLoadingView()
-        val disposable = queryData()
-        addDisposable(disposable)
-    }
-
-    abstract fun queryData(): Disposable
-
-    override fun onLoadData() {
-        loadData(true)
-    }
-
-    override fun onLoadMore() {
-        val dataSize = mAdapter.data.size
-        if (dataSize < PAGE_SIZE) {
-            mAdapter.loadMoreModule.loadMoreEnd(false)
-        } else {
-            if (dataSize % PAGE_SIZE != 0) {
-                mAdapter.loadMoreModule.loadMoreEnd(false)
-            } else {
-                mCurrentPage++
-                loadData(false)
-            }
-        }
-    }
-
-    /**
-     * 数据加载成功的处理逻辑
-     *
-     * @param data 从服务端查询的数据
-     */
-    protected open fun dispatchLoadDataSuccess(data: List<T>?) {
-        mLoadingData = false
-        if (isDetached) return
-
-        mMultipleStatusView?.showContent()
-        if (mRefresh) {
-            if (null == data || data.isEmpty()) {
-                mMultipleStatusView?.showEmpty()
-            }
-            mAdapter.setNewInstance(data?.toMutableList())
-            mAdapter.loadMoreModule.loadMoreComplete()
-            if (null == data || data.size < PAGE_SIZE) {
-                mAdapter.loadMoreModule.loadMoreEnd(goneLoadMoreView())
-            }
-            mSrlRefresh.isRefreshing = false
-        } else {
-            if (null == data || data.size < PAGE_SIZE) {
-                if (null != data) {
-                    mAdapter.addData(data)
-                }
-                mAdapter.loadMoreModule.loadMoreEnd(goneLoadMoreView())
-            } else {
-                mAdapter.addData(data)
-                mAdapter.loadMoreModule.loadMoreComplete()
-            }
-        }
-    }
-
-    /**
-     * 数据加载失败的处理逻辑
-     */
-    protected open fun dispatchLoadDataFailure() {
-        mLoadingData = false
-        if (isDetached) return
-
-        if (mRefresh) {
-            mMultipleStatusView?.showError()
-            mSrlRefresh.isRefreshing = false
-        } else {
-            mCurrentPage = if (mCurrentPage-- < FIRST_PAGE) FIRST_PAGE else mCurrentPage
-            mAdapter.loadMoreModule.loadMoreEnd(goneLoadMoreView())
-        }
-    }
-
-    protected open fun goneLoadMoreView() = false
-
-    private fun showLoadingView() {
-        mMultipleStatusView?.let {
-            if (mRefresh) {
-                it.showLoading()
-            }
-        }
-    }
-
-    override fun loadDateCompleted() = mAdapter.data.isNotEmpty()
-
-    override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
-    }
-
-    override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
-    }
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        EventBus.getDefault().register(this)
-    }
-
-    override fun onDestroy() {
-        super.onDestroy()
-        EventBus.getDefault().unregister(this)
-    }
-
-    @Subscribe(threadMode = ThreadMode.MAIN)
-    fun onMessageEvent(event: RefreshEvent) {
-        if (event.refresh) {
-            dispatchRefreshEvent(event)
-        }
-    }
-
-    protected open fun dispatchRefreshEvent(event: RefreshEvent) {
-    }
-
-}

+ 0 - 301
app/src/main/java/com/rc/core/ui/widget/MultipleStatusView.kt

@@ -1,301 +0,0 @@
-package com.rc.core.ui.widget
-
-import android.content.Context
-import android.content.res.TypedArray
-import android.util.AttributeSet
-import android.view.View
-import android.view.ViewGroup
-import android.widget.RelativeLayout
-import androidx.annotation.LayoutRes
-import xn.hxp.R
-
-/**
- * info
- *
- * @author ReiChin_
- */
-class MultipleStatusView @JvmOverloads constructor(
-    context: Context,
-    attrs: AttributeSet? = null,
-    defStyleAttr: Int = 0
-) :
-    RelativeLayout(context, attrs, defStyleAttr) {
-
-    companion object {
-        private const val STATUS_CONTENT = 0x00
-        private const val STATUS_LOADING = 0x01
-        private const val STATUS_EMPTY = 0x02
-        private const val STATUS_ERROR = 0x03
-        private const val STATUS_NO_NETWORK = 0x04
-
-        private val DEFAULT_LAYOUT_PARAMS =
-            LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
-
-        private const val NULL_RESOURCE_ID = -1
-    }
-
-    private var mEmptyView: View? = null
-    private var mErrorView: View? = null
-    private var mLoadingView: View? = null
-    private var mNoNetworkView: View? = null
-    private var mContentView: View? = null
-    private var mEmptyViewResId = NULL_RESOURCE_ID
-    private var mErrorViewResId = NULL_RESOURCE_ID
-    private var mLoadingViewResId = NULL_RESOURCE_ID
-    private var mNoNetworkViewResId = NULL_RESOURCE_ID
-    private var mContentViewResId = NULL_RESOURCE_ID
-
-    private var mViewStatus = -1
-
-    private val mOtherIds = ArrayList<Int>()
-
-    init {
-        val a: TypedArray =
-            context.obtainStyledAttributes(attrs, R.styleable.MultipleStatusView, defStyleAttr, 0)
-        mEmptyViewResId = a.getResourceId(
-            R.styleable.MultipleStatusView_emptyView,
-            R.layout.view_multiple_empty_view
-        )
-        mErrorViewResId = a.getResourceId(
-            R.styleable.MultipleStatusView_errorView,
-            R.layout.view_multiple_error_view
-        )
-        mLoadingViewResId = a.getResourceId(
-            R.styleable.MultipleStatusView_loadingView,
-            R.layout.view_multiple_loading_view
-        )
-        mNoNetworkViewResId = a.getResourceId(
-            R.styleable.MultipleStatusView_noNetworkView,
-            R.layout.view_multiple_no_network_view
-        )
-        mContentViewResId =
-            a.getResourceId(R.styleable.MultipleStatusView_contentView, NULL_RESOURCE_ID)
-        a.recycle()
-    }
-
-    override fun onFinishInflate() {
-        super.onFinishInflate()
-        showContent()
-    }
-
-    override fun onDetachedFromWindow() {
-        super.onDetachedFromWindow()
-        clear(mEmptyView, mLoadingView, mErrorView, mNoNetworkView)
-        if (mOtherIds.isNotEmpty()) {
-            mOtherIds.clear()
-        }
-        if (null != mOnRetryClickListener) {
-            mOnRetryClickListener = null
-        }
-        if (null != mViewStatusListener) {
-            mViewStatusListener = null
-        }
-    }
-
-    /**
-     * 获取当前状态
-     *
-     * @return 视图状态
-     */
-    fun getViewStatus() = mViewStatus
-
-    private var mOnRetryClickListener: ((view: View) -> Unit)? = null
-
-    /**
-     * 设置重试点击事件
-     *
-     * @param listener 重试点击事件
-     */
-    fun setOnRetryClickListener(listener: (view: View) -> Unit) {
-        this.mOnRetryClickListener = listener
-    }
-
-    /**
-     * 显示空视图
-     *
-     * @param view         自定义视图
-     * @param layoutParams 布局参数
-     */
-    fun showEmpty(
-        @LayoutRes layoutId: Int = mEmptyViewResId,
-        view: View = mEmptyView ?: View.inflate(context, layoutId, null),
-        layoutParams: ViewGroup.LayoutParams = DEFAULT_LAYOUT_PARAMS
-    ) {
-        changeViewStatus(STATUS_EMPTY)
-        if (null == mEmptyView) {
-            mEmptyView = view
-            val emptyRetryView: View? = mEmptyView!!.findViewById(R.id.empty_retry_view)
-            if (null != mOnRetryClickListener && null != emptyRetryView) {
-                emptyRetryView.setOnClickListener(mOnRetryClickListener)
-            }
-            mOtherIds.add(mEmptyView!!.id)
-            addView(mEmptyView, 0, layoutParams)
-        }
-        showViewById(mEmptyView!!.id)
-    }
-
-    /**
-     * 显示错误视图
-     *
-     * @param view         自定义视图
-     * @param layoutParams 布局参数
-     */
-    fun showError(
-        @LayoutRes layoutId: Int = mErrorViewResId,
-        view: View = mErrorView ?: View.inflate(context, layoutId, null),
-        layoutParams: ViewGroup.LayoutParams = DEFAULT_LAYOUT_PARAMS
-    ) {
-        changeViewStatus(STATUS_ERROR)
-        if (null == mErrorView) {
-            mErrorView = view
-            val errorRetryView: View? = mErrorView!!.findViewById(R.id.error_retry_view)
-            if (null != mOnRetryClickListener && null != errorRetryView) {
-                errorRetryView.setOnClickListener(mOnRetryClickListener)
-            }
-            mOtherIds.add(mErrorView!!.id)
-            addView(mErrorView, 0, layoutParams)
-        }
-        showViewById(mErrorView!!.id)
-    }
-
-    /**
-     * 显示加载中视图
-     *
-     * @param view         自定义视图
-     * @param layoutParams 布局参数
-     */
-    fun showLoading(
-        @LayoutRes layoutId: Int = mLoadingViewResId,
-        view: View = mLoadingView ?: View.inflate(context, layoutId, null),
-        layoutParams: ViewGroup.LayoutParams = DEFAULT_LAYOUT_PARAMS
-    ) {
-        changeViewStatus(STATUS_LOADING)
-        if (null == mLoadingView) {
-            mLoadingView = view
-            mOtherIds.add(mLoadingView!!.id)
-            addView(mLoadingView, 0, layoutParams)
-        }
-        showViewById(mLoadingView!!.id)
-    }
-
-    /**
-     * 显示无网络视图
-     *
-     * @param view         自定义视图
-     * @param layoutParams 布局参数
-     */
-    fun showNoNetwork(
-        @LayoutRes layoutId: Int = mNoNetworkViewResId,
-        view: View = mNoNetworkView ?: View.inflate(context, layoutId, null),
-        layoutParams: ViewGroup.LayoutParams = DEFAULT_LAYOUT_PARAMS
-    ) {
-        changeViewStatus(STATUS_NO_NETWORK)
-        if (null == mNoNetworkView) {
-            mNoNetworkView = view
-            val noNetworkRetryView: View? =
-                mNoNetworkView!!.findViewById(R.id.no_network_retry_view)
-            if (null != mOnRetryClickListener && null != noNetworkRetryView) {
-                noNetworkRetryView.setOnClickListener(mOnRetryClickListener)
-            }
-            mOtherIds.add(mNoNetworkView!!.id)
-            addView(mNoNetworkView, 0, layoutParams)
-        }
-        showViewById(mNoNetworkView!!.id)
-    }
-
-    /**
-     * 显示内容视图
-     *
-     * @param view         自定义视图
-     * @param layoutParams 布局参数
-     */
-    fun showContent(
-        @LayoutRes layoutId: Int = mContentViewResId,
-        view: View? = mContentView,
-        layoutParams: ViewGroup.LayoutParams = DEFAULT_LAYOUT_PARAMS
-    ) {
-        // ?: View.inflate(context, layoutId, null)
-
-        changeViewStatus(STATUS_CONTENT)
-
-        if (null == mContentView) {
-            if (NULL_RESOURCE_ID != layoutId) {
-                mContentView = View.inflate(context, layoutId, null)
-                addView(mContentView, 0, layoutParams)
-            } else {
-                showContentView()
-                return
-            }
-        }
-
-
-//        if (NULL_RESOURCE_ID == layoutId && null == mContentView) {
-////            mContentView = View.inflate(context, layoutId, null)
-////            addView(mContentView, 0, layoutParams)
-//        }
-
-
-//        if (NULL_RESOURCE_ID == layoutId && mContentView == null) {
-//            showContentView()
-//        } else {
-        clear(mContentView)
-        mContentView = view
-        addView(mContentView, 0, layoutParams)
-        showViewById(mContentView!!.id)
-//        }
-    }
-
-    private fun showViewById(viewId: Int) {
-        for (i in 0 until childCount) {
-            val view = getChildAt(i)
-            view.visibility = if (view.id == viewId) View.VISIBLE else View.GONE
-        }
-    }
-
-    private fun showContentView() {
-        for (i in 0 until childCount) {
-            val view = getChildAt(i)
-            view.visibility = if (mOtherIds.contains(view.id)) View.GONE else View.VISIBLE
-        }
-    }
-
-    private fun checkNull(obj: Any?, hint: String) {
-        if (null == obj) {
-            throw NullPointerException(hint)
-        }
-    }
-
-    private fun clear(vararg views: View?) {
-        try {
-            for (view in views) {
-                view?.let { removeView(it) }
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }
-    }
-
-    // 视图状态改变接口
-    private var mViewStatusListener: ((oldViewStatus: Int, newViewStatus: Int) -> Unit)? = null
-
-    /**
-     * 设置视图状态改变监听事件
-     */
-    fun setOnViewStatusChangeListener(listener: (oldViewStatus: Int, newViewStatus: Int) -> Unit) {
-        this.mViewStatusListener = listener
-    }
-
-    /**
-     * 改变视图状态
-     *
-     * @param newViewStatus 新的视图状态
-     */
-    private fun changeViewStatus(newViewStatus: Int) {
-        if (mViewStatus == newViewStatus) {
-            return
-        }
-        mViewStatusListener?.invoke(mViewStatus, newViewStatus)
-        mViewStatus = newViewStatus
-    }
-
-}

+ 0 - 53
app/src/main/java/com/rc/core/ui/widget/decoration/GridSpacingItemDecoration.java

@@ -1,53 +0,0 @@
-package com.rc.core.ui.widget.decoration;
-
-import android.graphics.Rect;
-import android.view.View;
-
-import androidx.recyclerview.widget.RecyclerView;
-
-/**
- * FileName: GridSpacingItemDecoration
- * Description:
- */
-public class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
-
-    private final int spanCount; //列数
-    private final int horizontalSpacing; // 水平间隔
-    private final int verticalSpacing; // 垂直间隔
-    private final boolean includeEdge; //是否包含边缘
-
-    public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
-        this(spanCount, spacing, spacing, includeEdge);
-    }
-
-    public GridSpacingItemDecoration(int spanCount, int horizontalSpacing, int verticalSpacing, boolean includeEdge) {
-        this.spanCount = spanCount;
-        this.horizontalSpacing = horizontalSpacing;
-        this.verticalSpacing = verticalSpacing;
-        this.includeEdge = includeEdge;
-    }
-
-    @Override
-    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
-
-        //这里是关键,需要根据你有几列来判断
-        int position = parent.getChildAdapterPosition(view); // item position
-        int column = position % spanCount; // item column
-
-        if (includeEdge) {
-            outRect.left = horizontalSpacing - column * horizontalSpacing / spanCount; // spacing - column * ((1f / spanCount) * spacing)
-            outRect.right = (column + 1) * horizontalSpacing / spanCount; // (column + 1) * ((1f / spanCount) * spacing)
-
-            if (position < spanCount) { // top edge
-                outRect.top = verticalSpacing;
-            }
-            outRect.bottom = verticalSpacing; // item bottom
-        } else {
-            outRect.left = column * horizontalSpacing / spanCount; // column * ((1f / spanCount) * spacing)
-            outRect.right = horizontalSpacing - (column + 1) * horizontalSpacing / spanCount; // spacing - (column + 1) * ((1f /    spanCount) * spacing)
-            if (position >= spanCount) {
-                outRect.top = verticalSpacing; // item top
-            }
-        }
-    }
-}

+ 0 - 148
app/src/main/java/com/rc/core/ui/widget/decoration/NoLastLineItemDecoration.java

@@ -1,148 +0,0 @@
-package com.rc.core.ui.widget.decoration;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.util.Log;
-import android.view.View;
-import android.widget.LinearLayout;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-
-public class NoLastLineItemDecoration extends RecyclerView.ItemDecoration {
-    public static final int HORIZONTAL = LinearLayout.HORIZONTAL;
-    public static final int VERTICAL = LinearLayout.VERTICAL;
-
-    private static final String TAG = "DividerItem";
-    private static final int[] ATTRS = new int[]{android.R.attr.listDivider};
-
-    private Drawable mDivider;
-
-    /**
-     * Current orientation. Either {@link #HORIZONTAL} or {@link #VERTICAL}.
-     */
-    private int mOrientation;
-
-    private final Rect mBounds = new Rect();
-
-    public NoLastLineItemDecoration(Context context, int orientation) {
-        final TypedArray a = context.obtainStyledAttributes(ATTRS);
-        mDivider = a.getDrawable(0);
-        if (mDivider == null) {
-            Log.w(TAG, "@android:attr/listDivider was not set in the theme used for this "
-                    + "DividerItemDecoration. Please set that attribute all call setDrawable()");
-        }
-        a.recycle();
-        setOrientation(orientation);
-    }
-
-    /**
-     * Sets the orientation for this divider. This should be called if
-     * {@link RecyclerView.LayoutManager} changes orientation.
-     *
-     * @param orientation {@link #HORIZONTAL} or {@link #VERTICAL}
-     */
-    public void setOrientation(int orientation) {
-        if (orientation != HORIZONTAL && orientation != VERTICAL) {
-            throw new IllegalArgumentException(
-                    "Invalid orientation. It should be either HORIZONTAL or VERTICAL");
-        }
-        mOrientation = orientation;
-    }
-
-    /**
-     * Sets the {@link Drawable} for this divider.
-     *
-     * @param drawable Drawable that should be used as a divider.
-     */
-    public void setDrawable(@NonNull Drawable drawable) {
-        if (drawable == null) {
-            throw new IllegalArgumentException("Drawable cannot be null.");
-        }
-        mDivider = drawable;
-    }
-
-    @Override
-    public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
-        if (parent.getLayoutManager() == null || mDivider == null) {
-            return;
-        }
-        if (mOrientation == VERTICAL) {
-            drawVertical(c, parent);
-        } else {
-            drawHorizontal(c, parent);
-        }
-    }
-
-    private void drawVertical(Canvas canvas, RecyclerView parent) {
-        canvas.save();
-        final int left;
-        final int right;
-        //noinspection AndroidLintNewApi - NewApi lint fails to handle overrides.
-        if (parent.getClipToPadding()) {
-            left = parent.getPaddingLeft();
-            right = parent.getWidth() - parent.getPaddingRight();
-            canvas.clipRect(left, parent.getPaddingTop(), right,
-                    parent.getHeight() - parent.getPaddingBottom());
-        } else {
-            left = 0;
-            right = parent.getWidth();
-        }
-
-        final int childCount = parent.getChildCount();
-        for (int i = 0; i < childCount - 1; i++) {
-            final View child = parent.getChildAt(i);
-            parent.getDecoratedBoundsWithMargins(child, mBounds);
-            final int bottom = mBounds.bottom + Math.round(child.getTranslationY());
-            final int top = bottom - mDivider.getIntrinsicHeight();
-            mDivider.setBounds(left, top, right, bottom);
-            mDivider.draw(canvas);
-        }
-        canvas.restore();
-    }
-
-    private void drawHorizontal(Canvas canvas, RecyclerView parent) {
-        canvas.save();
-        final int top;
-        final int bottom;
-        //noinspection AndroidLintNewApi - NewApi lint fails to handle overrides.
-        if (parent.getClipToPadding()) {
-            top = parent.getPaddingTop();
-            bottom = parent.getHeight() - parent.getPaddingBottom();
-            canvas.clipRect(parent.getPaddingLeft(), top,
-                    parent.getWidth() - parent.getPaddingRight(), bottom);
-        } else {
-            top = 0;
-            bottom = parent.getHeight();
-        }
-
-        final int childCount = parent.getChildCount();
-        for (int i = 0; i < childCount - 1; i++) {
-            final View child = parent.getChildAt(i);
-            parent.getLayoutManager().getDecoratedBoundsWithMargins(child, mBounds);
-            final int right = mBounds.right + Math.round(child.getTranslationX());
-            final int left = right - mDivider.getIntrinsicWidth();
-            mDivider.setBounds(left, top, right, bottom);
-            mDivider.draw(canvas);
-        }
-        canvas.restore();
-    }
-
-    @Override
-    public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
-                               RecyclerView.State state) {
-        if (mDivider == null) {
-            outRect.set(0, 0, 0, 0);
-            return;
-        }
-        if (mOrientation == VERTICAL) {
-            outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
-        } else {
-            outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
-        }
-    }
-}
-

+ 0 - 195
app/src/main/java/com/rc/core/util/ApkController.kt

@@ -1,195 +0,0 @@
-package com.rc.core.util
-
-import android.content.ComponentName
-import android.content.Context
-import android.content.Intent
-import android.net.Uri
-import android.os.Build
-import android.os.Process
-import androidx.core.content.FileProvider
-import com.rc.core.ui.ActivityCollector
-import java.io.*
-import java.nio.charset.Charset
-import kotlin.system.exitProcess
-
-/**
- * info
- *
- * @author ReiChin_
- */
-object ApkController {
-
-    fun installAPK(
-        apkFile: File,
-        appContext: Context,
-        applicationId: String
-    ) {
-        if (isRootPermission()) {
-            install(apkFile.path)
-//            startApp("com.dlc.chemical", "com.dlc.chemical.ui.SplashActivity")
-            startApp(appContext, "com.dlc.chemical", "com.dlc.chemical.ui.SplashActivity")
-            // silentInstall(appContext, apkFile.path)
-        } else {
-            installOnTask(apkFile, appContext, applicationId)
-        }
-    }
-
-    /**
-     * 判定app是否获取root权限
-     */
-    fun isRootPermission(): Boolean {
-        try {
-            val process = Runtime.getRuntime().exec("su")
-            val os = DataOutputStream(process.outputStream)
-            os.writeBytes("ls /data/data/\n")
-            os.writeBytes("exit\n")
-            os.flush()
-            val reader = BufferedReader(InputStreamReader(process.inputStream))
-            val builder = StringBuilder()
-            var line: String? = null
-            while (reader.readLine().also { line = it } != null) {
-                builder.append(line)
-                builder.append(System.getProperty("line.separator"))
-            }
-            val result = builder.toString()
-            if (result.contains("com.android.phone")) {
-                return true
-            }
-        } catch (e: IOException) {
-            return false
-        }
-        return false
-    }
-
-    /**
-     * 安装apk
-     */
-    fun install(apkPath: String): Boolean {
-        var result = false
-        var dataOutputStream: DataOutputStream? = null
-        var errorStream: BufferedReader? = null
-        try {
-            val process = Runtime.getRuntime().exec("su")
-            dataOutputStream = DataOutputStream(process.outputStream)
-            val command = "pm install -r $apkPath\n"
-            dataOutputStream.write(command.toByteArray(Charset.forName("utf-8")))
-            dataOutputStream.flush()
-            dataOutputStream.writeBytes("exit\n")
-            dataOutputStream.flush()
-            process.waitFor()
-            errorStream = BufferedReader(InputStreamReader(process.errorStream))
-            var msg = ""
-            var line: String
-            while (errorStream.readLine().also { line = it } != null) {
-                msg += line
-            }
-            if (!msg.contains("Failure")) {
-                result = true
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        } finally {
-            try {
-                dataOutputStream?.close()
-                errorStream?.close()
-            } catch (e: IOException) {
-            }
-        }
-        return result
-    }
-
-    fun startApp(appContext: Context, pkg: String, cls: String) {
-        val intent = Intent.makeRestartActivityTask(ComponentName(pkg, cls))
-        appContext.startActivity(intent)
-        exitProcess(0)
-    }
-
-    /**
-     * 启动app
-     */
-    fun startApp(packageName: String, activityName: String): Boolean {
-        var result = false
-        var dataOutputStream: DataOutputStream? = null
-        var errorStream: BufferedReader? = null
-        try {
-            val process = Runtime.getRuntime().exec("su")
-            dataOutputStream = DataOutputStream(process.outputStream)
-            val command = "sleep 120; am start -n $packageName/$activityName\n"
-            dataOutputStream.write(command.toByteArray(Charset.forName("utf-8")))
-            dataOutputStream.flush()
-            dataOutputStream.writeBytes("exit\n")
-            dataOutputStream.flush()
-            process.waitFor()
-            errorStream = BufferedReader(InputStreamReader(process.errorStream))
-            var msg = ""
-            var line: String
-            while (errorStream.readLine().also { line = it } != null) {
-                msg += line
-            }
-            if (!msg.contains("Failure")) {
-                result = true
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        } finally {
-            try {
-                dataOutputStream?.close()
-                errorStream?.close()
-            } catch (e: IOException) {
-            }
-        }
-        return result
-    }
-
-    /**
-     * 静默安装
-     *
-     * @param context
-     * @param apkPath
-     * @param autoStart 安装后是否自动启动
-     */
-    fun silentInstall(context: Context, apkPath: String, autoStart: Boolean = true) {
-        val intent = Intent().apply {
-            action = "android.intent.action.installslient"
-            putExtra("uri", apkPath)
-            putExtra("component", "com.dlc.chemical/com.dlc.chemical.ui.SplashActivity")
-            putExtra("enable", autoStart)
-        }
-        context.sendBroadcast(intent)
-    }
-
-    fun installOnTask(
-        apkFile: File,
-        appContext: Context,
-        applicationId: String
-    ) {
-        val intent = Intent()
-        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
-        intent.action = Intent.ACTION_VIEW
-
-        if (apkFile.exists()) {
-            // 提升目录读写权限,否则可能出现解析异常
-            DeviceUtils.promotePermission(apkFile.parentFile!!.path)
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
-                // 7.0以上的版本,特殊处理
-                intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
-                // 参数1 上下文, 参数2 Provider主机地址 和配置文件中保持一致   参数3  共享的文件
-                val uri = FileProvider.getUriForFile(
-                    appContext,
-                    "${applicationId}.fileprovider",
-                    apkFile
-                )
-                intent.setDataAndType(uri, "application/vnd.android.package-archive")
-            } else {
-                intent.setDataAndType(
-                    Uri.fromFile(apkFile),
-                    "application/vnd.android.package-archive"
-                )
-            }
-            appContext.startActivity(intent)
-            ActivityCollector.finishAll()
-            Process.killProcess(Process.myPid())
-        }
-    }
-
-}

+ 0 - 61
app/src/main/java/com/rc/core/util/ApkUpdater.kt

@@ -1,61 +0,0 @@
-package com.rc.core.util
-
-import android.content.Context
-import com.blankj.utilcode.util.LogUtils
-import com.rc.httpcore.net.DownloadListener
-import com.rc.httpcore.net.DownloadTask
-import java.io.File
-
-/**
- * info
- *
- * @author ReiChin_
- */
-class ApkUpdater(
-    private val appContext: Context,
-    private val applicationId: String,
-    private val callback: DownloadCallback? = null
-) {
-
-    fun downloadApk(downloadUrl: String) {
-        val fileName = "chemical-release.apk"
-        val apkFile = File(appContext.cacheDir, fileName)
-        if (apkFile.exists()) {
-            apkFile.delete()
-        }
-        val downloadTask = DownloadTask(
-            listener = object : DownloadListener {
-                override fun onProgress(progress: Int) {
-                    LogUtils.i("download apk, progress:$progress")
-                    callback?.onProgress(progress)
-                }
-
-                override fun onSuccess() {
-                    callback?.onSuccess(apkFile.path)
-                    ApkController.installAPK(apkFile, appContext, applicationId)
-                }
-
-                override fun onFailed(errMsg: String?) {
-                    callback?.onFailed(errMsg)
-                }
-
-                override fun onPaused() {
-                }
-
-                override fun onCanceled() {
-                }
-
-            }, dlPath = appContext.cacheDir.path,
-            fileName = fileName,
-            headers = mapOf("Accept-Encoding" to "identity")
-        )
-        downloadTask.execute(downloadUrl)
-    }
-
-    interface DownloadCallback {
-        fun onProgress(progress: Int)
-        fun onFailed(errMsg: String?)
-        fun onSuccess(apkFile: String)
-    }
-
-}

+ 0 - 208
app/src/main/java/com/rc/core/util/CrashHandler.kt

@@ -1,208 +0,0 @@
-package com.rc.core.util
-
-import android.content.Context
-import android.content.pm.PackageManager
-import android.os.Build
-import android.os.Environment
-import android.util.Log
-import java.io.*
-import java.text.SimpleDateFormat
-import java.util.*
-
-/**
- * info
- *
- * @author ReiChin_
- */
-object CrashHandler : Thread.UncaughtExceptionHandler {
-
-    private const val TAG = "LAB_Crash"
-
-    private var mContext: Context? = null
-
-    // 系统默认的 UncaughtException 处理类
-    private var mDefaultHandler: Thread.UncaughtExceptionHandler? = null
-
-    // 用来存储设备信息和异常信息
-    private val infos = HashMap<String, String>()
-
-    // 用于格式化日期,作为日志文件名的一部分
-    private val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
-
-    /**
-     * 初始化
-     */
-    fun initCrash(context: Context/*,  dstClass: Class<? out Activity>*/) {
-        mContext = context
-//        this.dstClass = dstClass;
-        // 获取系统默认的 UncaughtException 处理器
-        mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler()
-        // 设置该 CrashHandler 为程序的默认处理器
-        Thread.setDefaultUncaughtExceptionHandler(this)
-    }
-
-    override fun uncaughtException(thread: Thread, ex: Throwable) {
-        if (!handleException(ex) && mDefaultHandler != null) {
-            // 如果用户没有处理则让系统默认的异常处理器来处理
-            mDefaultHandler!!.uncaughtException(thread, ex)
-        } else {
-            try {
-                Thread.sleep(3000)
-            } catch (e: InterruptedException) {
-            }
-
-            // 退出程序,注释下面的重启启动程序代码
-//            SystemUtil.restartThroughIntentCompatMakeRestartActivityTask(
-//                ContextUtil.getContext(),
-//                dstClass
-//            );
-        }
-    }
-
-    /**
-     * 自定义错误处理,收集错误信息,发送错误报告等操作均在此完成
-     *
-     * @param ex
-     * @return true:如果处理了该异常信息;否则返回 false
-     */
-    private fun handleException(ex: Throwable?): Boolean {
-        if (ex == null) return false
-        Log.e(TAG, "", ex)
-
-        // 收集设备参数信息
-        mContext?.let {
-            collectDeviceInfo(it)
-        }
-
-        // 读取Error信息
-        readThrowableInfo(ex)?.let { error ->
-            mContext?.let {
-                // 保存日志文件
-                saveCrashInfo2File(error, it.cacheDir)
-            }
-        }
-        return true
-    }
-
-    /**
-     * 收集设备参数信息
-     * @param ctx
-     */
-    private fun collectDeviceInfo(ctx: Context) {
-        try {
-            ctx.packageManager.getPackageInfo(ctx.packageName, PackageManager.GET_ACTIVITIES)
-                .let { packageInfo ->
-                    infos["versionName"] = packageInfo.versionName ?: "null"
-                    infos["versionCode"] = packageInfo.versionCode.toString()
-                }
-        } catch (e: PackageManager.NameNotFoundException) {
-            Log.e(TAG, "an error occured when collect package info", e)
-        }
-
-        Build::class.java.declaredFields.forEach { field ->
-            try {
-                field.isAccessible = true
-                infos[field.name] = field.get(null).toString()
-                Log.d(TAG, field.name + " : " + field.get(null))
-            } catch (e: Exception) {
-                Log.e(TAG, "an error occured when collect crash info", e)
-            }
-        }
-    }
-
-    /**
-     * 保存错误信息到文件中
-     *
-     * @param error
-     * @return 返回文件名称, 便于将文件传送到服务器
-     */
-    private fun saveCrashInfo2File(error: String, cacheDir: File): String? {
-        val time = formatter.format(Date())
-        val sb = StringBuffer()
-        sb.append(time + "\n")
-        infos.entries.forEach { entry ->
-            sb.append("${entry.key} = ${entry.value} \n")
-        }
-
-        var fos: FileOutputStream? = null
-        try {
-            sb.append(error)
-            sb.append("\n\n\n")
-
-            saveErrorLogToSp(sb.toString())
-
-            val fileName = "error.log"
-            if (Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED) {
-                val errorFile = File(cacheDir, fileName)
-                if (!errorFile.exists()) {
-                    errorFile.createNewFile()
-                }
-                fos = FileOutputStream(errorFile)
-                fos.write(sb.toString().toByteArray())
-                fos.close()
-            }
-
-            return fileName
-        } catch (e: Exception) {
-            Log.e(TAG, "an error occured while writing file...", e)
-        } finally {
-            try {
-                fos?.let {
-                    it.close()
-                    fos = null
-                }
-            } catch (e: IOException) {
-                e.printStackTrace()
-            }
-        }
-
-        return null
-    }
-
-    /**
-     * 读取Throwable中的错误日志
-     *
-     * @param ex
-     * @return
-     */
-    private fun readThrowableInfo(ex: Throwable): String? {
-        var result: String? = null
-        var writer: Writer? = null
-        var printWriter: PrintWriter? = null
-        try {
-            writer = StringWriter()
-            printWriter = PrintWriter(writer)
-            ex.printStackTrace(printWriter)
-            var cause = ex.cause
-            while (cause != null) {
-                cause.printStackTrace(printWriter)
-                cause = cause.cause
-            }
-            result = writer.toString()
-        } catch (e: Exception) {
-            Log.e(TAG, "read throwable error....", e)
-        } finally {
-            printWriter?.let {
-                it.close()
-                printWriter = null
-            }
-            try {
-                writer?.let {
-                    it.close()
-                    writer = null
-                }
-            } catch (e: IOException) {
-                e.printStackTrace()
-            }
-        }
-        return result
-    }
-
-    private fun saveErrorLogToSp(errorInfo: String) {
-        mContext?.let { context ->
-            val sp = context.getSharedPreferences("error-log", Context.MODE_PRIVATE)
-            sp.edit().putString("error", errorInfo).apply()
-        }
-    }
-
-}

+ 0 - 120
app/src/main/java/com/rc/core/util/CrashHelper.kt

@@ -1,120 +0,0 @@
-package com.rc.core.util
-
-import android.os.Environment
-import android.util.Log
-import java.io.*
-import java.text.SimpleDateFormat
-import java.util.*
-
-/**
- * info
- *
- * @author ReiChin_
- */
-object CrashHelper {
-
-    private const val TAG = "LAB_Crash"
-
-    /**
-     * 自定义错误处理,收集错误信息,发送错误报告等操作均在此完成
-     *
-     * @param ex
-     * @return true:如果处理了该异常信息;否则返回 false
-     */
-    fun handleException(ex: Throwable?): Boolean {
-        if (ex == null) return false
-        Log.e(TAG, "", ex)
-
-        // 读取Error信息
-        readThrowableInfo(ex)?.let { error ->
-            // 保存日志文件
-            saveCrashInfo2File(error, Environment.getExternalStorageDirectory())
-        }
-        return true
-    }
-
-    /**
-     * 读取Throwable中的错误日志
-     *
-     * @param ex
-     * @return
-     */
-    private fun readThrowableInfo(ex: Throwable): String? {
-        var result: String? = null
-        var writer: Writer? = null
-        var printWriter: PrintWriter? = null
-        try {
-            writer = StringWriter()
-            printWriter = PrintWriter(writer)
-            ex.printStackTrace(printWriter)
-            var cause = ex.cause
-            while (cause != null) {
-                cause.printStackTrace(printWriter)
-                cause = cause.cause
-            }
-            result = writer.toString()
-        } catch (e: Exception) {
-            Log.e(TAG, "read throwable error....", e)
-        } finally {
-            printWriter?.let {
-                it.close()
-                printWriter = null
-            }
-            try {
-                writer?.let {
-                    it.close()
-                    writer = null
-                }
-            } catch (e: IOException) {
-                e.printStackTrace()
-            }
-        }
-        return result
-    }
-
-    /**
-     * 保存错误信息到文件中
-     *
-     * @param error
-     * @return 返回文件名称, 便于将文件传送到服务器
-     */
-    fun saveCrashInfo2File(error: String, cacheDir: File): String? {
-        val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
-        val time = formatter.format(Calendar.getInstance().time)
-        val sb = StringBuffer()
-        sb.append(time + "\n")
-
-        var fos: FileOutputStream? = null
-        try {
-            sb.append(error)
-            sb.append("\n\n\n")
-
-            val fileName = "error-${time}.log"
-            if (Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED) {
-                val errorFile = File(cacheDir, fileName)
-                if (!errorFile.exists()) {
-                    errorFile.createNewFile()
-                }
-                fos = FileOutputStream(errorFile)
-                fos.write(sb.toString().toByteArray())
-                fos.close()
-            }
-
-            return fileName
-        } catch (e: Exception) {
-            Log.e(TAG, "an error occured while writing file...", e)
-        } finally {
-            try {
-                fos?.let {
-                    it.close()
-                    fos = null
-                }
-            } catch (e: IOException) {
-                e.printStackTrace()
-            }
-        }
-
-        return null
-    }
-
-}

+ 0 - 102
app/src/main/java/com/rc/core/util/DateUtils.kt

@@ -1,102 +0,0 @@
-package com.rc.core.util
-
-import android.text.TextUtils
-import java.text.DateFormat
-import java.text.ParseException
-import java.text.SimpleDateFormat
-import java.util.*
-
-/**
- * info
- *
- * @author ReiChin_
- */
-object DateUtils {
-
-    /**
-     * 比较两个日期的年月日
-     * @param c1
-     * @param c2
-     * @return c1 > c2 返回 1;
-     * c1 = c2 返回 0;
-     * c1 < c2 返回 -1
-     */
-    fun compareToYMD(c1: Calendar?, c2: Calendar?): Int {
-        if (null == c1 || null == c2) {
-            return 0
-        }
-        clearTime(c1)
-        clearTime(c2)
-        return c1.compareTo(c2)
-    }
-
-    /**
-     * 重置时、分、秒、毫秒
-     */
-    private fun clearTime(calendar: Calendar) {
-        calendar[Calendar.HOUR_OF_DAY] = 0
-        calendar[Calendar.MINUTE] = 0
-        calendar[Calendar.SECOND] = 0
-        calendar[Calendar.MILLISECOND] = 0
-    }
-
-    /**
-     * yyyy-MM-dd 格式
-     */
-    fun formatDate(calendar: Calendar): String {
-        val format = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
-        return format.format(calendar.time)
-    }
-
-    /**
-     * 发生错误时,默认返回当前时间
-     *
-     * @param dateStr yyyy-MM-dd 格式
-     */
-    fun parseDate(dateStr: String?): Calendar {
-        return parseDate(dateStr, Calendar.getInstance())
-    }
-
-    /**
-     * @param dateStr yyyy-MM-dd 格式
-     * @param defDate 发生错误时,返回的时间
-     */
-    fun parseDate(dateStr: String?, defDate: Calendar): Calendar {
-        if (TextUtils.isEmpty(dateStr)) {
-            return defDate
-        }
-        try {
-            val calendar = Calendar.getInstance()
-            val format: DateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
-            val date = format.parse(dateStr)
-            if (null != date) {
-                calendar.time = date
-                return calendar
-            }
-        } catch (e: ParseException) {
-            e.printStackTrace()
-        }
-        return defDate
-    }
-
-    /**
-     * 格式化时间戳
-     *
-     * @param timestamp 时间戳,单位秒
-     * @return yyyy-MM-dd格式
-     */
-    fun formatTimestamp(timestamp: String?): String? {
-        if (null == timestamp) return null
-
-        return try {
-            val format: DateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
-            val calendar = Calendar.getInstance()
-            calendar.timeInMillis = timestamp.toLong() * 1000
-            format.format(calendar.time)
-        } catch (e: Exception) {
-            e.printStackTrace()
-            null
-        }
-    }
-
-}

+ 0 - 75
app/src/main/java/com/rc/core/util/DeviceUtils.kt

@@ -1,75 +0,0 @@
-package com.rc.core.util
-
-import android.annotation.SuppressLint
-import android.content.Context
-import android.content.pm.PackageManager
-import java.io.IOException
-import kotlin.math.roundToInt
-
-/**
- * info
- *
- * @author ReiChin_
- */
-object DeviceUtils {
-
-    /**
-     * 获取系统SN序列号
-     */
-    @SuppressLint("PrivateApi")
-    fun getAndroidSN(defSN: String = "NULL"): String {
-        return try {
-            val sysClass = Class.forName("android.os.SystemProperties")
-            sysClass.getMethod("get", String::class.java, String::class.java)
-                .invoke(sysClass, "ro.serialno", defSN) as? String ?: defSN
-        } catch (e: Exception) {
-            e.printStackTrace()
-            defSN
-        }
-    }
-
-    /**
-     * 获取当前apk版本号(versionCode)
-     */
-    fun getVersionCode(context: Context): Int {
-        return try {
-            context.packageManager.getPackageInfo(context.packageName, 0).versionCode
-        } catch (e: PackageManager.NameNotFoundException) {
-            -1
-        }
-    }
-
-    /**
-     * 提升读写权限
-     *
-     * @param filePath 文件路径
-     */
-    fun promotePermission(filePath: String) {
-        val command = "chmod 777 $filePath"
-        val runtime = Runtime.getRuntime()
-        try {
-            runtime.exec(command)
-        } catch (e: IOException) {
-            e.printStackTrace()
-        }
-    }
-
-    /**
-     * 根据手机的分辨率从 dp 的单位 转成为 px(像素)
-     */
-    fun dip2px(context: Context, dpValue: Float): Int {
-        val scale = context.resources.displayMetrics.density
-        return (dpValue * scale + 0.5f).toInt()
-    }
-
-    fun spanCount(context: Context, gridExpectedSize: Int, offset: Int, horizontalSpacing: Int): Int {
-        val screenWidth = context.resources.displayMetrics.widthPixels - offset + horizontalSpacing
-        val expected = screenWidth.toFloat() / (gridExpectedSize.toFloat() + horizontalSpacing)
-        var spanCount = expected.roundToInt()
-        if (spanCount == 0) {
-            spanCount = 1
-        }
-        return spanCount
-    }
-
-}

+ 0 - 18
app/src/main/java/com/rc/core/util/Extension.kt

@@ -1,18 +0,0 @@
-package com.rc.core.util
-
-import android.os.Build
-import android.text.Html
-import android.text.Spanned
-
-fun String.fromHtml(): Spanned {
-    return if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {
-        Html.fromHtml(this, Html.FROM_HTML_MODE_LEGACY)
-    } else {
-        Html.fromHtml(this)
-    }
-}
-
-fun String?.trimEndZero(): String {
-    if (null == this) return ""
-    return if (-1 != indexOf('.')) trimEnd('0').trimEnd('.') else this
-}

+ 0 - 32
app/src/main/java/com/rc/core/util/FastClickDelegate.kt

@@ -1,32 +0,0 @@
-package com.rc.core.util
-
-import android.view.View
-
-/**
- * info
- *
- * @author ReiChin_
- */
-class FastClickDelegate(private val listener: View.OnClickListener) : View.OnClickListener {
-
-    companion object {
-        private const val FAST_CLICK_DELAY_TIME = 1000
-    }
-
-    private var mLastClickTime = 1L
-
-    override fun onClick(v: View?) {
-        if (!isFastClick()) listener.onClick(v)
-    }
-
-    private fun isFastClick(): Boolean {
-        var isFastClick = true
-        val currentTimeMillis = System.currentTimeMillis()
-        if (currentTimeMillis - mLastClickTime > FAST_CLICK_DELAY_TIME) {
-            isFastClick = false
-        }
-        mLastClickTime = currentTimeMillis
-        return isFastClick
-    }
-
-}

+ 0 - 69
app/src/main/java/com/rc/core/util/Format.kt

@@ -1,69 +0,0 @@
-package com.rc.core.util
-
-import java.text.NumberFormat
-import java.text.SimpleDateFormat
-import java.util.*
-
-/**
- * info
- *
- * @author ReiChin_
- */
-object Format {
-
-    /**
-     * 将时区时间格式化成日期字符串
-     *
-     * @param zonedDateTime 2021-03-30T14:18:41.000+08:00
-     */
-    fun formatZonedDateTime(
-        zonedDateTime: String?,
-        pattern: String = "yyyy-MM-dd HH:mm:ss"
-    ): String {
-        val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX", Locale.getDefault())
-        val data: Date? = try {
-            dateFormat.parse(zonedDateTime)
-        } catch (e: Exception) {
-            null
-        }
-
-        return formatDate(data, pattern)
-    }
-
-    /**
-     * 将时间戳格式化成yyyy-MM-dd HH:mm:ss格式的日期字符串
-     *
-     * @param dateLong
-     * @return
-     */
-    fun formatTimestamp(dateLong: String?, pattern: String = "yyyy-MM-dd HH:mm:ss"): String {
-        val date: Date? = try {
-            dateLong?.let { Date(it.toLong()) }
-        } catch (e: Exception) {
-            null
-        }
-
-        return formatDate(date, pattern)
-    }
-
-    /**
-     * 按给定的格式格式化日期.
-     *
-     * @param date
-     * @param pattern : 格式化格式
-     * @return
-     */
-    fun formatDate(date: Date?, pattern: String = "yyyy-MM-dd"): String {
-        return date?.let {
-            SimpleDateFormat(pattern, Locale.getDefault()).format(it)
-        } ?: ""
-    }
-
-    fun formatFractionDigits(value: Float?, fd: Int = 2): String {
-        if (null == value) return "0.00"
-        val numberFormat = NumberFormat.getNumberInstance()
-        numberFormat.maximumFractionDigits = fd
-        return numberFormat.format(value)
-    }
-
-}

+ 0 - 162
app/src/main/java/com/rc/core/util/MediaUtils.kt

@@ -1,162 +0,0 @@
-package com.rc.core.util
-
-import android.content.ContentValues
-import android.content.Context
-import android.net.Uri
-import android.os.Build
-import android.os.Environment
-import android.provider.MediaStore
-import java.io.File
-import java.util.*
-
-/**
- * info
- *
- * @author ReiChin_
- */
-object MediaUtils {
-
-    /**
-     * 创建一条图片地址uri,用于保存拍照后的照片
-     *
-     * @param context
-     * @param cameraFileName
-     * @param mimeType
-     * @return 图片的uri
-     */
-    fun createImageUri(
-        context: Context,
-        cameraFileName: String,
-        mimeType: String? = "image/jpeg"
-    ): Uri? {
-        // ContentValues是我们希望这条记录被创建时包含的数据信息
-        val values = ContentValues()
-
-        val suffix = cameraFileName.substring(cameraFileName.lastIndexOf("."))
-        val fileName = cameraFileName.replace(suffix, "")
-        values.put(MediaStore.Images.Media.DISPLAY_NAME, fileName)
-
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
-            values.put(MediaStore.Images.Media.DATE_TAKEN, "${System.currentTimeMillis()}")
-        }
-        values.put(MediaStore.Images.Media.MIME_TYPE, mimeType)
-
-        // 判断是否有SD卡,优先使用SD卡存储,当没有SD卡时使用手机存储
-        return if (Environment.MEDIA_MOUNTED == Environment.getExternalStorageState()) {
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
-                values.put(MediaStore.Images.Media.RELATIVE_PATH, "DCIM/Camera")
-            }
-            context.applicationContext.contentResolver
-                .insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values)
-        } else {
-            context.applicationContext.contentResolver
-                .insert(MediaStore.Images.Media.INTERNAL_CONTENT_URI, values)
-        }
-    }
-
-    /**
-     * 创建一条视频地址uri,用于保存录制的视频
-     *
-     * @param context
-     * @param cameraFileName
-     * @param mimeType
-     * @return 视频的uri
-     */
-    fun createVideoUri(
-        context: Context,
-        cameraFileName: String,
-        mimeType: String? = "video/mp4"
-    ): Uri? {
-        // ContentValues是我们希望这条记录被创建时包含的数据信息
-        val values = ContentValues()
-
-        val suffix = cameraFileName.substring(cameraFileName.lastIndexOf("."))
-        val fileName = cameraFileName.replace(suffix, "")
-        values.put(MediaStore.Video.Media.DISPLAY_NAME, fileName)
-
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
-            values.put(MediaStore.Video.Media.DATE_TAKEN, "${System.currentTimeMillis()}")
-        }
-        values.put(MediaStore.Video.Media.MIME_TYPE, mimeType)
-
-        // 判断是否有SD卡,优先使用SD卡存储,当没有SD卡时使用手机存储
-        return if (Environment.MEDIA_MOUNTED == Environment.getExternalStorageState()) {
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
-                values.put(MediaStore.Video.Media.RELATIVE_PATH, Environment.DIRECTORY_MOVIES)
-            }
-            context.applicationContext.contentResolver
-                .insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, values)
-        } else {
-            context.applicationContext.contentResolver
-                .insert(MediaStore.Video.Media.INTERNAL_CONTENT_URI, values)
-        }
-    }
-
-    /**
-     * delete camera PATH
-     *
-     * @param context Context
-     * @param cameraPath Camera url
-     */
-    fun deleteCamera(context: Context, cameraPath: String?) {
-        try {
-            if (null != cameraPath && cameraPath.startsWith("content://")) {
-                context.contentResolver.delete(Uri.parse(cameraPath), null, null)
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }
-    }
-
-    fun deleteFile(filepath: String?) {
-        if (!filepath.isNullOrEmpty()) {
-            try {
-                File(filepath).delete()
-            } catch (e: Exception) {
-                e.printStackTrace()
-            }
-        }
-    }
-
-    /**
-     * 创建文件
-     *
-     * @param context 上下文
-     * @param fileName 文件名
-     * @param outCameraDirectory 输出目录
-     * @return
-     */
-    fun createCameraFile(
-        context: Context,
-        fileName: String,
-        outCameraDirectory: String? = null
-    ): File {
-        val folderDir: File
-        if (outCameraDirectory.isNullOrEmpty()) {
-            // 外部没有自定义拍照存储路径使用默认
-            val rootDir: File
-            if (Environment.MEDIA_MOUNTED == Environment.getExternalStorageState()) {
-                rootDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)
-                folderDir = File(rootDir.absolutePath + File.separator + "Camera" + File.separator)
-            } else {
-                rootDir =
-                    context.applicationContext.getExternalFilesDir(Environment.DIRECTORY_PICTURES)!!
-                folderDir = File(rootDir.absolutePath + File.separator)
-            }
-            if (!rootDir.exists()) {
-                rootDir.mkdirs()
-            }
-        } else {
-            // 自定义存储路径
-            folderDir = File(outCameraDirectory)
-            if (!Objects.requireNonNull(folderDir.parentFile).exists()) {
-                folderDir.parentFile?.mkdirs()
-            }
-        }
-        if (!folderDir.exists()) {
-            folderDir.mkdirs()
-        }
-
-        return File(folderDir, fileName)
-    }
-}

+ 0 - 35
app/src/main/java/com/rc/core/util/net/NetChangeListener.kt

@@ -1,35 +0,0 @@
-package com.rc.core.util.net
-
-/**
- * Function : 网络变化监听事件
- * Date:  2020-10-15 10:29
- * Author: ReiChin_
- * Version:
- */
-interface NetChangeListener {
-
-    /**
-     * wifi变为4G
-     */
-    fun onWifiTo4G()
-
-    /**
-     * 4G变为wifi
-     */
-    fun on4GToWifi()
-
-    /**
-     * 网络断开
-     */
-    fun onNetDisconnected()
-
-//    //实现接口内回调方法,调用对应函数变量的invoke(param)方法实现回调
-//    override fun nextFun(data: T?) {
-//        //函数类型的值可以通过其 invoke(……) 操作符调用:f.invoke(x) 或者直接 f(x)。
-//        this.next.invoke(data)
-//        //this.next(data)
-//    }
-//    override fun errorFun(code: Int, message: String) {
-//        this.error.invoke(code, message)
-//    }
-}

+ 0 - 20
app/src/main/java/com/rc/core/util/net/NetConnectedListener.kt

@@ -1,20 +0,0 @@
-package com.rc.core.util.net
-
-/**
- * Function : 判断是否有网络的监听
- * Date:  2020-10-15 10:30
- * Author: ReiChin_
- * Version:
- */
-interface NetConnectedListener {
-
-    /**
-     * 网络已连接
-     */
-    fun onReNetConnected(isReconnect: Boolean)
-
-    /**
-     * 网络未连接
-     */
-    fun onNetUnConnected()
-}

+ 0 - 145
app/src/main/java/com/rc/core/util/net/NetWatchdog.kt

@@ -1,145 +0,0 @@
-package com.rc.core.util.net
-
-import android.annotation.SuppressLint
-import android.content.BroadcastReceiver
-import android.content.Context
-import android.content.Intent
-import android.content.IntentFilter
-import android.net.ConnectivityManager
-import android.net.NetworkInfo
-import java.lang.Exception
-
-/**
- * Function :
- * Date:  2020-10-15 10:02
- * Author: ReiChin_
- * Version:
- */
-class NetWatchdog(context: Context) {
-
-    private val mAppContext = context.applicationContext
-
-    private var isReconnect = false
-
-    // 广播过滤器,监听网络变化
-    private val mNetIntentFilter = IntentFilter()
-
-    init {
-        mNetIntentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION)
-    }
-
-    private val mReceiver = object : BroadcastReceiver() {
-        override fun onReceive(context: Context?, intent: Intent?) {
-            // 获取手机的连接服务管理器,这里是连接管理器类
-            val cm = context?.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
-
-            val wifiNetworkInfo: NetworkInfo? = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI)
-            val mobileNetworkInfo: NetworkInfo? = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE)
-            val activeNetworkInfo: NetworkInfo? = cm.getActiveNetworkInfo()
-
-            val wifiState = wifiNetworkInfo?.state ?: NetworkInfo.State.UNKNOWN
-            val mobileState = mobileNetworkInfo?.state ?: NetworkInfo.State.UNKNOWN
-
-            if (activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting) {
-                mNetConnectedListener?.run {
-                    isReconnect = false
-                    onReNetConnected(isReconnect)
-                }
-            } else if (activeNetworkInfo == null){
-                mNetConnectedListener?.run {
-                    isReconnect = true
-                    onNetUnConnected()
-                }
-            }
-
-            if (NetworkInfo.State.CONNECTED != wifiState && NetworkInfo.State.CONNECTED == mobileState) {
-                mNetChangeListener?.onWifiTo4G()
-            } else if (NetworkInfo.State.CONNECTED == wifiState && NetworkInfo.State.CONNECTED != mobileState) {
-                mNetChangeListener?.on4GToWifi()
-            } else if (NetworkInfo.State.CONNECTED != wifiState && NetworkInfo.State.CONNECTED != mobileState) {
-                mNetChangeListener?.onNetDisconnected()
-            }
-        }
-    }
-
-    private var mNetChangeListener: NetChangeListener? = null
-
-    fun setNetChangeListener(listener: NetChangeListener) {
-        mNetChangeListener = listener
-    }
-
-    private var mNetConnectedListener: NetConnectedListener? = null
-
-    fun setNetConnectedListener(listener: NetConnectedListener) {
-        mNetConnectedListener = listener
-    }
-
-    /**
-     * 开始监听
-     */
-    fun startWatch() {
-        try {
-            mAppContext.registerReceiver(mReceiver, mNetIntentFilter)
-        } catch (e: Exception) {
-        }
-    }
-
-    /**
-     * 结束监听
-     */
-    fun stopWatch() {
-        try {
-            mAppContext.unregisterReceiver(mReceiver)
-        } catch (e: Exception) {
-        }
-    }
-
-    companion object {
-        /**
-         * 静态方法获取是否有网络连接
-         *
-         * @param context 上下文
-         * @return 是否连接
-         */
-        fun hasNet(context: Context): Boolean {
-            // 获取手机的连接服务管理器,这里是连接管理器类
-            val cm = context.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
-
-            val wifiNetworkInfo: NetworkInfo? = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI)
-            val mobileNetworkInfo: NetworkInfo? = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE)
-            val activeNetworkInfo: NetworkInfo? = cm.activeNetworkInfo
-
-            val wifiState = wifiNetworkInfo?.state ?: NetworkInfo.State.UNKNOWN
-            val mobileState = mobileNetworkInfo?.state ?: NetworkInfo.State.UNKNOWN
-
-            if (NetworkInfo.State.CONNECTED != wifiState && NetworkInfo.State.CONNECTED != mobileState) {
-                return false
-            }
-            if (activeNetworkInfo == null || !activeNetworkInfo.isConnectedOrConnecting) {
-                return false
-            }
-
-            return true
-        }
-
-        /**
-         * 静态判断是不是4G网络
-         *
-         * @param context 上下文
-         * @return 是否是4G
-         */
-        @SuppressLint("MissingPermission")
-        fun is4GConnected(context: Context): Boolean {
-            // 获取手机的连接服务管理器,这里是连接管理器类
-            val cm = context.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
-
-            val mobileNetworkInfo: NetworkInfo ? = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE)
-
-            val mobileState = mobileNetworkInfo?.state ?: NetworkInfo.State.UNKNOWN
-
-            return NetworkInfo.State.CONNECTED == mobileState
-        }
-    }
-
-
-}

+ 43 - 0
app/src/main/java/com/rc/httpcore/client/HttpTool.java

@@ -2,9 +2,16 @@ package com.rc.httpcore.client;
 
 import android.net.Uri;
 import android.util.Log;
+import android.widget.Toast;
 
+import androidx.annotation.NonNull;
+
+import com.blankj.utilcode.util.ActivityUtils;
 import com.blankj.utilcode.util.GsonUtils;
 import com.blankj.utilcode.util.LogUtils;
+import com.blankj.utilcode.util.ThreadUtils;
+import com.kongzue.dialogx.dialogs.WaitDialog;
+import com.rc.httpcore.HttpClient;
 import com.rc.httpcore.HttpConfig;
 import com.rc.httpcore.OkHttpUtils;
 import com.rc.httpcore.bean.AddChemical;
@@ -17,8 +24,12 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import okhttp3.Call;
 import okhttp3.Callback;
 import okhttp3.Response;
+import xn.hxp.app.ChemicalApp;
+import xn.hxp.ui.StartActivity;
+import xn.hxp.utils.Tool;
 
 public final class HttpTool {
 
@@ -115,4 +126,36 @@ public final class HttpTool {
         return OkHttpUtils.postSync(HttpConfig.Companion.getAPI_BASE_URL() + "chemical/aio/verify/aioScanLogin1", GsonUtils.toJson(map));
     }
 
+    /**
+     * 获取版本信息
+     */
+    public static Response getCheck() throws IOException {
+        return OkHttpUtils.getSync(HttpConfig.Companion.getAPI_BASE_URL() + "iot/aio/report?" + "deviceNo=" + Tool.INSTANCE.getSerialNumber() + "&code=" + "aio_chemical" + "&version=100");
+    }
+
+    /**
+     * 登出
+     *
+     * @throws IOException
+     */
+    public static void logout() throws IOException {
+        WaitDialog.show("退出中...");
+        OkHttpUtils.get(HttpConfig.Companion.getAPI_BASE_URL() + "auth/logout", new Callback() {
+            @Override
+            public void onFailure(@NonNull Call call, @NonNull IOException e) {
+                WaitDialog.dismiss();
+                ThreadUtils.runOnUiThread(() -> Toast.makeText(ActivityUtils.getTopActivity(), e.getMessage(), Toast.LENGTH_LONG).show());
+            }
+
+            @Override
+            public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
+                WaitDialog.dismiss();
+                ChemicalApp.userData = null;
+                ChemicalApp.subjectId = null;
+                HttpClient.INSTANCE.setToken(null);
+                ActivityUtils.startActivity(StartActivity.class);
+            }
+        });
+    }
+
 }

+ 0 - 1
app/src/main/java/xn/hxp/comm/Constants.kt

@@ -9,7 +9,6 @@ object Constants {
     //    var OFFTIME_TIME_TWO = 0     //弹框注销时间
     var WHAT_COUNT_DOWN_TWO = 1     //handle 通用参数
     var AUTHENTICATION = false //双人认证是否成功
-    var VIEW_TYPE: Boolean = false  //当前废弃或者领用页面  true 是  false 不是
     var secondsLeft = 30  //开锁业务30秒 没有开锁 关闭开锁请求
     var pwd = "123"  //工程密码
     const val APP_ID = "169ad630e3"

+ 173 - 167
app/src/main/java/xn/hxp/ui/MainActivity.kt

@@ -10,24 +10,31 @@ import android.os.Bundle
 import android.os.Handler
 import android.os.Looper
 import android.os.Message
-import android.util.Log
 import android.view.KeyEvent
-import android.view.LayoutInflater
 import android.view.View
 import android.widget.EditText
 import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
+import androidx.viewbinding.ViewBinding
 import com.blankj.utilcode.util.ActivityUtils
 import com.blankj.utilcode.util.AppUtils
+import com.blankj.utilcode.util.LogUtils
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
-import xn.hxp.app.ChemicalApp
+import com.lztek.toolkit.Lztek
+import com.rc.core.ui.activity.BaseActivity
+import com.rc.httpcore.HttpClient
+import com.rc.httpcore.HttpConfig
+import com.rc.httpcore.client.ApiRepository
+import com.rc.httpcore.exception.NetException
+import retrofit2.HttpException
 import xn.hxp.R
+import xn.hxp.app.ChemicalApp
 import xn.hxp.databinding.ActivityMainBinding
+import xn.hxp.receiver.TimeTickReceiver
 import xn.hxp.receiver.UsbReceiver
 import xn.hxp.ui.adapter.CabinetAdapter
-import xn.hxp.ui.plan.PlanAddActivity
 import xn.hxp.ui.discard.LedgerActivity
 import xn.hxp.ui.discard.WasteChemicalsActivity
 import xn.hxp.ui.inquiry.InquiryActivity
@@ -35,32 +42,26 @@ import xn.hxp.ui.login.FacialCardActivity
 import xn.hxp.ui.login.FacialLoginActivity
 import xn.hxp.ui.login.ScanLoginActivity
 import xn.hxp.ui.login.SwipeActivity
+import xn.hxp.ui.plan.PlanAddActivity
 import xn.hxp.ui.still.ChemicalsAlsoActivity
 import xn.hxp.ui.still.MsdsActivity
 import xn.hxp.ui.uses.UseActivity
 import xn.hxp.ui.uses.WarningEventsActivity
 import xn.hxp.ui.warehousing.ChemicalLabelingActivity
+import xn.hxp.utils.PrintTool
 import xn.hxp.utils.RelativeLayoutDebouncer
 import xn.hxp.utils.SharedPreferencesHelper
 import xn.hxp.utils.TimeUpdater
 import xn.hxp.utils.UiManager
 import xn.hxp.weidith.CustomDialog
-import com.lztek.toolkit.Lztek
-import com.blankj.utilcode.util.LogUtils
-import com.rc.core.ui.activity.RcBaseActivity
-import com.rc.core.util.DeviceUtils
-import com.rc.httpcore.HttpClient
-import com.rc.httpcore.HttpConfig
-import com.rc.httpcore.client.ApiRepository
-import com.rc.httpcore.exception.NetException
-import retrofit2.HttpException
-import xn.hxp.receiver.TimeTickReceiver
-import xn.hxp.utils.PrintTool
 import java.net.ConnectException
 import java.net.SocketTimeoutException
 
 //首页 -  登录or 未登录
-class MainActivity : RcBaseActivity<ActivityMainBinding>() {
+public class MainActivity : BaseActivity() {
+
+    lateinit var viewBinding: ActivityMainBinding
+
     private lateinit var timeUpdater: TimeUpdater
     private val mAdapter by lazy { CabinetAdapter() }
     private var currentPosition = 0
@@ -81,7 +82,6 @@ class MainActivity : RcBaseActivity<ActivityMainBinding>() {
 
 
     private lateinit var layoutManager: LinearLayoutManager
-    override fun createViewBinding() = ActivityMainBinding.inflate(LayoutInflater.from(this))
 
     override fun onResume() {
         super.onResume()
@@ -162,7 +162,7 @@ class MainActivity : RcBaseActivity<ActivityMainBinding>() {
                         }
 
                         if (input == pwd) {
-                            UiManager.switcher(this, SettingActivity::class.java)
+//                            UiManager.switcher(this, SettingActivity::class.java)
                         } else {
                             showToast("密码错误")
                         }
@@ -177,12 +177,6 @@ class MainActivity : RcBaseActivity<ActivityMainBinding>() {
         }
     }
 
-    override fun initData() {
-        super.initData()
-        //获取基础配置
-        basicConf()
-    }
-
     //获取刷卡信息
     override fun dispatchKeyEvent(event: KeyEvent): Boolean {
 //        mPortScanHelper.dispatchKeyEvent(event)
@@ -221,148 +215,6 @@ class MainActivity : RcBaseActivity<ActivityMainBinding>() {
     }
 
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
-        getUserIds()
-        val handler = Handler(Looper.getMainLooper())
-        timeUpdater = TimeUpdater(handler) { currentTime ->
-            viewBinding.inc.nowTime.text = "$currentTime"
-        }
-        // 启动定时更新
-        timeUpdater.startUpdating()
-
-        initAdapter()
-        viewBinding.imgLeft.setOnClickListener {
-            if (currentPosition > 0) {
-                currentPosition--
-                recyclerView.smoothScrollToPosition(currentPosition)
-            }
-        }
-
-        viewBinding.imgRight.setOnClickListener {
-            if (currentPosition < mAdapter.data.size - 1) {
-                currentPosition++
-                recyclerView.smoothScrollToPosition(currentPosition)
-            }
-        }
-        //登录
-        RelativeLayoutDebouncer.setDebouncedOnClickListener(viewBinding.inc.userLogin, 1000L) {
-            basicConfLog()
-        }
-
-//        viewBinding.inc.userLogin.setOnClickListener {
-//            basicConfLog()
-//        }
-        viewBinding.addChemicals.setOnClickListener {
-//            UiManager.switcher(this, PlanAddActivity::class.java)
-            //新增
-            if (ChemicalApp.userData != null) {
-                if (ChemicalApp.administrators || ChemicalApp.responsibles) {
-                    UiManager.switcher(this, PlanAddActivity::class.java)
-                } else {
-                    customDialogView(2, "当前人员无权限")
-                }
-            } else {
-                basicConfLog()
-            }
-        }
-
-
-        //待入库 TODO 暂时隐藏
-//        viewBinding.reSto.setOnClickListener {
-//            if (ChemicalApp.userData != null) {
-//                UiManager.switcher(this, WarehousingActivity::class.java)
-//            } else {
-//                basicConfLog()
-//            }
-//        }
-
-        //废弃
-        viewBinding.reDis.setOnClickListener {
-            if (ChemicalApp.userData != null) {
-                UiManager.switcher(this, WasteChemicalsActivity::class.java)
-            } else {
-                basicConfLog()
-            }
-        }
-
-        //查询
-        viewBinding.reInq.setOnClickListener {
-            val map = mutableMapOf<String, Any>()
-            if (ChemicalApp.userData != null) {
-                map["logIn"] = 1
-            } else {
-                map["logIn"] = 0
-            }
-            map["cabinetId"] = "a"
-            map["doorId"] = "a"
-            UiManager.switcher(this, map, InquiryActivity::class.java)
-        }
-
-        //领用
-        viewBinding.reCla.setOnClickListener {
-            if (ChemicalApp.userData != null) {
-                UiManager.switcher(this, UseActivity::class.java)
-            } else {
-                basicConfLog()
-            }
-        }
-
-        //归还
-        viewBinding.reRet.setOnClickListener {
-            if (ChemicalApp.userData != null) {
-                UiManager.switcher(this, ChemicalsAlsoActivity::class.java)
-            } else {
-                basicConfLog()
-            }
-        }
-
-        //电子台账
-        viewBinding.rlLedger.setOnClickListener {
-            if (ChemicalApp.userData != null) {
-                UiManager.switcher(this, LedgerActivity::class.java)
-            } else {
-                basicConfLog()
-            }
-        }
-
-        //标签管理
-        viewBinding.reLedger.setOnClickListener {
-
-            if (ChemicalApp.userData != null) {
-//                UiManager.switcher(this, ElectronicLedgerActivity::class.java)
-                //化学品标签
-                UiManager.switcher(this, ChemicalLabelingActivity::class.java)
-            } else {
-                basicConfLog()
-            }
-        }
-
-        //预警事件
-        viewBinding.rlWarning.setOnClickListener {
-            if (ChemicalApp.userData != null) {
-                UiManager.switcher(this, WarningEventsActivity::class.java)
-            } else {
-                basicConfLog()
-            }
-        }
-
-        //演示流程  -MSDS
-        viewBinding.rlDem.setOnClickListener {
-            //暂时不用演示流程  跳转MSDS
-//            UiManager.switcher(this, DemonstrateActivity::class.java)
-            UiManager.switcher(this, MsdsActivity::class.java)
-        }
-
-        viewBinding.inc.tvOutLogin.setOnClickListener {
-            ChemicalApp.userData = null
-//            ChemicalApp.subjectId = null
-            HttpClient.token = null
-            ActivityUtils.startActivity(SplashActivity::class.java)
-            LogUtils.d(ActivityUtils.getActivityList())
-        }
-    }
-
     /**
      * 查询柜子
      */
@@ -744,7 +596,7 @@ class MainActivity : RcBaseActivity<ActivityMainBinding>() {
                     ChemicalApp.subjectId = null
                     ChemicalApp.userData = null
                     callLogoutApis {
-                        ActivityUtils.startActivity(SplashActivity::class.java)
+                        ActivityUtils.startActivity(StartActivity::class.java)
                     }
                 } else {
                     sendEmptyMessageDelayed(WHAT_COUNT_DOWN, 1000)
@@ -758,6 +610,160 @@ class MainActivity : RcBaseActivity<ActivityMainBinding>() {
         mCounter = 0
     }
 
+    override fun cdFinish() {
+    }
+
+    override fun cdTime(cd: Int) {
+    }
+
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityMainBinding.inflate(layoutInflater)
+        return viewBinding;
+    }
+
+    override fun onInit() {
+        getUserIds()
+        val handler = Handler(Looper.getMainLooper())
+        timeUpdater = TimeUpdater(handler) { currentTime ->
+            viewBinding.inc.nowTime.text = "$currentTime"
+        }
+        // 启动定时更新
+        timeUpdater.startUpdating()
+
+        initAdapter()
+        viewBinding.imgLeft.setOnClickListener {
+            if (currentPosition > 0) {
+                currentPosition--
+                recyclerView.smoothScrollToPosition(currentPosition)
+            }
+        }
+
+        viewBinding.imgRight.setOnClickListener {
+            if (currentPosition < mAdapter.data.size - 1) {
+                currentPosition++
+                recyclerView.smoothScrollToPosition(currentPosition)
+            }
+        }
+        //登录
+        RelativeLayoutDebouncer.setDebouncedOnClickListener(viewBinding.inc.userLogin, 1000L) {
+            basicConfLog()
+        }
+
+//        viewBinding.inc.userLogin.setOnClickListener {
+//            basicConfLog()
+//        }
+        viewBinding.addChemicals.setOnClickListener {
+//            UiManager.switcher(this, PlanAddActivity::class.java)
+            //新增
+            if (ChemicalApp.userData != null) {
+                if (ChemicalApp.administrators || ChemicalApp.responsibles) {
+                    UiManager.switcher(this, PlanAddActivity::class.java)
+                } else {
+                    customDialogView(2, "当前人员无权限")
+                }
+            } else {
+                basicConfLog()
+            }
+        }
+
+
+        //待入库 TODO 暂时隐藏
+//        viewBinding.reSto.setOnClickListener {
+//            if (ChemicalApp.userData != null) {
+//                UiManager.switcher(this, WarehousingActivity::class.java)
+//            } else {
+//                basicConfLog()
+//            }
+//        }
+
+        //废弃
+        viewBinding.reDis.setOnClickListener {
+            if (ChemicalApp.userData != null) {
+                UiManager.switcher(this, WasteChemicalsActivity::class.java)
+            } else {
+                basicConfLog()
+            }
+        }
+
+        //查询
+        viewBinding.reInq.setOnClickListener {
+            val map = mutableMapOf<String, Any>()
+            if (ChemicalApp.userData != null) {
+                map["logIn"] = 1
+            } else {
+                map["logIn"] = 0
+            }
+            map["cabinetId"] = "a"
+            map["doorId"] = "a"
+            UiManager.switcher(this, map, InquiryActivity::class.java)
+        }
+
+        //领用
+        viewBinding.reCla.setOnClickListener {
+            if (ChemicalApp.userData != null) {
+                UiManager.switcher(this, UseActivity::class.java)
+            } else {
+                basicConfLog()
+            }
+        }
+
+        //归还
+        viewBinding.reRet.setOnClickListener {
+            if (ChemicalApp.userData != null) {
+                UiManager.switcher(this, ChemicalsAlsoActivity::class.java)
+            } else {
+                basicConfLog()
+            }
+        }
+
+        //电子台账
+        viewBinding.rlLedger.setOnClickListener {
+            if (ChemicalApp.userData != null) {
+                UiManager.switcher(this, LedgerActivity::class.java)
+            } else {
+                basicConfLog()
+            }
+        }
+
+        //标签管理
+        viewBinding.reLedger.setOnClickListener {
+
+            if (ChemicalApp.userData != null) {
+//                UiManager.switcher(this, ElectronicLedgerActivity::class.java)
+                //化学品标签
+                UiManager.switcher(this, ChemicalLabelingActivity::class.java)
+            } else {
+                basicConfLog()
+            }
+        }
+
+        //预警事件
+        viewBinding.rlWarning.setOnClickListener {
+            if (ChemicalApp.userData != null) {
+                UiManager.switcher(this, WarningEventsActivity::class.java)
+            } else {
+                basicConfLog()
+            }
+        }
+
+        //演示流程  -MSDS
+        viewBinding.rlDem.setOnClickListener {
+            //暂时不用演示流程  跳转MSDS
+//            UiManager.switcher(this, DemonstrateActivity::class.java)
+            UiManager.switcher(this, MsdsActivity::class.java)
+        }
+
+        viewBinding.inc.tvOutLogin.setOnClickListener {
+            ChemicalApp.userData = null
+            ChemicalApp.subjectId = null
+            HttpClient.token = null
+            ActivityUtils.startActivity(StartActivity::class.java)
+        }
+
+        //获取基础配置
+        basicConf()
+    }
+
     private fun callLogoutApis(callback: ((success: Boolean) -> Unit)? = null) {
         showLoading("退出中...")
         val disposable = ApiRepository.loginOut()

+ 73 - 74
app/src/main/java/xn/hxp/ui/SettingActivity.kt

@@ -1,74 +1,73 @@
-package xn.hxp.ui
-
-
-import android.content.Intent
-import android.os.Bundle
-import android.provider.Settings
-import android.view.LayoutInflater
-import com.blankj.utilcode.util.ActivityUtils
-import com.blankj.utilcode.util.GsonUtils
-import xn.hxp.comm.Constants
-import xn.hxp.databinding.ActivitySettingBinding
-import xn.hxp.utils.SharedPreferencesHelper
-import xn.hxp.utils.UiManager
-import com.lztek.toolkit.Lztek
-import com.blankj.utilcode.util.LogUtils
-import com.rc.core.ui.activity.RcBaseActivity
-import com.rc.httpcore.HttpConfig
-
-class SettingActivity : RcBaseActivity<ActivitySettingBinding>() {
-
-    private val REQUEST_ENABLE_BT = 1
-    private var mLztek: Lztek? = null
-    private var mDeviceNum: String? = null  //设备唯一标识
-    override fun createViewBinding() = ActivitySettingBinding.inflate(LayoutInflater.from(this))
-
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
-        try {
-            mLztek = Lztek.create(this)
-            val toUpperCase = mLztek!!.ethMac.toUpperCase()
-            mDeviceNum = toUpperCase.replace(":", "")
-            viewBinding.baNo.text = "$mDeviceNum"
-        } catch (e: Exception) {
-            showToast("设备编码异常")
-        }
-        viewBinding.apiBaseUrl.setText("${HttpConfig.API_BASE_URL}")
-        viewBinding.apiBaseImgUrl.setText("${HttpConfig.API_BASE_IMG_URL}")
-        viewBinding.apiBaseQcUrl.setText("${HttpConfig.API_BASE_QC_URL}")
-        viewBinding.cameraType.setText("${Constants.FACE_TAG}")
-        try {
-            val urlBase = SharedPreferencesHelper.getUrlBase(this)
-            if (urlBase != null) {
-                viewBinding.apiBaseUrl.setText("${urlBase.a}")
-                viewBinding.apiBaseImgUrl.setText("${urlBase.b}")
-                viewBinding.apiBaseQcUrl.setText("${urlBase.c}")
-                viewBinding.cameraType.setText("${urlBase.d}")
-            }
-        } catch (e: Exception) {
-        }
-        viewBinding.determine.setOnClickListener {
-            val a = viewBinding.apiBaseUrl.text.toString()    //api
-            val b = viewBinding.apiBaseImgUrl.text.toString() //文件图片地址
-            val c = viewBinding.apiBaseQcUrl.text.toString()  //二维码打印地址
-            val d = viewBinding.cameraType.text.toString()  //摄像头 前后置
-            val e = viewBinding.pwd.text.toString()// 工程密码
-            if (a == null || b == null || c == null || d == null || e == null) {
-                showToast("配置信息不能为空")
-                return@setOnClickListener
-            }
-            val settingsBean = SettingsBean(a, b, c, "$d", e)
-            LogUtils.i("======本地数据 $d")
-            SharedPreferencesHelper.saveUrlBase(this, settingsBean)
-            ActivityUtils.startActivity(SplashActivity::class.java)
-            finish()
-        }
-
-        viewBinding.blu.setOnClickListener {
-
-            val intent = Intent(Settings.ACTION_SETTINGS)
-            startActivity(intent)
-        }
-    }
-
-}
+//package xn.hxp.ui
+//
+//
+//import android.content.Intent
+//import android.os.Bundle
+//import android.provider.Settings
+//import android.view.LayoutInflater
+//import com.blankj.utilcode.util.ActivityUtils
+//import com.blankj.utilcode.util.GsonUtils
+//import xn.hxp.comm.Constants
+//import xn.hxp.databinding.ActivitySettingBinding
+//import xn.hxp.utils.SharedPreferencesHelper
+//import xn.hxp.utils.UiManager
+//import com.lztek.toolkit.Lztek
+//import com.blankj.utilcode.util.LogUtils
+//import com.rc.httpcore.HttpConfig
+//
+//class SettingActivity : RcBaseActivity<ActivitySettingBinding>() {
+//
+//    private val REQUEST_ENABLE_BT = 1
+//    private var mLztek: Lztek? = null
+//    private var mDeviceNum: String? = null  //设备唯一标识
+//    override fun createViewBinding() = ActivitySettingBinding.inflate(LayoutInflater.from(this))
+//
+//    override fun initViews(savedInstanceState: Bundle?) {
+//        super.initViews(savedInstanceState)
+//        try {
+//            mLztek = Lztek.create(this)
+//            val toUpperCase = mLztek!!.ethMac.toUpperCase()
+//            mDeviceNum = toUpperCase.replace(":", "")
+//            viewBinding.baNo.text = "$mDeviceNum"
+//        } catch (e: Exception) {
+//            showToast("设备编码异常")
+//        }
+//        viewBinding.apiBaseUrl.setText("${HttpConfig.API_BASE_URL}")
+//        viewBinding.apiBaseImgUrl.setText("${HttpConfig.API_BASE_IMG_URL}")
+//        viewBinding.apiBaseQcUrl.setText("${HttpConfig.API_BASE_QC_URL}")
+//        viewBinding.cameraType.setText("${Constants.FACE_TAG}")
+//        try {
+//            val urlBase = SharedPreferencesHelper.getUrlBase(this)
+//            if (urlBase != null) {
+//                viewBinding.apiBaseUrl.setText("${urlBase.a}")
+//                viewBinding.apiBaseImgUrl.setText("${urlBase.b}")
+//                viewBinding.apiBaseQcUrl.setText("${urlBase.c}")
+//                viewBinding.cameraType.setText("${urlBase.d}")
+//            }
+//        } catch (e: Exception) {
+//        }
+//        viewBinding.determine.setOnClickListener {
+//            val a = viewBinding.apiBaseUrl.text.toString()    //api
+//            val b = viewBinding.apiBaseImgUrl.text.toString() //文件图片地址
+//            val c = viewBinding.apiBaseQcUrl.text.toString()  //二维码打印地址
+//            val d = viewBinding.cameraType.text.toString()  //摄像头 前后置
+//            val e = viewBinding.pwd.text.toString()// 工程密码
+//            if (a == null || b == null || c == null || d == null || e == null) {
+//                showToast("配置信息不能为空")
+//                return@setOnClickListener
+//            }
+//            val settingsBean = SettingsBean(a, b, c, "$d", e)
+//            LogUtils.i("======本地数据 $d")
+//            SharedPreferencesHelper.saveUrlBase(this, settingsBean)
+//            ActivityUtils.startActivity(SplashActivity::class.java)
+//            finish()
+//        }
+//
+//        viewBinding.blu.setOnClickListener {
+//
+//            val intent = Intent(Settings.ACTION_SETTINGS)
+//            startActivity(intent)
+//        }
+//    }
+//
+//}

+ 0 - 363
app/src/main/java/xn/hxp/ui/SplashActivity.kt

@@ -1,363 +0,0 @@
-package xn.hxp.ui
-
-import android.content.Intent
-import android.net.Uri
-import android.os.Build
-import android.os.Bundle
-import android.os.Handler
-import android.util.Log
-import android.view.LayoutInflater
-import androidx.core.content.FileProvider
-import com.blankj.utilcode.util.AppUtils
-import com.blankj.utilcode.util.LogUtils
-import com.blankj.utilcode.util.SPUtils
-import com.hjq.permissions.OnPermissionCallback
-import com.hjq.permissions.Permission
-import com.hjq.permissions.XXPermissions
-import com.kongzue.dialogx.dialogs.MessageDialog
-import com.kongzue.dialogx.dialogs.PopTip
-import com.lztek.toolkit.Lztek
-import com.rc.core.ui.activity.RcBaseActivity
-import com.rc.core.util.ApkUpdater
-import com.rc.httpcore.HttpConfig
-import com.rc.httpcore.client.ApiRepository
-import com.rc.httpcore.client.HttpTool
-import okhttp3.Call
-import okhttp3.Callback
-import okhttp3.Response
-import xn.hxp.app.ChemicalApp
-import xn.hxp.comm.Constants
-import xn.hxp.databinding.ActivitySplashBinding
-import xn.hxp.utils.NetworkUtils
-import xn.hxp.utils.SharedPreferencesHelper
-import xn.hxp.utils.UiManager
-import java.io.File
-import java.io.IOException
-import java.util.concurrent.ThreadLocalRandom
-
-class SplashActivity : RcBaseActivity<ActivitySplashBinding>() {
-
-    private var mLztek: Lztek? = null
-    private var mDeviceNum: String? = null  //设备唯一标识
-    private var isOk = false
-    private var test: String = ""
-    override fun createViewBinding() = ActivitySplashBinding.inflate(LayoutInflater.from(this))
-
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
-        requestPermission()
-    }
-
-    private fun initView() {
-        viewBinding.versionName.text = "版本号:${AppUtils.getAppVersionName()}"
-        mLztek = Lztek.create(this)
-        val toUpperCase = mLztek!!.ethMac.toUpperCase()
-        mDeviceNum = toUpperCase.replace(":", "")
-        viewBinding.settings.setOnClickListener {
-            UiManager.switcher(this, SettingActivity::class.java)
-        }
-//        SharedPreferencesHelper.clearBeans(this)
-        val urlBase = SharedPreferencesHelper.getUrlBase(this)
-        if (urlBase != null) {
-            HttpConfig.API_BASE_URL = "${urlBase.a}"
-            HttpConfig.API_BASE_IMG_URL = "${urlBase.b}"
-            HttpConfig.API_BASE_QC_URL = "${urlBase.c}"
-            if (urlBase.d != null && urlBase.d.isNotEmpty()) {
-                LogUtils.i("=====摄像头 ${urlBase.d.toInt()}")
-                Constants.FACE_TAG = urlBase.d.toInt()
-            }
-        }
-
-        val isNetworkAvailable = NetworkUtils.isNetworkAvailable(this)
-        if (isNetworkAvailable) {
-            // 当前网络可用
-            queryAppVersion()
-        } else {
-            if (!isOk) {
-                SPUtils.getInstance()
-                    .put("interval", (ThreadLocalRandom.current().nextInt(20, 40) * 1000).toLong())
-                // 启动定时任务
-                myHandler.start()
-                isOk = true
-            }
-
-        }
-    }
-
-
-    private fun requestPermission() {
-
-        XXPermissions.with(this)
-            .permission(
-                Permission.CAMERA,
-                Permission.READ_EXTERNAL_STORAGE,
-                Permission.WRITE_EXTERNAL_STORAGE,
-                Permission.READ_PHONE_STATE,
-                Permission.RECORD_AUDIO
-            )
-            .request(object : OnPermissionCallback {
-                override fun onGranted(permissions: MutableList<String>, allGranted: Boolean) {
-                    if (allGranted) {
-                        initView()
-                    } else {
-                        MessageDialog.show("提示", "您必须同意所有权限才可以继续使用", "确定")
-                            .setCancelable(false).setOkButtonClickListener { dialog, v ->
-                                requestPermission()
-                                false
-                            }
-                    }
-                }
-
-                override fun onDenied(permissions: MutableList<String>, doNotAskAgain: Boolean) {
-                    super.onDenied(permissions, doNotAskAgain)
-                    if (doNotAskAgain) {
-                        MessageDialog.show("提示", "您必须同意所有权限才可以继续使用", "确定")
-                            .setCancelable(false).setOkButtonClickListener { dialog, v ->
-                                XXPermissions.startPermissionActivity(
-                                    this@SplashActivity,
-                                    permissions
-                                )
-                                false
-                            }
-                    } else {
-                        MessageDialog.show("提示", "您必须同意所有权限才可以继续使用", "确定")
-                            .setCancelable(false).setOkButtonClickListener { dialog, v ->
-                                requestPermission()
-                                false
-                            }
-                    }
-                }
-            })
-
-    }
-
-//
-//    private fun queryAppVersion() {
-//        showLoading("版本检测中...")
-//        val toDouble = DeviceUtils.getVersionName(this)//获取当前版本号
-//        val disposable = ApiRepository.apkVersion(mDeviceNum!!, 3, toDouble.toDouble())
-//            .subscribe({ data ->
-//                dismissLoading()
-//                if (data.needUpgrade) {
-//                    when {
-//                        data.appInfo.remark != null -> {
-//                            //同步进行更新
-//                            upDownloadManager(data.appInfo.remark)
-//                        }
-//                        data.appInfo.url != null -> {
-//                            upDownloadManager(data.appInfo.url)
-//                        }
-//                        else -> {
-//                            // 启动定时任务
-//                            try {
-//                                myHandler.stop()
-//                            } catch (e: Exception) {
-//
-//                            } finally {
-//                                myHandler.start()
-//                            }
-//                            showToast("版本信息不不存在")
-//                        }
-//                    }
-//                } else {
-//                    UiManager.switcher(this@SplashActivity, MainActivity::class.java)
-//                    finish()
-//                }
-//            }, { throwable ->
-//                dismissLoading()
-//                showNetError(throwable)
-//                // 启动定时任务
-//                try {
-//                    myHandler.stop()
-//                } catch (e: Exception) {
-//
-//                } finally {
-//                    myHandler.start()
-//                }
-//            })
-//        addDisposable(disposable)
-//    }
-
-    private fun queryAppVersion() {
-        // TODO 安装并重启本应用
-        showLoading("版本检测中...")
-        val toDouble = AppUtils.getAppVersionName()//获取当前版本号
-
-        //    AIO_MANAGER("aio_manager","管控一体机"),
-        //    AIO_CHEMICAL("aio_chemical","化学品一体机"),
-        //    AIO_INFOBORD("aio_infobord","电子信息牌"),
-        //    AIO_EXAM("aio_exam","学习考试一体机");
-
-        val disposable = ApiRepository.getCheck(mDeviceNum!!, "aio_chemical", toDouble.toDouble())
-            .subscribe({ data ->
-                LogUtils.json(data)
-                dismissLoading()
-                if (!data.needUpgrade) {
-                    ChemicalApp.labInfo = data.labInfo
-                    ChemicalApp.subjectId = data.labInfo.subjectId
-                    ChemicalApp.subjectName = data.labInfo.subjectName
-                    ChemicalApp.subRoom = data.labInfo.room
-                    UiManager.switcher(this@SplashActivity, MainActivity::class.java)
-                    finish()
-                } else {
-                    //需要更新
-                    if (data.appInfo != null) {
-                        when {
-                            data.appInfo!!.remark != null -> {
-                                //同步进行更新
-                                upDownloadManager(data!!.appInfo!!.remark)
-                            }
-
-                            data!!.appInfo!!.url != null -> {
-                                upDownloadManager(data.appInfo!!.url)
-                            }
-
-                            else -> {
-                                // 启动定时任务
-                                try {
-                                    myHandler.stop()
-                                } catch (e: Exception) {
-
-                                } finally {
-                                    SPUtils.getInstance()
-                                        .put(
-                                            "interval",
-                                            (ThreadLocalRandom.current()
-                                                .nextInt(20, 40) * 1000).toLong()
-                                        )
-                                    myHandler.start()
-                                }
-                                showToast("版本信息不不存在")
-                            }
-                        }
-                    } else {
-                        UiManager.switcher(this@SplashActivity, MainActivity::class.java)
-                        finish()
-                    }
-                }
-            }, { throwable ->
-                dismissLoading()
-                showNetError(throwable)
-                if (!isOk) {
-                    // 启动定时任务
-                    SPUtils.getInstance()
-                        .put(
-                            "interval",
-                            (ThreadLocalRandom.current().nextInt(20, 40) * 1000).toLong()
-                        )
-                    myHandler.start()
-                    isOk = true
-                }
-            })
-        addDisposable(disposable)
-
-    }
-
-
-    private fun upDownloadManager(downloadUrl: String) {
-        ApkUpdater(this, AppUtils.getAppPackageName(), callback = object :
-            ApkUpdater.DownloadCallback {
-            override fun onProgress(progress: Int) {
-                myHandler.stop()
-                showLoading("检测到新版本,开始更新(${progress}%)")
-            }
-
-            override fun onFailed(errMsg: String?) {
-                dismissLoading()
-                showToast("下载失败,请检查网络情况重新下载")
-                // 启动定时任务
-                try {
-                    myHandler.stop()
-                } catch (e: Exception) {
-
-                } finally {
-                    SPUtils.getInstance()
-                        .put(
-                            "interval",
-                            (ThreadLocalRandom.current().nextInt(20, 40) * 1000).toLong()
-                        )
-                    myHandler.start()
-                }
-            }
-
-            override fun onSuccess(apkFile: String) {
-                dismissLoading()
-                installApk(File(apkFile))
-//                UiManager.switcher(this@SplashActivity, MainActivity::class.java)
-//                finish()
-            }
-
-        }).downloadApk(downloadUrl)
-    }
-
-    private val myHandler = MyHandler {
-        // 在这里执行你的业务操作
-        //校验版本更新
-        val isNetworkAvailable = NetworkUtils.isNetworkAvailable(this)
-        if (isNetworkAvailable) {
-            // 当前网络可用
-            queryAppVersion()
-        } else {
-            // 当前网络不可用
-            showToast("当前网络不可用")
-        }
-
-    }
-
-
-    class MyHandler(private val callback: () -> Unit) {
-
-        private val handler = Handler()
-
-        //        private val interval: Long = 10 * 60 * 1000 // 10分钟
-
-
-        private val runnable = object : Runnable {
-            override fun run() {
-                callback.invoke()
-                handler.postDelayed(this, SPUtils.getInstance().getLong("interval", 10000L))
-            }
-        }
-
-        fun start() {
-            handler.postDelayed(runnable, SPUtils.getInstance().getLong("interval", 10000L))
-        }
-
-        fun stop() {
-            handler.removeCallbacks(runnable)
-            handler.removeCallbacksAndMessages(null)
-        }
-    }
-
-    override fun onDestroy() {
-        super.onDestroy()
-        // 停止定时任务
-        myHandler.stop()
-    }
-
-    /**
-     * 安装应用并唤起该应用
-     */
-    private fun installApk(apkFile: File) {
-        val intent = Intent(Intent.ACTION_VIEW)
-        if (Build.VERSION.SDK_INT >= 24) {
-            // 与AndroidManifest.xml中的authorities配置一致
-            val authority = AppUtils.getAppPackageName() + ".fileprovider"
-            intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
-            val uri = FileProvider.getUriForFile(this@SplashActivity, authority, apkFile)
-            intent.setDataAndType(uri, "application/vnd.android.package-archive")
-            // 如果需要新任务(Intent.FLAG_ACTIVITY_NEW_TASK),需加uri授权处理
-            // grantUriPermission(getApplicationContext(), uri, intent);
-        } else {
-            val uri = Uri.fromFile(apkFile)
-            intent.setDataAndType(uri, "application/vnd.android.package-archive")
-        }
-        intent.putExtra("IMPLUS_INSTALL", "SILENT_INSTALL")
-        // 如果需要新任务
-        // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        startActivity(intent)
-        finish()
-    }
-
-
-}

+ 177 - 0
app/src/main/java/xn/hxp/ui/StartActivity.java

@@ -0,0 +1,177 @@
+package xn.hxp.ui;
+
+import android.text.TextUtils;
+import android.view.View;
+
+import androidx.annotation.NonNull;
+import androidx.viewbinding.ViewBinding;
+
+import com.blankj.utilcode.util.ActivityUtils;
+import com.blankj.utilcode.util.AppUtils;
+import com.blankj.utilcode.util.GsonUtils;
+import com.blankj.utilcode.util.NetworkUtils;
+import com.blankj.utilcode.util.ThreadUtils;
+import com.hjq.permissions.OnPermissionCallback;
+import com.hjq.permissions.Permission;
+import com.hjq.permissions.XXPermissions;
+import com.kongzue.dialogx.dialogs.MessageDialog;
+import com.kongzue.dialogx.dialogs.PopTip;
+import com.rc.core.ui.activity.BaseActivity;
+import com.rc.httpcore.HttpConfig;
+import com.rc.httpcore.apk.LabInfo;
+import com.rc.httpcore.client.HttpTool;
+
+import org.json.JSONObject;
+
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import okhttp3.HttpUrl;
+import okhttp3.Response;
+import xn.hxp.app.ChemicalApp;
+import xn.hxp.comm.Constants;
+import xn.hxp.databinding.ActivityStartBinding;
+import xn.hxp.utils.SharedPreferencesHelper;
+
+public class StartActivity extends BaseActivity {
+    private ActivityStartBinding binding;
+
+    private int reTry = 0;
+
+    @Override
+    protected void cdFinish() {
+
+    }
+
+    @Override
+    protected void cdTime(int cd) {
+
+    }
+
+    @Override
+    protected ViewBinding setViewBinding() {
+        return binding = ActivityStartBinding.inflate(getLayoutInflater());
+    }
+
+    @Override
+    protected void onInit() {
+        requestPermission();
+    }
+
+    private void requestPermission() {
+        XXPermissions.with(this).permission(Permission.CAMERA,
+                Permission.READ_EXTERNAL_STORAGE,
+                Permission.WRITE_EXTERNAL_STORAGE,
+                Permission.READ_PHONE_STATE,
+                Permission.RECORD_AUDIO).request(new OnPermissionCallback() {
+            @Override
+            public void onGranted(@NonNull List<String> permissions, boolean allGranted) {
+                if (allGranted) {
+                    initView();
+                } else {
+                    MessageDialog.show("提示", "您必须同意所有权限才可以继续使用", "确定").setCancelable(false).setOkButtonClickListener((dialog, v) -> {
+                        requestPermission();
+                        return false;
+                    });
+                }
+            }
+
+            @Override
+            public void onDenied(@NonNull List<String> permissions, boolean doNotAskAgain) {
+                OnPermissionCallback.super.onDenied(permissions, doNotAskAgain);
+                if (doNotAskAgain) {
+                    MessageDialog.show("提示", "您必须同意所有权限才可以继续使用", "确定").setCancelable(false).setOkButtonClickListener((dialog, v) -> {
+                        XXPermissions.startPermissionActivity(StartActivity.this, permissions);
+                        return false;
+                    });
+                } else {
+                    MessageDialog.show("提示", "您必须同意所有权限才可以继续使用", "确定").setCancelable(false).setOkButtonClickListener((dialog, v) -> {
+                        requestPermission();
+                        return false;
+                    });
+                }
+            }
+        });
+    }
+
+    private void initView() {
+        binding.version.setText(AppUtils.getAppVersionName());
+
+        // 进去设置页面
+        binding.logo.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+
+            }
+        });
+
+        unreasonableCode();
+
+        ThreadUtils.executeByCachedAtFixRate(new ThreadUtils.SimpleTask<LabInfo>() {
+            @Override
+            public LabInfo doInBackground() throws Throwable {
+                boolean isAvailableByPing = NetworkUtils.isAvailableByPing(HttpUrl.get(HttpConfig.Companion.getAPI_BASE_URL()).host());
+                if (isAvailableByPing) {
+                    Response response = HttpTool.getCheck();
+                    if (response.isSuccessful()) {
+                        String json = response.body().string();
+                        JSONObject jsonObject = new JSONObject(json);
+                        int code = jsonObject.getInt("code");
+                        if (200 == code) {
+                            JSONObject data = jsonObject.getJSONObject("data");
+                            return GsonUtils.fromJson(data.getJSONObject("labInfo").toString(), LabInfo.class);
+                        } else {
+                            PopTip.show(jsonObject.getString("message"));
+                        }
+                    } else {
+                        PopTip.show(response.message());
+                    }
+                }
+                return null;
+            }
+
+            @Override
+            public void onSuccess(LabInfo labInfo) {
+                if (null != labInfo) {
+                    cancel();
+                    ChemicalApp.labInfo = labInfo;
+                    ChemicalApp.subjectId = labInfo.getSubjectId();
+                    ChemicalApp.subjectName = labInfo.getSubjectName();
+                    ChemicalApp.subRoom = labInfo.getRoom();
+                    ActivityUtils.startActivity(MainActivity.class);
+                    finish();
+                } else {
+                    reTry();
+                }
+            }
+
+            @Override
+            public void onFail(Throwable t) {
+                super.onFail(t);
+                reTry();
+            }
+        }, 20, TimeUnit.SECONDS);
+    }
+
+    private void reTry() {
+        if (reTry > 0) {
+            binding.hintTV.setText("正在连接服务器...(" + reTry + ")");
+        }
+        reTry++;
+    }
+
+    // 前同事代码
+    private void unreasonableCode() {
+        SettingsBean settingsBean = SharedPreferencesHelper.INSTANCE.getUrlBase(this);
+        if (null != settingsBean) {
+            HttpConfig.Companion.setAPI_BASE_URL(settingsBean.getA());
+            HttpConfig.Companion.setAPI_BASE_IMG_URL(settingsBean.getB());
+            HttpConfig.Companion.setAPI_BASE_QC_URL(settingsBean.getC());
+            settingsBean.getD();
+            if (!TextUtils.isEmpty(settingsBean.getD())) {
+                Constants.INSTANCE.setFACE_TAG(Integer.parseInt(settingsBean.getD()));
+            }
+        }
+    }
+
+}

+ 0 - 155
app/src/main/java/xn/hxp/ui/common/BaseCountDownActivity.java

@@ -1,155 +0,0 @@
-package xn.hxp.ui.common;
-
-import android.os.Bundle;
-import android.os.CountDownTimer;
-
-import androidx.annotation.Nullable;
-import androidx.viewbinding.ViewBinding;
-
-import com.blankj.utilcode.util.ActivityUtils;
-import com.blankj.utilcode.util.LogUtils;
-import com.kongzue.dialogx.dialogs.PopTip;
-import com.kongzue.dialogx.dialogs.WaitDialog;
-import com.rc.core.ui.activity.RcBaseActivity;
-import com.rc.httpcore.HttpClient;
-import com.rc.httpcore.bean.ConfigBean;
-import com.rc.httpcore.client.ApiRepository;
-
-import xn.hxp.app.ChemicalApp;
-import xn.hxp.comm.Constants;
-import xn.hxp.ui.SplashActivity;
-
-public abstract class BaseCountDownActivity<VB extends ViewBinding> extends RcBaseActivity<VB> {
-
-    // 公共配置倒计时长
-    private int backTime = 60;
-    // 页面自定义倒计时长
-    private int cTime = 0;
-    private CountDownTimer countDownTimer;
-
-    private void cdEnd() {
-        // 下面逻辑是之前开发者的  很难理解为什么写
-        if (Constants.INSTANCE.getVIEW_TYPE()) {
-            cdFinish();
-        } else {
-            ActivityUtils.startActivity(SplashActivity.class);
-            LogUtils.d(ActivityUtils.getActivityList());
-        }
-    }
-
-    private void invokeTime(int cd) {
-        if (!isDestroyed()) {
-            cdTime(cd);
-        }
-    }
-
-    /**
-     * 当前页最大倒计时
-     */
-    protected void setCTime(int cd) {
-        cTime = cd;
-    }
-
-    protected abstract void cdTime(int cd);
-
-    protected void cdFinish() {
-    }
-
-    /**
-     * 重置时间
-     */
-    private void reSetCdTime() {
-        ConfigBean configBean = ChemicalApp.confs;
-        if (null != configBean) {
-            backTime = configBean.getBackTime();
-            Constants.INSTANCE.setOFFTIME_TIME(configBean.getOffTime());
-        }
-    }
-
-    @Override
-    protected void onCreate(@Nullable Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        // 重置时间
-        reSetCdTime();
-        cTime = 0;
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-        openCD();
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-        stopCountDown();
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        stopCountDown();
-    }
-
-    @Override
-    public void onUserInteraction() {
-        super.onUserInteraction();
-        reSetCdTime();
-    }
-
-    private void openCD() {
-        stopCountDown();
-        countDownTimer = new CountDownTimer(1000, 1000) {
-            @Override
-            public void onTick(long millisUntilFinished) {
-
-            }
-
-
-            @Override
-            public void onFinish() {
-                if (!isFinishing() && !isDestroyed()) {
-                    if (cTime > 0) {
-                        cTime--;
-                        if (cTime <= 0) {
-                            cdEnd();
-                        } else {
-                            invokeTime(cTime);
-                        }
-                    } else {
-                        backTime--;
-                        if (backTime <= 0) {
-                            cdEnd();
-                        } else {
-                            invokeTime(backTime);
-                        }
-                    }
-                    countDownTimer.start();
-                }
-            }
-        };
-        countDownTimer.start();
-    }
-
-    protected void stopCountDown() {
-        if (null != countDownTimer) {
-            countDownTimer.cancel();
-            countDownTimer = null;
-        }
-    }
-
-    protected void callLogoutApi() {
-        WaitDialog.show("退出中...");
-        addDisposable(ApiRepository.INSTANCE.loginOut().subscribe(aBoolean -> {
-            WaitDialog.dismiss();
-            ChemicalApp.userData = null;
-            ChemicalApp.subjectId = null;
-            HttpClient.INSTANCE.setToken(null);
-            ActivityUtils.startActivity(SplashActivity.class);
-        }, throwable -> {
-            WaitDialog.dismiss();
-            PopTip.show(throwable.getMessage());
-        }));
-    }
-}

+ 0 - 135
app/src/main/java/xn/hxp/ui/common/BaseCountDownActivity.kt

@@ -1,135 +0,0 @@
-//package xn.hxp.ui.common
-//
-//import android.app.Dialog
-//import android.content.Intent
-//import android.os.Handler
-//import android.os.Looper
-//import android.os.Message
-//import android.util.Log
-//import androidx.viewbinding.ViewBinding
-//import com.blankj.utilcode.util.LogUtils
-//import xn.hxp.app.ChemicalApp
-//import xn.hxp.comm.Constants
-//import xn.hxp.iml.IBankTeps
-//import xn.hxp.ui.MainActivity
-//import xn.hxp.utils.TimesUils
-//import xn.hxp.utils.UiManager
-//import com.rc.core.ui.activity.RcBaseActivity
-//import com.rc.httpcore.client.ApiRepository
-//import com.tobey.dialogloading.DialogUtils
-//
-///**
-// * info
-// *
-// * @author ReiChin_
-// */
-//abstract class BaseCountDownActivity<VB : ViewBinding> : RcBaseActivity<VB>() {
-//    var mDialog: Dialog? = null
-//    private var mCounter = 0
-//    private var mIBankTeps: IBankTeps? = null
-//
-//    companion object {
-//        private var MAX_TIME = 60    //注销时间必须大于自动返回时间   单位
-//        private const val WHAT_COUNT_DOWN = 1
-//
-//    }
-//
-//
-//    // 在B Activity中设置回调
-//    fun seIBanks(callback: IBankTeps) {
-//        this.mIBankTeps = callback
-//    }
-//
-//    protected fun stopCountDown() {
-//        mCounter = 0
-//        mCountDownHandler.removeMessages(WHAT_COUNT_DOWN)
-//    }
-//
-//    protected fun startCountDown() {
-//        mCounter = 0
-////        Log.d("======父页面返回","--------${ChemicalApp.confs!!.backTime}")
-//        mCountDownHandler.removeMessages(WHAT_COUNT_DOWN)
-//        if (null != ChemicalApp.userData) {
-//            Constants.OFFTIME_TIME = ChemicalApp.confs!!.offTime  //弹框返回时间
-//            mCountDownHandler.sendEmptyMessage(WHAT_COUNT_DOWN)
-////            Log.d("======父页面返回","--------${ChemicalApp.confs!!.backTime}")
-//            if (ChemicalApp.confs!!.backTime != 0) {
-//                val secondsToMillisecondst =
-//                    TimesUils.secondsToMillisecondst(ChemicalApp.confs!!.backTime)
-//                MAX_TIME = ChemicalApp.confs!!.backTime
-////                Log.d("======父页面返回","--------$MAX_TIME")
-//            }
-//
-//        }
-//    }
-//
-//    override fun onResume() {
-//        super.onResume()
-////        Log.d("======父页面返回","--------232131---3231")
-//        startCountDown()
-//    }
-//
-//    override fun onPause() {
-//        super.onPause()
-//        stopCountDown()
-//    }
-//
-//    override fun onDestroy() {
-//        mCountDownHandler.removeCallbacksAndMessages(null)
-//        if (mDialog != null) {
-//            DialogUtils.Companion.closeDialog(mDialog!!)
-//        }
-//        if (Constants.VIEW_TYPE) {
-//            Constants.VIEW_TYPE = false
-//        }
-//        super.onDestroy()
-//    }
-//
-//    //和页面交互时进行触发得
-//    override fun onUserInteraction() {
-////        Log.d("===页面有交互","---------------")
-//        startCountDown()
-//    }
-//
-//    private val mCountDownHandler = object : Handler(Looper.getMainLooper()) {
-//
-//        override fun handleMessage(msg: Message) {
-//            if (WHAT_COUNT_DOWN == msg.what) {
-//                val countDown = MAX_TIME - mCounter
-//                if (isDestroyed) return
-//                if (countDown <= 0) {
-//                    if (Constants.VIEW_TYPE) {
-//                        //当前在废弃or领用页面
-//                        if (null != mIBankTeps) {
-//                            mIBankTeps!!.onViewLint()
-//                        }
-//                    } else {
-//                        UiManager.switcherCashier(
-//                            this@BaseCountDownActivity,
-//                            MainActivity::class.java
-//                        )
-//                    }
-//                } else {
-//                    sendEmptyMessageDelayed(WHAT_COUNT_DOWN, 1000)
-//                }
-//                mCounter++
-//            }
-//        }
-//    }
-//
-//
-//    protected fun callLogoutApi(callback: ((success: Boolean) -> Unit)? = null) {
-//        showLoading("退出中...")
-//        val disposable = ApiRepository.loginOut()
-//            .subscribe({
-//                dismissLoading()
-//                callback?.invoke(true)
-//            }, {
-//                dismissLoading()
-//                callback?.invoke(false)
-//            })
-//        addDisposable(disposable)
-//    }
-//
-//
-//}

+ 0 - 163
app/src/main/java/xn/hxp/ui/common/CommonListActivity.kt

@@ -1,163 +0,0 @@
-package xn.hxp.ui.common
-
-import android.annotation.SuppressLint
-import android.os.Bundle
-import android.view.View
-import android.widget.TextView
-import androidx.core.content.ContextCompat
-import androidx.recyclerview.widget.DividerItemDecoration
-import androidx.recyclerview.widget.LinearLayoutManager
-import androidx.recyclerview.widget.RecyclerView
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
-import androidx.viewbinding.ViewBinding
-import com.chad.library.adapter.base.BaseQuickAdapter
-import com.chad.library.adapter.base.listener.OnItemChildClickListener
-import com.chad.library.adapter.base.listener.OnItemClickListener
-import xn.hxp.ui.common.BaseCountDownActivity
-import xn.hxp.R
-import com.rc.core.util.FastClickDelegate
-import io.reactivex.rxjava3.disposables.Disposable
-
-/**
- * info
- *
- * @author ReiChin_
- */
-abstract class CommonListActivity<T, VB : ViewBinding> :
-    BaseCountDownActivity<VB>(),
-    OnItemClickListener,
-    OnItemChildClickListener {
-
-    companion object {
-        const val PAGE_SIZE = 7
-        const val FIRST_PAGE = 1
-    }
-
-    protected abstract val mAdapter: PageQuickAdapter<T>
-    protected abstract val mSrlRefresh: SwipeRefreshLayout
-    protected abstract val mRvContent: RecyclerView
-    protected abstract val mTvPageInfo: TextView
-    protected abstract val mTvPagePrev: TextView
-    protected abstract val mTvPageNext: TextView
-
-    protected var mCurrentPage = FIRST_PAGE
-    protected var mRefresh = false
-
-    override fun initListener() {
-        mSrlRefresh.setOnRefreshListener { loadData(true) }
-        // 上一页
-        mTvPagePrev.setOnClickListener(FastClickDelegate {
-            mCurrentPage--
-            loadData()
-        })
-        // 下一页
-        mTvPageNext.setOnClickListener(FastClickDelegate {
-            mCurrentPage++
-            loadData()
-        })
-    }
-
-    override fun initViews(savedInstanceState: Bundle?) {
-        initRecyclerView()
-    }
-
-    private fun initRecyclerView() {
-        mAdapter.setOnItemClickListener(this)
-        mAdapter.setOnItemChildClickListener(this)
-
-        mRvContent.layoutManager = createLayoutManager()
-        mAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInBottom)
-
-        createItemDecoration()?.let {
-            mRvContent.addItemDecoration(it)
-        }
-
-        mRvContent.adapter = mAdapter
-    }
-
-    override fun createItemDecoration(): RecyclerView.ItemDecoration? {
-        val decor = DividerItemDecoration(this, DividerItemDecoration.VERTICAL)
-        decor.setDrawable(ContextCompat.getDrawable(this, R.drawable.shape_item_divider)!!)
-        return decor
-    }
-
-    protected open fun createLayoutManager(): RecyclerView.LayoutManager {
-        return LinearLayoutManager(this)
-    }
-
-    override fun initData() {
-        super.initData()
-        if (autoLoadData()) {
-            loadData()
-        }
-    }
-
-    protected open fun autoLoadData() = true
-
-    /**
-     * 数据加载成功的处理逻辑
-     *
-     * @param data 从服务端查询的数据
-     */
-    protected open fun dispatchLoadDataSuccess(data: List<T>?, totalCnt: Int = 0) {
-        if (isDestroyed) return
-
-        if (mRefresh) mSrlRefresh.isRefreshing = false
-
-        if (data.isNullOrEmpty()) {
-            mAdapter.setEmptyView(R.layout.view_list_empty)
-        }
-        mAdapter.pageOffsite = (mCurrentPage - 1) * PAGE_SIZE
-        mAdapter.setNewInstance(data?.toMutableList())
-
-        updatePageInfo(totalCnt)
-    }
-
-    @SuppressLint("SetTextI18n")
-    private fun updatePageInfo(total: Int = 0) {
-        val pageCount = if (total % PAGE_SIZE == 0) total / PAGE_SIZE else total / PAGE_SIZE + 1
-        mTvPageInfo.text = "当前第 $mCurrentPage 页 共${pageCount}页 共${total}条记录"
-
-        // 上一页
-        mTvPagePrev.visibility = if (mCurrentPage > FIRST_PAGE) View.VISIBLE else View.GONE
-        // 下一页
-        mTvPageNext.visibility = if (mCurrentPage < pageCount) View.VISIBLE else View.GONE
-    }
-
-    /**
-     * 数据加载失败的处理逻辑
-     */
-    protected open fun dispatchLoadDataFailure(throwable: Throwable) {
-        if (isDestroyed) return
-
-        if (mRefresh) mSrlRefresh.isRefreshing = false
-
-        mAdapter.setNewInstance(null)
-        mAdapter.setEmptyView(R.layout.view_list_empty)
-        throwable.printStackTrace()
-        showNetError(throwable)
-        if (mCurrentPage == FIRST_PAGE) {
-            updatePageInfo()
-        }
-    }
-
-    protected fun loadData(refresh: Boolean = false) {
-        if (refresh) {
-            mCurrentPage = FIRST_PAGE
-        }
-        mRefresh = refresh
-        queryData()?.let { addDisposable(it) }
-    }
-
-    /**
-     * 查询数据
-     */
-    abstract fun queryData(): Disposable?
-
-    override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
-    }
-
-    override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
-    }
-
-}

+ 17 - 9
app/src/main/java/xn/hxp/ui/discard/ChecklistsActivity.kt

@@ -7,6 +7,7 @@ import android.view.LayoutInflater
 import android.view.View
 import androidx.core.content.ContextCompat
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
@@ -14,26 +15,31 @@ import xn.hxp.app.ChemicalApp
 import xn.hxp.R
 import xn.hxp.databinding.ActivityChecklistsBinding
 import xn.hxp.ui.adapter.ChecklistsAdapter
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.ui.still.ChemicalsAlsoActivity
 import xn.hxp.utils.TimeUpdater
 import xn.hxp.utils.UiManager
 import com.blankj.utilcode.util.LogUtils
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.client.ApiRepository
+import com.rc.httpcore.client.HttpTool
 
 //待归还清单
-class ChecklistsActivity : BaseCountDownActivity<ActivityChecklistsBinding>() {
+class ChecklistsActivity : BaseActivity() {
     private val mAdapter by lazy { ChecklistsAdapter(this) }
     private var mPages = 1  //总页码
     private var mDataPage = 10  //返回得总条数
     private var page = 1
     private var pageSize = 10
     private lateinit var timeUpdater: TimeUpdater
-    override fun createViewBinding() = ActivityChecklistsBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivityChecklistsBinding
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityChecklistsBinding.inflate(layoutInflater)
+        return viewBinding
+    }
+
+    override fun onInit() {
         initTitle()
         viewBinding.rvView?.layoutManager = LinearLayoutManager(this)
         viewBinding.rvView?.adapter = mAdapter
@@ -57,7 +63,7 @@ class ChecklistsActivity : BaseCountDownActivity<ActivityChecklistsBinding>() {
         }
 
         viewBinding.tvOutLogin.setOnClickListener {
-            callLogoutApi()
+            HttpTool.logout()
         }
 
         viewBinding.butNext.setOnClickListener {
@@ -72,10 +78,7 @@ class ChecklistsActivity : BaseCountDownActivity<ActivityChecklistsBinding>() {
             }
         }
 
-    }
 
-    override fun initData() {
-        super.initData()
         val handler = Handler(Looper.getMainLooper())
         timeUpdater = TimeUpdater(handler) { currentTime ->
             viewBinding.nowTime.text = "$currentTime"
@@ -107,6 +110,11 @@ class ChecklistsActivity : BaseCountDownActivity<ActivityChecklistsBinding>() {
         }
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
+
     override fun cdTime(cd: Int) {
         viewBinding.tvReturn.text = "返回${cd}s"
     }

+ 18 - 12
app/src/main/java/xn/hxp/ui/discard/LedgerActivity.kt

@@ -5,14 +5,14 @@ import android.os.Handler
 import android.os.Looper
 import android.view.LayoutInflater
 import androidx.core.content.ContextCompat
+import androidx.viewbinding.ViewBinding
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
+import com.rc.core.ui.activity.BaseActivity
 import xn.hxp.app.ChemicalApp
 import xn.hxp.R
 import xn.hxp.databinding.ActivityLedgerBinding
-import xn.hxp.ui.SplashActivity
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.ui.fragments.InventoryIedgerFragment
 
 import xn.hxp.ui.fragments.UseLedgerFragment
@@ -22,24 +22,28 @@ import xn.hxp.weidith.SwipeViewPager
 import xn.hxp.weidith.TabFragmentPagerAdapter
 import com.rc.httpcore.HttpClient
 import com.rc.httpcore.HttpConfig
+import com.rc.httpcore.client.HttpTool
 
 //电子台账
-class LedgerActivity : BaseCountDownActivity<ActivityLedgerBinding>() {
+class LedgerActivity : BaseActivity() {
 
 
     private lateinit var timeUpdater: TimeUpdater
     private lateinit var viewPager: SwipeViewPager
     private lateinit var pagerAdapter: TabFragmentPagerAdapter
+    lateinit var viewBinding: ActivityLedgerBinding
 
-    override fun createViewBinding() = ActivityLedgerBinding.inflate(LayoutInflater.from(this))
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityLedgerBinding.inflate(layoutInflater)
+        return viewBinding;
+    }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
         initTitle()
         fragmentInView()
         viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
         viewBinding.tvOutLogin.setOnClickListener {
-            callLogoutApi()
+            HttpTool.logout()
         }
 
         //返回
@@ -66,10 +70,6 @@ class LedgerActivity : BaseCountDownActivity<ActivityLedgerBinding>() {
             viewBinding.radioTwo.setTextColor(ContextCompat.getColor(this, R.color.purple_ff54a2ea))
             viewPager.currentItem = 1
         }
-    }
-
-    override fun initData() {
-        super.initData()
         val handler = Handler(Looper.getMainLooper())
         timeUpdater = TimeUpdater(handler) { currentTime ->
             viewBinding.nowTime.text = "$currentTime"
@@ -78,6 +78,7 @@ class LedgerActivity : BaseCountDownActivity<ActivityLedgerBinding>() {
         timeUpdater.startUpdating()
     }
 
+
     override fun onDestroy() {
         super.onDestroy()
         try {
@@ -85,6 +86,11 @@ class LedgerActivity : BaseCountDownActivity<ActivityLedgerBinding>() {
         } catch (e: Exception) {
         }
     }
+
+    override fun cdFinish() {
+        finish()
+    }
+
     override fun onBackPressed() {
         super.onBackPressed()
         finish()
@@ -115,7 +121,7 @@ class LedgerActivity : BaseCountDownActivity<ActivityLedgerBinding>() {
             .into(imageView)
 
         // 使用 Glide 加载网络图片
-        viewBinding.deptName.text="${ChemicalApp.confs!!.deptName}-${ChemicalApp.confs!!.roomNum}"
+        viewBinding.deptName.text = "${ChemicalApp.confs!!.deptName}-${ChemicalApp.confs!!.roomNum}"
         Glide.with(this)
             .load("${HttpConfig.API_BASE_IMG_URL}${ChemicalApp.confs!!.circularLogo}")
             .apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.AUTOMATIC))

+ 0 - 14
app/src/main/java/xn/hxp/ui/discard/ListReturnedActivity.kt

@@ -1,14 +0,0 @@
-package xn.hxp.ui.discard
-
-import android.view.LayoutInflater
-import xn.hxp.databinding.ActivityListReturnedBinding
-import xn.hxp.ui.common.BaseCountDownActivity
-
-//待归还清单
-class ListReturnedActivity : BaseCountDownActivity<ActivityListReturnedBinding>() {
-
-    override fun createViewBinding()= ActivityListReturnedBinding.inflate(LayoutInflater.from(this))
-    override fun cdTime(cd: Int) {
-    }
-
-}

+ 24 - 37
app/src/main/java/xn/hxp/ui/discard/WasteChemicalsActivity.kt

@@ -2,48 +2,47 @@ package xn.hxp.ui.discard
 
 import android.content.IntentFilter
 import android.hardware.usb.UsbManager
-import android.os.Bundle
 import android.os.CountDownTimer
 import android.os.Handler
 import android.os.Looper
 import android.view.KeyEvent
-import android.view.LayoutInflater
 import android.view.View
 import androidx.core.content.ContextCompat
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
+import com.blankj.utilcode.util.LogUtils
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
-import xn.hxp.app.ChemicalApp
+import com.rc.core.ui.activity.BaseActivity
+import com.rc.httpcore.HttpConfig
+import com.rc.httpcore.bean.*
+import com.rc.httpcore.client.ApiRepository
+import com.rc.httpcore.client.HttpTool
+import com.rc.httpcore.exception.NetException
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+import retrofit2.HttpException
 import xn.hxp.R
+import xn.hxp.app.ChemicalApp
 import xn.hxp.comm.Constants
 import xn.hxp.databinding.ActivityWasteChemicalsBinding
 import xn.hxp.receiver.OnSerialScanListener
 import xn.hxp.receiver.PortScanHelper
 import xn.hxp.receiver.UsbReceiver
-import xn.hxp.ui.SplashActivity
 import xn.hxp.ui.adapter.WasteChemicalsAdapter
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.ui.verify.TwoVerificationActivity
 import xn.hxp.utils.*
 import xn.hxp.weidith.CustomDialog
 import xn.hxp.weidith.DiscardDialog
 import xn.hxp.weidith.EdContDialog
 import xn.hxp.weidith.StorageDialog
-import com.blankj.utilcode.util.LogUtils
-import com.rc.httpcore.HttpConfig
-import com.rc.httpcore.bean.*
-import com.rc.httpcore.client.ApiRepository
-import com.rc.httpcore.exception.NetException
-import org.greenrobot.eventbus.EventBus
-import org.greenrobot.eventbus.Subscribe
-import org.greenrobot.eventbus.ThreadMode
-import retrofit2.HttpException
 import java.net.ConnectException
 import java.net.SocketTimeoutException
 
 //废弃-  化学品
-class WasteChemicalsActivity : BaseCountDownActivity<ActivityWasteChemicalsBinding>() {
+class WasteChemicalsActivity : BaseActivity() {
     private val mAdapter by lazy { WasteChemicalsAdapter(this) }
     private var mUsbReceiver: UsbReceiver? = null  // 刷卡广播注册
     private var mHandleScanEvent = false //当前是否已经获取过 usb返回的参数
@@ -67,16 +66,18 @@ class WasteChemicalsActivity : BaseCountDownActivity<ActivityWasteChemicalsBindi
     //    private var mStockModelList = mutableListOf<ReturnDetailsBean>()
     private var mIsLock = false //是否打开过锁  只要是只能锁被打开 就需要进行异常数据上报
 
-    override fun createViewBinding() =
-        ActivityWasteChemicalsBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivityWasteChemicalsBinding
+
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityWasteChemicalsBinding.inflate(layoutInflater)
+        return viewBinding
+    }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
         inAdapter()
-        Constants.VIEW_TYPE = true
         viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
         viewBinding.tvOutLogin.setOnClickListener {
-            callLogoutApi()
+            HttpTool.logout()
         }
 
         viewBinding.tvReturn.setOnClickListener {
@@ -159,7 +160,6 @@ class WasteChemicalsActivity : BaseCountDownActivity<ActivityWasteChemicalsBindi
                         }
 
                         override fun onTimerReply() {
-                            stopCountDown()
                         }
                     })
                 if (!this.isFinishing && !this.isDestroyed) {
@@ -217,11 +217,6 @@ class WasteChemicalsActivity : BaseCountDownActivity<ActivityWasteChemicalsBindi
             stockDetailsList()
         }
 
-    }
-
-    override fun initData() {
-        super.initData()
-
         val handler = Handler(Looper.getMainLooper())
         timeUpdater = TimeUpdater(handler) { currentTime ->
             viewBinding.nowTime.text = "$currentTime"
@@ -255,6 +250,7 @@ class WasteChemicalsActivity : BaseCountDownActivity<ActivityWasteChemicalsBindi
         }
     }
 
+
     private fun outTimeWarnData() {
         var mStockModelList = mutableListOf<TimeWarBean>()
         val map = mutableMapOf<String, Any>()
@@ -480,7 +476,6 @@ class WasteChemicalsActivity : BaseCountDownActivity<ActivityWasteChemicalsBindi
                     }
 
                     override fun onTimerReply() {
-                        stopCountDown()
                     }
                 })
             if (!this.isFinishing && !this.isDestroyed) {
@@ -1398,15 +1393,7 @@ class WasteChemicalsActivity : BaseCountDownActivity<ActivityWasteChemicalsBindi
 
     //自动返回了
     override fun cdFinish() {
-        super.cdFinish()
-        if (Constants.VIEW_TYPE) {
-            Constants.VIEW_TYPE = false
-        }
-        if (mIsLock) {
-            outTimeWarnData()
-        } else {
-            finish()
-        }
+        finish()
     }
 
 }

+ 33 - 12
app/src/main/java/xn/hxp/ui/fragments/InventoryIedgerFragment.kt

@@ -7,6 +7,7 @@ import android.view.ViewGroup
 import android.widget.AdapterView
 import androidx.core.content.ContextCompat
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
 import xn.hxp.app.ChemicalApp
 import xn.hxp.R
 import xn.hxp.databinding.FragmentInventoryIedgerBinding
@@ -17,7 +18,7 @@ import xn.hxp.ui.adapter.InventoryAdapter
 import xn.hxp.weidith.ChemicalTypeDialog
 import xn.hxp.weidith.StorageDialog
 import com.blankj.utilcode.util.LogUtils
-import com.rc.core.ui.fragment.RcBaseFragment
+import com.rc.core.ui.fragment.BaseFragment
 import com.rc.httpcore.bean.ChemicalTypeBean
 import com.rc.httpcore.bean.LockVoListBean
 import com.rc.httpcore.client.ApiRepository
@@ -26,7 +27,7 @@ import com.rc.httpcore.client.ApiRepository
 /**
  * 库存台账
  */
-class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>() {
+class InventoryIedgerFragment : BaseFragment() {
 
     private val mAdapter by lazy { InventoryAdapter(requireActivity()) }
     private var mCabinetId: String? = null
@@ -47,20 +48,21 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
     private var mDataPage = -1  //返回得总条数
     private var page = 1
     private var pageSize = 10
+
     companion object {
         fun newInstance(): InventoryIedgerFragment {
             return InventoryIedgerFragment()
         }
     }
 
-    override fun createViewBinding(
-        inflater: LayoutInflater,
-        container: ViewGroup?
-    ): FragmentInventoryIedgerBinding {
-        return FragmentInventoryIedgerBinding.inflate(inflater, container, false)
+    lateinit var viewBinding: FragmentInventoryIedgerBinding
+    override fun setViewBinding(inflater: LayoutInflater, container: ViewGroup?): ViewBinding {
+        viewBinding = FragmentInventoryIedgerBinding.inflate(inflater, container, false)
+        return viewBinding
     }
 
-    override fun initViews(savedInstanceState: Bundle?) {
+    override fun onInit() {
+
         viewBinding.rvView?.layoutManager = LinearLayoutManager(requireActivity())
         viewBinding.rvView?.adapter = mAdapter
         //获取列表信息
@@ -103,7 +105,7 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
                             override fun onClick(data: ChemicalTypeBean) {
                                 viewBinding.chemType.text = "${data.label}"
                                 viewBinding.chemType.tag = "${data.value}"
-                                mChemicalCategory="${data.value}"
+                                mChemicalCategory = "${data.value}"
                             }
                         })
                     if (!chemDialog.isShowing) {
@@ -138,9 +140,11 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
                     0 -> {
                         mChemicalLevel = null
                     }
+
                     1 -> {
                         mChemicalLevel = "1"
                     }
+
                     2 -> {
                         mChemicalLevel = "2"
                     }
@@ -179,15 +183,19 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
                     0 -> {
                         mStatus = null
                     }
+
                     1 -> {
                         mStatus = "1"
                     }
+
                     2 -> {
                         mStatus = "2"
                     }
+
                     3 -> {
                         mStatus = "3"
                     }
+
                     4 -> {
                         mStatus = "4"
                     }
@@ -228,9 +236,9 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
                 }
             }
         }
-
     }
 
+
     private fun getLists() {
         showLoading("查询中...")
         val map = mutableMapOf<String, Any>()
@@ -266,12 +274,12 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
                     dismissLoading()
                     viewBinding.total.text = "入库数:${data.total}"
                     mDataPage = data.pages  //总页
-                    if (mAdapter.data!=null){
+                    if (mAdapter.data != null) {
                         mAdapter.data.clear()
                         mAdapter.notifyDataSetChanged()
                         initPagesView(data.pages)
                     }
-                    if (data.pages!=0){
+                    if (data.pages != 0) {
                         if (data.pages > 1 && data.current > 1) {
                             //当前需要更新页码
                             upPagesView(data.pages, data.current)
@@ -304,13 +312,16 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
             1 -> {
                 viewBinding.one.visibility = View.VISIBLE
             }
+
             2 -> {
                 viewBinding.two.visibility = View.VISIBLE
             }
+
             3 -> {
                 viewBinding.two.visibility = View.VISIBLE
                 viewBinding.three.visibility = View.VISIBLE
             }
+
             else -> {
                 viewBinding.two.visibility = View.VISIBLE
                 viewBinding.three.visibility = View.VISIBLE
@@ -333,11 +344,13 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 2 -> {
                     viewBinding.three.visibility = View.GONE
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 3 -> {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
@@ -358,11 +371,13 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 2 -> {
                     viewBinding.three.visibility = View.GONE
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 3 -> {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
@@ -392,6 +407,7 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 2 -> {
 //                    viewBinding.two.visibility = View.VISIBLE
                     viewBinding.one.setTextColor(
@@ -416,6 +432,7 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 3 -> {
 //                    viewBinding.three.visibility = View.VISIBLE
                     viewBinding.one.setTextColor(
@@ -468,6 +485,7 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 2 -> {
                     viewBinding.one.setTextColor(
                         ContextCompat.getColor(
@@ -491,6 +509,7 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 3 -> {
                     viewBinding.one.setTextColor(
                         ContextCompat.getColor(
@@ -514,6 +533,7 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_page)
                 }
+
                 else -> {
                     viewBinding.three.text = "$current"
                     if (pages == current) {
@@ -583,6 +603,7 @@ class InventoryIedgerFragment : RcBaseFragment<FragmentInventoryIedgerBinding>()
             }
         }
     }
+
     //查询柜子  存储位置  默认第一个
     private fun getCabinet(tag: Int) {
         showLoading("查询中...")

+ 25 - 8
app/src/main/java/xn/hxp/ui/fragments/QueryOneFragment.kt

@@ -7,6 +7,7 @@ import android.view.ViewGroup
 import android.widget.AdapterView
 import androidx.core.content.ContextCompat
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
 import xn.hxp.app.ChemicalApp
 import xn.hxp.R
 import xn.hxp.databinding.FragmentQueryOneBinding
@@ -17,13 +18,13 @@ import xn.hxp.weidith.ChemicalTypeDialog
 import xn.hxp.weidith.EdContThDialog
 import xn.hxp.weidith.EdContTwoDialog
 import com.blankj.utilcode.util.LogUtils
-import com.rc.core.ui.fragment.RcBaseFragment
+import com.rc.core.ui.fragment.BaseFragment
 import com.rc.httpcore.bean.ChemicalTypeBean
 import com.rc.httpcore.bean.HxpStockWaitListBean
 import com.rc.httpcore.client.ApiRepository
 
 
-class QueryOneFragment : RcBaseFragment<FragmentQueryOneBinding>() {
+class QueryOneFragment : BaseFragment() {
 
     // 创建一个空的可变 Map 对象   进行初始查询
     private val mAdapterUse by lazy { InquiryItemAdapter() }  //化学品信息
@@ -36,20 +37,21 @@ class QueryOneFragment : RcBaseFragment<FragmentQueryOneBinding>() {
     private var mCabinetId: String? = null
     private var mDoorId: String? = null
     private val sPrinDate: MutableList<String> = mutableListOf()
+
     companion object {
         fun newInstance(): QueryOneFragment {
             return QueryOneFragment()
         }
     }
 
-    override fun createViewBinding(
-        inflater: LayoutInflater,
-        container: ViewGroup?,
-    ): FragmentQueryOneBinding {
-        return FragmentQueryOneBinding.inflate(inflater, container, false)
+    lateinit var viewBinding: FragmentQueryOneBinding
+    override fun setViewBinding(inflater: LayoutInflater, container: ViewGroup?): ViewBinding {
+        viewBinding = FragmentQueryOneBinding.inflate(inflater, container, false)
+        return viewBinding
     }
 
-    override fun initViews(savedInstanceState: Bundle?) {
+    override fun onInit() {
+
         viewBinding.rvUse?.layoutManager = LinearLayoutManager(requireActivity())
         viewBinding.rvUse?.adapter = mAdapterUse
         val sPinner = viewBinding.spLev
@@ -104,10 +106,12 @@ class QueryOneFragment : RcBaseFragment<FragmentQueryOneBinding>() {
                         //管控
                         "$position"
                     }
+
                     2 -> {
                         //非管控
                         "$position"
                     }
+
                     else -> {
                         null
                     }
@@ -215,6 +219,7 @@ class QueryOneFragment : RcBaseFragment<FragmentQueryOneBinding>() {
         }
     }
 
+
     // 在 Fragment 中隐藏当前 Fragment
     private fun hideCurrentFragment() {
         val transaction = requireActivity().supportFragmentManager.beginTransaction()
@@ -298,13 +303,16 @@ class QueryOneFragment : RcBaseFragment<FragmentQueryOneBinding>() {
             1 -> {
                 viewBinding.one.visibility = View.VISIBLE
             }
+
             2 -> {
                 viewBinding.two.visibility = View.VISIBLE
             }
+
             3 -> {
                 viewBinding.two.visibility = View.VISIBLE
                 viewBinding.three.visibility = View.VISIBLE
             }
+
             else -> {
                 viewBinding.two.visibility = View.VISIBLE
                 viewBinding.three.visibility = View.VISIBLE
@@ -327,11 +335,13 @@ class QueryOneFragment : RcBaseFragment<FragmentQueryOneBinding>() {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 2 -> {
                     viewBinding.three.visibility = View.GONE
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 3 -> {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
@@ -352,11 +362,13 @@ class QueryOneFragment : RcBaseFragment<FragmentQueryOneBinding>() {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 2 -> {
                     viewBinding.three.visibility = View.GONE
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 3 -> {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
@@ -386,6 +398,7 @@ class QueryOneFragment : RcBaseFragment<FragmentQueryOneBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 2 -> {
 //                    viewBinding.two.visibility = View.VISIBLE
                     viewBinding.one.setTextColor(
@@ -410,6 +423,7 @@ class QueryOneFragment : RcBaseFragment<FragmentQueryOneBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 3 -> {
 //                    viewBinding.three.visibility = View.VISIBLE
                     viewBinding.one.setTextColor(
@@ -462,6 +476,7 @@ class QueryOneFragment : RcBaseFragment<FragmentQueryOneBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 2 -> {
                     viewBinding.one.setTextColor(
                         ContextCompat.getColor(
@@ -485,6 +500,7 @@ class QueryOneFragment : RcBaseFragment<FragmentQueryOneBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 3 -> {
                     viewBinding.one.setTextColor(
                         ContextCompat.getColor(
@@ -508,6 +524,7 @@ class QueryOneFragment : RcBaseFragment<FragmentQueryOneBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_page)
                 }
+
                 else -> {
                     viewBinding.three.text = "$current"
                     if (pages == current) {

+ 22 - 10
app/src/main/java/xn/hxp/ui/fragments/QueryTwoFragment.kt

@@ -6,18 +6,19 @@ import android.view.View
 import android.view.ViewGroup
 import androidx.core.content.ContextCompat
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
 import xn.hxp.app.ChemicalApp
 import xn.hxp.R
 import xn.hxp.databinding.FragmentQueryTwoBinding
 import xn.hxp.ui.adapter.UesItemDetail
 import com.blankj.utilcode.util.LogUtils
-import com.rc.core.ui.fragment.RcBaseFragment
+import com.rc.core.ui.fragment.BaseFragment
 import com.rc.httpcore.bean.HxpStockWaitListBean
 import com.rc.httpcore.bean.QueryTwoBean
 import com.rc.httpcore.client.ApiRepository
 
 //查询-详情列表
-class QueryTwoFragment : RcBaseFragment<FragmentQueryTwoBinding>() {
+class QueryTwoFragment : BaseFragment() {
 
     private val mAdapterUse by lazy { UesItemDetail() }  //化学品信息
 
@@ -37,14 +38,13 @@ class QueryTwoFragment : RcBaseFragment<FragmentQueryTwoBinding>() {
         }
     }
 
-    override fun createViewBinding(
-        inflater: LayoutInflater,
-        container: ViewGroup?,
-    ): FragmentQueryTwoBinding {
-        return FragmentQueryTwoBinding.inflate(inflater, container, false)
+    lateinit var viewBinding: FragmentQueryTwoBinding
+    override fun setViewBinding(inflater: LayoutInflater, container: ViewGroup?): ViewBinding {
+        viewBinding = FragmentQueryTwoBinding.inflate(inflater, container, false)
+        return viewBinding
     }
 
-    override fun initViews(savedInstanceState: Bundle?) {
+    override fun onInit() {
         viewBinding.rvUse?.layoutManager = LinearLayoutManager(requireActivity())
         viewBinding.rvUse?.adapter = mAdapterUse
         viewBinding.butUpper.setOnClickListener {
@@ -142,8 +142,8 @@ class QueryTwoFragment : RcBaseFragment<FragmentQueryTwoBinding>() {
         mChemicalId = hxpStockWaitListBean.chemicalId
         mCabinetId = cabinetId
         mDoorId = doorId
-        page=1
-        pageSize=10
+        page = 1
+        pageSize = 10
         getList()
     }
 
@@ -162,13 +162,16 @@ class QueryTwoFragment : RcBaseFragment<FragmentQueryTwoBinding>() {
             1 -> {
                 viewBinding.one.visibility = View.VISIBLE
             }
+
             2 -> {
                 viewBinding.two.visibility = View.VISIBLE
             }
+
             3 -> {
                 viewBinding.two.visibility = View.VISIBLE
                 viewBinding.three.visibility = View.VISIBLE
             }
+
             else -> {
                 viewBinding.two.visibility = View.VISIBLE
                 viewBinding.three.visibility = View.VISIBLE
@@ -191,11 +194,13 @@ class QueryTwoFragment : RcBaseFragment<FragmentQueryTwoBinding>() {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 2 -> {
                     viewBinding.three.visibility = View.GONE
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 3 -> {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
@@ -216,11 +221,13 @@ class QueryTwoFragment : RcBaseFragment<FragmentQueryTwoBinding>() {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 2 -> {
                     viewBinding.three.visibility = View.GONE
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 3 -> {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
@@ -250,6 +257,7 @@ class QueryTwoFragment : RcBaseFragment<FragmentQueryTwoBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 2 -> {
 //                    viewBinding.two.visibility = View.VISIBLE
                     viewBinding.one.setTextColor(
@@ -274,6 +282,7 @@ class QueryTwoFragment : RcBaseFragment<FragmentQueryTwoBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 3 -> {
 //                    viewBinding.three.visibility = View.VISIBLE
                     viewBinding.one.setTextColor(
@@ -326,6 +335,7 @@ class QueryTwoFragment : RcBaseFragment<FragmentQueryTwoBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 2 -> {
                     viewBinding.one.setTextColor(
                         ContextCompat.getColor(
@@ -349,6 +359,7 @@ class QueryTwoFragment : RcBaseFragment<FragmentQueryTwoBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 3 -> {
                     viewBinding.one.setTextColor(
                         ContextCompat.getColor(
@@ -372,6 +383,7 @@ class QueryTwoFragment : RcBaseFragment<FragmentQueryTwoBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_page)
                 }
+
                 else -> {
                     viewBinding.three.text = "$current"
                     if (pages == current) {

+ 23 - 9
app/src/main/java/xn/hxp/ui/fragments/UseLedgerFragment.kt

@@ -7,6 +7,7 @@ import android.view.ViewGroup
 import android.widget.AdapterView
 import androidx.core.content.ContextCompat
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
 import xn.hxp.app.ChemicalApp
 import xn.hxp.R
 import xn.hxp.databinding.FragmentUseLedgerBinding
@@ -19,7 +20,7 @@ import xn.hxp.utils.UiManager
 import xn.hxp.weidith.ChemicalTypeDialog
 import xn.hxp.weidith.StorageDialog
 import com.blankj.utilcode.util.LogUtils
-import com.rc.core.ui.fragment.RcBaseFragment
+import com.rc.core.ui.fragment.BaseFragment
 import com.rc.httpcore.bean.ChemicalTypeBean
 import com.rc.httpcore.bean.LockVoListBean
 import com.rc.httpcore.client.ApiRepository
@@ -29,7 +30,7 @@ import kotlinx.coroutines.Job
 /**
  *  使用台账
  */
-class UseLedgerFragment : RcBaseFragment<FragmentUseLedgerBinding>() {
+class UseLedgerFragment : BaseFragment() {
 
     private val mAdapter by lazy { UseLedgerAdapter() }
     private var mCabinetId: String? = null
@@ -57,14 +58,14 @@ class UseLedgerFragment : RcBaseFragment<FragmentUseLedgerBinding>() {
         }
     }
 
-    override fun createViewBinding(
-        inflater: LayoutInflater,
-        container: ViewGroup?
-    ): FragmentUseLedgerBinding {
-        return FragmentUseLedgerBinding.inflate(inflater, container, false)
+    lateinit var viewBinding: FragmentUseLedgerBinding
+
+    override fun setViewBinding(inflater: LayoutInflater, container: ViewGroup?): ViewBinding {
+        viewBinding = FragmentUseLedgerBinding.inflate(inflater, container, false)
+        return viewBinding
     }
 
-    override fun initViews(savedInstanceState: Bundle?) {
+    override fun onInit() {
 
         viewBinding.rvView?.layoutManager = LinearLayoutManager(requireActivity())
         viewBinding.rvView?.adapter = mAdapter
@@ -131,9 +132,11 @@ class UseLedgerFragment : RcBaseFragment<FragmentUseLedgerBinding>() {
                     0 -> {
                         mChemicalLevel = null
                     }
+
                     1 -> {
                         mChemicalLevel = "1"
                     }
+
                     2 -> {
                         mChemicalLevel = "2"
                     }
@@ -190,7 +193,6 @@ class UseLedgerFragment : RcBaseFragment<FragmentUseLedgerBinding>() {
                 }
             }
         }
-
     }
 
 
@@ -266,13 +268,16 @@ class UseLedgerFragment : RcBaseFragment<FragmentUseLedgerBinding>() {
             1 -> {
                 viewBinding.one.visibility = View.VISIBLE
             }
+
             2 -> {
                 viewBinding.two.visibility = View.VISIBLE
             }
+
             3 -> {
                 viewBinding.two.visibility = View.VISIBLE
                 viewBinding.three.visibility = View.VISIBLE
             }
+
             else -> {
                 viewBinding.two.visibility = View.VISIBLE
                 viewBinding.three.visibility = View.VISIBLE
@@ -295,11 +300,13 @@ class UseLedgerFragment : RcBaseFragment<FragmentUseLedgerBinding>() {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 2 -> {
                     viewBinding.three.visibility = View.GONE
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 3 -> {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
@@ -320,11 +327,13 @@ class UseLedgerFragment : RcBaseFragment<FragmentUseLedgerBinding>() {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 2 -> {
                     viewBinding.three.visibility = View.GONE
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 3 -> {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
@@ -354,6 +363,7 @@ class UseLedgerFragment : RcBaseFragment<FragmentUseLedgerBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 2 -> {
 //                    viewBinding.two.visibility = View.VISIBLE
                     viewBinding.one.setTextColor(
@@ -378,6 +388,7 @@ class UseLedgerFragment : RcBaseFragment<FragmentUseLedgerBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 3 -> {
 //                    viewBinding.three.visibility = View.VISIBLE
                     viewBinding.one.setTextColor(
@@ -430,6 +441,7 @@ class UseLedgerFragment : RcBaseFragment<FragmentUseLedgerBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 2 -> {
                     viewBinding.one.setTextColor(
                         ContextCompat.getColor(
@@ -453,6 +465,7 @@ class UseLedgerFragment : RcBaseFragment<FragmentUseLedgerBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 3 -> {
                     viewBinding.one.setTextColor(
                         ContextCompat.getColor(
@@ -476,6 +489,7 @@ class UseLedgerFragment : RcBaseFragment<FragmentUseLedgerBinding>() {
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_page)
                 }
+
                 else -> {
                     viewBinding.three.text = "$current"
                     if (pages == current) {

+ 23 - 17
app/src/main/java/xn/hxp/ui/inquiry/InquiryActivity.kt

@@ -11,21 +11,21 @@ import android.view.LayoutInflater
 import android.view.View
 import android.widget.AdapterView
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
 import com.blankj.utilcode.util.LogUtils
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
 import com.chad.library.adapter.base.util.getItemView
+import com.rc.core.ui.activity.BaseActivity
 import xn.hxp.app.ChemicalApp
 import xn.hxp.R
 import xn.hxp.databinding.ActivityInquiryBinding
 import xn.hxp.receiver.OnSerialScanListener
 import xn.hxp.receiver.PortScanHelper
 import xn.hxp.receiver.UsbReceiver
-import xn.hxp.ui.SplashActivity
 import xn.hxp.ui.adapter.CabinetDoorAdapter
 import xn.hxp.ui.adapter.CabinetDoorRighAdapter
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.ui.fragments.QueryOneFragment
 import xn.hxp.ui.fragments.QueryTwoFragment
 import xn.hxp.ui.login.FacialCardActivity
@@ -37,12 +37,13 @@ import xn.hxp.weidith.*
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.bean.*
 import com.rc.httpcore.client.ApiRepository
+import com.rc.httpcore.client.HttpTool
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
 
 //化学品-查询   已登录-未登录   未登录-扫码弹框提示当前某一个信息   已登陆 显示所有列表
-class InquiryActivity : BaseCountDownActivity<ActivityInquiryBinding>() {
+class InquiryActivity : BaseActivity() {
 
     private lateinit var timeUpdater: TimeUpdater
     private var logIn = 0  //未登录
@@ -63,10 +64,13 @@ class InquiryActivity : BaseCountDownActivity<ActivityInquiryBinding>() {
     private lateinit var faceList: List<String>//人员区间值
     private var mLoginType: String? = null //登录方式
 
-    override fun createViewBinding() = ActivityInquiryBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivityInquiryBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityInquiryBinding.inflate(layoutInflater)
+        return viewBinding
+    }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
         logIn = intent.getIntExtra("logIn", 0)
         val stringExtra = intent.getStringExtra("cabinetId")
         val stringExtra1 = intent.getStringExtra("doorId")
@@ -78,7 +82,7 @@ class InquiryActivity : BaseCountDownActivity<ActivityInquiryBinding>() {
         //注册广播
         EventBus.getDefault().register(this)
         viewBinding.tvOutLogin.setOnClickListener {
-            callLogoutApi ()
+            HttpTool.logout()
         }
 
         if (logIn == 1) {
@@ -135,6 +139,13 @@ class InquiryActivity : BaseCountDownActivity<ActivityInquiryBinding>() {
                 showToast("无权限信息")
             }
         }
+
+        val handler = Handler(Looper.getMainLooper())
+        timeUpdater = TimeUpdater(handler) { currentTime ->
+            viewBinding.nowTime.text = "$currentTime"
+        }
+        // 启动定时更新
+        timeUpdater.startUpdating()
     }
 
     private fun initTitle() {
@@ -234,16 +245,6 @@ class InquiryActivity : BaseCountDownActivity<ActivityInquiryBinding>() {
     }
 
 
-    override fun initData() {
-        super.initData()
-        val handler = Handler(Looper.getMainLooper())
-        timeUpdater = TimeUpdater(handler) { currentTime ->
-            viewBinding.nowTime.text = "$currentTime"
-        }
-        // 启动定时更新
-        timeUpdater.startUpdating()
-    }
-
     //查询存储位置  默认第一个
     private fun getCabinet(subId: String) {
         showLoading("查询中...")
@@ -459,6 +460,10 @@ class InquiryActivity : BaseCountDownActivity<ActivityInquiryBinding>() {
         EventBus.getDefault().unregister(this) //关闭广播
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
     //必须写这个方法  防止注册失败
     @Subscribe(threadMode = ThreadMode.MAIN)
     fun onUpdateEventEvent(event: KeyEvent) {
@@ -475,6 +480,7 @@ class InquiryActivity : BaseCountDownActivity<ActivityInquiryBinding>() {
         viewBinding.tvReturn.text = "返回${cd}s"
     }
 
+
     //==========================开锁信息===================
 
     //=================开锁流程================

+ 17 - 15
app/src/main/java/xn/hxp/ui/inquiry/QueryDetailsActivity.kt

@@ -4,42 +4,44 @@ package xn.hxp.ui.inquiry
 import android.os.Bundle
 import android.view.LayoutInflater
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
+import com.rc.core.ui.activity.BaseActivity
 import xn.hxp.app.ChemicalApp
 import xn.hxp.databinding.ActivityQueryDetailsBinding
 import xn.hxp.ui.adapter.CabinetDoorAdapter
 import xn.hxp.ui.adapter.CabinetDoorRighAdapter
-import xn.hxp.ui.common.BaseCountDownActivity
 import com.rc.httpcore.client.ApiRepository
 
 //查询 详情
-class QueryDetailsActivity : BaseCountDownActivity<ActivityQueryDetailsBinding>() {
+class QueryDetailsActivity : BaseActivity() {
 
     val mutableMap = mutableMapOf<String, String>()
     private val mAdapterLeft by lazy { CabinetDoorAdapter(this) }  //左边柜子
     private val mAdapterRigh by lazy { CabinetDoorRighAdapter(this) }  //右边柜子
 
-    override fun createViewBinding() =
-        ActivityQueryDetailsBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivityQueryDetailsBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityQueryDetailsBinding.inflate(layoutInflater)
+        return viewBinding
+    }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
-        inAdapter()
-        viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
+    override fun cdFinish() {
+        finish()
+    }
 
+    override fun cdTime(cd: Int) {
+        viewBinding.tvReturn.text = "返回${cd}s"
     }
 
-    override fun initData() {
-        super.initData()
+    override fun onInit() {
+        inAdapter()
+        viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
         val stockId = intent.getStringExtra("stockId")
         if (stockId != null) {
             getList(stockId)
         }
     }
 
-    override fun cdTime(cd: Int) {
-        viewBinding.tvReturn.text = "返回${cd}s"
-    }
-
     private fun getList(stockId: String) {
 //        showLoading("查询中...")
 //        mutableMap["stockId"] = stockId
@@ -64,7 +66,7 @@ class QueryDetailsActivity : BaseCountDownActivity<ActivityQueryDetailsBinding>(
             mAdapterRigh.data.forEach { it.isType = false }  //柜门初始化
             mAdapterLeft.notifyDataSetChanged()
             if (mAdapterLeft.data[position].cabinetDoorVoList != null) {
-                mAdapterLeft.data[position].isType=true
+                mAdapterLeft.data[position].isType = true
                 mAdapterRigh.setNewInstance(mAdapterLeft.data[position].cabinetDoorVoList.toMutableList())
             }
         }

+ 13 - 18
app/src/main/java/xn/hxp/ui/login/FacialCardActivity.kt

@@ -10,6 +10,7 @@ import android.view.MotionEvent
 import android.view.View
 import android.widget.TextView
 import androidx.appcompat.app.AlertDialog
+import androidx.viewbinding.ViewBinding
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
@@ -19,11 +20,11 @@ import xn.hxp.databinding.ActivityFacialCardBinding
 import xn.hxp.receiver.OnSerialScanListener
 import xn.hxp.receiver.PortScanHelper
 import xn.hxp.receiver.UsbReceiver
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.utils.MediaPlayerHelper
 import xn.hxp.weidith.AuthenticationDialog
 import xn.hxp.weidith.CustomDialog
 import com.blankj.utilcode.util.LogUtils
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpClient
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.client.ApiRepository
@@ -48,7 +49,7 @@ import java.text.SimpleDateFormat
 import java.util.*
 
 //刷卡+人脸   登录方式
-class FacialCardActivity : BaseCountDownActivity<ActivityFacialCardBinding>() {
+class FacialCardActivity : BaseActivity() {
     private var mUsbReceiver: UsbReceiver? = null  // 刷卡广播注册
     private var mHandleScanEvent = false //当前是否已经获取过 usb返回的参数
     private lateinit var mFotoapparat: Fotoapparat
@@ -63,12 +64,14 @@ class FacialCardActivity : BaseCountDownActivity<ActivityFacialCardBinding>() {
     private var timeLeftInSeconds = 2
     private var mTvView: TextView? = null
     private var mDialogsAut: AuthenticationDialog? = null
-    private val countHandler = Handler(Looper.getMainLooper()) //整个页面 60秒后 直接关闭
 
-    override fun createViewBinding() = ActivityFacialCardBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivityFacialCardBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityFacialCardBinding.inflate(layoutInflater)
+        return viewBinding
+    }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
         //注册广播
         EventBus.getDefault().register(this)
         MediaPlayerHelper.playRawMp3(this, R.raw.login_shua_ka)
@@ -86,9 +89,6 @@ class FacialCardActivity : BaseCountDownActivity<ActivityFacialCardBinding>() {
             .load("${HttpConfig.API_BASE_IMG_URL}${ChemicalApp.confs!!.circularLogo}")
             .apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.AUTOMATIC))
             .into(viewBinding.image)
-        countHandler.postDelayed({
-            finish()
-        }, totalTimeInMillis) // 50秒后关闭
     }
 
     override fun onResume() {
@@ -296,11 +296,6 @@ class FacialCardActivity : BaseCountDownActivity<ActivityFacialCardBinding>() {
         addDisposable(disposable)
     }
 
-    override fun initData() {
-        super.initData()
-    }
-
-
     override fun onBackPressed() {
         super.onBackPressed()
         finish()
@@ -310,6 +305,7 @@ class FacialCardActivity : BaseCountDownActivity<ActivityFacialCardBinding>() {
         viewBinding.tvReturn.text = "返回${cd}s"
     }
 
+
     //获取刷卡信息
     override fun dispatchKeyEvent(event: KeyEvent): Boolean {
         mPortScanHelper.dispatchKeyEvent(event)
@@ -353,11 +349,10 @@ class FacialCardActivity : BaseCountDownActivity<ActivityFacialCardBinding>() {
         } catch (e: Exception) {
 
         }
+    }
 
-        try {
-            countHandler.removeCallbacksAndMessages(null)
-        } catch (e: Exception) {
-        }
+    override fun cdFinish() {
+        finish()
     }
 
     //必须写这个方法  防止注册失败

+ 14 - 33
app/src/main/java/xn/hxp/ui/login/FacialLoginActivity.kt

@@ -9,10 +9,12 @@ import android.view.LayoutInflater
 import android.view.MotionEvent
 import android.view.View
 import android.widget.TextView
+import androidx.viewbinding.ViewBinding
 import com.blankj.utilcode.util.LogUtils
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpClient
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.client.ApiRepository
@@ -30,7 +32,6 @@ import xn.hxp.R
 import xn.hxp.app.ChemicalApp
 import xn.hxp.comm.Constants
 import xn.hxp.databinding.ActivityFacialLoginBinding
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.utils.MediaPlayerHelper
 import xn.hxp.utils.UiManager
 import xn.hxp.weidith.AuthenticationDialog
@@ -46,7 +47,7 @@ import java.util.Locale
 /**
  * 人脸登录
  */
-class FacialLoginActivity : BaseCountDownActivity<ActivityFacialLoginBinding>() {
+class FacialLoginActivity : BaseActivity() {
 
     private lateinit var mFotoapparat: Fotoapparat
 //    private lateinit var mCountDownTimer: CountDownTimer
@@ -57,11 +58,13 @@ class FacialLoginActivity : BaseCountDownActivity<ActivityFacialLoginBinding>()
     private var mTvView: TextView? = null
     private var mDialogsAut: AuthenticationDialog? = null
 
-    override fun createViewBinding() = ActivityFacialLoginBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivityFacialLoginBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityFacialLoginBinding.inflate(layoutInflater)
+        return viewBinding
+    }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
-        setCTime(30)
+    override fun onInit() {
         MediaPlayerHelper.playRawMp3(this, R.raw.login_ren_lian)
         // 使用 Glide 加载网络图片
         viewBinding.deptName.text = "${ChemicalApp.confs!!.deptName}-${ChemicalApp.confs!!.roomNum}"
@@ -141,36 +144,9 @@ class FacialLoginActivity : BaseCountDownActivity<ActivityFacialLoginBinding>()
             .build()
         mFotoapparat.stop()
         mFotoapparat.start()
-//        mCountDownTimer = object : CountDownTimer(totalTimeInMillis, 1000) {
-//            override fun onTick(millisUntilFinished: Long) {
-//                val secondsRemaining = millisUntilFinished / 1000
-//                // 在最后六秒进行提示
-//                if (secondsRemaining.toInt() == 6) {
-//                    val message = "多次识别失败 $secondsRemaining 秒后关闭当前页面,请注意!"
-//                    showToast(message)
-//                }
-//            }
-//
-//            override fun onFinish() {
-//                mFotoapparat.stop()
-//                cancelTime()
-//                finish()
-//            }
-//        }
-//        mCountDownTimer.start()
         handlerBack.post(countdownRunnableTwo)
     }
 
-    override fun onStart() {
-        super.onStart()
-//        mFotoapparat.start()
-    }
-
-    override fun onStop() {
-        super.onStop()
-//        mFotoapparat.stop()
-    }
-
     override fun onBackPressed() {
         super.onBackPressed()
         finish()
@@ -180,6 +156,7 @@ class FacialLoginActivity : BaseCountDownActivity<ActivityFacialLoginBinding>()
         viewBinding.tvReturn.text = "返回${cd}s"
     }
 
+
     override fun onDestroy() {
         super.onDestroy()
 //        cancelTime()//手动关闭
@@ -199,6 +176,10 @@ class FacialLoginActivity : BaseCountDownActivity<ActivityFacialLoginBinding>()
         }
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
     private fun takePicture() {
         LogUtils.i("=======111人脸登录任务进行中")
         val format = SimpleDateFormat("yyyyMMdd_HHmmssSSS", Locale.getDefault())

+ 58 - 49
app/src/main/java/xn/hxp/ui/login/ScanLoginActivity.kt

@@ -10,6 +10,7 @@ import android.view.MotionEvent
 import android.view.View
 import android.widget.ImageView
 import android.widget.TextView
+import androidx.viewbinding.ViewBinding
 import com.blankj.utilcode.util.LogUtils
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
@@ -20,13 +21,13 @@ import com.google.zxing.WriterException
 import com.google.zxing.common.BitMatrix
 import com.kongzue.dialogx.dialogs.PopTip
 import com.lztek.toolkit.Lztek
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpClient
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.client.ApiRepository
 import xn.hxp.R
 import xn.hxp.app.ChemicalApp
 import xn.hxp.databinding.ActivityScanLoginBinding
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.utils.MediaPlayerHelper
 import xn.hxp.utils.TimesUils
 import xn.hxp.utils.UiManager
@@ -42,59 +43,17 @@ import kotlin.Unit
 import kotlin.let
 
 //扫码登录
-class ScanLoginActivity : BaseCountDownActivity<ActivityScanLoginBinding>() {
+class ScanLoginActivity : BaseActivity() {
     private var mLztek: Lztek? = null
     private var mDeviceNum: String? = null  //设备唯一标识
 
-    override fun createViewBinding() = ActivityScanLoginBinding.inflate(LayoutInflater.from(this))
-
-    override fun initData() {
-        super.initData()
-        MediaPlayerHelper.playRawMp3(this, R.raw.login_wei_xin_sao_ma)
-        viewBinding.deptName.text = "${ChemicalApp.confs!!.deptName}-${ChemicalApp.confs!!.roomNum}"
-        viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
-        Glide.with(this)
-            .load("${HttpConfig.API_BASE_IMG_URL}${ChemicalApp.confs!!.circularLogo}")
-            .apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.AUTOMATIC))
-            .into(viewBinding.image)
-        val stringExtra = intent.getStringExtra("mtypes")
-        val map = mutableMapOf<String, String>()
-        if (stringExtra != null) {
-            map["mtypes"] = stringExtra
-        }
-
-        when (stringExtra) {
-            "1" -> {
-                viewBinding.linType.visibility = View.GONE
-            }
-
-            "6" -> {
-                viewBinding.tvFace.visibility = View.GONE
-            }
-        }
-        try {
-            var str = intent.getStringExtra("faceList")
-            if (str != null) {
-                map["faceList"] = str
-            }
-        } catch (e: Exception) {
-
-        }
-        //人脸识别
-        viewBinding.tvFace.setOnClickListener {
-            UiManager.switcher(this, map, FacialLoginActivity::class.java)
-            finish()
-        }
-        //刷卡
-        viewBinding.tvCrad.setOnClickListener {
-            UiManager.switcher(this, map, SwipeActivity::class.java)
-            finish()
-        }
+    lateinit var viewBinding: ActivityScanLoginBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityScanLoginBinding.inflate(layoutInflater)
+        return viewBinding
     }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
-
+    override fun onInit() {
         val stringExtra = intent.getStringExtra("mtypes")
         if (stringExtra == "1") {
             viewBinding.linType.visibility = View.GONE
@@ -134,8 +93,53 @@ class ScanLoginActivity : BaseCountDownActivity<ActivityScanLoginBinding>() {
 
         viewBinding.tvReturn.setOnClickListener { finish() }
 
+
+        MediaPlayerHelper.playRawMp3(this, R.raw.login_wei_xin_sao_ma)
+        viewBinding.deptName.text = "${ChemicalApp.confs!!.deptName}-${ChemicalApp.confs!!.roomNum}"
+        viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
+        Glide.with(this)
+            .load("${HttpConfig.API_BASE_IMG_URL}${ChemicalApp.confs!!.circularLogo}")
+            .apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.AUTOMATIC))
+            .into(viewBinding.image)
+
+        initData();
     }
 
+    private fun initData() {
+        val stringExtra = intent.getStringExtra("mtypes")
+        val map = mutableMapOf<String, String>()
+        if (stringExtra != null) {
+            map["mtypes"] = stringExtra
+        }
+
+        when (stringExtra) {
+            "1" -> {
+                viewBinding.linType.visibility = View.GONE
+            }
+
+            "6" -> {
+                viewBinding.tvFace.visibility = View.GONE
+            }
+        }
+        try {
+            var str = intent.getStringExtra("faceList")
+            if (str != null) {
+                map["faceList"] = str
+            }
+        } catch (e: Exception) {
+
+        }
+        //人脸识别
+        viewBinding.tvFace.setOnClickListener {
+            UiManager.switcher(this, map, FacialLoginActivity::class.java)
+            finish()
+        }
+        //刷卡
+        viewBinding.tvCrad.setOnClickListener {
+            UiManager.switcher(this, map, SwipeActivity::class.java)
+            finish()
+        }
+    }
 
     private val myHandler = MyHandler {
         logInAuthScan()
@@ -260,6 +264,10 @@ class ScanLoginActivity : BaseCountDownActivity<ActivityScanLoginBinding>() {
         }
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
     class MyHandler(private val callback: () -> Unit) {
 
         private val handler = Handler()
@@ -293,6 +301,7 @@ class ScanLoginActivity : BaseCountDownActivity<ActivityScanLoginBinding>() {
         viewBinding.tvReturn.text = "返回${cd}s"
     }
 
+
     private val handlerBack = Handler(Looper.getMainLooper())
     private var timeLeftInSeconds = 2
     private var mTvView: TextView? = null

+ 13 - 7
app/src/main/java/xn/hxp/ui/login/SwipeActivity.kt

@@ -10,11 +10,13 @@ import android.view.LayoutInflater
 import android.view.MotionEvent
 import android.view.View
 import android.widget.TextView
+import androidx.viewbinding.ViewBinding
 import com.blankj.utilcode.util.ActivityUtils
 import com.blankj.utilcode.util.LogUtils
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpClient
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.bean.UserData
@@ -31,7 +33,6 @@ import xn.hxp.receiver.OnSerialScanListener
 import xn.hxp.receiver.PortScanHelper
 import xn.hxp.receiver.UsbReceiver
 import xn.hxp.ui.MainActivity
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.utils.MediaPlayerHelper
 import xn.hxp.utils.UiManager
 import xn.hxp.weidith.AuthenticationDialog
@@ -42,15 +43,17 @@ import java.net.SocketTimeoutException
 /**
  * 刷卡登录
  */
-class SwipeActivity : BaseCountDownActivity<ActivitySwipeBinding>() {
+class SwipeActivity : BaseActivity() {
     private var mUsbReceiver: UsbReceiver? = null  // 刷卡广播注册
     private var mHandleScanEvent = false //当前是否已经获取过 usb返回的参数
 
+    lateinit var viewBinding: ActivitySwipeBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivitySwipeBinding.inflate(layoutInflater)
+        return viewBinding
+    }
 
-    override fun createViewBinding() = ActivitySwipeBinding.inflate(LayoutInflater.from(this))
-
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
         MediaPlayerHelper.playRawMp3(this, R.raw.login_shua_ka)
         //注册广播
         EventBus.getDefault().register(this)
@@ -105,7 +108,6 @@ class SwipeActivity : BaseCountDownActivity<ActivitySwipeBinding>() {
         }
     }
 
-
     override fun onResume() {
         super.onResume()
         mPortScanHelper.onResume()
@@ -235,6 +237,10 @@ class SwipeActivity : BaseCountDownActivity<ActivitySwipeBinding>() {
         EventBus.getDefault().unregister(this) //关闭广播
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
     //必须写这个方法  防止注册失败
     @Subscribe(threadMode = ThreadMode.MAIN)
     fun onUpdateEventEvent(event: KeyEvent) {

+ 21 - 15
app/src/main/java/xn/hxp/ui/plan/PlanAddActivity.java

@@ -2,7 +2,6 @@ package xn.hxp.ui.plan;
 
 import android.content.Intent;
 import android.database.DataSetObserver;
-import android.os.Bundle;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.KeyEvent;
@@ -12,9 +11,8 @@ import androidx.activity.result.ActivityResult;
 import androidx.activity.result.ActivityResultCallback;
 import androidx.activity.result.ActivityResultLauncher;
 import androidx.activity.result.contract.ActivityResultContracts;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
 import androidx.fragment.app.Fragment;
+import androidx.viewbinding.ViewBinding;
 import androidx.viewpager2.widget.ViewPager2;
 
 import com.blankj.utilcode.util.GsonUtils;
@@ -23,9 +21,12 @@ import com.blankj.utilcode.util.ThreadUtils;
 import com.blankj.utilcode.util.TimeUtils;
 import com.bumptech.glide.Glide;
 import com.kongzue.dialogx.dialogs.PopTip;
+import com.rc.core.ui.activity.BaseActivity;
 import com.rc.httpcore.HttpConfig;
 import com.rc.httpcore.bean.ChemicalInfoBean;
+import com.rc.httpcore.client.HttpTool;
 
+import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -35,7 +36,6 @@ import java.util.Locale;
 import xn.hxp.app.ChemicalApp;
 import xn.hxp.databinding.ActivityPlanAddBinding;
 import xn.hxp.receiver.PortScanHelper;
-import xn.hxp.ui.common.BaseCountDownActivity;
 import xn.hxp.ui.plan.add.AddActivity;
 import xn.hxp.ui.plan.locker.LockerAdapter;
 import xn.hxp.ui.plan.room.RoomTool;
@@ -55,7 +55,7 @@ import xn.hxp.ui.plan.unlock.UnlockActivity;
 /**
  * 待录入页面
  */
-public class PlanAddActivity extends BaseCountDownActivity<ActivityPlanAddBinding> {
+public class PlanAddActivity extends BaseActivity {
 
     protected ActivityPlanAddBinding binding;
     // 柜子fragmentAdapter
@@ -88,15 +88,15 @@ public class PlanAddActivity extends BaseCountDownActivity<ActivityPlanAddBindin
     protected ActivityResultLauncher<Intent> intentActivityResultLauncher;
     protected PortScanHelper portScanHelper;
 
-    @NonNull
+
     @Override
-    protected ActivityPlanAddBinding createViewBinding() {
+    protected ViewBinding setViewBinding() {
         return binding = ActivityPlanAddBinding.inflate(getLayoutInflater());
     }
 
+
     @Override
-    protected void initViews(@Nullable Bundle savedInstanceState) {
-        super.initViews(savedInstanceState);
+    protected void onInit() {
         hxpCabinetDAO = RoomTool.getInstance().hxpCabinetDAO();
         hxpCabinetDAO.deleteAll();
         hxpDoorDAO = RoomTool.getInstance().hxpDoorDAO();
@@ -147,7 +147,7 @@ public class PlanAddActivity extends BaseCountDownActivity<ActivityPlanAddBindin
                     PopTip.show("请录入化学品!");
                     return;
                 }
-                showLoading("加载中...", false);
+                showLoading("加载中...");
                 ThreadUtils.executeByCached(new ThreadUtils.SimpleTask<PlanAddData>() {
                     @Override
                     public PlanAddData doInBackground() throws Throwable {
@@ -227,11 +227,8 @@ public class PlanAddActivity extends BaseCountDownActivity<ActivityPlanAddBindin
             }
         });
         planAddActivityHelp.updateInventoryUi();
-    }
 
-    @Override
-    protected void initData() {
-        super.initData();
+
         try {
             // 日期
             binding.nowTime.setText(TimeUtils.getNowString(new SimpleDateFormat("MM月dd日 EEEE ", Locale.getDefault())));
@@ -258,7 +255,11 @@ public class PlanAddActivity extends BaseCountDownActivity<ActivityPlanAddBindin
         binding.tvOutLogin.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                callLogoutApi();
+                try {
+                    HttpTool.logout();
+                } catch (IOException e) {
+                    LogUtils.e(Log.getStackTraceString(e));
+                }
             }
         });
         binding.tvReturn.setOnClickListener(v -> finish());
@@ -296,6 +297,11 @@ public class PlanAddActivity extends BaseCountDownActivity<ActivityPlanAddBindin
         }
     };
 
+    @Override
+    protected void cdFinish() {
+        finish();
+    }
+
     @Override
     protected void cdTime(int cd) {
         binding.tvReturn.setText("返回" + cd + "s");

+ 2 - 2
app/src/main/java/xn/hxp/ui/plan/PlanAddActivityHelp.java

@@ -59,7 +59,7 @@ public class PlanAddActivityHelp {
     }
 
     public void getLabInfo() {
-        activity.showLoading("加载中...", false);
+        activity.showLoading("加载中...");
         // 实验室基本信息
         activity.addDisposable(ApiRepository.INSTANCE.getRelList(ChemicalApp.subjectId).subscribe(new Consumer<ChemicalInfoBean>() {
             @Override
@@ -180,7 +180,7 @@ public class PlanAddActivityHelp {
     }
 
     public void chemicalSearchByCode(String code) {
-        activity.showLoading("查询中...", false);
+        activity.showLoading("查询中...");
         ThreadUtils.executeByCached(new ThreadUtils.SimpleTask<HxpChemicalVo>() {
             @Override
             public HxpChemicalVo doInBackground() throws Throwable {

+ 71 - 67
app/src/main/java/xn/hxp/ui/plan/add/AddActivity.java

@@ -12,14 +12,14 @@ import androidx.activity.result.ActivityResult;
 import androidx.activity.result.ActivityResultCallback;
 import androidx.activity.result.ActivityResultLauncher;
 import androidx.activity.result.contract.ActivityResultContracts;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
+import androidx.viewbinding.ViewBinding;
 
 import com.blankj.utilcode.util.GsonUtils;
 import com.blankj.utilcode.util.LogUtils;
 import com.blankj.utilcode.util.TimeUtils;
 import com.bumptech.glide.Glide;
 import com.kongzue.dialogx.dialogs.PopTip;
+import com.rc.core.ui.activity.BaseActivity;
 import com.rc.httpcore.HttpConfig;
 import com.rc.httpcore.bean.BelongingPersonBean;
 import com.rc.httpcore.bean.ChemicalTypeBean;
@@ -27,7 +27,9 @@ import com.rc.httpcore.bean.HxpChemicalVo;
 import com.rc.httpcore.bean.HxpControlConfig;
 import com.rc.httpcore.bean.TopicDataBean;
 import com.rc.httpcore.client.ApiRepository;
+import com.rc.httpcore.client.HttpTool;
 
+import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.List;
@@ -36,7 +38,6 @@ import java.util.Locale;
 import io.reactivex.rxjava3.functions.Consumer;
 import xn.hxp.app.ChemicalApp;
 import xn.hxp.databinding.ActivityAddBinding;
-import xn.hxp.ui.common.BaseCountDownActivity;
 import xn.hxp.ui.plan.change.ChangeCabinetActivity;
 import xn.hxp.ui.plan.room.RoomTool;
 import xn.hxp.ui.plan.room.bean.input_add.InventoryItemBean;
@@ -50,7 +51,7 @@ import xn.hxp.ui.plan.room.dao.HxpLayerDAO;
 import xn.hxp.weidith.ChemicalTypeDialog;
 
 
-public class AddActivity extends BaseCountDownActivity<ActivityAddBinding> {
+public class AddActivity extends BaseActivity {
     protected ActivityAddBinding binding;
 
     // 化学品信息
@@ -76,16 +77,76 @@ public class AddActivity extends BaseCountDownActivity<ActivityAddBinding> {
 
     protected HxpInventoryDAO hxpInventoryDAO;
 
-    @NonNull
+    private void initUi() {
+        try {
+            // 日期
+            binding.nowTime.setText(TimeUtils.getNowString(new SimpleDateFormat("MM月dd日 EEEE ", Locale.getDefault())));
+            // 用户
+            Glide.with(this).load(HttpConfig.Companion.getAPI_BASE_IMG_URL() + ChemicalApp.userData.getAvatar()).into(binding.imageName);
+            String userName = ChemicalApp.userData.getUserName();
+            binding.tvName.setText(TextUtils.isEmpty(userName) ? "" : userName);
+            // 实验室logo
+            Glide.with(this).load(HttpConfig.Companion.getAPI_BASE_IMG_URL() + ChemicalApp.confs.getCircularLogo()).into(binding.image);
+            // 实验室名称
+            String subName = ChemicalApp.subjectName;
+            subName = TextUtils.isEmpty(subName) ? "" : subName;
+            // 房间号
+            String roomNum = ChemicalApp.subRoom;
+            roomNum = TextUtils.isEmpty(roomNum) ? "" : roomNum;
+            binding.deptName.setText(subName + "-" + roomNum);
+        } catch (Exception e) {
+            LogUtils.e(Log.getStackTraceString(e));
+        }
+
+        // 退出
+        binding.tvOutLogin.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                try {
+                    HttpTool.logout();
+                } catch (IOException e) {
+                    LogUtils.e(Log.getStackTraceString(e));
+                }
+            }
+        });
+
+        hxpCabinetDAO = RoomTool.getInstance().hxpCabinetDAO();
+        hxpDoorDAO = RoomTool.getInstance().hxpDoorDAO();
+        hxpLayerDAO = RoomTool.getInstance().hxpLayerDAO();
+        hxpInventoryDAO = RoomTool.getInstance().hxpInventoryDAO();
+        CabinetLayerSelect cabinetLayerSelect = hxpLayerDAO.getChanged();
+        inventoryItemBean = new InventoryItemBean(cabinetLayerSelect.getCabinetId(), cabinetLayerSelect.getDoorId(), cabinetLayerSelect.getLayer());
+
+        HxpCabinetVo hxpCabinetVo = hxpCabinetDAO.getById(cabinetLayerSelect.getCabinetId());
+        String cabinetName = hxpCabinetVo.getCabinetName();
+        cabinetName = TextUtils.isEmpty(cabinetName) ? "" : cabinetName;
+
+        HxpCabinetDoorVo hxpCabinetDoorVo = hxpDoorDAO.getById(cabinetLayerSelect.getDoorId());
+        String doorName = hxpCabinetDoorVo.getDoorName();
+        doorName = TextUtils.isEmpty(doorName) ? "" : doorName;
+        int layer = cabinetLayerSelect.getLayer();
+        binding.cabinetLayerSelectTV.setText(cabinetName + "-" + doorName + "-" + layer + "层");
+        binding.cabinetLayerSelectTV.setSelected(true);
+    }
+
+    @Override
+    protected void cdFinish() {
+        finish();
+    }
+
+    @Override
+    protected void cdTime(int cd) {
+
+    }
+
     @Override
-    protected ActivityAddBinding createViewBinding() {
+    protected ViewBinding setViewBinding() {
         return binding = ActivityAddBinding.inflate(getLayoutInflater());
     }
 
     @Override
-    protected void initViews(@Nullable Bundle savedInstanceState) {
-        super.initViews(savedInstanceState);
-        // 化学品搜索
+    protected void onInit() {
+// 化学品搜索
         binding.chemicalSearchBT.setOnClickListener(v -> {
             Editable chemicalSearchETText = binding.chemicalSearchET.getText();
             if (null == chemicalSearchETText || TextUtils.isEmpty(chemicalSearchETText)) {
@@ -238,12 +299,8 @@ public class AddActivity extends BaseCountDownActivity<ActivityAddBinding> {
 
         // 返回
         binding.tvReturn.setOnClickListener(v -> finish());
-    }
 
-    @Override
-    protected void initData() {
-        super.initData();
-        showLoading("请稍等...", false);
+        showLoading("请稍等...");
         // 化学品类别列表获取
         addDisposable(ApiRepository.INSTANCE.getOptions("chemicals_category").subscribe(new Consumer<List<ChemicalTypeBean>>() {
             @Override
@@ -279,59 +336,6 @@ public class AddActivity extends BaseCountDownActivity<ActivityAddBinding> {
         }
     }
 
-    private void initUi() {
-        try {
-            // 日期
-            binding.nowTime.setText(TimeUtils.getNowString(new SimpleDateFormat("MM月dd日 EEEE ", Locale.getDefault())));
-            // 用户
-            Glide.with(this).load(HttpConfig.Companion.getAPI_BASE_IMG_URL() + ChemicalApp.userData.getAvatar()).into(binding.imageName);
-            String userName = ChemicalApp.userData.getUserName();
-            binding.tvName.setText(TextUtils.isEmpty(userName) ? "" : userName);
-            // 实验室logo
-            Glide.with(this).load(HttpConfig.Companion.getAPI_BASE_IMG_URL() + ChemicalApp.confs.getCircularLogo()).into(binding.image);
-            // 实验室名称
-            String subName = ChemicalApp.subjectName;
-            subName = TextUtils.isEmpty(subName) ? "" : subName;
-            // 房间号
-            String roomNum = ChemicalApp.subRoom;
-            roomNum = TextUtils.isEmpty(roomNum) ? "" : roomNum;
-            binding.deptName.setText(subName + "-" + roomNum);
-        } catch (Exception e) {
-            LogUtils.e(Log.getStackTraceString(e));
-        }
-
-        // 退出
-        binding.tvOutLogin.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                callLogoutApi();
-            }
-        });
-
-        hxpCabinetDAO = RoomTool.getInstance().hxpCabinetDAO();
-        hxpDoorDAO = RoomTool.getInstance().hxpDoorDAO();
-        hxpLayerDAO = RoomTool.getInstance().hxpLayerDAO();
-        hxpInventoryDAO = RoomTool.getInstance().hxpInventoryDAO();
-        CabinetLayerSelect cabinetLayerSelect = hxpLayerDAO.getChanged();
-        inventoryItemBean = new InventoryItemBean(cabinetLayerSelect.getCabinetId(), cabinetLayerSelect.getDoorId(), cabinetLayerSelect.getLayer());
-
-        HxpCabinetVo hxpCabinetVo = hxpCabinetDAO.getById(cabinetLayerSelect.getCabinetId());
-        String cabinetName = hxpCabinetVo.getCabinetName();
-        cabinetName = TextUtils.isEmpty(cabinetName) ? "" : cabinetName;
-
-        HxpCabinetDoorVo hxpCabinetDoorVo = hxpDoorDAO.getById(cabinetLayerSelect.getDoorId());
-        String doorName = hxpCabinetDoorVo.getDoorName();
-        doorName = TextUtils.isEmpty(doorName) ? "" : doorName;
-        int layer = cabinetLayerSelect.getLayer();
-        binding.cabinetLayerSelectTV.setText(cabinetName + "-" + doorName + "-" + layer + "层");
-        binding.cabinetLayerSelectTV.setSelected(true);
-    }
-
-    @Override
-    protected void cdTime(int cd) {
-
-    }
-
     @Override
     protected void onDestroy() {
         addActivityHelp = null;

+ 3 - 3
app/src/main/java/xn/hxp/ui/plan/add/AddActivityHelp.java

@@ -48,7 +48,7 @@ public class AddActivityHelp {
      * @param userId 归属人ID
      */
     public void topicSearch(String userId) {
-        activity.showLoading("查询中...", false);
+        activity.showLoading("查询中...");
         activity.addDisposable(ApiRepository.INSTANCE.getTopicList(userId).subscribe(topicDataBeans -> {
             activity.dismissLoading();
             new SelectTopicDialog(activity, topicDataBeans, topicDataBean -> {
@@ -68,7 +68,7 @@ public class AddActivityHelp {
      * 归属人搜索
      */
     public void belongSearch(Editable belongETText) {
-        activity.showLoading("查询中...", false);
+        activity.showLoading("查询中...");
         activity.addDisposable(ApiRepository.INSTANCE.getSelects(belongETText.toString()).subscribe(belongingPersonBeans -> {
             activity.dismissLoading();
             new BelongingPersonDialog(activity, belongingPersonBeans, data -> {
@@ -94,7 +94,7 @@ public class AddActivityHelp {
      * 化学品搜索
      */
     public void hxpSearch(Editable chemicalSearchETText) {
-        activity.showLoading("查询中...", false);
+        activity.showLoading("查询中...");
         ThreadUtils.executeByCached(new ThreadUtils.SimpleTask<List<HxpChemicalVo>>() {
             @Override
             public List<HxpChemicalVo> doInBackground() throws Throwable {

+ 15 - 20
app/src/main/java/xn/hxp/ui/plan/change/ChangeCabinetActivity.java

@@ -3,14 +3,14 @@ package xn.hxp.ui.plan.change;
 import android.content.Intent;
 import android.os.Bundle;
 
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
+import androidx.viewbinding.ViewBinding;
 import androidx.viewpager2.widget.ViewPager2;
 
+import com.rc.core.ui.activity.BaseActivity;
+
 import java.util.List;
 
 import xn.hxp.databinding.ActivityChangeCabinetBinding;
-import xn.hxp.ui.common.BaseCountDownActivity;
 import xn.hxp.ui.plan.FragmentCallBack;
 import xn.hxp.ui.plan.room.RoomTool;
 import xn.hxp.ui.plan.room.bean.locker.CabinetLayerSelect;
@@ -19,24 +19,14 @@ import xn.hxp.ui.plan.room.bean.locker.HxpCabinetVo;
 /**
  * 更换位置
  */
-public class ChangeCabinetActivity extends BaseCountDownActivity<ActivityChangeCabinetBinding> {
+public class ChangeCabinetActivity extends BaseActivity {
     private ActivityChangeCabinetBinding binding;
     private ChangeCabinetAdapter changeCabinetAdapter;
     private CabinetLayerSelect cabinetLayerSelect;
 
-    @NonNull
-    @Override
-    protected ActivityChangeCabinetBinding createViewBinding() {
-        return binding = ActivityChangeCabinetBinding.inflate(getLayoutInflater());
-    }
-
     @Override
-    protected void initViews(@Nullable Bundle savedInstanceState) {
-        super.initViews(savedInstanceState);
+    protected void onInit() {
         List<HxpCabinetVo> hxpCabinetVoList = RoomTool.getInstance().hxpCabinetDAO().getAll();
-        for (int i = 0; i < hxpCabinetVoList.size(); i++) {
-            HxpCabinetVo s = hxpCabinetVoList.get(i);
-        }
         changeCabinetAdapter = new ChangeCabinetAdapter(this, hxpCabinetVoList, fragmentCallBack);
         binding.cabinetVP.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
             @Override
@@ -61,11 +51,6 @@ public class ChangeCabinetActivity extends BaseCountDownActivity<ActivityChangeC
         });
     }
 
-    @Override
-    protected void initData() {
-        super.initData();
-    }
-
     FragmentCallBack fragmentCallBack = new FragmentCallBack() {
         @Override
         public void onSelected(CabinetLayerSelect lastSelectInfo) {
@@ -73,8 +58,18 @@ public class ChangeCabinetActivity extends BaseCountDownActivity<ActivityChangeC
         }
     };
 
+    @Override
+    protected void cdFinish() {
+        finish();
+    }
+
     @Override
     protected void cdTime(int cd) {
 
     }
+
+    @Override
+    protected ViewBinding setViewBinding() {
+        return binding = ActivityChangeCabinetBinding.inflate(getLayoutInflater());
+    }
 }

+ 20 - 12
app/src/main/java/xn/hxp/ui/plan/save_list/SaveListActivity.java

@@ -6,15 +6,18 @@ import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
 
-import androidx.annotation.NonNull;
+import androidx.viewbinding.ViewBinding;
 
 import com.blankj.utilcode.util.GsonUtils;
 import com.blankj.utilcode.util.LogUtils;
 import com.blankj.utilcode.util.TimeUtils;
 import com.bumptech.glide.Glide;
+import com.rc.core.ui.activity.BaseActivity;
 import com.rc.httpcore.HttpConfig;
 import com.rc.httpcore.bean.UserValidationBean;
+import com.rc.httpcore.client.HttpTool;
 
+import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.List;
@@ -26,7 +29,6 @@ import io.reactivex.rxjava3.disposables.Disposable;
 import xn.hxp.app.ChemicalApp;
 import xn.hxp.databinding.ActivitySaveListBinding;
 import xn.hxp.ui.MainActivity;
-import xn.hxp.ui.common.BaseCountDownActivity;
 import xn.hxp.ui.plan.PlanAddData;
 import xn.hxp.ui.plan.room.RoomTool;
 import xn.hxp.ui.plan.room.bean.input_add.InventoryItemBean;
@@ -39,7 +41,7 @@ import xn.hxp.ui.plan.room.dao.HxpInventoryDAO;
 import xn.hxp.utils.UiManager;
 
 
-public class SaveListActivity extends BaseCountDownActivity<ActivitySaveListBinding> {
+public class SaveListActivity extends BaseActivity {
 
     protected ActivitySaveListBinding binding;
     private SaveListAdapter saveListAdapter;
@@ -55,17 +57,14 @@ public class SaveListActivity extends BaseCountDownActivity<ActivitySaveListBind
     protected Disposable unlockDisposable, unlockStatusDisposable;
     protected CountDownTimer unlockStatusCDTimer;
 
-    @NonNull
+
     @Override
-    protected ActivitySaveListBinding createViewBinding() {
-        ChemicalApp.confs.setBackTime(10);
-        binding = ActivitySaveListBinding.inflate(getLayoutInflater());
-        return binding;
+    protected ViewBinding setViewBinding() {
+        return binding = ActivitySaveListBinding.inflate(getLayoutInflater());
     }
 
     @Override
-    protected void initData() {
-        super.initData();
+    protected void onInit() {
         try {
             // 日期
             binding.nowTime.setText(TimeUtils.getNowString(new SimpleDateFormat("MM月dd日 EEEE ", Locale.getDefault())));
@@ -90,7 +89,11 @@ public class SaveListActivity extends BaseCountDownActivity<ActivitySaveListBind
         binding.tvOutLogin.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                callLogoutApi();
+                try {
+                    HttpTool.logout();
+                } catch (IOException e) {
+                    LogUtils.e(Log.getStackTraceString(e));
+                }
             }
         });
 
@@ -140,7 +143,6 @@ public class SaveListActivity extends BaseCountDownActivity<ActivitySaveListBind
 
         binding.exit.setOnClickListener(v -> UiManager.INSTANCE.switcher(SaveListActivity.this, MainActivity.class));
 
-        setCTime(10);
     }
 
     public List<String> splitStringIntoChunks(String inputString, int chunkSize) {
@@ -161,8 +163,14 @@ public class SaveListActivity extends BaseCountDownActivity<ActivitySaveListBind
         return result;
     }
 
+    @Override
+    protected void cdFinish() {
+        finish();
+    }
+
     @Override
     protected void cdTime(int cd) {
         binding.exit.setText("结束" + cd + "s");
     }
+
 }

+ 10 - 9
app/src/main/java/xn/hxp/ui/plan/save_list/SaveListAdapter.java

@@ -9,14 +9,6 @@ import android.view.ViewGroup;
 import android.widget.BaseAdapter;
 
 import com.blankj.utilcode.util.LogUtils;
-import xn.hxp.app.ChemicalApp;
-import xn.hxp.databinding.ItemSaveListBinding;
-import xn.hxp.ui.plan.room.RoomTool;
-import xn.hxp.ui.plan.room.bean.input_add.InventoryItemBean;
-import xn.hxp.ui.plan.room.bean.locker.HxpCabinetDoorVo;
-import xn.hxp.ui.plan.room.bean.locker.HxpCabinetLockVo;
-import xn.hxp.ui.plan.room.bean.locker.HxpCabinetVo;
-import xn.hxp.ui.plan.room.dao.HxpDoorDAO;
 import com.kongzue.dialogx.dialogs.PopTip;
 import com.rc.httpcore.bean.BelongingPersonBean;
 import com.rc.httpcore.bean.HxpChemicalVo;
@@ -29,6 +21,15 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import xn.hxp.app.ChemicalApp;
+import xn.hxp.databinding.ItemSaveListBinding;
+import xn.hxp.ui.plan.room.RoomTool;
+import xn.hxp.ui.plan.room.bean.input_add.InventoryItemBean;
+import xn.hxp.ui.plan.room.bean.locker.HxpCabinetDoorVo;
+import xn.hxp.ui.plan.room.bean.locker.HxpCabinetLockVo;
+import xn.hxp.ui.plan.room.bean.locker.HxpCabinetVo;
+import xn.hxp.ui.plan.room.dao.HxpDoorDAO;
+
 public class SaveListAdapter extends BaseAdapter {
 
     private SaveListActivity activity;
@@ -160,7 +161,7 @@ public class SaveListAdapter extends BaseAdapter {
      * 单独开锁
      */
     public void unlock(HxpCabinetLockVo nowLockVo) {
-        activity.showLoading("开锁中...", false);
+        activity.showLoading("开锁中...");
         Map<String, Object> map = new HashMap<>();
         map.put("subId", ChemicalApp.subjectId);
         map.put("subName", ChemicalApp.subjectName);

+ 18 - 10
app/src/main/java/xn/hxp/ui/plan/unlock/UnlockActivity.java

@@ -1,33 +1,33 @@
 package xn.hxp.ui.plan.unlock;
 
 import android.content.Intent;
-import android.os.Bundle;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
 
 import androidx.activity.result.ActivityResultLauncher;
 import androidx.activity.result.contract.ActivityResultContracts;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
+import androidx.viewbinding.ViewBinding;
 
 import com.blankj.utilcode.util.GsonUtils;
 import com.blankj.utilcode.util.LogUtils;
 import com.blankj.utilcode.util.TimeUtils;
 import com.bumptech.glide.Glide;
+import com.rc.core.ui.activity.BaseActivity;
 import com.rc.httpcore.HttpConfig;
 import com.rc.httpcore.bean.UserValidationBean;
+import com.rc.httpcore.client.HttpTool;
 
+import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.Locale;
 
 import xn.hxp.app.ChemicalApp;
 import xn.hxp.databinding.ActivityUnlockBinding;
-import xn.hxp.ui.common.BaseCountDownActivity;
 import xn.hxp.ui.plan.PlanAddData;
 import xn.hxp.ui.verify.DoubleVerifyActivity;
 
-public class UnlockActivity extends BaseCountDownActivity<ActivityUnlockBinding> {
+public class UnlockActivity extends BaseActivity {
     protected ActivityUnlockBinding binding;
     private ActivityResultLauncher<Intent> intentActivityResultLauncher;
     protected UnlockActivityHelp activityHelp;
@@ -40,15 +40,14 @@ public class UnlockActivity extends BaseCountDownActivity<ActivityUnlockBinding>
 
     protected UnlockAdapter unlockAdapter;
 
-    @NonNull
+
     @Override
-    protected ActivityUnlockBinding createViewBinding() {
+    protected ViewBinding setViewBinding() {
         return binding = ActivityUnlockBinding.inflate(getLayoutInflater());
     }
 
     @Override
-    protected void initViews(@Nullable Bundle savedInstanceState) {
-        super.initViews(savedInstanceState);
+    protected void onInit() {
         Intent getIntent = getIntent();
         if (null != getIntent && getIntent.hasExtra("data")) {
             String json = getIntent.getStringExtra("data");
@@ -111,12 +110,21 @@ public class UnlockActivity extends BaseCountDownActivity<ActivityUnlockBinding>
         binding.tvOutLogin.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                callLogoutApi();
+                try {
+                    HttpTool.logout();
+                } catch (IOException e) {
+                    LogUtils.e(Log.getStackTraceString(e));
+                }
             }
         });
         binding.exit.setOnClickListener(v -> finish());
     }
 
+    @Override
+    protected void cdFinish() {
+        finish();
+    }
+
     @Override
     protected void cdTime(int cd) {
         binding.exit.setText("结束" + cd + "s");

+ 2 - 2
app/src/main/java/xn/hxp/ui/plan/unlock/UnlockActivityHelp.java

@@ -295,7 +295,7 @@ public class UnlockActivityHelp {
      * 单独开锁
      */
     public void unlock(HxpCabinetLockVo nowLockVo) {
-        activity.showLoading("开锁中...", false);
+        activity.showLoading("开锁中...");
         map.clear();
         map.put("subId", ChemicalApp.subjectId);
         map.put("subName", ChemicalApp.subjectName);
@@ -494,7 +494,7 @@ public class UnlockActivityHelp {
     }
 
     public void save() {
-        activity.showLoading("入库中...", false);
+        activity.showLoading("入库中...");
         ThreadUtils.executeByCached(new ThreadUtils.SimpleTask<String>() {
             @Override
             public String doInBackground() throws Throwable {

+ 25 - 22
app/src/main/java/xn/hxp/ui/still/ChemicalsAlsoActivity.kt

@@ -14,6 +14,7 @@ import android.widget.Toast
 import androidx.core.content.ContextCompat
 import androidx.lifecycle.lifecycleScope
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
 import com.blankj.utilcode.util.LogUtils
 import com.blankj.utilcode.util.ThreadUtils
 import com.blankj.utilcode.util.ThreadUtils.SimpleTask
@@ -21,12 +22,14 @@ import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
 import com.kongzue.dialogx.dialogs.PopTip
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.bean.GiveBackBean
 import com.rc.httpcore.bean.LockVoListBean
 import com.rc.httpcore.bean.ReturnDetailsBean
 import com.rc.httpcore.bean.ReturnGiveBackBean
 import com.rc.httpcore.client.ApiRepository
+import com.rc.httpcore.client.HttpTool
 import com.rc.httpcore.exception.NetException
 import kotlinx.coroutines.*
 import org.greenrobot.eventbus.EventBus
@@ -43,7 +46,6 @@ import xn.hxp.receiver.PortScanHelper
 import xn.hxp.receiver.UsbReceiver
 import xn.hxp.ui.PrintBean
 import xn.hxp.ui.adapter.ReturningChemicalsAdapter
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.ui.verify.TwoVerificationActivity
 import xn.hxp.utils.*
 import xn.hxp.utils.bluetooth.BluetoothTool
@@ -55,7 +57,7 @@ import java.net.SocketTimeoutException
 import java.nio.charset.StandardCharsets
 
 //化学品-归还   StorageDialog  柜字信息
-class ChemicalsAlsoActivity : BaseCountDownActivity<ActivityChemicalsAlsoBinding>() {
+class ChemicalsAlsoActivity : BaseActivity() {
 
     //归还列表
     private val mAdapter by lazy { ReturningChemicalsAdapter() }
@@ -79,31 +81,21 @@ class ChemicalsAlsoActivity : BaseCountDownActivity<ActivityChemicalsAlsoBinding
     private var pageSize = 10
     private var mWeighDialog: WeighDialog? = null
     private var isok = false // true  再次开门
-    override fun createViewBinding() =
-        ActivityChemicalsAlsoBinding.inflate(LayoutInflater.from(this))
 
-    override fun initData() {
-        super.initData()
-        val handler = Handler(Looper.getMainLooper())
-        timeUpdater = TimeUpdater(handler) { currentTime ->
-            viewBinding.nowTime.text = "$currentTime"
-        }
-        // 启动定时更新
-        timeUpdater.startUpdating()
-        //归还列表信息查询
-        useList()
+    lateinit var viewBinding: ActivityChemicalsAlsoBinding
 
-        MediaPlayerHelper.playRawMp3(this, R.raw.saomiaobiaoqian)
-        customDialogView(0, "请扫描标签")
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityChemicalsAlsoBinding.inflate(layoutInflater)
+        return viewBinding
     }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
+
         //注册广播
         EventBus.getDefault().register(this)
         initTitle()
         viewBinding.tvOutLogin.setOnClickListener {
-            callLogoutApi()
+            HttpTool.logout()
         }
         inAdapter()//初始化适配器
         viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
@@ -376,10 +368,19 @@ class ChemicalsAlsoActivity : BaseCountDownActivity<ActivityChemicalsAlsoBinding
             }
         }
 
+        val handler = Handler(Looper.getMainLooper())
+        timeUpdater = TimeUpdater(handler) { currentTime ->
+            viewBinding.nowTime.text = "$currentTime"
+        }
+        // 启动定时更新
+        timeUpdater.startUpdating()
+        //归还列表信息查询
+        useList()
 
+        MediaPlayerHelper.playRawMp3(this, R.raw.saomiaobiaoqian)
+        customDialogView(0, "请扫描标签")
     }
 
-
     private fun updateRfid(
         ids: String,
         rfid: String
@@ -591,7 +592,6 @@ class ChemicalsAlsoActivity : BaseCountDownActivity<ActivityChemicalsAlsoBinding
                 }
 
                 override fun onTimerReply() {
-                    stopCountDown()
                 }
             })
         discardDialog.show()
@@ -715,7 +715,6 @@ class ChemicalsAlsoActivity : BaseCountDownActivity<ActivityChemicalsAlsoBinding
                     }
 
                     override fun onTimerReply() {
-                        stopCountDown()
                     }
                 })
             mWeighDialog!!.show()
@@ -1553,6 +1552,10 @@ class ChemicalsAlsoActivity : BaseCountDownActivity<ActivityChemicalsAlsoBinding
 
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
     //必须写这个方法  防止注册失败
     @Subscribe(threadMode = ThreadMode.MAIN)
     fun onUpdateEventEvent(event: KeyEvent) {

+ 0 - 35
app/src/main/java/xn/hxp/ui/still/DemonstrateActivity.kt

@@ -1,35 +0,0 @@
-package xn.hxp.ui.still
-
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import xn.hxp.databinding.ActivityDemonstrateBinding
-import xn.hxp.ui.common.BaseCountDownActivity
-
-//演示流程  暂时不用  更换成MSDS
-class DemonstrateActivity : BaseCountDownActivity<ActivityDemonstrateBinding>() {
-
-
-    override fun createViewBinding() = ActivityDemonstrateBinding.inflate(LayoutInflater.from(this))
-
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
-
-        //申购
-        viewBinding.butSubscribe.setOnClickListener {
-
-        }
-
-
-        //存储
-        viewBinding.storage.setOnClickListener {
-
-        }
-
-    }
-
-    override fun cdTime(cd: Int) {
-        viewBinding.tvReturn.text = "返回${cd}s"
-    }
-
-}

+ 14 - 11
app/src/main/java/xn/hxp/ui/still/MsdsActivity.kt

@@ -8,16 +8,17 @@ import android.view.LayoutInflater
 import android.widget.ArrayAdapter
 import android.widget.AutoCompleteTextView
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
 import com.king.zxing.util.CodeUtils
 import xn.hxp.databinding.ActivityMsdsBinding
 import xn.hxp.ui.adapter.MsdsListAdapter
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.utils.TimeUpdater
 import xn.hxp.utils.UiManager
 import com.blankj.utilcode.util.LogUtils
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.core.util.EscapeUnescape
 import com.rc.core.util.VideoFullScreenWebChromeClient
 import com.rc.core.util.WebViewHelper
@@ -28,7 +29,7 @@ import xn.hxp.app.ChemicalApp
 import java.net.URLEncoder
 
 //MSDS
-class MsdsActivity : BaseCountDownActivity<ActivityMsdsBinding>() {
+class MsdsActivity : BaseActivity() {
 
     private lateinit var timeUpdater: TimeUpdater
     private val mAdapter by lazy { MsdsListAdapter(this) }
@@ -36,10 +37,13 @@ class MsdsActivity : BaseCountDownActivity<ActivityMsdsBinding>() {
     private var mCont: String? = null  //文件地址
     private var mName: String? = null //文件名称
 
-    override fun createViewBinding() = ActivityMsdsBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivityMsdsBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityMsdsBinding.inflate(layoutInflater)
+        return viewBinding
+    }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
         viewBinding.rvView?.layoutManager = LinearLayoutManager(this)
         viewBinding.rvView?.adapter = mAdapter
         viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
@@ -70,10 +74,6 @@ class MsdsActivity : BaseCountDownActivity<ActivityMsdsBinding>() {
         viewBinding.tvReturn.setOnClickListener {
             finish()
         }
-    }
-
-    override fun initData() {
-        super.initData()
         val handler = Handler(Looper.getMainLooper())
         timeUpdater = TimeUpdater(handler) { currentTime ->
             viewBinding.nowTime.text = "$currentTime"
@@ -128,7 +128,6 @@ class MsdsActivity : BaseCountDownActivity<ActivityMsdsBinding>() {
 //                }
             }
         }
-
     }
 
     override fun onDestroy() {
@@ -139,6 +138,10 @@ class MsdsActivity : BaseCountDownActivity<ActivityMsdsBinding>() {
         }
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
     override fun onBackPressed() {
         super.onBackPressed()
         finish()
@@ -160,7 +163,7 @@ class MsdsActivity : BaseCountDownActivity<ActivityMsdsBinding>() {
                     mAdapter.setNewInstance(data.records.toMutableList())
                     mCont = mAdapter.data[0].content
                     mName = mAdapter.data[0].name
-                    mId=mAdapter.data[0].id
+                    mId = mAdapter.data[0].id
                     //二维码需要改动  拉取公用配置
                     val qrCode: Bitmap = CodeUtils.createQRCode(
                         "${HttpConfig.API_BASE_QC_URL}?code=${mAdapter.data[0].id}&type=1",

+ 16 - 10
app/src/main/java/xn/hxp/ui/still/MsdsScreenActivity.kt

@@ -3,12 +3,12 @@ package xn.hxp.ui.still
 import android.graphics.Bitmap
 import android.os.Bundle
 import android.view.LayoutInflater
+import androidx.viewbinding.ViewBinding
 import xn.hxp.app.ChemicalApp
 import xn.hxp.databinding.ActivityMsdsScreenBinding
-import xn.hxp.ui.common.BaseCountDownActivity
 import com.king.zxing.util.CodeUtils
 import com.blankj.utilcode.util.LogUtils
-import com.rc.core.ui.activity.RcBaseActivity
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.core.util.EscapeUnescape
 import com.rc.core.util.VideoFullScreenWebChromeClient
 import com.rc.core.util.WebViewHelper
@@ -16,19 +16,19 @@ import com.rc.httpcore.HttpConfig
 import java.net.URLEncoder
 
 //全屏展示
-class MsdsScreenActivity : RcBaseActivity<ActivityMsdsScreenBinding>() {
+class MsdsScreenActivity : BaseActivity() {
 
 
-    override fun createViewBinding() = ActivityMsdsScreenBinding.inflate(LayoutInflater.from(this))
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    lateinit var viewBinding: ActivityMsdsScreenBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityMsdsScreenBinding.inflate(layoutInflater)
+        return viewBinding
+    }
+
+    override fun onInit() {
         viewBinding.closeScreen.setOnClickListener {
             finish()
         }
-    }
-
-    override fun initData() {
-        super.initData()
         val stringExtra1 = intent.getStringExtra("mCont")
         val stringExtra2 = intent.getStringExtra("mName")
         val stringExtra = intent.getStringExtra("mId")
@@ -63,6 +63,12 @@ class MsdsScreenActivity : RcBaseActivity<ActivityMsdsScreenBinding>() {
             "utf-8",
             null
         )
+    }
+
+    override fun cdFinish() {
+        finish()
+    }
 
+    override fun cdTime(cd: Int) {
     }
 }

+ 15 - 7
app/src/main/java/xn/hxp/ui/uses/ProcessedActivity.kt

@@ -6,6 +6,7 @@ import android.view.LayoutInflater
 import android.view.View
 import androidx.recyclerview.widget.GridLayoutManager
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
@@ -13,17 +14,18 @@ import xn.hxp.app.ChemicalApp
 import xn.hxp.R
 import xn.hxp.databinding.ActivityProcessedBinding
 import xn.hxp.ui.adapter.*
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.weidith.ImgDialogs
 import com.blankj.utilcode.util.LogUtils
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.apk.ProcessedBean
 import com.rc.httpcore.client.ApiRepository
+import com.rc.httpcore.client.HttpTool
 import java.util.*
 
 
 //已处理 or  未处理  需要处理    //  item_timeout
-class ProcessedActivity : BaseCountDownActivity<ActivityProcessedBinding>() {
+class ProcessedActivity : BaseActivity() {
 
     //化学品信息
     private val mAdapter by lazy { TimeoutAdapter() }
@@ -40,10 +42,14 @@ class ProcessedActivity : BaseCountDownActivity<ActivityProcessedBinding>() {
 
     private var mNoticeId: String? = null
     private var mHandleNotes: String? = null
-    override fun createViewBinding() = ActivityProcessedBinding.inflate(LayoutInflater.from(this))
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    lateinit var viewBinding: ActivityProcessedBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityProcessedBinding.inflate(layoutInflater)
+        return viewBinding
+    }
+
+    override fun onInit() {
         viewBinding.tvName.text = ChemicalApp.userData!!.userName
         viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
         val imageView = viewBinding.imageName
@@ -92,21 +98,23 @@ class ProcessedActivity : BaseCountDownActivity<ActivityProcessedBinding>() {
         }
 
         viewBinding.tvOutLogin.setOnClickListener {
-            callLogoutApi()
+            HttpTool.logout()
         }
 
         val noticeId = intent.getStringExtra("noticeId")
         if (noticeId != null) {
             getLists(noticeId)
         }
+    }
 
+    override fun cdFinish() {
+        finish()
     }
 
     override fun cdTime(cd: Int) {
         viewBinding.tvReturn.text = "返回${cd}s"
     }
 
-
     private fun getLists(noticeId: String) {
         showLoading("加载中...")
         val disposable = ApiRepository.warningNoticeDetail(noticeId)

+ 18 - 29
app/src/main/java/xn/hxp/ui/uses/UseActivity.kt

@@ -12,6 +12,7 @@ import android.widget.Toast
 import androidx.core.content.ContextCompat
 import androidx.lifecycle.lifecycleScope
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
@@ -20,12 +21,10 @@ import xn.hxp.R
 import xn.hxp.blu.BluetoothConnectionManager
 import xn.hxp.comm.Constants
 import xn.hxp.databinding.ActivityUseBinding
-import xn.hxp.ui.SplashActivity
 import xn.hxp.ui.adapter.CabinetDoorAdapter
 import xn.hxp.ui.adapter.CabinetDoorRighAdapter
 import xn.hxp.ui.adapter.UsageLabelDialogAdapter
 import xn.hxp.ui.adapter.UseListAdapter
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.ui.verify.TwoVerificationActivity
 import xn.hxp.utils.*
 import xn.hxp.weidith.CustomDialog
@@ -33,17 +32,19 @@ import xn.hxp.weidith.StorageDialog
 import xn.hxp.weidith.UsageLabelDialog
 import xn.hxp.weidith.WeighDialog
 import com.blankj.utilcode.util.LogUtils
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpClient
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.bean.*
 import com.rc.httpcore.client.ApiRepository
+import com.rc.httpcore.client.HttpTool
 import kotlinx.coroutines.*
 import java.lang.Runnable
 import java.math.BigDecimal
 import java.nio.charset.StandardCharsets
 
 //化学品 领用
-class UseActivity : BaseCountDownActivity<ActivityUseBinding>() {
+class UseActivity : BaseActivity() {
 
     private val mAdapter by lazy { UseListAdapter() }
     private val mAdapterLeft by lazy { CabinetDoorAdapter(this) }  //左边柜子
@@ -80,22 +81,13 @@ class UseActivity : BaseCountDownActivity<ActivityUseBinding>() {
     private var isok = false // true  再次开门
     private var isLcok = false  //是否打开开门按钮
 
-    override fun createViewBinding() = ActivityUseBinding.inflate(LayoutInflater.from(this))
-
-    override fun initData() {
-        super.initData()
-        val handler = Handler(Looper.getMainLooper())
-        timeUpdater = TimeUpdater(handler) { currentTime ->
-            viewBinding.nowTime.text = "$currentTime"
-        }
-        // 启动定时更新
-        timeUpdater.startUpdating()
-
+    lateinit var viewBinding: ActivityUseBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityUseBinding.inflate(layoutInflater)
+        return viewBinding
     }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
-        Constants.VIEW_TYPE = true
+    override fun onInit() {
         initTitle()
         inAdapter()
         getStockList()//查询列表信息
@@ -110,7 +102,7 @@ class UseActivity : BaseCountDownActivity<ActivityUseBinding>() {
             }
         }
         viewBinding.tvOutLogin.setOnClickListener {
-            callLogoutApi()
+            HttpTool.logout()
         }
 
         //化学品柜 查询
@@ -145,8 +137,14 @@ class UseActivity : BaseCountDownActivity<ActivityUseBinding>() {
         }
         MediaPlayerHelper.playRawMp3(this, R.raw.lingyongguimen)
         customDialogView(0, "请选择要打开的柜门")
-    }
 
+        val handler = Handler(Looper.getMainLooper())
+        timeUpdater = TimeUpdater(handler) { currentTime ->
+            viewBinding.nowTime.text = "$currentTime"
+        }
+        // 启动定时更新
+        timeUpdater.startUpdating()
+    }
 
     private fun initTitle() {
         viewBinding.tvName.text = ChemicalApp.userData!!.userName
@@ -360,7 +358,6 @@ class UseActivity : BaseCountDownActivity<ActivityUseBinding>() {
                 }
 
                 override fun onTimerReply() {
-                    stopCountDown()
                 }
             })
         if (!mUsageLabelDialog!!.isShowing) {
@@ -1324,15 +1321,7 @@ class UseActivity : BaseCountDownActivity<ActivityUseBinding>() {
     }
 
     override fun cdFinish() {
-        super.cdFinish()
-        if (Constants.VIEW_TYPE) {
-            Constants.VIEW_TYPE = false
-        }
-        if (mIsLock) {
-            outTimeWarnData()
-        } else {
-            finish()
-        }
+        finish()
     }
 
     override fun onDestroy() {

+ 30 - 11
app/src/main/java/xn/hxp/ui/uses/WarningEventsActivity.kt

@@ -9,6 +9,7 @@ import android.view.View
 import android.widget.AdapterView
 import androidx.core.content.ContextCompat
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
@@ -17,19 +18,19 @@ import com.codbking.widget.bean.DateType
 import xn.hxp.app.ChemicalApp
 import xn.hxp.R
 import xn.hxp.databinding.ActivityWarningEventsBinding
-import xn.hxp.ui.SplashActivity
 import xn.hxp.ui.adapter.WarningEventsAdapter
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.utils.TimeUpdater
 import xn.hxp.utils.UiManager
 import com.blankj.utilcode.util.LogUtils
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpClient
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.client.ApiRepository
+import com.rc.httpcore.client.HttpTool
 import java.util.*
 
 //预警事件
-class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding>() {
+class WarningEventsActivity : BaseActivity() {
     private lateinit var timeUpdater: TimeUpdater
     private val mAdapter by lazy { WarningEventsAdapter(this) }
     private var mNoticeStatus: String? = null   //1是已处理,0和2是未处理
@@ -40,11 +41,13 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
     private var page = 1
     private var pageSize = 10
 
-    override fun createViewBinding() =
-        ActivityWarningEventsBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivityWarningEventsBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityWarningEventsBinding.inflate(layoutInflater)
+        return viewBinding
+    }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
         warningNoticeCount()
         viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
         viewBinding.rvView?.layoutManager = LinearLayoutManager(this)
@@ -53,7 +56,7 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
             finish()
         }
         viewBinding.tvOutLogin.setOnClickListener {
-            callLogoutApi()
+            HttpTool.logout()
         }
         mAdapter.setOnItemChildClickListener { adapter, view, position ->
             if (view.id == R.id.operate) {
@@ -121,11 +124,13 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
                         mNoticeStatus = null
                         getLists()
                     }
+
                     1 -> {//待处理
                         LogUtils.i("===测hi是===$position")
                         mNoticeStatus = "0"
                         getLists()
                     }
+
                     2 -> {//已处理
                         LogUtils.i("===测hi是===$position")
                         mNoticeStatus = "1"
@@ -139,10 +144,7 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
             }
         }
 
-    }
 
-    override fun initData() {
-        super.initData()
         val handler = Handler(Looper.getMainLooper())
         timeUpdater = TimeUpdater(handler) { currentTime ->
             viewBinding.nowTime.text = "$currentTime"
@@ -188,6 +190,7 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
         }
     }
 
+
     override fun onDestroy() {
         super.onDestroy()
         try {
@@ -196,6 +199,10 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
         }
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
     override fun cdTime(cd: Int) {
         viewBinding.tvReturn.text = "返回${cd}s"
     }
@@ -260,13 +267,16 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
             1 -> {
                 viewBinding.one.visibility = View.VISIBLE
             }
+
             2 -> {
                 viewBinding.two.visibility = View.VISIBLE
             }
+
             3 -> {
                 viewBinding.two.visibility = View.VISIBLE
                 viewBinding.three.visibility = View.VISIBLE
             }
+
             else -> {
                 viewBinding.two.visibility = View.VISIBLE
                 viewBinding.three.visibility = View.VISIBLE
@@ -289,11 +299,13 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 2 -> {
                     viewBinding.three.visibility = View.GONE
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 3 -> {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
@@ -314,11 +326,13 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 2 -> {
                     viewBinding.three.visibility = View.GONE
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
                 }
+
                 3 -> {
                     viewBinding.many.visibility = View.GONE
                     viewBinding.drop.visibility = View.GONE
@@ -348,6 +362,7 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 2 -> {
 //                    viewBinding.two.visibility = View.VISIBLE
                     viewBinding.one.setTextColor(
@@ -372,6 +387,7 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 3 -> {
 //                    viewBinding.three.visibility = View.VISIBLE
                     viewBinding.one.setTextColor(
@@ -424,6 +440,7 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 2 -> {
                     viewBinding.one.setTextColor(
                         ContextCompat.getColor(
@@ -447,6 +464,7 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                 }
+
                 3 -> {
                     viewBinding.one.setTextColor(
                         ContextCompat.getColor(
@@ -470,6 +488,7 @@ class WarningEventsActivity : BaseCountDownActivity<ActivityWarningEventsBinding
                     viewBinding.two.setBackgroundResource(R.drawable.bg_sou_suo_two_page)
                     viewBinding.three.setBackgroundResource(R.drawable.bg_sou_suo_page)
                 }
+
                 else -> {
                     viewBinding.three.text = "$current"
                     if (pages == current) {

+ 14 - 18
app/src/main/java/xn/hxp/ui/verify/DoubleVerifyActivity.java

@@ -1,27 +1,25 @@
 package xn.hxp.ui.verify;
 
 import android.graphics.Bitmap;
-import android.os.Bundle;
 import android.view.KeyEvent;
 import android.view.View;
 
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
+import androidx.viewbinding.ViewBinding;
 
 import com.blankj.utilcode.util.GsonUtils;
-import xn.hxp.databinding.ActivityDoubleVerifyBinding;
-import xn.hxp.receiver.PortScanHelper;
-import xn.hxp.ui.common.BaseCountDownActivity;
-import xn.hxp.ui.plan.PlanAddData;
-import xn.hxp.ui.verify.include.DetectType;
+import com.rc.core.ui.activity.BaseActivity;
 import com.rc.httpcore.bean.UserValidationBean;
 
 import java.util.ArrayList;
 import java.util.List;
 
 import kotlin.Triple;
+import xn.hxp.databinding.ActivityDoubleVerifyBinding;
+import xn.hxp.receiver.PortScanHelper;
+import xn.hxp.ui.plan.PlanAddData;
+import xn.hxp.ui.verify.include.DetectType;
 
-public class DoubleVerifyActivity extends BaseCountDownActivity<ActivityDoubleVerifyBinding> {
+public class DoubleVerifyActivity extends BaseActivity {
     protected ActivityDoubleVerifyBinding binding;
     private DoubleVerifyActivityHelp activityHelp;
     protected PortScanHelper portScanHelper;
@@ -43,21 +41,14 @@ public class DoubleVerifyActivity extends BaseCountDownActivity<ActivityDoubleVe
 
     protected PlanAddData planAddData;
 
-    @NonNull
     @Override
-    protected ActivityDoubleVerifyBinding createViewBinding() {
+    protected ViewBinding setViewBinding() {
         return binding = ActivityDoubleVerifyBinding.inflate(getLayoutInflater());
     }
 
     @Override
-    protected void initViews(@Nullable Bundle savedInstanceState) {
-        super.initViews(savedInstanceState);
+    protected void onInit() {
         activityHelp = new DoubleVerifyActivityHelp(this);
-    }
-
-    @Override
-    protected void initData() {
-        super.initData();
 
         planAddData = GsonUtils.fromJson(getIntent().getStringExtra("data"), PlanAddData.class);
 
@@ -111,6 +102,11 @@ public class DoubleVerifyActivity extends BaseCountDownActivity<ActivityDoubleVe
         return super.dispatchKeyEvent(event);
     }
 
+    @Override
+    protected void cdFinish() {
+        finish();
+    }
+
     @Override
     protected void cdTime(int cd) {
         binding.tvReturn.setText("返回" + cd + "s");

+ 22 - 18
app/src/main/java/xn/hxp/ui/verify/ScanCodeTwoActivity.kt

@@ -9,6 +9,7 @@ import android.view.MotionEvent
 import android.view.View
 import android.widget.ImageView
 import android.widget.TextView
+import androidx.viewbinding.ViewBinding
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
@@ -17,7 +18,6 @@ import xn.hxp.R
 import xn.hxp.comm.Constants
 import xn.hxp.databinding.ActivityScanCodeTwoBinding
 import xn.hxp.ui.DoubleDialogBean
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.utils.*
 import xn.hxp.weidith.CustomDialog
 import xn.hxp.weidith.DoublePeopleDialog
@@ -27,6 +27,7 @@ import com.google.zxing.WriterException
 import com.google.zxing.common.BitMatrix
 import com.lztek.toolkit.Lztek
 import com.blankj.utilcode.util.LogUtils
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpClient
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.bean.UserValidationBean
@@ -38,7 +39,7 @@ import java.net.SocketTimeoutException
 import java.util.*
 
 //扫码-双人认证
-class ScanCodeTwoActivity : BaseCountDownActivity<ActivityScanCodeTwoBinding>() {
+class ScanCodeTwoActivity : BaseActivity() {
     private var count = 1   //认证次数
     private var mChemicalLevel: Int = 0      //管控类型
     private var mTag = 0     //0  新增入库    1 归还废弃空瓶等   2 待入库  3 领用认证需要换api 需要判断不同权限 进行验证通过
@@ -55,10 +56,13 @@ class ScanCodeTwoActivity : BaseCountDownActivity<ActivityScanCodeTwoBinding>()
     private var mVoiceCount = 1  //认证次数
     private val mDoubleDialogBean = mutableListOf<DoubleDialogBean>() //双人认证 需要显示的
 
-    override fun createViewBinding() = ActivityScanCodeTwoBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivityScanCodeTwoBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityScanCodeTwoBinding.inflate(layoutInflater)
+        return viewBinding
+    }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
         Constants.AUTHENTICATION = false
         try {
             SharedPreferencesHelper.clearList(this)
@@ -134,6 +138,15 @@ class ScanCodeTwoActivity : BaseCountDownActivity<ActivityScanCodeTwoBinding>()
         MediaPlayerHelper.playRawMp3(this, R.raw.diyiren_saoma)
 
         handlerUtil.startTask(task, 10000)
+
+        viewBinding.deptName.text = "${ChemicalApp.confs!!.deptName}-${ChemicalApp.confs!!.roomNum}"
+        Glide.with(this)
+            .load("${HttpConfig.API_BASE_IMG_URL}${ChemicalApp.confs!!.circularLogo}")
+            .apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.AUTOMATIC))
+            .into(viewBinding.image)
+
+        // 在3秒后执行延迟任务
+        handler.postDelayed(delayedTask, 4000)
     }
 
     // 定义一个定时任务  扫码-双人认证
@@ -150,19 +163,6 @@ class ScanCodeTwoActivity : BaseCountDownActivity<ActivityScanCodeTwoBinding>()
 
     }
 
-    override fun initData() {
-        super.initData()
-        viewBinding.deptName.text = "${ChemicalApp.confs!!.deptName}-${ChemicalApp.confs!!.roomNum}"
-        Glide.with(this)
-            .load("${HttpConfig.API_BASE_IMG_URL}${ChemicalApp.confs!!.circularLogo}")
-            .apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.AUTOMATIC))
-            .into(viewBinding.image)
-
-        // 在3秒后执行延迟任务
-        handler.postDelayed(delayedTask, 4000)
-    }
-
-
     private val delayedTask = object : Runnable {
         override fun run() {
             // 在这里编写需要延迟执行的代码
@@ -556,6 +556,10 @@ class ScanCodeTwoActivity : BaseCountDownActivity<ActivityScanCodeTwoBinding>()
         }
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
     override fun cdTime(cd: Int) {
         viewBinding.tvReturn.text = "返回${cd}s"
     }

+ 16 - 6
app/src/main/java/xn/hxp/ui/verify/SwipeCodeTwoActivity.kt

@@ -10,6 +10,7 @@ import android.view.LayoutInflater
 import android.view.MotionEvent
 import android.view.View
 import android.widget.TextView
+import androidx.viewbinding.ViewBinding
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
@@ -22,7 +23,6 @@ import xn.hxp.receiver.PortScanHelper
 import xn.hxp.receiver.UsbReceiver
 import xn.hxp.ui.DoubleDialogBean
 import xn.hxp.ui.MainActivity
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.utils.HandlerUtil
 import xn.hxp.utils.MediaPlayerHelper
 import xn.hxp.utils.SharedPreferencesHelper
@@ -30,6 +30,7 @@ import xn.hxp.utils.UiManager
 import xn.hxp.weidith.CustomDialog
 import xn.hxp.weidith.DoublePeopleDialog
 import com.blankj.utilcode.util.LogUtils
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.bean.UserValidationBean
 import com.rc.httpcore.client.ApiRepository
@@ -43,7 +44,7 @@ import java.net.SocketTimeoutException
 import java.util.*
 
 //双人-刷卡认证
-class SwipeCodeTwoActivity : BaseCountDownActivity<ActivitySwipeCodeTwoBinding>() {
+class SwipeCodeTwoActivity : BaseActivity() {
 
     private var mUsbReceiver: UsbReceiver? = null  // 刷卡广播注册
     private var mHandleScanEvent = false //当前是否已经获取过 usb返回的参数
@@ -58,11 +59,13 @@ class SwipeCodeTwoActivity : BaseCountDownActivity<ActivitySwipeCodeTwoBinding>(
     private var mVoiceCount = 1  //认证次数
     private val mDoubleDialogBean = mutableListOf<DoubleDialogBean>() //双人认证 需要显示的
 
-    override fun createViewBinding() =
-        ActivitySwipeCodeTwoBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivitySwipeCodeTwoBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivitySwipeCodeTwoBinding.inflate(layoutInflater)
+        return viewBinding
+    }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
         Constants.AUTHENTICATION = false
         //注册广播
         EventBus.getDefault().register(this)
@@ -347,6 +350,7 @@ class SwipeCodeTwoActivity : BaseCountDownActivity<ActivitySwipeCodeTwoBinding>(
                         }
 
                     }
+
                     1 -> { //归还业务  标签管理
                         if (count == 1) {
                             if (data.userId == ChemicalApp.userData!!.userId) {
@@ -384,6 +388,7 @@ class SwipeCodeTwoActivity : BaseCountDownActivity<ActivitySwipeCodeTwoBinding>(
                             }
                         }
                     }
+
                     2 -> {//待入库
                         if (count == 1) {
                             if (data.userId == ChemicalApp.userData!!.userId) {
@@ -536,6 +541,10 @@ class SwipeCodeTwoActivity : BaseCountDownActivity<ActivitySwipeCodeTwoBinding>(
         EventBus.getDefault().unregister(this) //关闭广播
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
     //必须写这个方法  防止注册失败
     @Subscribe(threadMode = ThreadMode.MAIN)
     fun onUpdateEventEvent(event: KeyEvent) {
@@ -565,6 +574,7 @@ class SwipeCodeTwoActivity : BaseCountDownActivity<ActivitySwipeCodeTwoBinding>(
                     throwable.message!!
                 }
             }
+
             is SocketTimeoutException -> "请求超时,请稍后重试"
             is ConnectException -> "无法连接服务器,请检查网络"
             is HttpException -> "服务器繁忙,请稍后重试"

+ 21 - 7
app/src/main/java/xn/hxp/ui/verify/TwoPersonActivity.kt

@@ -6,6 +6,7 @@ import android.view.LayoutInflater
 import android.view.MotionEvent
 import android.view.View
 import android.widget.TextView
+import androidx.viewbinding.ViewBinding
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
@@ -14,13 +15,13 @@ import xn.hxp.R
 import xn.hxp.comm.Constants
 import xn.hxp.databinding.ActivityTwoPersonBinding
 import xn.hxp.ui.DoubleDialogBean
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.utils.MediaPlayerHelper
 import xn.hxp.utils.SharedPreferencesHelper
 import xn.hxp.utils.UiManager
 import xn.hxp.weidith.CustomDialog
 import xn.hxp.weidith.DoublePeopleDialog
 import com.blankj.utilcode.util.LogUtils
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpClient
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.bean.UserValidationBean
@@ -42,7 +43,7 @@ import java.text.SimpleDateFormat
 import java.util.*
 
 //双人-人脸验证
-class TwoPersonActivity : BaseCountDownActivity<ActivityTwoPersonBinding>() {
+class TwoPersonActivity : BaseActivity() {
 
     //第一个人
     private lateinit var mFotoapparat: Fotoapparat
@@ -63,10 +64,13 @@ class TwoPersonActivity : BaseCountDownActivity<ActivityTwoPersonBinding>() {
     private val handlerBackTwo = Handler(Looper.getMainLooper())
     private val countHandler = Handler(Looper.getMainLooper()) //整个页面 60秒后 直接关闭
 
-    override fun createViewBinding() = ActivityTwoPersonBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivityTwoPersonBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityTwoPersonBinding.inflate(layoutInflater)
+        return viewBinding
+    }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
         Constants.AUTHENTICATION = false
         try {
             SharedPreferencesHelper.clearList(this)
@@ -87,10 +91,12 @@ class TwoPersonActivity : BaseCountDownActivity<ActivityTwoPersonBinding>() {
                 viewBinding.lint.visibility = View.GONE
                 viewBinding.lintTwo.visibility = View.GONE
             }
+
             0 -> {
                 viewBinding.scan.visibility = View.GONE
                 viewBinding.scanTwo.visibility = View.GONE
             }
+
             1 -> {
                 viewBinding.campus.visibility = View.GONE
                 viewBinding.campusTwo.visibility = View.GONE
@@ -156,6 +162,7 @@ class TwoPersonActivity : BaseCountDownActivity<ActivityTwoPersonBinding>() {
         }, totalTimeInMillis) // 15秒后关闭对话框
     }
 
+
     override fun onStart() {
         super.onStart()
         mFotoapparat.start()
@@ -249,7 +256,7 @@ class TwoPersonActivity : BaseCountDownActivity<ActivityTwoPersonBinding>() {
 //                if (count == 1) {
 //                    LogUtils.i("第a一个人 $mUserId    ${data.userId}")
 //                }
-                if (mUserId!=null){
+                if (mUserId != null) {
                     if (mUserId.equals(data.userId)) {
                         customDialogView(0, "不能是同一个人")
 //                        startHandler()
@@ -265,7 +272,7 @@ class TwoPersonActivity : BaseCountDownActivity<ActivityTwoPersonBinding>() {
                             if (data.userId == ChemicalApp.userData!!.userId) {
                                 isLogin = true
                                 faceTwo()
-                                customDialog(data.userName, data.faceImg,data.userId)
+                                customDialog(data.userName, data.faceImg, data.userId)
                                 var bean =
                                     DoubleDialogBean(data.userName, data.faceImg, data.userId)
                                 mDoubleDialogBean.add(bean)
@@ -380,6 +387,7 @@ class TwoPersonActivity : BaseCountDownActivity<ActivityTwoPersonBinding>() {
                             }
                         }
                     }
+
                     1 -> { //归还业务  标签管理
                         if (count == 1) {
                             if (data.userId == ChemicalApp.userData!!.userId) {
@@ -422,6 +430,7 @@ class TwoPersonActivity : BaseCountDownActivity<ActivityTwoPersonBinding>() {
                             }
                         }
                     }
+
                     2 -> {//待入库
                         if (count == 1) {
                             if (data.userId == ChemicalApp.userData!!.userId) {
@@ -621,6 +630,10 @@ class TwoPersonActivity : BaseCountDownActivity<ActivityTwoPersonBinding>() {
         }
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
 
     /**
      * 0  没有图标 1 绿色(成功)   2红色(失败)
@@ -645,6 +658,7 @@ class TwoPersonActivity : BaseCountDownActivity<ActivityTwoPersonBinding>() {
                     throwable.message!!
                 }
             }
+
             is SocketTimeoutException -> "请求超时,请稍后重试"
             is ConnectException -> "无法连接服务器,请检查网络"
             is HttpException -> "服务器繁忙,请稍后重试"

+ 14 - 9
app/src/main/java/xn/hxp/ui/verify/TwoVerificationActivity.kt

@@ -13,6 +13,7 @@ import android.view.View
 import android.widget.ImageView
 import android.widget.TextView
 import androidx.core.view.isVisible
+import androidx.viewbinding.ViewBinding
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
@@ -23,7 +24,6 @@ import xn.hxp.receiver.OnSerialScanListener
 import xn.hxp.receiver.PortScanHelper
 import xn.hxp.receiver.UsbReceiver
 import xn.hxp.ui.DoubleDialogBean
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.utils.*
 import xn.hxp.weidith.CustomDialog
 import xn.hxp.weidith.DoublePeopleDialog
@@ -34,6 +34,7 @@ import com.google.zxing.common.BitMatrix
 import com.lztek.toolkit.Lztek
 import com.blankj.utilcode.util.LogUtils
 import com.kongzue.dialogx.dialogs.WaitDialog
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpClient
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.bean.UserValidationBean
@@ -60,7 +61,7 @@ import java.util.*
 
 
 //双人认证 整合 可随意调整刷卡扫码人脸业务
-class TwoVerificationActivity : BaseCountDownActivity<ActivityTwoVerificationBinding>() {
+class TwoVerificationActivity : BaseActivity() {
     //扫码需要的
     private var mLztek: Lztek? = null
     private var mDeviceNum: String? = null  //设备唯一标识
@@ -98,11 +99,13 @@ class TwoVerificationActivity : BaseCountDownActivity<ActivityTwoVerificationBin
     private var mVoiceCount = 1  //认证次数
     private lateinit var timeUpdater: TimeUpdater
 
-    override fun createViewBinding() =
-        ActivityTwoVerificationBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivityTwoVerificationBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityTwoVerificationBinding.inflate(layoutInflater)
+        return viewBinding
+    }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
         try {
             SharedPreferencesHelper.clearList(this)
         } catch (e: Exception) {
@@ -270,6 +273,7 @@ class TwoVerificationActivity : BaseCountDownActivity<ActivityTwoVerificationBin
         viewBinding.tvReturn.text = "返回${cd}s"
     }
 
+
     //语音提示
     private val task = Runnable {
         if (mVoiceCount == 6) {
@@ -407,6 +411,10 @@ class TwoVerificationActivity : BaseCountDownActivity<ActivityTwoVerificationBin
 
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
     private fun viewGones() {
         viewBinding.lint.visibility = View.GONE
         viewBinding.lintTwo.visibility = View.GONE
@@ -1061,7 +1069,6 @@ class TwoVerificationActivity : BaseCountDownActivity<ActivityTwoVerificationBin
     private fun replaceOnes() {
         //第一个人 人脸
         TextViewDebouncer.setDebouncedOnClickListener(viewBinding.face, 1000L) {
-            mUIDelegate.clearDisposable()
             mVerOne = 1
             closeOneMission()
             mFotoapparat.stop()
@@ -1088,7 +1095,6 @@ class TwoVerificationActivity : BaseCountDownActivity<ActivityTwoVerificationBin
         //刷卡
         TextViewDebouncer.setDebouncedOnClickListener(viewBinding.campus, 1000L) {
             WaitDialog.dismiss()
-            mUIDelegate.clearDisposable()
             mVerOne = 2
             closeOneMission()
             mHandleScanEvent = false
@@ -1112,7 +1118,6 @@ class TwoVerificationActivity : BaseCountDownActivity<ActivityTwoVerificationBin
 
         //扫码
         TextViewDebouncer.setDebouncedOnClickListener(viewBinding.scan, 1000L) {
-            mUIDelegate.clearDisposable()
             closeOneMission()
             mHandleScanEvent = true
             mVerOne = 3

+ 17 - 11
app/src/main/java/xn/hxp/ui/warehousing/ChemicalLabelingActivity.kt

@@ -9,6 +9,7 @@ import android.view.View
 import android.widget.AdapterView
 import androidx.core.content.ContextCompat
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
@@ -17,24 +18,24 @@ import xn.hxp.R
 import xn.hxp.comm.Constants
 import xn.hxp.databinding.ActivityChemicalLabelingBinding
 import xn.hxp.ui.PrintBean
-import xn.hxp.ui.SplashActivity
 import xn.hxp.ui.adapter.ChemicalLabelingAdapter
 import xn.hxp.ui.adapter.CustomSpinnerTwoAdapter
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.ui.verify.TwoVerificationActivity
 import xn.hxp.utils.*
 import xn.hxp.weidith.*
 import com.blankj.utilcode.util.LogUtils
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpClient
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.bean.LockVoListBean
 import com.rc.httpcore.bean.ReturnDetailsBean
 import com.rc.httpcore.client.ApiRepository
+import com.rc.httpcore.client.HttpTool
 import com.sun.jna.Pointer
 import xn.hxp.app.ChemicalApp
 
 //标签列表
-class ChemicalLabelingActivity : BaseCountDownActivity<ActivityChemicalLabelingBinding>() {
+class ChemicalLabelingActivity : BaseActivity() {
 
     private val mAdapter by lazy { ChemicalLabelingAdapter(this) }
     private lateinit var timeUpdater: TimeUpdater
@@ -54,17 +55,20 @@ class ChemicalLabelingActivity : BaseCountDownActivity<ActivityChemicalLabelingB
     var h = Pointer.NULL
 
 
-    override fun createViewBinding() =
-        ActivityChemicalLabelingBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivityChemicalLabelingBinding
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityChemicalLabelingBinding.inflate(layoutInflater)
+        return viewBinding
+    }
+
+    override fun onInit() {
         val sPinner = viewBinding.sPinner
         viewBinding.rvInventory.layoutManager = LinearLayoutManager(this)
         viewBinding.rvInventory.adapter = mAdapter
         viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
         viewBinding.tvOutLogin.setOnClickListener {
-            callLogoutApi()
+            HttpTool.logout()
         }
 
         viewBinding.tvReturn.setOnClickListener {
@@ -314,10 +318,7 @@ class ChemicalLabelingActivity : BaseCountDownActivity<ActivityChemicalLabelingB
                 }
             }
         }
-    }
 
-    override fun initData() {
-        super.initData()
         val handler = Handler(Looper.getMainLooper())
         timeUpdater = TimeUpdater(handler) { currentTime ->
             viewBinding.nowTime.text = "$currentTime"
@@ -340,6 +341,7 @@ class ChemicalLabelingActivity : BaseCountDownActivity<ActivityChemicalLabelingB
             .into(viewBinding.image)
     }
 
+
     override fun onBackPressed() {
         super.onBackPressed()
         finish()
@@ -999,6 +1001,10 @@ class ChemicalLabelingActivity : BaseCountDownActivity<ActivityChemicalLabelingB
         }
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
 
     //查询柜子  存储位置  默认第一个
     private fun getCabinet() {

+ 18 - 23
app/src/main/java/xn/hxp/ui/warehousing/ElectronicLedgerActivity.kt

@@ -1,42 +1,36 @@
 package xn.hxp.ui.warehousing
 
-import android.os.Bundle
 import android.os.Handler
 import android.os.Looper
-import android.view.LayoutInflater
+import androidx.viewbinding.ViewBinding
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
-import com.caysn.autoreplyprint.AutoReplyPrint
-import xn.hxp.R
+import com.rc.core.ui.activity.BaseActivity
+import com.rc.httpcore.HttpConfig
+import com.rc.httpcore.client.HttpTool
+import xn.hxp.app.ChemicalApp
 import xn.hxp.databinding.ActivityElectronicLedgerBinding
-import xn.hxp.ui.SplashActivity
-import xn.hxp.ui.common.BaseCountDownActivity
-import xn.hxp.utils.BitmapUtils
-import xn.hxp.utils.MediaPlayerHelper
+import xn.hxp.utils.PrintTool
 import xn.hxp.utils.TimeUpdater
 import xn.hxp.utils.UiManager
 import xn.hxp.weidith.AirBottleDialog
 import xn.hxp.weidith.CustomDialog
-import com.blankj.utilcode.util.LogUtils
-import com.rc.httpcore.HttpClient
-import com.rc.httpcore.HttpConfig
-import com.sun.jna.Pointer
-import xn.hxp.app.ChemicalApp
-import xn.hxp.utils.PrintTool
 
 //标签管理
-class ElectronicLedgerActivity : BaseCountDownActivity<ActivityElectronicLedgerBinding>() {
+class ElectronicLedgerActivity : BaseActivity() {
 
     private lateinit var timeUpdater: TimeUpdater
-    override fun createViewBinding() =
-        ActivityElectronicLedgerBinding.inflate(LayoutInflater.from(this))
+    lateinit var viewBinding: ActivityElectronicLedgerBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityElectronicLedgerBinding.inflate(layoutInflater)
+        return viewBinding
+    }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
         viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
         viewBinding.tvOutLogin.setOnClickListener {
-            callLogoutApi()
+            HttpTool.logout()
         }
         viewBinding.tvReturn.setOnClickListener {
             finish()
@@ -58,10 +52,7 @@ class ElectronicLedgerActivity : BaseCountDownActivity<ActivityElectronicLedgerB
             })
             airBottleDialog.show()
         }
-    }
 
-    override fun initData() {
-        super.initData()
         val handler = Handler(Looper.getMainLooper())
         timeUpdater = TimeUpdater(handler) { currentTime ->
             viewBinding.nowTime.text = "$currentTime"
@@ -103,6 +94,10 @@ class ElectronicLedgerActivity : BaseCountDownActivity<ActivityElectronicLedgerB
         }
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
     /**
      * 0  没有图标 1 绿色(成功)   2红色(失败)
      *   失败或者成功的弹框

+ 22 - 17
app/src/main/java/xn/hxp/ui/warehousing/WarehousingActivity.kt

@@ -12,13 +12,16 @@ import android.widget.Toast
 import androidx.core.content.ContextCompat
 import androidx.lifecycle.lifecycleScope
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.viewbinding.ViewBinding
 import com.blankj.utilcode.util.LogUtils
 import com.bumptech.glide.Glide
 import com.bumptech.glide.load.engine.DiskCacheStrategy
 import com.bumptech.glide.request.RequestOptions
+import com.rc.core.ui.activity.BaseActivity
 import com.rc.httpcore.HttpConfig
 import com.rc.httpcore.bean.*
 import com.rc.httpcore.client.ApiRepository
+import com.rc.httpcore.client.HttpTool
 import com.rc.httpcore.exception.NetException
 import com.sun.jna.Pointer
 import kotlinx.coroutines.*
@@ -31,7 +34,6 @@ import xn.hxp.databinding.ActivityWarehousingBinding
 import xn.hxp.ui.PrintBean
 import xn.hxp.ui.adapter.ChemicalsAdapter
 import xn.hxp.ui.adapter.InventoryListAdapter
-import xn.hxp.ui.common.BaseCountDownActivity
 import xn.hxp.ui.verify.TwoVerificationActivity
 import xn.hxp.utils.*
 import xn.hxp.utils.bluetooth.BluetoothTool
@@ -44,7 +46,7 @@ import java.net.SocketTimeoutException
 import java.nio.charset.StandardCharsets
 
 //待入库
-class WarehousingActivity : BaseCountDownActivity<ActivityWarehousingBinding>() {
+class WarehousingActivity : BaseActivity() {
 
     private val mAdapter by lazy { InventoryListAdapter(this) }
     private val mAdapterChemicals by lazy { ChemicalsAdapter(this) }
@@ -82,21 +84,13 @@ class WarehousingActivity : BaseCountDownActivity<ActivityWarehousingBinding>()
     private var isClisLit = false  //是否点击称重关闭按钮
 //    private lateinit var mChemicalConfsBean: ChemicalConfsBean  //获取化学品的称重超过比例or
 
-    override fun createViewBinding() = ActivityWarehousingBinding.inflate(LayoutInflater.from(this))
-
-    override fun initData() {
-        super.initData()
-        val handler = Handler(Looper.getMainLooper())
-        timeUpdater = TimeUpdater(handler) { currentTime ->
-            viewBinding.nowTime.text = "$currentTime"
-        }
-        // 启动定时更新
-        timeUpdater.startUpdating()
-        getRelList()//获取实验室 信息
+    lateinit var viewBinding: ActivityWarehousingBinding
+    override fun setViewBinding(): ViewBinding {
+        viewBinding = ActivityWarehousingBinding.inflate(layoutInflater)
+        return viewBinding
     }
 
-    override fun initViews(savedInstanceState: Bundle?) {
-        super.initViews(savedInstanceState)
+    override fun onInit() {
         initTitle()
         initAdapter()
         viewBinding.tvReturn.text = "返回${ChemicalApp.confs!!.backTime}s"
@@ -105,7 +99,7 @@ class WarehousingActivity : BaseCountDownActivity<ActivityWarehousingBinding>()
         }
 
         viewBinding.tvOutLogin.setOnClickListener {
-            callLogoutApi()
+            HttpTool.logout()
         }
 
         //查询后根据返回集合数量  判断当天的显示
@@ -302,6 +296,13 @@ class WarehousingActivity : BaseCountDownActivity<ActivityWarehousingBinding>()
             }
         }
 
+        val handler = Handler(Looper.getMainLooper())
+        timeUpdater = TimeUpdater(handler) { currentTime ->
+            viewBinding.nowTime.text = "$currentTime"
+        }
+        // 启动定时更新
+        timeUpdater.startUpdating()
+        getRelList()//获取实验室 信息
     }
 
     //验证方式
@@ -368,6 +369,7 @@ class WarehousingActivity : BaseCountDownActivity<ActivityWarehousingBinding>()
         viewBinding.tvReturn.text = "返回${cd}s"
     }
 
+
     private fun initAdapter() {
         //入库列表信息
         viewBinding.rvInventory?.layoutManager = LinearLayoutManager(this)
@@ -518,7 +520,6 @@ class WarehousingActivity : BaseCountDownActivity<ActivityWarehousingBinding>()
                                     }
 
                                     override fun onTimerReply() {
-                                        stopCountDown()
                                     }
                                 })
                             mWeighDialog!!.show()
@@ -1476,6 +1477,10 @@ class WarehousingActivity : BaseCountDownActivity<ActivityWarehousingBinding>()
         }
     }
 
+    override fun cdFinish() {
+        finish()
+    }
+
     //=================开锁流程================
     private val task = Runnable {
         //判断所有的锁开锁成功

+ 0 - 32
app/src/main/java/xn/hxp/utils/NetworkUtils.kt

@@ -1,32 +0,0 @@
-package xn.hxp.utils
-
-import android.content.Context
-import android.net.ConnectivityManager
-import android.net.NetworkCapabilities
-import android.os.Build
-
-object NetworkUtils {
-
-    fun isNetworkAvailable(context: Context): Boolean {
-        val connectivityManager =
-            context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
-
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
-            val networkCapabilities = connectivityManager.activeNetwork ?: return false
-            val activeNetwork =
-                connectivityManager.getNetworkCapabilities(networkCapabilities) ?: return false
-
-            return when {
-                activeNetwork.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> true
-                activeNetwork.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> true
-                activeNetwork.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) -> true
-                else -> false
-            }
-        } else {
-            @Suppress("DEPRECATION")
-            val networkInfo = connectivityManager.activeNetworkInfo ?: return false
-            return networkInfo.isConnected
-        }
-    }
-
-}

+ 3 - 1
app/src/main/java/xn/hxp/utils/SharedPreferencesHelper.kt

@@ -6,6 +6,9 @@ import xn.hxp.ui.DoubleDialogBean
 import xn.hxp.ui.SettingsBean
 import com.google.gson.Gson
 
+/**
+ * @author 前同事代码
+ */
 object SharedPreferencesHelper {
     private const val PREF_NAME = "MyPreferences"
     private const val KEY_MY_LIST = "myList"
@@ -75,5 +78,4 @@ object SharedPreferencesHelper {
     }
 
 
-
 }

+ 2 - 7
app/src/main/java/xn/hxp/weidith/BelongingPersonDialog.kt

@@ -8,23 +8,18 @@ import android.os.Bundle
 import android.os.Handler
 import android.os.Looper
 import android.os.Message
-import android.util.Log
 import android.view.Gravity
 import android.view.MotionEvent
 import android.view.Window
 import android.view.WindowManager
 import android.widget.Button
-import android.widget.TextView
 import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
+import com.blankj.utilcode.util.LogUtils
+import com.rc.httpcore.bean.BelongingPersonBean
 import xn.hxp.R
 import xn.hxp.comm.Constants
-import xn.hxp.ui.MainActivity
 import xn.hxp.ui.adapter.BelongingPersonAdapter
-import xn.hxp.ui.common.BaseCountDownActivity
-import xn.hxp.utils.UiManager
-import com.blankj.utilcode.util.LogUtils
-import com.rc.httpcore.bean.BelongingPersonBean
 
 //选择-归属人-信息列表
 class BelongingPersonDialog(

+ 2 - 2
app/src/main/java/xn/hxp/weidith/TabFragmentPagerAdapter.kt

@@ -3,11 +3,11 @@ package xn.hxp.weidith
 import androidx.fragment.app.FragmentManager
 import androidx.fragment.app.FragmentPagerAdapter
 import androidx.viewbinding.ViewBinding
-import com.rc.core.ui.fragment.RcBaseFragment
+import com.rc.core.ui.fragment.BaseFragment
 
 class TabFragmentPagerAdapter (
     fragmentManager: FragmentManager,
-    private val pageParamArray: MutableList<out RcBaseFragment<out ViewBinding>>
+    private val pageParamArray: MutableList<out BaseFragment>
 ) : FragmentPagerAdapter(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
 
     override fun getCount() = pageParamArray.size

+ 60 - 0
app/src/main/res/layout/activity_start.xml

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/main"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@mipmap/img_hxpglpt_bg"
+    tools:context=".ui.StartActivity">
+
+    <TextView
+        android:id="@+id/logo"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerInParent="true"
+        android:drawableTop="@mipmap/img_qdy_zjzn"
+        android:drawablePadding="30dp"
+        android:text="欢迎使用化学品智能管控平台"
+        android:textColor="@color/white"
+        android:textSize="30sp" />
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/logo"
+        android:layout_centerHorizontal="true"
+        android:layout_marginTop="20dp"
+        android:gravity="center_vertical"
+        android:orientation="horizontal">
+
+        <TextView
+            android:id="@+id/hint_TV"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="正在连接服务器..."
+            android:textColor="@color/white"
+            android:textSize="20sp" />
+
+        <ProgressBar
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="10dp" />
+    </LinearLayout>
+
+    <TextView
+        android:id="@+id/version"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true" />
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:layout_centerHorizontal="true"
+        android:layout_marginBottom="20dp"
+        android:text="@string/copy_right"
+        android:textColor="@color/white"
+        android:textSize="12sp" />
+</RelativeLayout>

+ 12 - 12
serialport/.cxx/Debug/6e5q1f5t/arm64-v8a/configure_fingerprint.bin

@@ -2,28 +2,28 @@ C/C++ Structured Logb
 `
 ^D:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\additional_project_files.txtC
 A
-?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint	Ýà“ÁÒ2 —’¼‘Ò2_
+?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint	¦•‘èÒ2 —’¼‘Ò2_
 ]
-[D:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\android_gradle_build.json	Ýà“ÁÒ2˜
+[D:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\android_gradle_build.json	¦•‘èÒ2˜
  œ’¼‘Ò2d
 b
-`D:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\android_gradle_build_mini.json	Ýà“ÁÒ2”	 ¼’¼‘Ò2Q
+`D:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\android_gradle_build_mini.json	¦•‘èÒ2”	 ¼’¼‘Ò2Q
 O
-MD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\build.ninja	Ýà“ÁÒ2މ 쑼‘Ò2U
+MD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\build.ninja	¦•‘èÒ2މ 쑼‘Ò2U
 S
-QD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\build.ninja.txt	Ýà“ÁÒ2Z
+QD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\build.ninja.txt	¦•‘èÒ2Z
 X
-VD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\build_file_index.txt	Ýà“ÁÒ2
? ¿’¼‘Ò2[
+VD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\build_file_index.txt	¦•‘èÒ2
? ¿’¼‘Ò2[
 Y
-WD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\compile_commands.json	Ýà“ÁÒ2¸ 둼‘Ò2_
+WD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\compile_commands.json	¦•‘èÒ2¸ 둼‘Ò2_
 ]
-[D:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\compile_commands.json.bin	Ýà“ÁÒ2	… 둼‘Ò2e
+[D:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\compile_commands.json.bin	¦•‘èÒ2	… 둼‘Ò2e
 c
-aD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\metadata_generation_command.txt	Ýà“ÁÒ2
+aD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\metadata_generation_command.txt	¦•‘èÒ2
 ž ¾’¼‘Ò2X
 V
-TD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\prefab_config.json	Ýà“ÁÒ2
( ¾’¼‘Ò2]
+TD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\prefab_config.json	¦•‘èÒ2
( ¾’¼‘Ò2]
 [
-YD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\symbol_folder_index.txt	Ýà“ÁÒ2
X ¾’¼‘Ò2C
+YD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\arm64-v8a\symbol_folder_index.txt	¦•‘èÒ2
X ¾’¼‘Ò2C
 A
-?D:\work\HuaXuePin\xn_hxp\serialport\src\main\cpp\CMakeLists.txt	Ýà“ÁÒ2
Ó ÈÒðê©2
+?D:\work\HuaXuePin\xn_hxp\serialport\src\main\cpp\CMakeLists.txt	¦•‘èÒ2
Ó ÈÒðê©2

+ 12 - 12
serialport/.cxx/Debug/6e5q1f5t/x86/configure_fingerprint.bin

@@ -2,27 +2,27 @@ C/C++ Structured Log\
 Z
 XD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\additional_project_files.txtC
 A
-?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint	†ì½Ò2 ï“…‘Ò2Y
+?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint	àö“áÒ2 ï“…‘Ò2Y
 W
-UD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\android_gradle_build.json	†ì½Ò2ô	 ô“…‘Ò2^
+UD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\android_gradle_build.json	àö“áÒ2ô	 ô“…‘Ò2^
 \
-ZD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\android_gradle_build_mini.json	†ì½Ò2ð –”…‘Ò2K
+ZD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\android_gradle_build_mini.json	àö“áÒ2ð –”…‘Ò2K
 I
-GD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\build.ninja	†ì½Ò2Õˆ “…‘Ò2O
+GD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\build.ninja	àö“áÒ2Õˆ “…‘Ò2O
 M
-KD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\build.ninja.txt	†ì½Ò2T
+KD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\build.ninja.txt	àö“áÒ2T
 R
-PD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\build_file_index.txt	†ì½Ò2
? ™”…‘Ò2U
+PD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\build_file_index.txt	àö“áÒ2
? ™”…‘Ò2U
 S
-QD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\compile_commands.json	†ì½Ò2¯ Á“…‘Ò2Y
+QD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\compile_commands.json	àö“áÒ2¯ Á“…‘Ò2Y
 W
-UD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\compile_commands.json.bin	†ì½Ò2	ü Á“…‘Ò2_
+UD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\compile_commands.json.bin	àö“áÒ2	ü Á“…‘Ò2_
 ]
-[D:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\metadata_generation_command.txt	‡ì½Ò2
+[D:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\metadata_generation_command.txt	àö“áÒ2
 € ˜”…‘Ò2R
 P
-ND:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\prefab_config.json	‡ì½Ò2
( ˜”…‘Ò2W
+ND:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\prefab_config.json	àö“áÒ2
( ˜”…‘Ò2W
 U
-SD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\symbol_folder_index.txt	‡ì½Ò2
R ™”…‘Ò2C
+SD:\work\HuaXuePin\xn_hxp\serialport\.cxx\Debug\6e5q1f5t\x86\symbol_folder_index.txt	àö“áÒ2
R ™”…‘Ò2C
 A
-?D:\work\HuaXuePin\xn_hxp\serialport\src\main\cpp\CMakeLists.txt	‡ì½Ò2
Ó ÈÒðê©2
+?D:\work\HuaXuePin\xn_hxp\serialport\src\main\cpp\CMakeLists.txt	àö“áÒ2
Ó ÈÒðê©2