From 17eb1d06e104bc1cd93498fe3a3eaecf14c9d734 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 12 十一月 2020 13:57:35 +0800
Subject: [PATCH] 1. 修复现场整改时,问题状态是‘问题审核通过’而不是“整改未审核”的问题; 2. 修改任意拍照界面的多图片展示方式为Glide,减少内存溢出的可能性; 3. 新增图片类型枚举类,罗列原有的图片类型,并新增“铭牌”和“监测设备”; 4. 修复导航功能可能导致空指针的问题; 5. 任意拍界面新增按分类拍摄功能; 6. 修复现场整改界面打开崩溃问题;

---
 app/src/main/java/cn/flightfeather/thirdapp/common/database/DbFactory.kt |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/app/src/main/java/cn/flightfeather/thirdapp/common/database/DbFactory.kt b/app/src/main/java/cn/flightfeather/thirdapp/common/database/DbFactory.kt
index d46e875..ce71fa6 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/common/database/DbFactory.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/common/database/DbFactory.kt
@@ -8,24 +8,32 @@
  * @author riku
  * Date: 2019/5/16
  */
-class DbFactory private constructor(application: CommonApplication){
+class DbFactory private constructor(private val application: CommonApplication){
+
+    private var daoSession: DaoSession? = null
+
+    init {
+        daoSession = application.daoSession
+    }
 
     companion object {
 
         @Volatile
-        private lateinit var daoSession: DaoSession
+        private var mDbFactory: DbFactory? = null
 
         //鏁版嵁搴撳垵濮嬪寲
         @JvmStatic
         @Synchronized
         fun init(application: CommonApplication) {
-            daoSession = application.daoSession
+            if (mDbFactory == null) {
+                mDbFactory = DbFactory(application)
+            }
         }
 
         //鑾峰彇鏁版嵁搴撴搷浣滃璞aoSession
         fun getGreenDaoObservable(): Observable<DaoSession> {
             return Observable.create { emitter ->
-                daoSession.let {
+                mDbFactory?.daoSession?.let {
                     emitter.onNext(it)
                     emitter.onComplete()
                 }
@@ -33,7 +41,10 @@
         }
 
         fun getInstance(): DaoSession {
-            return daoSession
+            if (mDbFactory == null) {
+                mDbFactory = DbFactory(CommonApplication.getInstance())
+            }
+            return mDbFactory!!.daoSession!!
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3