feat: ring widget style (selectable bars/rings)
Build APK / build (pull_request) Successful in 1m34s
Build APK / build (pull_request) Successful in 1m34s
Add RingRenderer (circular gauge mirror of BarRenderer), a widget_layout_rings layout, a Bars/Rings preference + in-app toggle, and ring rendering branch in ClaudeUsageWidget. Full (4x2) widget honors the chosen style; compact size stays bars. Phase 1 of porting hamed-elfayome/Claude-Usage-Tracker features.
This commit is contained in:
@@ -132,6 +132,12 @@ class PreferencesManager(context: Context) {
|
||||
} catch (e: Exception) { emptyList() }
|
||||
}
|
||||
|
||||
// ── Widget style ─────────────────────────────────────────────────────────
|
||||
|
||||
/** Home-screen widget visual style: [STYLE_BARS] (default) or [STYLE_RINGS]. */
|
||||
fun getWidgetStyle(): String = prefs.getString(KEY_WIDGET_STYLE, STYLE_BARS) ?: STYLE_BARS
|
||||
fun setWidgetStyle(style: String) = prefs.edit().putString(KEY_WIDGET_STYLE, style).apply()
|
||||
|
||||
// ── Notification settings ────────────────────────────────────────────────
|
||||
|
||||
fun isNotifyEnabled(): Boolean = prefs.getBoolean(KEY_NOTIFY_ENABLED, true)
|
||||
@@ -155,6 +161,10 @@ class PreferencesManager(context: Context) {
|
||||
private const val KEY_HISTORY = "usage_history"
|
||||
private const val KEY_NOTIFY_ENABLED = "notify_enabled"
|
||||
private const val KEY_AUTH_FAILS = "auth_fail_count"
|
||||
private const val KEY_WIDGET_STYLE = "widget_style"
|
||||
|
||||
const val STYLE_BARS = "bars"
|
||||
const val STYLE_RINGS = "rings"
|
||||
|
||||
internal const val MIN_HISTORY_GAP_MS = 2 * 60 * 1000L // collapse readings <2 min apart
|
||||
private const val HISTORY_RETENTION_MS = 7 * 24 * 60 * 60 * 1000L // keep 7 days
|
||||
|
||||
Reference in New Issue
Block a user