fix: widget 用量条左对齐(label 统一 44dp)+ 署名动态化跟随应用内语言
- 三套布局三行 label 统一 44dp:此前 row2/3 为 60dp、row1 44dp, 进度条起点差 16dp 导致不对齐;英文标签简化为 Week/Month 后 44dp 足够 - 署名 TextView 补 @+id/widget_brand,Provider 动态 setTextViewText: 与行标签同源(跟随应用内语言),避免宿主进程按系统语言渲染混搭
This commit is contained in:
parent
4107954080
commit
b51644048d
@ -60,6 +60,10 @@ class OpenCodeGoWidgetProvider : AppWidgetProvider() {
|
||||
for (widgetId in appWidgetIds) {
|
||||
val views = RemoteViews(context.packageName, R.layout.widget_opencode_go)
|
||||
|
||||
// 署名动态设置:与行标签同源(跟随应用内语言),
|
||||
// 避免 XML 静态文本由宿主进程按系统语言渲染造成中英混搭
|
||||
views.setTextViewText(R.id.widget_brand, context.getString(R.string.widget_brand))
|
||||
|
||||
// 点击左上角品牌 → 打开 APP;点击其它内容区域 → 切换服务;刷新按钮单独刷新。
|
||||
val openAppIntent = Intent(context, MainActivity::class.java).apply {
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
|
||||
@ -137,7 +137,7 @@
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginBottom="3dp">
|
||||
<TextView android:id="@+id/row2_label"
|
||||
android:layout_width="60dp" android:layout_height="wrap_content"
|
||||
android:layout_width="44dp" android:layout_height="wrap_content"
|
||||
android:maxLines="1" android:ellipsize="end"
|
||||
android:text="@string/window_weekly" android:textColor="#C4A0AB" android:textSize="11sp" />
|
||||
<TextView android:id="@+id/row2_pct"
|
||||
@ -163,7 +163,7 @@
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginBottom="3dp">
|
||||
<TextView android:id="@+id/row3_label"
|
||||
android:layout_width="60dp" android:layout_height="wrap_content"
|
||||
android:layout_width="44dp" android:layout_height="wrap_content"
|
||||
android:maxLines="1" android:ellipsize="end"
|
||||
android:text="@string/window_monthly" android:textColor="#C4A0AB" android:textSize="11sp" />
|
||||
<TextView android:id="@+id/row3_pct"
|
||||
@ -227,6 +227,7 @@
|
||||
android:progressBackgroundTint="#00000000"
|
||||
android:indeterminate="false" />
|
||||
<TextView
|
||||
android:id="@+id/widget_brand"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/widget_brand"
|
||||
|
||||
@ -148,7 +148,7 @@
|
||||
android:layout_marginBottom="3dp">
|
||||
|
||||
<TextView android:id="@+id/row2_label"
|
||||
android:layout_width="60dp" android:layout_height="wrap_content"
|
||||
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" />
|
||||
|
||||
@ -178,7 +178,7 @@
|
||||
android:layout_marginBottom="3dp">
|
||||
|
||||
<TextView android:id="@+id/row3_label"
|
||||
android:layout_width="60dp" android:layout_height="wrap_content"
|
||||
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" />
|
||||
|
||||
@ -252,6 +252,7 @@
|
||||
android:indeterminate="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_brand"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/widget_brand"
|
||||
|
||||
@ -103,7 +103,7 @@
|
||||
android:layout_marginBottom="6dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="60dp" android:layout_height="wrap_content"
|
||||
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" />
|
||||
|
||||
@ -129,7 +129,7 @@
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="60dp" android:layout_height="wrap_content"
|
||||
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" />
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user