Files
Android-key-of-love/app/src/main/res/layout/fragment_home.xml

379 lines
16 KiB
XML
Raw Normal View History

2025-11-26 16:47:15 +08:00
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
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"
android:id="@+id/rootCoordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.home.HomeFragment">
<!-- 原来的内容:背景 + VIP + 权益 + 按钮 -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- 背景 -->
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/bg"
android:scaleType="fitXY"
android:adjustViewBounds="true" />
<!-- 内容 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<!-- vip -->
<!-- 成为会员 -->
<ImageView
android:id="@+id/vip"
2026-02-10 18:26:31 +08:00
android:layout_width="@dimen/sw_216dp"
android:layout_height="@dimen/sw_161dp"
2025-11-26 16:47:15 +08:00
android:layout_gravity="top|center_horizontal"
2026-02-10 18:26:31 +08:00
android:layout_marginTop="@dimen/sw_40dp"
2025-11-26 16:47:15 +08:00
android:scaleType="fitCenter"
android:src="@drawable/vip" />
<TextView
android:id="@+id/member"
2026-02-10 18:26:31 +08:00
android:layout_marginTop="@dimen/sw_28dp"
android:layout_width="@dimen/sw_290dp"
2025-11-26 16:47:15 +08:00
android:layout_height="wrap_content"
2026-02-10 18:26:31 +08:00
android:textSize="@dimen/sw_18sp"
2025-11-26 16:47:15 +08:00
android:textStyle="bold"
android:textColor="#1B1F1A"
android:layout_gravity="center_horizontal"
2026-01-21 21:53:34 +08:00
android:gravity="center"
android:text="@string/home_member" />
2025-11-26 16:47:15 +08:00
<TextView
android:id="@+id/Unlock"
2026-02-10 18:26:31 +08:00
android:layout_marginTop="@dimen/sw_3dp"
2025-11-26 16:47:15 +08:00
android:layout_width="wrap_content"
android:layout_height="wrap_content"
2026-02-10 18:26:31 +08:00
android:textSize="@dimen/sw_14sp"
2025-11-26 16:47:15 +08:00
android:textColor="#1B1F1A"
android:layout_gravity="center_horizontal"
2026-01-21 21:53:34 +08:00
android:text="@string/home_unlock" />
2025-11-26 16:47:15 +08:00
<!-- 权益 -->
<LinearLayout
2026-02-10 18:26:31 +08:00
android:layout_marginTop="@dimen/sw_22dp"
2025-11-26 16:47:15 +08:00
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:orientation="horizontal">
<!-- 权益1 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
2026-02-10 18:26:31 +08:00
android:layout_width="@dimen/sw_54dp"
android:layout_height="@dimen/sw_44dp"
2025-11-26 16:47:15 +08:00
android:src="@drawable/ai_dialogue"
android:scaleType="fitCenter" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
2026-02-10 18:26:31 +08:00
android:textSize="@dimen/sw_12sp"
2025-11-26 16:47:15 +08:00
android:gravity="center"
android:textColor="#1B1F1A"
2026-01-21 21:53:34 +08:00
android:text="@string/home_ai_dialogue" />
2025-11-26 16:47:15 +08:00
</LinearLayout>
<!-- 权益2 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<ImageView
2026-02-10 18:26:31 +08:00
android:layout_width="@dimen/sw_54dp"
android:layout_height="@dimen/sw_44dp"
2025-11-26 16:47:15 +08:00
android:src="@drawable/personalized_keyboard"
android:scaleType="fitCenter" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
2026-02-10 18:26:31 +08:00
android:textSize="@dimen/sw_12sp"
2025-11-26 16:47:15 +08:00
android:gravity="center"
android:textColor="#1B1F1A"
2026-01-21 21:53:34 +08:00
android:text="@string/home_ai_keyboard" />
2025-11-26 16:47:15 +08:00
</LinearLayout>
<!-- 权益3 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<ImageView
2026-02-10 18:26:31 +08:00
android:layout_width="@dimen/sw_54dp"
android:layout_height="@dimen/sw_44dp"
2025-11-26 16:47:15 +08:00
android:src="@drawable/chat_persona"
android:scaleType="fitCenter" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
2026-02-10 18:26:31 +08:00
android:textSize="@dimen/sw_12sp"
2025-11-26 16:47:15 +08:00
android:gravity="center"
android:textColor="#1B1F1A"
2026-01-21 21:53:34 +08:00
android:text="@string/home_ai_persona" />
2025-11-26 16:47:15 +08:00
</LinearLayout>
<!-- 权益4 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<ImageView
2026-02-10 18:26:31 +08:00
android:layout_width="@dimen/sw_54dp"
android:layout_height="@dimen/sw_44dp"
2025-11-26 16:47:15 +08:00
android:src="@drawable/emotional_counseling"
android:scaleType="fitCenter" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
2026-02-10 18:26:31 +08:00
android:textSize="@dimen/sw_12sp"
2025-11-26 16:47:15 +08:00
android:gravity="center"
android:textColor="#1B1F1A"
2026-01-21 21:53:34 +08:00
android:text="@string/home_ai_counseling" />
2025-11-26 16:47:15 +08:00
</LinearLayout>
</LinearLayout>
<!-- 按钮 -->
<LinearLayout
android:id="@+id/rechargeButton"
2026-02-10 18:26:31 +08:00
android:layout_marginTop="@dimen/sw_22dp"
android:layout_width="@dimen/sw_257dp"
android:layout_height="@dimen/sw_57dp"
2025-11-26 16:47:15 +08:00
android:layout_gravity="center_horizontal"
android:gravity="center"
android:background="@drawable/button_bg"
2026-02-10 18:26:31 +08:00
android:elevation="@dimen/sw_4dp"
2025-11-26 16:47:15 +08:00
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
2026-02-10 18:26:31 +08:00
android:textSize="@dimen/sw_15sp"
2025-11-26 16:47:15 +08:00
android:textStyle="bold"
android:gravity="center"
android:textColor="#1B1F1A"
2026-01-21 21:53:34 +08:00
android:text="@string/home_recharge" />
2025-11-26 16:47:15 +08:00
</LinearLayout>
</LinearLayout>
</FrameLayout>
<!-- 半透明遮罩:点击 / 下滑关闭底部盒子 -->
<View
android:id="@+id/view_scrim"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#66000000"
android:visibility="gone" />
<!-- 圆角底部盒子BottomSheet -->
<com.google.android.material.card.MaterialCardView
android:id="@+id/bottomSheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:backgroundTint="@android:color/white"
app:cardUseCompatPadding="false"
2026-02-10 18:26:31 +08:00
app:cardElevation="@dimen/sw_8dp"
2025-11-26 16:47:15 +08:00
app:cardBackgroundColor="@android:color/white"
app:shapeAppearance="@style/ShapeAppearance.TopRoundedOnly"
app:layout_behavior="@string/bottom_sheet_behavior">
<ImageView
android:id="@+id/backgroundImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/option_background"
android:scaleType="fitXY"
android:adjustViewBounds="true" />
<!-- 盒子内容 -->
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- 顶部“可点击的头部区域”,点击可展开/收起 -->
<LinearLayout
android:id="@+id/bottomSheetHeader"
android:layout_width="match_parent"
2026-02-10 18:26:31 +08:00
android:layout_height="@dimen/sw_48dp"
2025-11-26 16:47:15 +08:00
android:gravity="center"
2026-02-10 18:26:31 +08:00
android:paddingTop="@dimen/sw_8dp"
android:paddingBottom="@dimen/sw_8dp"
2025-11-26 16:47:15 +08:00
android:orientation="vertical">
<!-- 小横条指示器 -->
<View
2026-02-10 18:26:31 +08:00
android:layout_width="@dimen/sw_40dp"
android:layout_height="@dimen/sw_4dp"
2025-11-26 16:47:15 +08:00
android:background="@drawable/bs_handle_bg" />
</LinearLayout>
<!-- 顶部选项栏:两个选项,对应两个列表 -->
<LinearLayout
android:id="@+id/topTabs"
android:layout_width="match_parent"
2026-02-10 18:26:31 +08:00
android:layout_height="@dimen/sw_40dp"
2025-11-26 16:47:15 +08:00
android:orientation="horizontal"
android:gravity="center_vertical"
2026-02-10 18:26:31 +08:00
android:paddingStart="@dimen/sw_16dp"
android:paddingEnd="@dimen/sw_16dp">
2025-11-26 16:47:15 +08:00
<TextView
android:id="@+id/tab_list1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
2026-02-10 18:26:31 +08:00
android:layout_marginEnd="@dimen/sw_20dp"
2025-11-26 16:47:15 +08:00
android:gravity="center"
2026-01-21 21:53:34 +08:00
android:text="@string/home_tab1"
2026-02-10 18:26:31 +08:00
android:textSize="@dimen/sw_14sp"
2025-11-26 16:47:15 +08:00
android:textStyle="bold"
android:textColor="#1B1F1A" />
<TextView
android:id="@+id/tab_list2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
2026-02-10 18:26:31 +08:00
android:layout_marginStart="@dimen/sw_20dp"
2025-11-26 16:47:15 +08:00
android:gravity="center"
2026-01-21 21:53:34 +08:00
android:text="@string/home_tab2"
2026-02-10 18:26:31 +08:00
android:textSize="@dimen/sw_14sp"
2025-11-26 16:47:15 +08:00
android:textColor="#801B1F1A" />
</LinearLayout>
<!-- 第二个列表下面的标签行(数量不固定),只在第二个列表时可见 -->
<HorizontalScrollView
android:id="@+id/tagScroll"
android:layout_width="match_parent"
2026-02-10 18:26:31 +08:00
android:layout_height="@dimen/sw_40dp"
2025-11-26 16:47:15 +08:00
android:visibility="gone"
android:fillViewport="true"
android:scrollbars="none"
android:overScrollMode="never">
<LinearLayout
android:id="@+id/tagContainer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center_vertical" />
</HorizontalScrollView>
<!-- 内容区ViewPager2 里放不同的 RecyclerView卡片列表-->
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
2026-02-12 19:40:32 +08:00
<FrameLayout
android:id="@+id/noResultOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:visibility="gone"
android:clickable="true"
android:focusable="true"
android:importantForAccessibility="no">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center_horizontal"
android:orientation="vertical"
android:gravity="center_horizontal">
<!-- 顶部“可点击的头部区域”,点击可展开/收起 -->
<LinearLayout
android:id="@+id/bottomSheetHeader"
android:layout_width="match_parent"
android:layout_height="@dimen/sw_48dp"
android:gravity="center"
android:paddingTop="@dimen/sw_8dp"
android:paddingBottom="@dimen/sw_8dp"
android:orientation="vertical">
<!-- 小横条指示器 -->
<View
android:layout_width="@dimen/sw_40dp"
android:layout_height="@dimen/sw_4dp"
android:background="@drawable/bs_handle_bg" />
</LinearLayout>
<ImageView
android:id="@+id/noResultImage"
android:layout_width="@dimen/sw_175dp"
android:layout_height="@dimen/sw_177dp"
android:src="@drawable/no_search_result"
android:scaleType="fitCenter"
android:contentDescription="@null"
android:importantForAccessibility="no" />
<TextView
android:id="@+id/noResultText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textAlignment="center"
android:text="@string/search_not_data"
android:textSize="@dimen/sw_13sp"
android:textColor="#1B1F1A"
android:includeFontPadding="false" />
</LinearLayout>
</FrameLayout>
2025-11-26 16:47:15 +08:00
</com.google.android.material.card.MaterialCardView>
<!-- 浮动按钮 -->
<ImageView
android:id="@+id/floatingImage"
2026-02-10 18:26:31 +08:00
android:layout_width="@dimen/sw_92dp"
android:layout_height="@dimen/sw_78dp"
android:elevation="@dimen/sw_99dp"
2025-11-26 16:47:15 +08:00
android:layout_gravity="center_vertical|end"
2026-02-10 18:26:31 +08:00
android:layout_marginEnd="@dimen/sw_16dp"
android:layout_marginTop="@dimen/sw_80dp"
2025-11-26 16:47:15 +08:00
android:src="@drawable/floating"
android:scaleType="centerInside" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>