ee68b11ad0
Android 16 bug: EncryptedSharedPreferences threw on ANY exception (Keystore busy during screen-lock/BG wakeup) and the code deleted the encrypted prefs file on any failure, permanently erasing session cookies. Now only KeyPermanentlyInvalidatedException (biometric/PIN change) triggers delete; transient failures preserve the file for the next session. Also prevents saving cookies to plain-text fallback prefs if encrypted prefs are unavailable. WorkManager periodic (15 min, requires network) added alongside AlarmManager as a Doze-mode backup for Android 16, where inexact alarms can be batched up to 75 min. UI: sync icon 24→32dp (large widget), 20→28dp (small); reset-time font 9→11sp (large), 8→10sp (small). Security: - All Log.d response-body and URL-bearing logs gated behind BuildConfig.DEBUG - Cookie header value stripped of CRLF to prevent HTTP header injection - LoginActivity coroutine migrated from bare CoroutineScope to lifecycleScope - Widget removed from keyguard (lock-screen) category — usage data is sensitive Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
143 lines
4.6 KiB
XML
143 lines
4.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
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="12dp">
|
|
|
|
<!-- 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="11sp"
|
|
android:textStyle="bold" />
|
|
|
|
<ImageButton
|
|
android:id="@+id/btn_refresh"
|
|
android:layout_width="28dp"
|
|
android:layout_height="28dp"
|
|
android:src="@android:drawable/ic_menu_rotate"
|
|
android:background="@android:color/transparent"
|
|
android:contentDescription="Refresh" />
|
|
|
|
</LinearLayout>
|
|
|
|
<!-- SESSION row -->
|
|
<LinearLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="horizontal"
|
|
android:gravity="center_vertical"
|
|
android:layout_marginTop="7dp">
|
|
|
|
<TextView
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:layout_weight="1"
|
|
android:text="SESSION"
|
|
android:textColor="#555555"
|
|
android:textSize="8sp"
|
|
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="11sp"
|
|
android:textStyle="bold" />
|
|
|
|
<TextView
|
|
android:id="@+id/tv_session_label"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginStart="6dp"
|
|
android:text=""
|
|
android:textColor="#555555"
|
|
android:textSize="10sp" />
|
|
|
|
</LinearLayout>
|
|
|
|
<ProgressBar
|
|
android:id="@+id/progress_bar"
|
|
style="@android:style/Widget.ProgressBar.Horizontal"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="4dp"
|
|
android:layout_marginTop="3dp"
|
|
android:max="100"
|
|
android:progress="0"
|
|
android:progressTint="#CC785C"
|
|
android:progressBackgroundTint="#252525" />
|
|
|
|
<!-- 7-DAY row -->
|
|
<LinearLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="horizontal"
|
|
android:gravity="center_vertical"
|
|
android:layout_marginTop="7dp">
|
|
|
|
<TextView
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:layout_weight="1"
|
|
android:text="WEEKLY"
|
|
android:textColor="#555555"
|
|
android:textSize="8sp"
|
|
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="11sp"
|
|
android:textStyle="bold" />
|
|
|
|
<TextView
|
|
android:id="@+id/tv_weekly_label"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginStart="6dp"
|
|
android:text=""
|
|
android:textColor="#555555"
|
|
android:textSize="10sp" />
|
|
|
|
</LinearLayout>
|
|
|
|
<ProgressBar
|
|
android:id="@+id/progress_bar_weekly"
|
|
style="@android:style/Widget.ProgressBar.Horizontal"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="4dp"
|
|
android:layout_marginTop="3dp"
|
|
android:max="100"
|
|
android:progress="0"
|
|
android:progressTint="#7B8FCC"
|
|
android:progressBackgroundTint="#252525" />
|
|
|
|
<TextView
|
|
android:id="@+id/tv_status"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginTop="4dp"
|
|
android:text=""
|
|
android:textColor="#CC785C"
|
|
android:textSize="8sp"
|
|
android:maxLines="1" />
|
|
|
|
</LinearLayout>
|