Rainytoken/app/src/main/res/layout/widget_opencode_go_preview.xml
WaterRain b51644048d
fix: widget 用量条左对齐(label 统一 44dp)+ 署名动态化跟随应用内语言
- 三套布局三行 label 统一 44dp:此前 row2/3 为 60dp、row1 44dp,
  进度条起点差 16dp 导致不对齐;英文标签简化为 Week/Month 后 44dp 足够
- 署名 TextView 补 @+id/widget_brand,Provider 动态 setTextViewText:
  与行标签同源(跟随应用内语言),避免宿主进程按系统语言渲染混搭
2026-08-01 13:43:05 +00:00

183 lines
6.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- 小组件预览布局 — 小米小部件中心选择器展示用 -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/widget_bg">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="12dp"
android:gravity="center_vertical">
<!-- 标题行 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="2dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="24dp"
android:src="@drawable/rainytoken_wordmark"
android:adjustViewBounds="true" />
<ProgressBar
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1"
android:max="100"
android:progress="0"
android:progressTint="#00000000"
android:progressBackgroundTint="#00000000"
android:indeterminate="false" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/widget_auto_refresh"
android:textColor="#C4A0AB"
android:textSize="10sp" />
</LinearLayout>
<!-- OpenCode Go 标识 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="22dp"
android:layout_height="12dp"
android:src="@drawable/ic_opencode_go_logo"
android:layout_marginEnd="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/widget_title_opencode"
android:textColor="#8A7A82"
android:textSize="11sp" />
</LinearLayout>
<!-- 5h -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="6dp">
<TextView
android:layout_width="44dp" android:layout_height="wrap_content"
android:maxLines="1" android:ellipsize="end"
android:text="5h" android:textColor="#8A7A82" android:textSize="11sp" />
<TextView
android:layout_width="38dp" android:layout_height="wrap_content"
android:text="42%" android:textColor="#3D2C35" android:textSize="12sp"
android:textStyle="bold" android:gravity="end" />
<ProgressBar
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="0dp" android:layout_height="6dp"
android:layout_weight="1" android:layout_marginStart="8dp"
android:layout_marginEnd="8dp" android:max="100" android:progress="42"
android:progressTint="#FF85A2" />
</LinearLayout>
<!-- 本周 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="6dp">
<TextView
android:layout_width="44dp" android:layout_height="wrap_content"
android:maxLines="1" android:ellipsize="end"
android:text="@string/window_weekly" android:textColor="#8A7A82" android:textSize="11sp" />
<TextView
android:layout_width="38dp" android:layout_height="wrap_content"
android:text="68%" android:textColor="#3D2C35" android:textSize="12sp"
android:textStyle="bold" android:gravity="end" />
<ProgressBar
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="0dp" android:layout_height="6dp"
android:layout_weight="1" android:layout_marginStart="8dp"
android:layout_marginEnd="8dp" android:max="100" android:progress="68"
android:progressTint="#FFA726" />
</LinearLayout>
<!-- 本月 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="8dp">
<TextView
android:layout_width="44dp" android:layout_height="wrap_content"
android:maxLines="1" android:ellipsize="end"
android:text="@string/window_monthly" android:textColor="#8A7A82" android:textSize="11sp" />
<TextView
android:layout_width="38dp" android:layout_height="wrap_content"
android:text="35%" android:textColor="#3D2C35" android:textSize="12sp"
android:textStyle="bold" android:gravity="end" />
<ProgressBar
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="0dp" android:layout_height="6dp"
android:layout_weight="1" android:layout_marginStart="8dp"
android:layout_marginEnd="8dp" android:max="100" android:progress="35"
android:progressTint="#FF85A2" />
</LinearLayout>
<!-- DeepSeek 余额 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="4dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="12dp"
android:src="@drawable/ic_deepseek_logo"
android:adjustViewBounds="true"
android:layout_marginEnd="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/widget_deepseek_balance"
android:textColor="#8A7A82"
android:textSize="11sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¥18.00"
android:textColor="#3D2C35"
android:textSize="11sp"
android:textStyle="bold"
android:layout_marginStart="4dp" />
</LinearLayout>
</LinearLayout>
</FrameLayout>