Weekly reset now reads "Resets Friday, Jun 6 · 3:00 PM" in the app and full widget; small widget uses a compact "Fri, Jun 6" via a new formatResetShort(). (Amir's local UI polish, folded in on top of v1.14.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -144,7 +144,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, if (pace != null) MARKER_COLOR else null))
|
||||
v.setTextViewText(R.id.tv_weekly_label, formatResetDay(apiData.weeklyResetAtEpoch))
|
||||
v.setTextViewText(R.id.tv_weekly_label, formatResetShort(apiData.weeklyResetAtEpoch))
|
||||
} else {
|
||||
val weeklyDays = Integer.bitCount(prefs.getWeeklyMask())
|
||||
v.setTextViewText(R.id.tv_weekly_value, "${weeklyDays}d")
|
||||
@@ -279,13 +279,21 @@ class ClaudeUsageWidget : AppWidgetProvider() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Weekly reset shown with the weekday name ("Resets Friday 3:00 PM"), never "tomorrow". */
|
||||
/** Weekly reset with weekday + date ("Resets Friday, Jun 6 · 3:00 PM"), never "tomorrow". */
|
||||
private fun formatResetDay(epochMs: Long): String {
|
||||
if (epochMs <= 0) return ""
|
||||
if (epochMs <= System.currentTimeMillis()) return "Resets soon"
|
||||
val day = SimpleDateFormat("EEEE", Locale.US).format(Date(epochMs))
|
||||
val date = SimpleDateFormat("MMM d", Locale.US).format(Date(epochMs))
|
||||
val timeStr = SimpleDateFormat("h:mm a", Locale.US).format(Date(epochMs))
|
||||
return "Resets $day $timeStr"
|
||||
return "Resets $day, $date · $timeStr"
|
||||
}
|
||||
|
||||
/** Compact weekly reset for the space-tight small widget: "Fri, Jun 6". */
|
||||
private fun formatResetShort(epochMs: Long): String {
|
||||
if (epochMs <= 0) return ""
|
||||
if (epochMs <= System.currentTimeMillis()) return "soon"
|
||||
return SimpleDateFormat("EEE, MMM d", Locale.US).format(Date(epochMs))
|
||||
}
|
||||
|
||||
private fun formatTime(ms: Long) =
|
||||
|
||||
@@ -264,8 +264,9 @@ class MainActivity : AppCompatActivity() {
|
||||
if (epochMs <= 0) return ""
|
||||
if (epochMs <= System.currentTimeMillis()) return "Resets soon"
|
||||
val day = SimpleDateFormat("EEEE", Locale.US).format(Date(epochMs))
|
||||
val date = SimpleDateFormat("MMM d", Locale.US).format(Date(epochMs))
|
||||
val timeStr = SimpleDateFormat("h:mm a", Locale.US).format(Date(epochMs))
|
||||
return "Resets $day $timeStr"
|
||||
return "Resets $day, $date · $timeStr"
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
Reference in New Issue
Block a user