v1.12: restore reset-time labels, bolder pace tick
Fix v1.11 regression where the pace tag overwrote the reset-time label (gone entirely on the small widget). The widget reset lines now show the actual reset time again; pace is conveyed by the bar tick. Make the pace tick more prominent: wider core + white halo so it stands out against any fill color. versionCode 13 / versionName 1.12. Includes rebuilt signed release APK. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -107,8 +107,7 @@ class ClaudeUsageWidget : AppWidgetProvider() {
|
||||
val pace = PaceCalc.compute(apiData.fiveHourUtilization, apiData.utilizationResetAtEpoch, PaceCalc.SESSION_WINDOW_MS)
|
||||
v.setTextViewText(R.id.tv_session_value, "$pct%")
|
||||
v.setImageViewBitmap(R.id.bar_session, BarRenderer.render(pct, pace?.markerPct, SESSION_FILL, pace?.tierColor))
|
||||
v.setTextViewText(R.id.tv_session_label,
|
||||
if (pace != null) PaceCalc.shortTag(apiData.fiveHourUtilization, pace) else formatReset(apiData.utilizationResetAtEpoch))
|
||||
v.setTextViewText(R.id.tv_session_label, formatReset(apiData.utilizationResetAtEpoch))
|
||||
}
|
||||
hasApiMessages -> {
|
||||
val rem = apiData!!.effectiveRemaining
|
||||
@@ -137,8 +136,7 @@ class ClaudeUsageWidget : AppWidgetProvider() {
|
||||
val pace = PaceCalc.compute(apiData.weeklyUtilization, apiData.weeklyResetAtEpoch, PaceCalc.WEEKLY_WINDOW_MS)
|
||||
v.setTextViewText(R.id.tv_weekly_value, "$wPct%")
|
||||
v.setImageViewBitmap(R.id.bar_weekly, BarRenderer.render(wPct, pace?.markerPct, WEEKLY_FILL, pace?.tierColor))
|
||||
v.setTextViewText(R.id.tv_weekly_label,
|
||||
if (pace != null) PaceCalc.shortTag(apiData.weeklyUtilization, pace) else formatReset(apiData.weeklyResetAtEpoch))
|
||||
v.setTextViewText(R.id.tv_weekly_label, formatReset(apiData.weeklyResetAtEpoch))
|
||||
} else {
|
||||
val weeklyDays = Integer.bitCount(prefs.getWeeklyMask())
|
||||
v.setTextViewText(R.id.tv_weekly_value, "${weeklyDays}d")
|
||||
@@ -187,7 +185,7 @@ class ClaudeUsageWidget : AppWidgetProvider() {
|
||||
val pace = PaceCalc.compute(apiData.fiveHourUtilization, apiData.utilizationResetAtEpoch, PaceCalc.SESSION_WINDOW_MS)
|
||||
v.setTextViewText(R.id.tv_session_value, "$pct%")
|
||||
v.setImageViewBitmap(R.id.bar_session, BarRenderer.render(pct, pace?.markerPct, SESSION_FILL, pace?.tierColor))
|
||||
v.setTextViewText(R.id.tv_session_label, resetWithPace(apiData.utilizationResetAtEpoch, apiData.fiveHourUtilization, pace))
|
||||
v.setTextViewText(R.id.tv_session_label, formatReset(apiData.utilizationResetAtEpoch))
|
||||
}
|
||||
hasApiMessages -> {
|
||||
val rem = apiData!!.effectiveRemaining
|
||||
@@ -219,7 +217,7 @@ class ClaudeUsageWidget : AppWidgetProvider() {
|
||||
val pace = PaceCalc.compute(apiData.weeklyUtilization, apiData.weeklyResetAtEpoch, PaceCalc.WEEKLY_WINDOW_MS)
|
||||
v.setTextViewText(R.id.tv_weekly_value, "$wPct%")
|
||||
v.setImageViewBitmap(R.id.bar_weekly, BarRenderer.render(wPct, pace?.markerPct, WEEKLY_FILL, pace?.tierColor))
|
||||
v.setTextViewText(R.id.tv_weekly_label, resetWithPace(apiData.weeklyResetAtEpoch, apiData.weeklyUtilization, pace))
|
||||
v.setTextViewText(R.id.tv_weekly_label, formatReset(apiData.weeklyResetAtEpoch))
|
||||
} else {
|
||||
val weeklyDays = Integer.bitCount(prefs.getWeeklyMask())
|
||||
v.setTextViewText(R.id.tv_weekly_value, "$weeklyDays d")
|
||||
@@ -260,14 +258,6 @@ class ClaudeUsageWidget : AppWidgetProvider() {
|
||||
}
|
||||
}
|
||||
|
||||
/** "Resets at 3:00 PM · 8% under pace" — reset line with the pace tag appended. */
|
||||
private fun resetWithPace(resetEpoch: Long, usedPct: Float, pace: PaceCalc.Pace?): CharSequence {
|
||||
val reset = formatReset(resetEpoch)
|
||||
if (pace == null) return reset
|
||||
val tag = PaceCalc.shortTag(usedPct, pace)
|
||||
return if (reset.isBlank()) tag else "$reset · $tag"
|
||||
}
|
||||
|
||||
private fun formatReset(epochMs: Long): String {
|
||||
if (epochMs <= 0) return ""
|
||||
val now = System.currentTimeMillis()
|
||||
|
||||
Reference in New Issue
Block a user