Browse Source

1.修改IM样式

王鹏鹏 2 years ago
parent
commit
3d590b9417
19 changed files with 302 additions and 16 deletions
  1. 3 0
      .idea/misc.xml
  2. 2 2
      baselib/src/main/java/com/yingyangfly/baselib/base/BaseActivity.kt
  3. 3 0
      baselib/src/main/java/com/yingyangfly/baselib/db/DoctorDao.kt
  4. 5 0
      baselib/src/main/java/com/yingyangfly/baselib/router/RouterUrlCommon.kt
  5. 6 0
      healthconsultation/src/main/AndroidManifest.xml
  6. 5 6
      healthconsultation/src/main/java/com/yingyang/healthconsultation/activity/HealthConsultationActivity.kt
  7. 20 0
      healthconsultation/src/main/java/com/yingyang/healthconsultation/adapter/SearchDoctorAdapter.kt
  8. 2 2
      healthconsultation/src/main/java/com/yingyang/healthconsultation/consultationsheet/ConsultationRequestActivity.kt
  9. 2 2
      healthconsultation/src/main/java/com/yingyang/healthconsultation/doctordetails/DoctorDetailsActivity.kt
  10. 2 2
      healthconsultation/src/main/java/com/yingyang/healthconsultation/payment/PaymentActivity.kt
  11. 92 0
      healthconsultation/src/main/java/com/yingyang/healthconsultation/search/SearchDoctorActivity.kt
  12. 6 0
      healthconsultation/src/main/manifest/AndroidManifest.xml
  13. 2 1
      healthconsultation/src/main/res/layout/activity_consultation_request.xml
  14. 1 1
      healthconsultation/src/main/res/layout/activity_health_consultation.xml
  15. 112 0
      healthconsultation/src/main/res/layout/activity_search_doctor.xml
  16. 36 0
      healthconsultation/src/main/res/layout/item_search_doctor.xml
  17. BIN
      healthconsultation/src/main/res/mipmap-xxhdpi/icon_search.png
  18. 1 0
      healthconsultation/src/main/res/values/colors.xml
  19. 2 0
      healthconsultation/src/main/res/values/strings.xml

+ 3 - 0
.idea/misc.xml

@@ -38,6 +38,7 @@
         <entry key="..\:/workspace/hcp-pad/common/src/main/res/layout/common_content_loading_dialog.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pad/common/src/main/res/layout/ugckit_fragment_dialog_permission_introduction.xml" value="0.1" />
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/drawable/bg_btn_doctor_details.xml" value="0.155" />
+        <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/drawable/bg_button_submit.xml" value="0.161" />
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/drawable/bg_button_submitl.xml" value="0.155" />
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/drawable/bg_cancel_order.xml" value="0.155" />
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/drawable/bg_condition_describe.xml" value="0.155" />
@@ -85,6 +86,7 @@
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/layout/activity_main.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/layout/activity_paid.xml" value="0.5371900826446281" />
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/layout/activity_payment.xml" value="0.31773743016759776" />
+        <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/layout/activity_search_doctor.xml" value="0.4" />
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/layout/dialog_payment_qr_code.xml" value="0.176" />
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/layout/dialog_select_pic.xml" value="0.4421768707482993" />
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/layout/fragment_evaluate.xml" value="0.22239583333333332" />
@@ -94,6 +96,7 @@
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/layout/item_evaluate.xml" value="1.0" />
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/layout/item_image.xml" value="0.6682539682539682" />
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/layout/item_recommend_doctor.xml" value="0.6" />
+        <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/layout/item_search_doctor.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pad/healthconsultation/src/main/res/layout/item_sick_time.xml" value="0.8800000000000001" />
         <entry key="..\:/workspace/hcp-pad/home/src/main/res/drawable/anim_loading.xml" value="0.2185" />
         <entry key="..\:/workspace/hcp-pad/home/src/main/res/drawable/bg_buttom_game.xml" value="0.219" />

+ 2 - 2
baselib/src/main/java/com/yingyangfly/baselib/base/BaseActivity.kt

@@ -74,7 +74,7 @@ abstract class BaseActivity<DB : ViewDataBinding> : AppCompatActivity(),
     /**
      * 健康咨询
      */
-    var daocorDao: DoctorDao? = null
+    var doctorDao: DoctorDao? = null
 
     @SuppressLint("SourceLockedOrientationActivity")
     override fun onCreate(savedInstanceState: Bundle?) {
@@ -98,7 +98,7 @@ abstract class BaseActivity<DB : ViewDataBinding> : AppCompatActivity(),
         db = AppDataBase.getInstance(mContext)
         if (db != null) {
             questionsDao = db?.getQuestionsDao()
-            daocorDao = db?.getDoctorsDao()
+            doctorDao = db?.getDoctorsDao()
         }
         initMVVM()
         initViews()

+ 3 - 0
baselib/src/main/java/com/yingyangfly/baselib/db/DoctorDao.kt

@@ -14,6 +14,9 @@ interface DoctorDao : BaseDao<DoctorBean> {
     @Query("select * from Doctor")
     fun getAllDoctorBean(): MutableList<DoctorBean>
 
+    @Query("select * from Doctor where userName like '%' || :name || '%'")
+    fun getAllDoctorBeanByName(name: String): MutableList<DoctorBean>
+
     @Query("select * from Doctor where id = :id")
     fun getDoctor(id: String): DoctorBean
 

+ 5 - 0
baselib/src/main/java/com/yingyangfly/baselib/router/RouterUrlCommon.kt

@@ -175,4 +175,9 @@ object RouterUrlCommon {
      */
     const val evaluationHistory = "/evaluation/history"
 
+    /**
+     * 医生搜索
+     */
+    const val searchDoctor = "/search/doctor"
+
 }

+ 6 - 0
healthconsultation/src/main/AndroidManifest.xml

@@ -65,5 +65,11 @@
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustResize|adjustPan" />
+
+        <activity
+            android:name="com.yingyang.healthconsultation.search.SearchDoctorActivity"
+            android:configChanges="keyboardHidden|orientation|screenSize"
+            android:screenOrientation="landscape"
+            android:windowSoftInputMode="adjustResize|adjustPan" />
     </application>
 </manifest>

+ 5 - 6
healthconsultation/src/main/java/com/yingyang/healthconsultation/activity/HealthConsultationActivity.kt

@@ -107,7 +107,7 @@ class HealthConsultationActivity :
                         finish()
                     }
                     R.id.searchLayout -> {
-
+                        JumpUtil.jumpActivity(RouterUrlCommon.searchDoctor, mContext)
                     }
 
                     R.id.btnHome -> {
@@ -164,8 +164,8 @@ class HealthConsultationActivity :
      */
     private fun getRecommendDoctorList() {
         doctorBeans.clear()
-        if (daocorDao != null) {
-            daocorDao?.deleteAll()
+        if (doctorDao != null) {
+            doctorDao?.deleteAll()
         }
         viewModel.getRecommendDoctorList(fail = {
             it.show()
@@ -173,8 +173,8 @@ class HealthConsultationActivity :
             if (it.isNullOrEmpty().not()) {
                 doctorBeans.clear()
                 doctorBeans.addAll(it!!)
-                if (daocorDao != null) {
-                    daocorDao?.insertAll(doctorBeans)
+                if (doctorDao != null) {
+                    doctorDao?.insertAll(doctorBeans)
                 }
             }
             recommendDoctorAdapter.setData(doctorBeans)
@@ -204,7 +204,6 @@ class HealthConsultationActivity :
             TUICallback() {
             override fun onSuccess() {
                 runOnUiThread {
-                    "IM登陆成功".toast()
                     val param = Bundle()
                     param.putInt(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C)
                     param.putString(TUIConstants.TUIChat.CHAT_ID, bean.id)

+ 20 - 0
healthconsultation/src/main/java/com/yingyang/healthconsultation/adapter/SearchDoctorAdapter.kt

@@ -0,0 +1,20 @@
+package com.yingyang.healthconsultation.adapter
+
+import com.yingyang.healthconsultation.R
+import com.yingyang.healthconsultation.databinding.ItemSearchDoctorBinding
+import com.yingyangfly.baselib.adapter.BaseDataBindingAdapter
+import com.yingyangfly.baselib.db.DoctorBean
+
+/**
+ * 医生搜索adapter
+ */
+class SearchDoctorAdapter(override val layoutId: Int = R.layout.item_search_doctor) :
+    BaseDataBindingAdapter<DoctorBean, ItemSearchDoctorBinding>() {
+    override fun onBindViewHolder(
+        binding: ItemSearchDoctorBinding,
+        item: DoctorBean,
+        position: Int
+    ) {
+        binding.data = item
+    }
+}

+ 2 - 2
healthconsultation/src/main/java/com/yingyang/healthconsultation/consultationsheet/ConsultationRequestActivity.kt

@@ -36,8 +36,8 @@ class ConsultationRequestActivity :
     }
 
     override fun initViews() {
-        if (daocorDao != null) {
-            doctorBean = daocorDao?.getDoctor(id)
+        if (doctorDao != null) {
+            doctorBean = doctorDao?.getDoctor(id)
             if (doctorBean != null) {
                 binding.data = doctorBean!!
                 val consultationTotal = "咨询量:" + doctorBean!!.consultationTotal

+ 2 - 2
healthconsultation/src/main/java/com/yingyang/healthconsultation/doctordetails/DoctorDetailsActivity.kt

@@ -77,8 +77,8 @@ class DoctorDetailsActivity :
             it.toast()
         }, success = {
             if (it != null) {
-                if (daocorDao != null) {
-                    daocorDao?.insert(it)
+                if (doctorDao != null) {
+                    doctorDao?.insert(it)
                 }
                 binding.data = it
                 val consultationTotal = "咨询量:" + it.consultationTotal

+ 2 - 2
healthconsultation/src/main/java/com/yingyang/healthconsultation/payment/PaymentActivity.kt

@@ -43,8 +43,8 @@ class PaymentActivity : BaseMVVMActivity<ActivityPaymentBinding, PaymentViewMode
 
     override fun initViews() {
         rxTimer = RxTimer()
-        if (daocorDao != null) {
-            doctorBean = daocorDao?.getDoctor(id)
+        if (doctorDao != null) {
+            doctorBean = doctorDao?.getDoctor(id)
             if (doctorBean != null) {
                 binding.data = doctorBean
             }

+ 92 - 0
healthconsultation/src/main/java/com/yingyang/healthconsultation/search/SearchDoctorActivity.kt

@@ -0,0 +1,92 @@
+package com.yingyang.healthconsultation.search
+
+import android.annotation.SuppressLint
+import android.view.MotionEvent
+import android.view.View
+import com.alibaba.android.arouter.facade.annotation.Route
+import com.yingyang.healthconsultation.R
+import com.yingyang.healthconsultation.adapter.SearchDoctorAdapter
+import com.yingyang.healthconsultation.databinding.ActivitySearchDoctorBinding
+import com.yingyangfly.baselib.base.BaseActivity
+import com.yingyangfly.baselib.db.DoctorBean
+import com.yingyangfly.baselib.ext.getEndAnimation
+import com.yingyangfly.baselib.ext.getScaleAnimation
+import com.yingyangfly.baselib.ext.toast
+import com.yingyangfly.baselib.router.RouterUrlCommon
+
+/**
+ * 医生搜索页面
+ */
+@Route(path = RouterUrlCommon.searchDoctor)
+class SearchDoctorActivity : BaseActivity<ActivitySearchDoctorBinding>(),
+    View.OnTouchListener {
+
+    private val adapter by lazy { SearchDoctorAdapter() }
+    private var doctorList = mutableListOf<DoctorBean>()
+
+    override fun initViews() {
+        binding {
+            rvDoctors.adapter = adapter
+        }
+    }
+
+    @SuppressLint("ClickableViewAccessibility")
+    override fun initListener() {
+        binding {
+            backLayout.setOnTouchListener(this@SearchDoctorActivity)
+            btnSearch.setOnTouchListener(this@SearchDoctorActivity)
+        }
+    }
+
+    override fun initData() {
+
+    }
+
+    @SuppressLint("ClickableViewAccessibility")
+    override fun onTouch(v: View, event: MotionEvent): Boolean {
+        when (event.action) {
+            MotionEvent.ACTION_DOWN -> {
+                if (v.id == R.id.backLayout || v.id == R.id.btnSearch) {
+                    v.startAnimation(getScaleAnimation())
+                }
+            }
+            MotionEvent.ACTION_UP -> {
+                v.startAnimation(getEndAnimation())
+                when (v.id) {
+                    R.id.backLayout -> {
+                        //返回首页
+                        finish()
+                    }
+                    R.id.btnSearch -> {
+                        if (binding.editDoctor.text.toString().trim().isNotEmpty()) {
+                            loadData()
+                        } else {
+                            "请输入医生姓名".toast()
+                        }
+                    }
+                }
+            }
+            MotionEvent.ACTION_CANCEL -> {
+                if (v.id == R.id.backLayout || v.id == R.id.btnSearch) {
+                    v.startAnimation(getEndAnimation())
+                }
+            }
+        }
+        return true
+    }
+
+    /**
+     * 搜索医生列表
+     */
+    private fun loadData() {
+        if (doctorDao != null) {
+            val doctors =
+                doctorDao?.getAllDoctorBeanByName(binding.editDoctor.text.toString().trim())
+            if (doctors.isNullOrEmpty().not()) {
+                doctorList.clear()
+                doctorList.addAll(doctors!!)
+            }
+        }
+        adapter.setData(doctorList)
+    }
+}

+ 6 - 0
healthconsultation/src/main/manifest/AndroidManifest.xml

@@ -65,5 +65,11 @@
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustResize|adjustPan" />
+
+        <activity
+            android:name="com.yingyang.healthconsultation.search.SearchDoctorActivity"
+            android:configChanges="keyboardHidden|orientation|screenSize"
+            android:screenOrientation="landscape"
+            android:windowSoftInputMode="adjustResize|adjustPan" />
     </application>
 </manifest>

+ 2 - 1
healthconsultation/src/main/res/layout/activity_consultation_request.xml

@@ -34,7 +34,8 @@
             <androidx.appcompat.widget.AppCompatImageView
                 android:layout_width="@dimen/divider_48px"
                 android:layout_height="@dimen/divider_48px"
-                android:background="@mipmap/icon_back" />
+                android:background="@mipmap/icon_back"
+                android:scaleType="centerInside" />
 
             <androidx.appcompat.widget.AppCompatTextView
                 android:layout_width="wrap_content"

+ 1 - 1
healthconsultation/src/main/res/layout/activity_health_consultation.xml

@@ -90,7 +90,7 @@
                         android:id="@+id/imageSearch"
                         android:layout_width="@dimen/divider_30px"
                         android:layout_height="@dimen/divider_28px"
-                        android:layout_marginStart="@dimen/divider_34px"
+                        android:layout_marginStart="@dimen/divider_24px"
                         android:background="@mipmap/icon_search"
                         app:layout_constraintBottom_toBottomOf="parent"
                         app:layout_constraintStart_toStartOf="parent"

+ 112 - 0
healthconsultation/src/main/res/layout/activity_search_doctor.xml

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout 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"
+    tools:ignore="ResourceName">
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@mipmap/icon_uniform_background">
+
+        <LinearLayout
+            android:id="@+id/backLayout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="@dimen/divider_65px"
+            android:layout_marginTop="@dimen/divider_35px"
+            android:gravity="center"
+            android:orientation="horizontal"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent">
+
+            <androidx.appcompat.widget.AppCompatImageView
+                android:layout_width="@dimen/divider_48px"
+                android:layout_height="@dimen/divider_48px"
+                android:background="@mipmap/icon_back" />
+
+            <androidx.appcompat.widget.AppCompatTextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/divider_14px"
+                android:text="@string/back_pager"
+                android:textColor="@android:color/white"
+                android:textSize="@dimen/divider_28px"
+                android:textStyle="bold" />
+
+        </LinearLayout>
+
+        <LinearLayout
+            android:id="@+id/searchLayout"
+            android:layout_width="0dp"
+            android:layout_height="@dimen/divider_60px"
+            android:layout_marginStart="@dimen/divider_42px"
+            android:layout_marginTop="@dimen/divider_32px"
+            android:background="@drawable/bg_home_page_search"
+            android:gravity="center_vertical"
+            android:orientation="horizontal"
+            app:layout_constraintEnd_toStartOf="@+id/btnSearch"
+            app:layout_constraintStart_toEndOf="@+id/backLayout"
+            app:layout_constraintTop_toTopOf="parent">
+
+            <androidx.appcompat.widget.AppCompatImageView
+                android:id="@+id/imageSearch"
+                android:layout_width="@dimen/divider_30px"
+                android:layout_height="@dimen/divider_28px"
+                android:layout_marginStart="@dimen/divider_24px"
+                android:background="@mipmap/icon_search"
+                android:scaleType="centerInside" />
+
+            <androidx.appcompat.widget.AppCompatEditText
+                android:id="@+id/editDoctor"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="@dimen/divider_9px"
+                android:background="@null"
+                android:gravity="center_vertical"
+                android:hint="@string/please_input_doctors_name"
+                android:textColor="@color/color_FF333333"
+                android:textColorHint="@color/color_FF767575"
+                android:textSize="@dimen/divider_28px" />
+        </LinearLayout>
+
+        <androidx.appcompat.widget.AppCompatButton
+            android:id="@+id/btnSearch"
+            android:layout_width="@dimen/divider_120px"
+            android:layout_height="@dimen/divider_60px"
+            android:layout_marginStart="@dimen/divider_20px"
+            android:layout_marginTop="@dimen/divider_32px"
+            android:layout_marginEnd="@dimen/divider_20px"
+            android:background="@drawable/bg_home_page_search"
+            android:gravity="center"
+            android:text="@string/search"
+            android:textColor="@color/color_FF333333"
+            android:textSize="@dimen/divider_28px"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toEndOf="@+id/searchLayout"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <com.google.android.material.card.MaterialCardView
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_marginStart="@dimen/divider_22px"
+            android:layout_marginTop="@dimen/divider_26px"
+            android:layout_marginEnd="@dimen/divider_22px"
+            android:layout_marginBottom="@dimen/divider_21px"
+            android:theme="@style/Theme.MaterialComponents.NoActionBar"
+            app:cardBackgroundColor="@android:color/white"
+            app:cardCornerRadius="@dimen/divider_28px"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/searchLayout">
+
+            <androidx.recyclerview.widget.RecyclerView
+                android:id="@+id/rvDoctors"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
+        </com.google.android.material.card.MaterialCardView>
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+</layout>

+ 36 - 0
healthconsultation/src/main/res/layout/item_search_doctor.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    tools:ignore="ResourceName">
+
+    <data>
+
+        <variable
+            name="data"
+            type="com.yingyangfly.baselib.db.DoctorBean" />
+    </data>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/divider_90px"
+        android:orientation="vertical">
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="@dimen/divider_37px"
+            android:layout_marginTop="@dimen/divider_30px"
+            android:text='@{data.userName+" "+data.departmentName}'
+            android:textColor="@color/color_FF333333"
+            android:textSize="@dimen/divider_28px" />
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/divider_1px"
+            android:layout_gravity="bottom"
+            android:layout_marginStart="@dimen/divider_37px"
+            android:layout_marginEnd="@dimen/divider_46px"
+            android:background="@color/color_FFD5D5D5" />
+    </LinearLayout>
+
+</layout>

BIN
healthconsultation/src/main/res/mipmap-xxhdpi/icon_search.png


+ 1 - 0
healthconsultation/src/main/res/values/colors.xml

@@ -31,4 +31,5 @@
     <color name="color_FF4A76FF" tools:ignore="ResourceName">#FF4A76FF</color>
     <color name="color_FFFFA535" tools:ignore="ResourceName">#FFFFA535</color>
     <color name="color_FFFFFF" tools:ignore="ResourceName">#FFFFFF</color>
+    <color name="color_FFD5D5D5" tools:ignore="ResourceName">#FFD5D5D5</color>
 </resources>

+ 2 - 0
healthconsultation/src/main/res/values/strings.xml

@@ -54,4 +54,6 @@
     <string name="order_payment" translatable="false" tools:ignore="ResourceName">订单支付</string>
     <string name="payment_completed" tools:ignore="ResourceName">已完成支付</string>
     <string name="view_all" tools:ignore="ResourceName">查看全部</string>
+    <string name="please_input_doctors_name" translatable="false" tools:ignore="ResourceName">请输入医生姓名</string>
+    <string name="search" tools:ignore="ResourceName">搜索</string>
 </resources>