feat: 国际进港查询筛选按钮有效时显示红点提示
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package com.lukouguoji.gjj.viewModel
|
|||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import androidx.lifecycle.MediatorLiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import com.lukouguoji.gjj.R
|
import com.lukouguoji.gjj.R
|
||||||
import com.lukouguoji.gjj.activity.IntImpQueryEditActivity
|
import com.lukouguoji.gjj.activity.IntImpQueryEditActivity
|
||||||
@@ -71,6 +72,20 @@ class IntImpQueryViewModel : BasePageViewModel(), IOnItemClickListener {
|
|||||||
val businessType = MutableLiveData("")
|
val businessType = MutableLiveData("")
|
||||||
val goodsCn = MutableLiveData("")
|
val goodsCn = MutableLiveData("")
|
||||||
|
|
||||||
|
// 是否有筛选条件(任意一个非空则为 true)
|
||||||
|
val hasFilter: MediatorLiveData<Boolean> = MediatorLiveData<Boolean>().apply {
|
||||||
|
val update = { _: Any? ->
|
||||||
|
value = listOf(spCode, flightNo, origin, awbType, businessType, goodsCn)
|
||||||
|
.any { !it.value.isNullOrEmpty() }
|
||||||
|
}
|
||||||
|
addSource(spCode, update)
|
||||||
|
addSource(flightNo, update)
|
||||||
|
addSource(origin, update)
|
||||||
|
addSource(awbType, update)
|
||||||
|
addSource(businessType, update)
|
||||||
|
addSource(goodsCn, update)
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// 方法区
|
// 方法区
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
5
module_gjj/src/main/res/drawable/bg_red_dot.xml
Normal file
5
module_gjj/src/main/res/drawable/bg_red_dot.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="#F44336" />
|
||||||
|
</shape>
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
|
<import type="android.view.View" />
|
||||||
<import type="com.lukouguoji.module_base.ui.weight.search.layout.SearchLayoutType" />
|
<import type="com.lukouguoji.module_base.ui.weight.search.layout.SearchLayoutType" />
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
@@ -114,13 +115,26 @@
|
|||||||
android:padding="2dp"
|
android:padding="2dp"
|
||||||
android:src="@drawable/img_search" />
|
android:src="@drawable/img_search" />
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp">
|
||||||
android:onClick="@{()-> viewModel.filterClick()}"
|
|
||||||
android:padding="5dp"
|
<ImageView
|
||||||
android:src="@drawable/img_filter" />
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:onClick="@{()-> viewModel.filterClick()}"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:src="@drawable/img_filter" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="8dp"
|
||||||
|
android:layout_height="8dp"
|
||||||
|
android:layout_gravity="top|end"
|
||||||
|
android:background="@drawable/bg_red_dot"
|
||||||
|
android:visibility="@{viewModel.hasFilter ? View.VISIBLE : View.GONE}" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user