Jelajahi Sumber

1.添加获取moca试题库module

王鹏鹏 2 tahun lalu
induk
melakukan
a22a125811

+ 9 - 3
baselib/schemas/com.yingyangfly.baselib.db.AppDataBase/1.json

@@ -2,11 +2,11 @@
   "formatVersion": 1,
   "database": {
     "version": 1,
-    "identityHash": "ad6a89569e113dcddb338d8e7989c320",
+    "identityHash": "7411cf86970910d9fc2d3cd5c1842017",
     "entities": [
       {
         "tableName": "Questions",
-        "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `isJudge` TEXT, `orgCode` TEXT, `orgName` TEXT, `reviewDesc` TEXT, `reviewItem` TEXT, `reviewScore` TEXT, `reviewType` TEXT, `type` TEXT, `updateBy` TEXT, `viewType` TEXT, `inputString` TEXT, `reviewId` INTEGER NOT NULL, `reviewAnswer` TEXT, `correct` TEXT, `score` TEXT, PRIMARY KEY(`id`))",
+        "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `isJudge` TEXT, `orgCode` TEXT, `orgName` TEXT, `reviewDesc` TEXT, `reviewItem` TEXT, `reviewScore` TEXT, `reviewType` TEXT, `type` TEXT, `updateBy` TEXT, `viewType` TEXT, `inputString` TEXT, `reviewId` INTEGER NOT NULL, `reviewAnswer` TEXT, `correct` TEXT, `score` TEXT, `usedTime` TEXT, PRIMARY KEY(`id`))",
         "fields": [
           {
             "fieldPath": "id",
@@ -103,6 +103,12 @@
             "columnName": "score",
             "affinity": "TEXT",
             "notNull": false
+          },
+          {
+            "fieldPath": "usedTime",
+            "columnName": "usedTime",
+            "affinity": "TEXT",
+            "notNull": false
           }
         ],
         "primaryKey": {
@@ -118,7 +124,7 @@
     "views": [],
     "setupQueries": [
       "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
-      "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'ad6a89569e113dcddb338d8e7989c320')"
+      "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '7411cf86970910d9fc2d3cd5c1842017')"
     ]
   }
 }

+ 15 - 2
moca/src/main/java/com/yingyangfly/moca/activity/MocaActivity.kt

@@ -7,6 +7,7 @@ import com.yingyangfly.baselib.ext.setOnSingleClickListener
 import com.yingyangfly.baselib.router.RouterUrlCommon
 import com.yingyangfly.baselib.utils.LiveEventBusUtil
 import com.yingyangfly.baselib.utils.RxBusCodes
+import com.yingyangfly.baselib.utils.RxTimer
 import gorden.rxbus2.Subscribe
 import gorden.rxbus2.ThreadMode
 
@@ -16,8 +17,10 @@ import gorden.rxbus2.ThreadMode
 @Route(path = RouterUrlCommon.mocaEvaluation)
 class MocaActivity : BaseActivity<ActivityMocaBinding>() {
 
-    override fun initViews() {
+    lateinit var rxTimer: RxTimer
 
+    override fun initViews() {
+        rxTimer = RxTimer()
     }
 
     override fun initListener() {
@@ -27,7 +30,17 @@ class MocaActivity : BaseActivity<ActivityMocaBinding>() {
     }
 
     override fun initData() {
-
+        val m: Long = 1000
+        rxTimer.interval(m) {
+            val time = it + 1
+            val minutes = time / 60
+            val seconds = time % 60
+            binding.tvTimes.text = if (minutes > 0) {
+                minutes.toString() + "分" + seconds.toString() + "秒"
+            } else {
+                seconds.toString() + "秒"
+            }
+        }
     }
 
     /**

+ 12 - 0
moca/src/main/res/layout/activity_moca.xml

@@ -31,6 +31,18 @@
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent" />
 
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/tvTimes"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/divider_36px"
+            android:layout_marginEnd="@dimen/divider_30px"
+            android:textColor="@android:color/white"
+            android:textSize="@dimen/divider_28px"
+            android:textStyle="bold"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
         <androidx.cardview.widget.CardView
             android:layout_width="match_parent"
             android:layout_height="0dp"