Build APK / build (push) Successful in 1m29s
Security: - LoginActivity WebView now enforces a host allow-list in shouldOverrideUrlLoading: only claude.ai + required SSO/CDN hosts (Google, Apple, Cloudflare, gstatic, recaptcha) can navigate; everything else is blocked. market://intent:// still blocked; about:/data: allowed. Device-verified: claude.ai login + Cloudflare challenge still load. Tests (33, pure-JVM JUnit4, no device needed): - Extracted shouldRecordHistory() pure throttle decision (regression guard for the empty-history-chart bug) + HistoryThrottleTest. - UsageDataTest (mergedWith last-good/partial-union, computed props), PaceCalcTest, PeakHoursTest. - Added junit:junit:4.13.2 as testImplementation only. Build quality: - widget_layout.xml: suppress false-positive UseAppTint lint on the widget refresh button (app:tint doesn't work in RemoteViews; android:tint is correct here) so lintDebug is clean. Verified locally: 33 unit tests pass, lintDebug 0 errors, signed assembleRelease OK (apksigner verified, signer identity unchanged), emulator smoke test launches + renders without crash.
190 lines
6.1 KiB
XML
190 lines
6.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
xmlns:tools="http://schemas.android.com/tools"
|
|
android:id="@+id/widget_root"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
android:orientation="vertical"
|
|
android:background="@drawable/widget_background"
|
|
android:padding="14dp">
|
|
|
|
<!-- Header -->
|
|
<LinearLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="horizontal"
|
|
android:gravity="center_vertical">
|
|
|
|
<TextView
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:layout_weight="1"
|
|
android:text="Claude Pro"
|
|
android:textColor="#FFFFFF"
|
|
android:textSize="13sp"
|
|
android:textStyle="bold" />
|
|
|
|
<ImageView
|
|
android:id="@+id/img_peak"
|
|
android:layout_width="16dp"
|
|
android:layout_height="16dp"
|
|
android:layout_marginEnd="4dp"
|
|
android:src="@drawable/ic_claude_burst"
|
|
android:contentDescription="Peak hours" />
|
|
|
|
<TextView
|
|
android:id="@+id/tv_peak"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginEnd="6dp"
|
|
android:text=""
|
|
android:textColor="#CC785C"
|
|
android:textSize="9sp"
|
|
android:textStyle="bold" />
|
|
|
|
<ImageButton
|
|
android:id="@+id/btn_refresh"
|
|
android:layout_width="32dp"
|
|
android:layout_height="32dp"
|
|
android:src="@android:drawable/ic_menu_rotate"
|
|
android:background="@android:color/transparent"
|
|
android:tint="#999999"
|
|
tools:ignore="UseAppTint"
|
|
android:contentDescription="Refresh" />
|
|
|
|
</LinearLayout>
|
|
|
|
<!-- Divider — View is not in RemoteViews allowlist on Android 12+; use TextView instead -->
|
|
<TextView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="1dp"
|
|
android:layout_marginTop="8dp"
|
|
android:layout_marginBottom="10dp"
|
|
android:background="#2A2A2A" />
|
|
|
|
<!-- 5-hour window bar -->
|
|
<LinearLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="horizontal"
|
|
android:gravity="center_vertical">
|
|
|
|
<TextView
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:layout_weight="1"
|
|
android:text="SESSION"
|
|
android:textColor="#FFFFFF"
|
|
android:textSize="9sp"
|
|
android:textStyle="bold" />
|
|
|
|
<TextView
|
|
android:id="@+id/tv_session_value"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:text="—"
|
|
android:textColor="#FFFFFF"
|
|
android:textSize="13sp"
|
|
android:textStyle="bold" />
|
|
|
|
</LinearLayout>
|
|
|
|
<ImageView
|
|
android:id="@+id/bar_session"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="6dp"
|
|
android:layout_marginTop="5dp"
|
|
android:scaleType="fitXY"
|
|
android:adjustViewBounds="false"
|
|
android:contentDescription="Session usage bar" />
|
|
|
|
<TextView
|
|
android:id="@+id/tv_session_label"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginTop="3dp"
|
|
android:text=""
|
|
android:textColor="#FFFFFF"
|
|
android:textSize="11sp"
|
|
android:textStyle="bold" />
|
|
|
|
<!-- 7-day window bar -->
|
|
<LinearLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="horizontal"
|
|
android:gravity="center_vertical"
|
|
android:layout_marginTop="10dp">
|
|
|
|
<TextView
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:layout_weight="1"
|
|
android:text="WEEKLY"
|
|
android:textColor="#FFFFFF"
|
|
android:textSize="9sp"
|
|
android:textStyle="bold" />
|
|
|
|
<TextView
|
|
android:id="@+id/tv_weekly_value"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:text="—"
|
|
android:textColor="#FFFFFF"
|
|
android:textSize="13sp"
|
|
android:textStyle="bold" />
|
|
|
|
</LinearLayout>
|
|
|
|
<ImageView
|
|
android:id="@+id/bar_weekly"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="6dp"
|
|
android:layout_marginTop="5dp"
|
|
android:scaleType="fitXY"
|
|
android:adjustViewBounds="false"
|
|
android:contentDescription="Weekly usage bar" />
|
|
|
|
<TextView
|
|
android:id="@+id/tv_weekly_label"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginTop="3dp"
|
|
android:text=""
|
|
android:textColor="#FFFFFF"
|
|
android:textSize="11sp"
|
|
android:textStyle="bold" />
|
|
|
|
<!-- Footer -->
|
|
<LinearLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="horizontal"
|
|
android:layout_marginTop="8dp"
|
|
android:gravity="center_vertical">
|
|
|
|
<TextView
|
|
android:id="@+id/tv_status"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:layout_weight="1"
|
|
android:text=""
|
|
android:textColor="#FFFFFF"
|
|
android:textSize="9sp"
|
|
android:textStyle="bold"
|
|
android:singleLine="true"
|
|
android:ellipsize="end" />
|
|
|
|
<TextView
|
|
android:id="@+id/tv_updated"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:text=""
|
|
android:textColor="#FFFFFF"
|
|
android:textSize="9sp"
|
|
android:textStyle="bold" />
|
|
|
|
</LinearLayout>
|
|
|
|
</LinearLayout>
|