优化ai对话页面
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -84,6 +84,7 @@ dependencies {
|
||||
implementation libs.androidx.compose.material3
|
||||
implementation libs.material
|
||||
implementation libs.appcompat
|
||||
implementation libs.luban
|
||||
testImplementation libs.junit
|
||||
androidTestImplementation libs.androidx.junit
|
||||
androidTestImplementation libs.androidx.espresso.core
|
||||
|
||||
@@ -12,11 +12,8 @@ import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.provider.MediaStore
|
||||
import android.text.Editable
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableString
|
||||
import android.text.TextUtils
|
||||
import android.text.TextWatcher
|
||||
import android.text.style.ImageSpan
|
||||
import android.view.KeyEvent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -46,6 +43,7 @@ import com.ck.ckcollar.app.ui.base.CKBaseActivity
|
||||
import com.ck.ckcollar.app.ui.dialog.CKAlertDialog
|
||||
import com.ck.ckcollar.app.utils.CKUtils
|
||||
import com.ck.ckcollar.app.utils.Const
|
||||
import com.ck.ckcollar.app.utils.LubanCompressUtil
|
||||
import com.ck.ckcollar.app.utils.networkone.ICallback
|
||||
import com.ck.ckcollar.app.utils.networkone.TTHttpClient
|
||||
import com.ck.ckcollar.app.utils.networkone.model.TTRequestData
|
||||
@@ -518,32 +516,22 @@ class CustomerActivity : CKBaseActivity() {
|
||||
var model = Gson().fromJson<UploadModel>(data, UploadModel::class.java)
|
||||
|
||||
url = model.urls
|
||||
handler.post {
|
||||
sendMessage(UUID.randomUUID().toString(), "", false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onFailed(code: String, msg: String) {
|
||||
hiddenProgeassDialog()
|
||||
lock = true
|
||||
path = ""
|
||||
url = ""
|
||||
toast(msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun addImage(path: String) {
|
||||
try {
|
||||
var bitmap = TTUtils.getBitmap(path, 300, 300)
|
||||
var imageSpan = ImageSpan(bitmap!!);
|
||||
var spannableString = SpannableString("$$$$$");
|
||||
spannableString.setSpan(
|
||||
imageSpan, 0, 5,
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
);
|
||||
binding.editMessage.text?.insert(0, spannableString);
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getList() {
|
||||
TTHttpClient.get(this, "会话消息列表", TTRequestParam(), object : ICallback {
|
||||
override fun onSuccess(data: String) {
|
||||
@@ -573,15 +561,38 @@ class CustomerActivity : CKBaseActivity() {
|
||||
|
||||
if (requestCode == 55 && resultCode == RESULT_OK) {
|
||||
path = PreferencesUtils.getString(this@CustomerActivity, Const.IMAGE_PATH, "")!!
|
||||
|
||||
addImage(path!!)
|
||||
uploadImage()
|
||||
sendSelectedImage()
|
||||
} else if (requestCode == 56 && resultCode == RESULT_OK) {
|
||||
path = TTUtils.getImageUrl(this, data!!.getData());
|
||||
addImage(path)
|
||||
sendSelectedImage()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun sendSelectedImage() {
|
||||
if (TextUtils.isEmpty(path)) return
|
||||
|
||||
LubanCompressUtil.getCompressFile(
|
||||
this,
|
||||
File(path),
|
||||
object : LubanCompressUtil.CompressCallback {
|
||||
override fun success(file: File) {
|
||||
if (isFinishing || isDestroyed) return
|
||||
path = file.absolutePath
|
||||
lock = false
|
||||
binding.contentBottom.visibility = View.GONE
|
||||
binding.editMessage.setText("")
|
||||
uploadImage()
|
||||
}
|
||||
|
||||
override fun fail(failMsg: String) {
|
||||
if (isFinishing || isDestroyed) return
|
||||
lock = true
|
||||
path = ""
|
||||
toast(failMsg)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
@@ -101,7 +101,19 @@ class HealthFragment: CKBaseFragment() {
|
||||
|
||||
|
||||
binding.textDate.text = getString(R.string.pet_advisor2)
|
||||
binding.textDate2.text = "("+customerStatusModel.serviceStartTime +","+customerStatusModel.serviceEndTime+")"
|
||||
val serviceTimes = listOfNotNull(
|
||||
customerStatusModel.serviceStartTime?.takeIf { it.isNotBlank() },
|
||||
customerStatusModel.serviceEndTime?.takeIf { it.isNotBlank() }
|
||||
)
|
||||
binding.textDate2.text = when (serviceTimes.size) {
|
||||
0 -> getString(R.string.pet_advisor_time_default)
|
||||
1 -> serviceTimes.first()
|
||||
else -> getString(
|
||||
R.string.pet_advisor_time_format,
|
||||
serviceTimes[0],
|
||||
serviceTimes[1]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailed(code: String, msg: String) {
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
<com.ck.ckcollar.app.widget.CKLinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:layout_height="60dp"
|
||||
android:background="?attr/mainBackground"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
>
|
||||
<com.scwang.smartrefresh.layout.header.ClassicsHeader
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"></com.scwang.smartrefresh.layout.header.ClassicsHeader>
|
||||
android:layout_height="wrap_content"/>
|
||||
<!--内容-->
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@@ -33,7 +34,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@mipmap/image_health_top"
|
||||
></com.ck.ckcollar.app.widget.CKImageView>
|
||||
/>
|
||||
|
||||
|
||||
<com.ck.ckcollar.app.widget.CKLinearLayout
|
||||
@@ -45,64 +46,83 @@
|
||||
android:paddingHorizontal="20dp"
|
||||
>
|
||||
|
||||
<com.ck.ckcollar.app.widget.CKRelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<com.ck.ckcollar.app.widget.CKLinearLayout
|
||||
<com.ck.ckcollar.app.widget.CKFrameLayout
|
||||
android:id="@+id/contentCustomer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@drawable/bg_health_item1"
|
||||
android:paddingLeft="18dp"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
android:layout_height="96dp"
|
||||
android:layout_marginTop="8dp">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="75dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/bg_health_item1" />
|
||||
|
||||
<com.ck.ckcollar.app.widget.CKLinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/customerTextContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="75dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="18dp"
|
||||
android:paddingRight="96dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.ck.ckcollar.app.widget.CKLinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.ck.ckcollar.app.widget.CKTextView
|
||||
android:id="@+id/textDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/textColor"
|
||||
android:text="@string/pet_advisor"
|
||||
android:textStyle="bold"
|
||||
></com.ck.ckcollar.app.widget.CKTextView>
|
||||
android:text="@string/pet_advisor2"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.ck.ckcollar.app.widget.CKTextView
|
||||
android:id="@+id/textDate2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="13sp"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="@string/pet_advisor_time_default"
|
||||
android:textColor="@color/textColor"
|
||||
></com.ck.ckcollar.app.widget.CKTextView>
|
||||
android:textSize="12sp"
|
||||
app:autoSizeMaxTextSize="12sp"
|
||||
app:autoSizeMinTextSize="9sp"
|
||||
app:autoSizeStepGranularity="1sp"
|
||||
app:autoSizeTextType="uniform" />
|
||||
|
||||
</com.ck.ckcollar.app.widget.CKLinearLayout>
|
||||
|
||||
<com.ck.ckcollar.app.widget.CKTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/textColor"
|
||||
android:text="@string/pet_advisor_desc"
|
||||
></com.ck.ckcollar.app.widget.CKTextView>
|
||||
android:text="@string/pet_advisor_desc" />
|
||||
</com.ck.ckcollar.app.widget.CKLinearLayout>
|
||||
|
||||
<com.ck.ckcollar.app.widget.CKImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/image_health_kf"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="25dp"
|
||||
></com.ck.ckcollar.app.widget.CKImageView>
|
||||
</com.ck.ckcollar.app.widget.CKRelativeLayout>
|
||||
android:id="@+id/imageCustomerService"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="75dp"
|
||||
android:layout_gravity="top|end"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@mipmap/image_health_kf"/>
|
||||
</com.ck.ckcollar.app.widget.CKFrameLayout>
|
||||
|
||||
|
||||
<com.ck.ckcollar.app.widget.CKLinearLayout
|
||||
@@ -134,7 +154,7 @@
|
||||
android:text="@string/ai_text_diagnosis"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textStyle="bold"
|
||||
></com.ck.ckcollar.app.widget.CKTextView>
|
||||
/>
|
||||
<com.ck.ckcollar.app.widget.CKTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -142,7 +162,7 @@
|
||||
android:textSize="14sp"
|
||||
android:text="@string/ai_text_diagnosis_tag"
|
||||
android:layout_marginTop="15dp"
|
||||
></com.ck.ckcollar.app.widget.CKTextView>
|
||||
/>
|
||||
</com.ck.ckcollar.app.widget.CKLinearLayout>
|
||||
|
||||
<com.ck.ckcollar.app.widget.CKImageView
|
||||
@@ -151,11 +171,11 @@
|
||||
android:src="@mipmap/image_health_wz"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
></com.ck.ckcollar.app.widget.CKImageView>
|
||||
/>
|
||||
</com.ck.ckcollar.app.widget.CKRelativeLayout>
|
||||
<View
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="0dp"></View>
|
||||
android:layout_height="0dp"/>
|
||||
<com.ck.ckcollar.app.widget.CKRelativeLayout
|
||||
android:id="@+id/btnAIPhoto"
|
||||
android:layout_width="match_parent"
|
||||
@@ -171,7 +191,7 @@
|
||||
android:src="@mipmap/image_health_tp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
></com.ck.ckcollar.app.widget.CKImageView>
|
||||
/>
|
||||
<com.ck.ckcollar.app.widget.CKLinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -185,7 +205,7 @@
|
||||
android:text="@string/ai_photo_diagnosis"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textStyle="bold"
|
||||
></com.ck.ckcollar.app.widget.CKTextView>
|
||||
/>
|
||||
<com.ck.ckcollar.app.widget.CKTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -193,7 +213,7 @@
|
||||
android:textSize="14sp"
|
||||
android:text="@string/ai_photo_diagnosis_tag"
|
||||
android:layout_marginTop="15dp"
|
||||
></com.ck.ckcollar.app.widget.CKTextView>
|
||||
/>
|
||||
</com.ck.ckcollar.app.widget.CKLinearLayout>
|
||||
|
||||
</com.ck.ckcollar.app.widget.CKRelativeLayout>
|
||||
@@ -207,7 +227,7 @@
|
||||
android:textColor="@color/textColor"
|
||||
android:text="@string/pet_knowledge_popularization"
|
||||
android:layout_marginTop="30dp"
|
||||
></com.ck.ckcollar.app.widget.CKTextView>
|
||||
/>
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
@@ -215,7 +235,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="10dp"
|
||||
></androidx.recyclerview.widget.RecyclerView>
|
||||
/>
|
||||
</com.ck.ckcollar.app.widget.CKLinearLayout>
|
||||
|
||||
</com.ck.ckcollar.app.widget.CKLinearLayout>
|
||||
|
||||
@@ -122,6 +122,8 @@
|
||||
<!-- 宠物顾问模块 -->
|
||||
<string name="pet_advisor">宠物顾问(早 9:00-晚 21:00)</string>
|
||||
<string name="pet_advisor2">宠物顾问</string>
|
||||
<string name="pet_advisor_time_default">08:00-12:00/14:00-21:00</string>
|
||||
<string name="pet_advisor_time_format">%1$s/%2$s</string>
|
||||
<string name="pet_advisor_desc">1分钟快速响应,贴心守护爱宠健康</string>
|
||||
<string name="ai_text_diagnosis">AI文字问诊</string>
|
||||
<string name="ai_text_diagnosis_tag">通用</string>
|
||||
|
||||
@@ -10,6 +10,7 @@ activityCompose = "1.8.0"
|
||||
composeBom = "2024.09.00"
|
||||
|
||||
material = "1.9.0"
|
||||
luban = "1.1.8"
|
||||
|
||||
[libraries]
|
||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||
@@ -27,6 +28,7 @@ androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-
|
||||
androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
||||
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
|
||||
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||
luban = { group = "com.github.Curzibn", name = "Luban", version.ref = "luban" }
|
||||
appcompat = { group = "androidx.appcompat", name = "appcompat", version = "1.6.1" }
|
||||
|
||||
[plugins]
|
||||
|
||||
Reference in New Issue
Block a user