Procházet zdrojové kódy

1.添加获取mmse试题库UI跳转

王鹏鹏 před 2 roky
rodič
revize
7ed8aa0b97

+ 4 - 8
mmse/src/main/java/com/yingyangfly/mmse/fragment/CountFragment.kt

@@ -95,17 +95,16 @@ class CountFragment : BaseFragment<FragmentCountBinding>() {
     private fun loadData() {
         if (dao != null) {
             firstquestion = dao?.getQuestion(questionId)
-            Log.e("wpp", "firstquestion-----------------" + firstquestion?.inputString)
             if (firstquestion != null) {
-                binding.tvResultOne.text = if (firstquestion?.inputString.isNullOrEmpty()) {
+                val str = if (firstquestion?.inputString.isNullOrEmpty()) {
                     ""
                 } else {
                     firstquestion?.inputString
                 }
+                binding.editResultOne.setText(str)
             }
             val secondQuestionnId = questionId + 1
             secondQuestion = dao?.getQuestion(secondQuestionnId)
-            Log.e("wpp", "secondQuestion-----------------" + secondQuestion?.inputString)
             if (secondQuestion != null) {
                 binding.tvResultTwo.text = if (secondQuestion?.inputString.isNullOrEmpty()) {
                     ""
@@ -115,7 +114,6 @@ class CountFragment : BaseFragment<FragmentCountBinding>() {
             }
             val thirdQuestionId = questionId + 2
             thirdQuestion = dao?.getQuestion(thirdQuestionId)
-            Log.e("wpp", "thirdQuestion-----------------" + thirdQuestion?.inputString)
             if (thirdQuestion != null) {
                 binding.tvResultThree.text = if (thirdQuestion?.inputString.isNullOrEmpty()) {
                     ""
@@ -125,7 +123,6 @@ class CountFragment : BaseFragment<FragmentCountBinding>() {
             }
             val fourthQuestionId = questionId + 3
             fourthQuestion = dao?.getQuestion(fourthQuestionId)
-            Log.e("wpp", "fourthQuestion-----------------" + fourthQuestion?.inputString)
             if (fourthQuestion != null) {
                 binding.tvResultFour.text = if (fourthQuestion?.inputString.isNullOrEmpty()) {
                     ""
@@ -135,7 +132,6 @@ class CountFragment : BaseFragment<FragmentCountBinding>() {
             }
             val fifthQuestionId = questionId + 4
             fifthQuestion = dao?.getQuestion(fifthQuestionId)
-            Log.e("wpp", "fifthQuestion-----------------" + fifthQuestion?.inputString)
             if (fifthQuestion != null) {
                 binding.tvResultFive.text = if (fifthQuestion?.inputString.isNullOrEmpty()) {
                     ""
@@ -151,12 +147,12 @@ class CountFragment : BaseFragment<FragmentCountBinding>() {
      */
     private fun judge(): Boolean {
         if (dao != null) {
-            if (binding.tvResultOne.text.toString().isNullOrEmpty()) {
+            if (binding.editResultOne.text.toString().trim().isNullOrEmpty()) {
                 "请输入第一道题目的答案".toast()
                 return false
             } else {
                 if (firstquestion != null) {
-                    firstquestion?.inputString = binding.tvResultOne.text.toString()
+                    firstquestion?.inputString = binding.editResultOne.text.toString()
                     dao?.update(firstquestion!!)
                 }
             }

+ 0 - 1
mmse/src/main/java/com/yingyangfly/mmse/fragment/YearFragment.kt

@@ -93,7 +93,6 @@ class YearFragment : BaseFragment<FragmentYearBinding>() {
 
     override fun onResume() {
         super.onResume()
-        closeKeyBord(binding.tvYear, mContext)
         loadData()
     }
 

+ 10 - 5
mmse/src/main/res/layout/fragment_count.xml

@@ -4,6 +4,11 @@
     xmlns:tools="http://schemas.android.com/tools"
     tools:ignore="ResourceName">
 
+    <data>
+
+        <import type="android.text.InputType" />
+    </data>
+
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
@@ -34,20 +39,20 @@
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toTopOf="parent" />
 
-                <androidx.appcompat.widget.AppCompatTextView
-                    android:id="@+id/tvResultOne"
+                <androidx.appcompat.widget.AppCompatEditText
+                    android:id="@+id/editResultOne"
                     android:layout_width="wrap_content"
                     android:layout_height="@dimen/divider_53px"
                     android:layout_marginStart="@dimen/divider_20px"
                     android:layout_marginTop="@dimen/divider_118px"
                     android:background="@drawable/bg_calculation_results"
                     android:gravity="center"
+                    android:inputType="@{InputType.TYPE_CLASS_NUMBER}"
                     android:textColor="@color/color_FF333333"
                     android:textSize="@dimen/divider_34px"
                     android:textStyle="bold"
                     app:layout_constraintStart_toEndOf="@+id/tvHundredMinusSeven"
-                    app:layout_constraintTop_toTopOf="parent"
-                    tools:text="@string/previous_question" />
+                    app:layout_constraintTop_toTopOf="parent" />
 
                 <androidx.appcompat.widget.AppCompatTextView
                     android:id="@+id/tvHundredMinusSevenTwo"
@@ -74,7 +79,7 @@
                     android:textSize="@dimen/divider_34px"
                     android:textStyle="bold"
                     app:layout_constraintStart_toEndOf="@+id/tvHundredMinusSevenTwo"
-                    app:layout_constraintTop_toBottomOf="@+id/tvResultOne"
+                    app:layout_constraintTop_toBottomOf="@+id/editResultOne"
                     tools:text="@string/previous_question" />
 
                 <androidx.appcompat.widget.AppCompatTextView

+ 5 - 2
mmse/src/main/res/layout/fragment_year.xml

@@ -9,6 +9,8 @@
         <variable
             name="data"
             type="com.yingyangfly.baselib.db.QuestionsBean" />
+
+        <import type="android.text.InputType" />
     </data>
 
     <androidx.constraintlayout.widget.ConstraintLayout
@@ -51,9 +53,10 @@
                     android:layout_width="match_parent"
                     android:layout_height="@dimen/divider_62px"
                     android:background="@color/color_FF4A76FF"
-                    android:clickable="false"
+                    android:focusable="true"
+                    android:focusableInTouchMode="true"
                     android:gravity="center_vertical"
-                    android:inputType="none"
+                    android:inputType="@{InputType.TYPE_CLASS_NUMBER}"
                     android:paddingStart="@dimen/divider_43px"
                     android:paddingEnd="@dimen/divider_43px"
                     android:textColor="@android:color/white"