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:
@@ -66,6 +66,7 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
setupNotificationSettings()
|
||||
setupWidgetStyleSetting()
|
||||
|
||||
binding.btnDebug.setOnClickListener {
|
||||
if (binding.tvDebugInfo.visibility == android.view.View.GONE) {
|
||||
@@ -112,6 +113,15 @@ class MainActivity : AppCompatActivity() {
|
||||
if (prefs.isNotifyEnabled()) requestNotificationPermission()
|
||||
}
|
||||
|
||||
/** Bars ⇄ Rings switch for the home-screen widget; redraws any placed widgets immediately. */
|
||||
private fun setupWidgetStyleSetting() {
|
||||
binding.switchRingStyle.isChecked = prefs.getWidgetStyle() == PreferencesManager.STYLE_RINGS
|
||||
binding.switchRingStyle.setOnCheckedChangeListener { _, checked ->
|
||||
prefs.setWidgetStyle(if (checked) PreferencesManager.STYLE_RINGS else PreferencesManager.STYLE_BARS)
|
||||
ClaudeUsageWidget.notifyDataChanged(this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun requestNotificationPermission() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) return
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS)
|
||||
|
||||
Reference in New Issue
Block a user