feat(fragment): 新增 DbInspectFragment 本地数据库调试查看功能
- 新增 DbInspectFragment,支持按表切换(菜品/食材/调料/槽位)查看全量数据 - 分页加载(每页 50 条)+ isDel 过滤开关,避免大数据量时内存占用过高 - 切换 Tab 立即清空旧数据防止闪现,loadMoreDbInspect 加并发保护 - 槽位表字段少无 isDel,切换到该 Tab 时自动隐藏 isDel 相关控件 - 菜品/食材/调料表字段改为每行 3 列紧凑布局,槽位表保持逐行显示 - SettingActivity 新增"数据库查看"入口,复用 SingleFragmentActivity 承载 - 4 个 DAO 新增分页查询及计数方法,DbRepository/DbViewModel 同步扩展 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -109,6 +109,37 @@
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llDbInspect"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginHorizontal="32dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:background="@drawable/shape_white_dc_15_corners"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:clipToOutline="true">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="数据库查看"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginStart="32dp"
|
||||
android:textColor="@color/black333" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/ic_arrow_right3"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- <!– 底部导航菜单 –>-->
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:id="@+id/bottomMenu"-->
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="#F5F5F5">
|
||||
|
||||
<!-- Tab 切换栏 -->
|
||||
<RadioGroup
|
||||
android:id="@+id/rgTabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="#FFFFFF">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rbCookFood"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="菜品"
|
||||
android:textSize="14sp"
|
||||
android:checked="true" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rbGoods"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="食材"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rbSeasoning"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="调料"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rbSlot"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="槽位"
|
||||
android:textSize="14sp" />
|
||||
</RadioGroup>
|
||||
|
||||
<!-- Tab 下方指示条 -->
|
||||
<View
|
||||
android:id="@+id/vTabIndicator"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="3dp"
|
||||
android:background="#5C77F7" />
|
||||
|
||||
<!-- 工具栏:记录数 + isDel 开关 + 刷新 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:background="#FFFFFF">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="共 0 条"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#888888" />
|
||||
|
||||
<!-- 显示已删除数据开关 -->
|
||||
<TextView
|
||||
android:id="@+id/tvDelLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="显示已删除"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#888888"
|
||||
android:paddingStart="8dp" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/swShowDel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:paddingEnd="4dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRefresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="12dp"
|
||||
android:paddingVertical="6dp"
|
||||
android:text="刷新"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#5C77F7" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 记录列表 -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvRecords"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:clipToPadding="false" />
|
||||
|
||||
<!-- 加载更多按钮 -->
|
||||
<TextView
|
||||
android:id="@+id/tvLoadMore"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="44dp"
|
||||
android:gravity="center"
|
||||
android:text="加载更多"
|
||||
android:textSize="13sp"
|
||||
android:textColor="#5C77F7"
|
||||
android:background="#FFFFFF"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
app:cardCornerRadius="6dp"
|
||||
app:cardElevation="1dp"
|
||||
app:cardBackgroundColor="#FFFFFF">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:textSize="11sp"
|
||||
android:lineSpacingMultiplier="1.3"
|
||||
android:fontFamily="monospace" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
Reference in New Issue
Block a user