refactor(watch): 重构手表绑定对话框及首页卡片布局
- 移除首页手表卡片的 Tab 分类功能(心脑血管/癌症等) - 重构绑定对话框:更新标题为健康监测工具绑定、简化用户信息展示、优化 SN 编码输入框 - 简化未绑定手表占位视图,仅保留绑定按钮 - 切换环境配置至测试环境(TEST/xj_health/)
This commit is contained in:
@@ -37,10 +37,10 @@ object UrlConfig {
|
||||
private const val PRODUCT_HOME_BANK_IP = "https://api-jkglpt.iosp.ydpt.tech/"
|
||||
|
||||
|
||||
val baseUrlType: BaseUrlType = BaseUrlType.PRODUCT
|
||||
val baseUrlType: BaseUrlType = BaseUrlType.TEST
|
||||
|
||||
// const val middle = "xj_health/" //test
|
||||
const val middle = "hb/" //product
|
||||
const val middle = "xj_health/" //test
|
||||
// const val middle = "hb/" //product
|
||||
|
||||
var isOpenIm: Boolean = true
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.sw.healthyclients.adapter.common.ViewPagerAdapter
|
||||
import com.sw.healthyclients.bean.common.TabItemBean
|
||||
import com.sw.healthyclients.data.local.DataStoreManager
|
||||
import com.xjjk.healthyclients.R
|
||||
import com.xjjk.healthyclients.bean.home.HomeWatchAllDataBean
|
||||
import com.xjjk.healthyclients.bean.home.WatchInfoBean
|
||||
@@ -20,7 +19,6 @@ import com.xjjk.healthyclients.databinding.LayoutHomeItemWatchBinding
|
||||
import com.xjjk.healthyclients.event.WatchDataChangeEvent
|
||||
import com.xjjk.healthyclients.fragment.WatchItemFragment
|
||||
import com.xjjk.healthyclients.superfuntion.init
|
||||
import com.xjjk.healthyclients.superfuntion.onCreateTab
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
class HomeWatchView(context: Context?, attrs: AttributeSet?) :
|
||||
@@ -32,6 +30,8 @@ class HomeWatchView(context: Context?, attrs: AttributeSet?) :
|
||||
private const val AUTO_PLAY_INTERVAL = 5000L
|
||||
}
|
||||
private var hasWatch: Boolean = false
|
||||
// private var tabIndex: Int? = 0
|
||||
|
||||
|
||||
var mContext: Context? = context
|
||||
var mBinding: LayoutHomeItemWatchBinding = DataBindingUtil.inflate(
|
||||
@@ -60,28 +60,29 @@ class HomeWatchView(context: Context?, attrs: AttributeSet?) :
|
||||
|
||||
|
||||
fun init(fragment: Fragment) {
|
||||
val arrayOf = arrayOf("心脑血管", "癌症", "慢呼", "糖尿病", "亚健康")
|
||||
mBinding.watchTabLayout.onCreateTab(arrayOf, 1) { tab ->
|
||||
if (tab?.position != 0) {
|
||||
mBinding.emptyText.visibility = View.VISIBLE
|
||||
mBinding.emptyText.text = "紧急开发中"
|
||||
mBinding.viewPager.visibility = View.GONE
|
||||
mBinding.layoutNoWatch.visibility = View.GONE
|
||||
stopAutoPlay()
|
||||
} else {
|
||||
if (!DataStoreManager.isLogin()) {
|
||||
showLoginEmpty()
|
||||
} else if (hasWatch) {
|
||||
mBinding.viewPager.visibility = View.VISIBLE
|
||||
mBinding.emptyText.visibility = View.GONE
|
||||
mBinding.layoutNoWatch.visibility = View.GONE
|
||||
startAutoPlay()
|
||||
} else {
|
||||
showNoWatchPlaceholder()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// val arrayOf = arrayOf("心脑血管", "癌症", "慢呼", "糖尿病", "亚健康")
|
||||
// mBinding.watchTabLayout.onCreateTab(arrayOf, 1) { tab ->
|
||||
// tabIndex =tab?.position
|
||||
// if (tab?.position != 0) {
|
||||
// mBinding.emptyText.visibility = View.VISIBLE
|
||||
// mBinding.emptyText.text = "紧急开发中"
|
||||
// mBinding.viewPager.visibility = View.GONE
|
||||
// mBinding.layoutNoWatch.visibility = View.GONE
|
||||
// stopAutoPlay()
|
||||
// } else {
|
||||
// if (!DataStoreManager.isLogin()) {
|
||||
// showLoginEmpty()
|
||||
// } else if (hasWatch) {
|
||||
// mBinding.viewPager.visibility = View.VISIBLE
|
||||
// mBinding.emptyText.visibility = View.GONE
|
||||
// mBinding.layoutNoWatch.visibility = View.GONE
|
||||
// startAutoPlay()
|
||||
// } else {
|
||||
// showNoWatchPlaceholder()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
val tabList: MutableList<TabItemBean> = mutableListOf()
|
||||
(0..4).forEach { _ ->
|
||||
@@ -109,6 +110,9 @@ class HomeWatchView(context: Context?, attrs: AttributeSet?) :
|
||||
}
|
||||
|
||||
fun setWatchInfo(watchInfo: WatchInfoBean?) {
|
||||
// if (tabIndex != 0) {
|
||||
// return
|
||||
// }
|
||||
if (watchInfo?.hasWatch == true) {
|
||||
hasWatch = true
|
||||
mBinding.viewPager.visibility = View.VISIBLE
|
||||
|
||||
@@ -18,89 +18,130 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:text="健康监测"
|
||||
android:text="健康监测工具绑定"
|
||||
android:textColor="@color/text_black_33"
|
||||
android:textSize="@dimen/txt16"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/userid_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:layout_below="@+id/tv_title"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical">
|
||||
<!-- <RelativeLayout-->
|
||||
<!-- android:id="@+id/userid_layout"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="52dp"-->
|
||||
<!-- android:layout_below="@+id/tv_title"-->
|
||||
<!-- android:layout_marginTop="10dp"-->
|
||||
<!-- android:gravity="center_vertical">-->
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:text="工 号:"
|
||||
android:textColor="@color/text_black_33"
|
||||
android:textSize="16sp" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_centerVertical="true"-->
|
||||
<!-- android:layout_marginLeft="15dp"-->
|
||||
<!-- android:text="工 号:"-->
|
||||
<!-- android:textColor="@color/text_black_33"-->
|
||||
<!-- android:textSize="16sp" />-->
|
||||
|
||||
<com.allen.library.shape.ShapeLinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="82dp"
|
||||
android:layout_marginRight="15dp"
|
||||
app:shapeCornersRadius="8dp"
|
||||
app:shapeSolidColor="#F5F7FB"
|
||||
app:shapeStrokeColor="#E6E6EA"
|
||||
app:shapeStrokeWidth="1dp">
|
||||
<!-- <com.allen.library.shape.ShapeLinearLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:layout_marginLeft="82dp"-->
|
||||
<!-- android:layout_marginRight="15dp"-->
|
||||
<!-- app:shapeCornersRadius="8dp"-->
|
||||
<!-- app:shapeSolidColor="#F5F7FB"-->
|
||||
<!-- app:shapeStrokeColor="#E6E6EA"-->
|
||||
<!-- app:shapeStrokeWidth="1dp">-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/et_userid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="start|center_vertical"
|
||||
android:paddingLeft="8dp"
|
||||
android:textColor="@color/text_black_33"
|
||||
android:textSize="16sp"
|
||||
tools:text="666666" />
|
||||
</com.allen.library.shape.ShapeLinearLayout>
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/et_userid"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:gravity="start|center_vertical"-->
|
||||
<!-- android:paddingLeft="8dp"-->
|
||||
<!-- android:textColor="@color/text_black_33"-->
|
||||
<!-- android:textSize="16sp"-->
|
||||
<!-- tools:text="666666" />-->
|
||||
<!-- </com.allen.library.shape.ShapeLinearLayout>-->
|
||||
|
||||
</RelativeLayout>
|
||||
<!-- </RelativeLayout>-->
|
||||
|
||||
<!-- <RelativeLayout-->
|
||||
<!-- android:id="@+id/username_layout"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="52dp"-->
|
||||
<!-- android:layout_below="@+id/userid_layout"-->
|
||||
<!-- android:layout_marginTop="10dp"-->
|
||||
<!-- android:gravity="center_vertical">-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_centerVertical="true"-->
|
||||
<!-- android:layout_marginLeft="15dp"-->
|
||||
<!-- android:text="姓 名:"-->
|
||||
<!-- android:textColor="@color/text_black_33"-->
|
||||
<!-- android:textSize="16sp" />-->
|
||||
|
||||
<!-- <com.allen.library.shape.ShapeLinearLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:layout_marginLeft="82dp"-->
|
||||
<!-- android:layout_marginRight="15dp"-->
|
||||
<!-- app:shapeCornersRadius="8dp"-->
|
||||
<!-- app:shapeSolidColor="#F5F7FB"-->
|
||||
<!-- app:shapeStrokeColor="#E6E6EA"-->
|
||||
<!-- app:shapeStrokeWidth="1dp">-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/et_username"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:gravity="start|center_vertical"-->
|
||||
<!-- android:paddingLeft="8dp"-->
|
||||
<!-- android:textColor="@color/text_black_33"-->
|
||||
<!-- android:textSize="16sp"-->
|
||||
<!-- tools:text="666666" />-->
|
||||
<!-- </com.allen.library.shape.ShapeLinearLayout>-->
|
||||
|
||||
<!-- </RelativeLayout>-->
|
||||
<RelativeLayout
|
||||
android:id="@+id/username_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:layout_below="@+id/userid_layout"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_title"
|
||||
android:layout_marginTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/et_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_toLeftOf="@+id/et_userid"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:textColor="#808080"
|
||||
android:textSize="15sp"
|
||||
tools:text="666666" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/et_userid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="15dp"
|
||||
android:textColor="#808080"
|
||||
android:textSize="15sp"
|
||||
tools:text="666666" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/et_username"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:text="姓 名:"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="心脑血管监测工具SN编码:"
|
||||
android:textColor="@color/text_black_33"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<com.allen.library.shape.ShapeLinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="82dp"
|
||||
android:layout_marginRight="15dp"
|
||||
app:shapeCornersRadius="8dp"
|
||||
app:shapeSolidColor="#F5F7FB"
|
||||
app:shapeStrokeColor="#E6E6EA"
|
||||
app:shapeStrokeWidth="1dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/et_username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="start|center_vertical"
|
||||
android:paddingLeft="8dp"
|
||||
android:textColor="@color/text_black_33"
|
||||
android:textSize="16sp"
|
||||
tools:text="666666" />
|
||||
</com.allen.library.shape.ShapeLinearLayout>
|
||||
|
||||
android:textSize="15sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
@@ -111,20 +152,19 @@
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:text="序列号:"
|
||||
android:textColor="@color/text_black_33"
|
||||
android:textSize="16sp" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_centerVertical="true"-->
|
||||
<!-- android:layout_marginLeft="15dp"-->
|
||||
<!-- android:text="序列号:"-->
|
||||
<!-- android:textColor="@color/text_black_33"-->
|
||||
<!-- android:textSize="16sp" />-->
|
||||
|
||||
<com.allen.library.shape.ShapeLinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="82dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
app:shapeCornersRadius="8dp"
|
||||
app:shapeSolidColor="#FFFFFF"
|
||||
app:shapeStrokeColor="#E6E6EA"
|
||||
@@ -136,10 +176,11 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:gravity="start|center_vertical"
|
||||
android:hint="请输入SN编码"
|
||||
android:paddingLeft="8dp"
|
||||
android:textColor="@color/text_black_33"
|
||||
android:textSize="16sp"
|
||||
tools:text="666666" />
|
||||
android:textColorHint="#B6B6B6"
|
||||
android:textSize="16sp" />
|
||||
</com.allen.library.shape.ShapeLinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -63,20 +63,20 @@
|
||||
app:shapeCornersBottomLeftRadius="12dp"
|
||||
app:shapeSolidColor="@color/white">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/watch_tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@+id/toolbar_lay"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@color/white"
|
||||
app:tabIndicatorFullWidth="false"
|
||||
app:tabIndicatorHeight="@dimen/dp_0"
|
||||
app:tabMinWidth="@dimen/dp_0"
|
||||
app:tabMode="auto"
|
||||
app:tabPaddingEnd="@dimen/dp_0"
|
||||
app:tabPaddingStart="@dimen/dp_0"
|
||||
app:tabRippleColor="@null" />
|
||||
<!-- <com.google.android.material.tabs.TabLayout-->
|
||||
<!-- android:id="@+id/watch_tab_layout"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="40dp"-->
|
||||
<!-- android:layout_below="@+id/toolbar_lay"-->
|
||||
<!-- android:layout_marginTop="5dp"-->
|
||||
<!-- android:background="@color/white"-->
|
||||
<!-- app:tabIndicatorFullWidth="false"-->
|
||||
<!-- app:tabIndicatorHeight="@dimen/dp_0"-->
|
||||
<!-- app:tabMinWidth="@dimen/dp_0"-->
|
||||
<!-- app:tabMode="auto"-->
|
||||
<!-- app:tabPaddingEnd="@dimen/dp_0"-->
|
||||
<!-- app:tabPaddingStart="@dimen/dp_0"-->
|
||||
<!-- app:tabRippleColor="@null" />-->
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/viewPager"
|
||||
@@ -92,9 +92,9 @@
|
||||
<TextView
|
||||
android:id="@+id/empty_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="163dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="55dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@color/white"
|
||||
android:gravity="center"
|
||||
android:text="暂未登录"
|
||||
@@ -105,32 +105,17 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_no_watch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="64dp"
|
||||
android:layout_below="@+id/watch_tab_layout"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="20dp"
|
||||
android:visibility="gone"
|
||||
android:paddingBottom="20dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:src="@drawable/icon_empty1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="~暂无数据~"
|
||||
android:textColor="#B6B6B6"
|
||||
android:textSize="11sp" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.allen.library.shape.ShapeTextView
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/btn_bind_watch"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
|
||||
Reference in New Issue
Block a user