From 1f4d2bf9b5be9fa1e5e489ff3b22018ca33b08c5 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 12 Sep 2026 18:47:55 +0000 Subject: [PATCH] fix: clear the mechanical Android Lint warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lint reports 874 warnings / 0 errors per amethyst variant. 512 of those are in Crowdin-managed values-*/strings.xml (mostly MissingQuantity — a translator's plural missing a quantity) and are not ours to hand-edit; this takes the ones that are mechanical and behaviour-preserving: - EmptySuperCall (24 in amethyst, plus 2 in commons the amethyst run cannot see): ViewModel.onCleared is documented empty, so drop the super calls. - UseKtx (2): Canvas.withTranslation for the LaTeX drawable, and Bitmap.toDrawable for the map pin — the KTX form CLAUDE.md asks for, and both compile to the same calls. - ConstantLocale (1): CalendarEventListCard held its "MMM" formatter in a file-level val, which captures Locale.getDefault() once — month abbreviations stayed in whatever language was active at class init. The formatter is now cached per locale, which keeps the property the original comment was protecting (a formatter per recompose was 500 allocations while scrolling), and the locale comes from LocalLocale.current.platformLocale so the read is observable: Locale.getDefault() inside a composable is not, and Compose's own NonObservableLocale check rates that an error. - UnusedResources (6): the Android Studio new-project wizard's leftover colors (purple_200, teal_200, teal_700, black, white, transparent), each verified unreferenced from Kotlin and XML. purple_500/700 are in use and stay. - UseTomlInstead (3): the debug-only Compose/Perfetto tracing dependencies move into the version catalog. Same coordinates and versions; the catalog already carries BOM-managed versionless entries. playDebug goes from 874 warnings to 838, still 0 errors. Deliberately left, because each is a decision rather than a cleanup: AppLinkWarning (autoVerify only works if the domains serve a matching assetlinks.json), the 126 unused source strings and 10 PluralsCandidate (both churn the translation surface), GradleDependency / NewerVersionAvailable (dependency bumps need the license check), VectorRaster / VectorPath / IconDensities / IconXmlAndPng (redrawing assets), BatteryLife (the battery-optimization helper working as designed), and InlinedApi / ClickableViewAccessibility / DiscouragedApi / InsecureBaseConfiguration (each needs its surrounding intent read first). Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_0123kXtseu4X18hL3GMDcdER --- amethyst/build.gradle.kts | 6 +++--- .../amethyst/ui/components/LatexEquation.kt | 10 +++++----- .../note/creators/location/LocationPreviewMap.kt | 4 ++-- .../amethyst/ui/screen/UserFeedViewModel.kt | 1 - .../ui/screen/loggedIn/AccountViewModel.kt | 1 - .../screen/loggedIn/buzz/AgentConsoleViewModel.kt | 1 - .../loggedIn/buzz/AgentWorkBoardViewModel.kt | 1 - .../ui/screen/loggedIn/buzz/BuzzDmListViewModel.kt | 1 - .../ui/screen/loggedIn/buzz/JobBoardViewModel.kt | 1 - .../loggedIn/buzz/WorkflowRunBoardViewModel.kt | 1 - .../loggedIn/calendars/CalendarEventListCard.kt | 14 +++++++++++--- .../create/NewCalendarCollectionViewModel.kt | 1 - .../privateDM/send/ChatNewMessageViewModel.kt | 1 - .../send/ChannelNewMessageViewModel.kt | 1 - .../ui/screen/loggedIn/chess/ChessViewModelNew.kt | 1 - .../nip23LongForm/LongFormPostViewModel.kt | 1 - .../nip99Classifieds/NewProductViewModel.kt | 1 - .../screen/loggedIn/home/ShortNotePostViewModel.kt | 1 - .../ui/screen/loggedIn/home/VoiceReplyViewModel.kt | 1 - .../loggedIn/music/AddToMusicPlaylistViewModel.kt | 1 - .../nests/room/chat/NestNewMessageViewModel.kt | 1 - .../publicMessages/NewPublicMessageViewModel.kt | 1 - .../loggedIn/profile/relays/RelayFeedViewModel.kt | 1 - .../loggedIn/settings/StringFeedViewModel.kt | 1 - .../loggedIn/video/hls/NewHlsVideoViewModel.kt | 1 - .../screen/loggedIn/wallet/ReloadMintViewModel.kt | 1 - .../screen/loggedIn/wallet/TopUpMintViewModel.kt | 1 - .../wallet/wizard/CashuWalletWizardViewModel.kt | 1 - amethyst/src/main/res/values/colors.xml | 6 ------ .../amethyst/commons/viewmodels/FeedViewModel.kt | 1 - .../amethyst/commons/viewmodels/NestViewModel.kt | 1 - gradle/libs.versions.toml | 4 ++++ 32 files changed, 25 insertions(+), 45 deletions(-) diff --git a/amethyst/build.gradle.kts b/amethyst/build.gradle.kts index 77010ea9fe..38e3f1d217 100644 --- a/amethyst/build.gradle.kts +++ b/amethyst/build.gradle.kts @@ -399,9 +399,9 @@ dependencies { // Usage: runtime-enable, then capture a Perfetto trace with the `track_event` data source: // adb shell am broadcast -a androidx.tracing.perfetto.action.ENABLE_TRACING \ // -n com.vitorpamplona.amethyst.debug/androidx.tracing.perfetto.TracingReceiver - debugImplementation("androidx.compose.runtime:runtime-tracing") - debugImplementation("androidx.tracing:tracing-perfetto:1.0.1") - debugImplementation("androidx.tracing:tracing-perfetto-binary:1.0.1") + debugImplementation(libs.androidx.compose.runtime.tracing) + debugImplementation(libs.androidx.tracing.perfetto) + debugImplementation(libs.androidx.tracing.perfetto.binary) implementation(project(":quartz")) implementation(project(":commons")) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/LatexEquation.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/LatexEquation.kt index ea0f43dffc..f8b68bce78 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/LatexEquation.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/LatexEquation.kt @@ -40,6 +40,7 @@ import androidx.compose.ui.text.rememberTextMeasurer import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.TextUnitType import androidx.compose.ui.unit.sp +import androidx.core.graphics.withTranslation import com.vitorpamplona.amethyst.commons.richtext.MathParser import ru.noties.jlatexmath.JLatexMathDrawable @@ -130,12 +131,11 @@ fun LatexEquation( Canvas(modifier = equationModifier) { drawIntoCanvas { canvas -> val native = canvas.nativeCanvas - val checkpoint = native.save() // Position the icon's baseline on the text baseline within the padded box. - native.translate(0f, drawTopPx) - drawable.setBounds(0, 0, drawable.intrinsicWidth, drawable.intrinsicHeight) - drawable.draw(native) - native.restoreToCount(checkpoint) + native.withTranslation(y = drawTopPx) { + drawable.setBounds(0, 0, drawable.intrinsicWidth, drawable.intrinsicHeight) + drawable.draw(this) + } } } if (trailing.isNotEmpty()) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/location/LocationPreviewMap.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/location/LocationPreviewMap.kt index 5d9161d1e6..28a5d99dfd 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/location/LocationPreviewMap.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/location/LocationPreviewMap.kt @@ -23,7 +23,6 @@ package com.vitorpamplona.amethyst.ui.note.creators.location import android.graphics.ColorFilter import android.graphics.ColorMatrix import android.graphics.ColorMatrixColorFilter -import android.graphics.drawable.BitmapDrawable import android.view.MotionEvent import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxWidth @@ -36,6 +35,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.viewinterop.AndroidView +import androidx.core.graphics.drawable.toDrawable import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.compose.LocalLifecycleOwner @@ -159,7 +159,7 @@ fun LocationPreviewMap( remember(pinColor, pinEmoji) { if (pinColor != null && pinEmoji != null) { val bitmap = roadEventPinBitmap(pinEmoji, pinColor.toArgb(), context.resources.displayMetrics.density) - BitmapDrawable(context.resources, bitmap) + bitmap.toDrawable(context.resources) } else { null } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/UserFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/UserFeedViewModel.kt index d2e039deb8..fc7ba0b466 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/UserFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/UserFeedViewModel.kt @@ -118,6 +118,5 @@ open class UserFeedViewModel( override fun onCleared() { Log.d("Init") { "OnCleared: ${this.javaClass.simpleName}" } bundler.cancel() - super.onCleared() } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt index cda7e35f72..a1b4069ec7 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt @@ -2647,7 +2647,6 @@ class AccountViewModel( com.vitorpamplona.amethyst.ui.screen.loggedIn.nests.room.activity.NestBridge .clear() feedStates.destroy() - super.onCleared() } fun loadMentions( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/AgentConsoleViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/AgentConsoleViewModel.kt index ad6c0e879b..771037b0ce 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/AgentConsoleViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/AgentConsoleViewModel.kt @@ -310,7 +310,6 @@ class AgentConsoleViewModel : ViewModel() { override fun onCleared() { stopObserving() stopWatching() - super.onCleared() } /** One decrypted observer telemetry frame rendered on the Observer tab. */ diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/AgentWorkBoardViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/AgentWorkBoardViewModel.kt index e3f106f595..fe0d4e9ebf 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/AgentWorkBoardViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/AgentWorkBoardViewModel.kt @@ -218,7 +218,6 @@ class AgentWorkBoardViewModel : ViewModel() { override fun onCleared() { stopWatching() - super.onCleared() } companion object { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/BuzzDmListViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/BuzzDmListViewModel.kt index dd2284163e..4fd4f3509f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/BuzzDmListViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/BuzzDmListViewModel.kt @@ -360,6 +360,5 @@ class BuzzDmListViewModel : ViewModel() { override fun onCleared() { liveJob?.cancel() liveJob = null - super.onCleared() } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/JobBoardViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/JobBoardViewModel.kt index 62ead90720..1f60812ea3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/JobBoardViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/JobBoardViewModel.kt @@ -137,7 +137,6 @@ class JobBoardViewModel : ViewModel() { override fun onCleared() { stopWatching() - super.onCleared() } companion object { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/WorkflowRunBoardViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/WorkflowRunBoardViewModel.kt index 4dc32ff52c..10982c18d5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/WorkflowRunBoardViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/buzz/WorkflowRunBoardViewModel.kt @@ -258,7 +258,6 @@ class WorkflowRunBoardViewModel : ViewModel() { override fun onCleared() { stopWatching() - super.onCleared() } companion object { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarEventListCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarEventListCard.kt index 66ef72ab54..782330a58a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarEventListCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarEventListCard.kt @@ -41,6 +41,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalLocale import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp @@ -58,11 +59,15 @@ import java.time.Instant import java.time.ZoneId import java.time.format.DateTimeFormatter import java.util.Locale +import java.util.concurrent.ConcurrentHashMap // Thread-safe and hoisted: previously each CalendarDateBadge recompose allocated a new // SimpleDateFormat, which (a) is not thread-safe and (b) created 500 allocations while scrolling. -private val MonthShortFormatter: DateTimeFormatter = - DateTimeFormatter.ofPattern("MMM", Locale.getDefault()) +// Cached per locale rather than in a single val that captures the locale once: the month +// names have to follow a language the user changes while the app is running. +private val monthShortFormatters = ConcurrentHashMap() + +private fun monthShortFormatter(locale: Locale): DateTimeFormatter = monthShortFormatters.getOrPut(locale) { DateTimeFormatter.ofPattern("MMM", locale) } @Composable fun CalendarEventListCard( @@ -214,7 +219,10 @@ private fun CalendarDateBadge(startSeconds: Long?) { Instant.ofEpochSecond(startSeconds).atZone(ZoneId.systemDefault()).toLocalDate() } val day = localDate.dayOfMonth.toString() - val month = remember(localDate) { MonthShortFormatter.format(localDate).uppercase() } + // LocalLocale rather than Locale.getDefault(): the latter is not observable, so a + // locale change while the app runs would leave the month name in the old language. + val locale = LocalLocale.current.platformLocale + val month = remember(localDate, locale) { monthShortFormatter(locale).format(localDate).uppercase() } Column( modifier = Modifier.size(width = 52.dp, height = 60.dp), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/create/NewCalendarCollectionViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/create/NewCalendarCollectionViewModel.kt index 84e811a228..be0fdf4c00 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/create/NewCalendarCollectionViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/create/NewCalendarCollectionViewModel.kt @@ -109,7 +109,6 @@ class NewCalendarCollectionViewModel : ViewModel() { override fun onCleared() { liveScanJob?.cancel() - super.onCleared() } fun toggle(address: Address) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ChatNewMessageViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ChatNewMessageViewModel.kt index 4c7e45f109..863e3ff8ef 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ChatNewMessageViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ChatNewMessageViewModel.kt @@ -801,7 +801,6 @@ class ChatNewMessageViewModel : } override fun onCleared() { - super.onCleared() Log.d("Init") { "OnCleared: ${this.javaClass.simpleName}" } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelNewMessageViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelNewMessageViewModel.kt index 4b51c95c6e..baab2e6279 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelNewMessageViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelNewMessageViewModel.kt @@ -1027,7 +1027,6 @@ open class ChannelNewMessageViewModel : } override fun onCleared() { - super.onCleared() Log.d("Init") { "OnCleared: ${this.javaClass.simpleName}" } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessViewModelNew.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessViewModelNew.kt index 8966460217..893c23fb17 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessViewModelNew.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chess/ChessViewModelNew.kt @@ -132,7 +132,6 @@ class ChessViewModelNew( fun clearFocusedGame() = logic.clearFocusedGame() override fun onCleared() { - super.onCleared() logic.stopPolling() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostViewModel.kt index 0488d076df..ed5ff94326 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostViewModel.kt @@ -739,7 +739,6 @@ class LongFormPostViewModel : } override fun onCleared() { - super.onCleared() Log.d("Init") { "OnCleared: ${this.javaClass.simpleName}" } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductViewModel.kt index 3075d4a6a7..32a137507f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip99Classifieds/NewProductViewModel.kt @@ -612,7 +612,6 @@ open class NewProductViewModel : } override fun onCleared() { - super.onCleared() Log.d("Init") { "OnCleared: ${this.javaClass.simpleName}" } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt index af9a45edd5..cf79d6b90d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt @@ -1977,7 +1977,6 @@ open class ShortNotePostViewModel : } override fun onCleared() { - super.onCleared() writingAssistant?.close() writingAssistant = null Log.d("Init") { "OnCleared: ${this.javaClass.simpleName}" } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/VoiceReplyViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/VoiceReplyViewModel.kt index 3ba074d1ca..0bf353eea1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/VoiceReplyViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/VoiceReplyViewModel.kt @@ -320,7 +320,6 @@ class VoiceReplyViewModel : ViewModel() { override fun onCleared() { cancel() - super.onCleared() Log.d("Init") { "OnCleared: ${this.javaClass.simpleName}" } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/music/AddToMusicPlaylistViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/music/AddToMusicPlaylistViewModel.kt index 3707b774fa..23078cb368 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/music/AddToMusicPlaylistViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/music/AddToMusicPlaylistViewModel.kt @@ -102,7 +102,6 @@ class AddToMusicPlaylistViewModel : ViewModel() { override fun onCleared() { liveScanJob?.cancel() - super.onCleared() } private suspend fun rescan() { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/chat/NestNewMessageViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/chat/NestNewMessageViewModel.kt index 86ebb445bb..4eb9691cfe 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/chat/NestNewMessageViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/chat/NestNewMessageViewModel.kt @@ -597,7 +597,6 @@ open class NestNewMessageViewModel : } override fun onCleared() { - super.onCleared() Log.d("Init") { "OnCleared: ${this.javaClass.simpleName}" } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/publicMessages/NewPublicMessageViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/publicMessages/NewPublicMessageViewModel.kt index 1fbfff94a6..d573313ee9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/publicMessages/NewPublicMessageViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/publicMessages/NewPublicMessageViewModel.kt @@ -660,7 +660,6 @@ class NewPublicMessageViewModel : } override fun onCleared() { - super.onCleared() Log.d("Init") { "OnCleared: ${this.javaClass.simpleName}" } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelayFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelayFeedViewModel.kt index 4f4beac566..bc191f6643 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelayFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelayFeedViewModel.kt @@ -196,6 +196,5 @@ class RelayFeedViewModel : override fun onCleared() { Log.d("Init") { "OnCleared: ${this.javaClass.simpleName}" } - super.onCleared() } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/StringFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/StringFeedViewModel.kt index 53d18baf2e..1b0e00f245 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/StringFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/StringFeedViewModel.kt @@ -116,6 +116,5 @@ open class StringFeedViewModel( override fun onCleared() { Log.d("Init") { "OnCleared: ${this.javaClass.simpleName}" } bundler.cancel() - super.onCleared() } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/hls/NewHlsVideoViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/hls/NewHlsVideoViewModel.kt index f5115a3feb..aed382fcf0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/hls/NewHlsVideoViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/hls/NewHlsVideoViewModel.kt @@ -180,7 +180,6 @@ open class NewHlsVideoViewModel : ViewModel() { } override fun onCleared() { - super.onCleared() currentJob?.cancel() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/ReloadMintViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/ReloadMintViewModel.kt index 532b8c925a..8a30b81dc5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/ReloadMintViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/ReloadMintViewModel.kt @@ -459,7 +459,6 @@ class ReloadMintViewModel : ViewModel() { // The pipeline runs on the AccountViewModel scope, not this VM's, so it would // outlive the screen — cancel it when the screen goes away. job?.cancel() - super.onCleared() } companion object { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/TopUpMintViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/TopUpMintViewModel.kt index 6fde099208..f6dc022003 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/TopUpMintViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/TopUpMintViewModel.kt @@ -267,7 +267,6 @@ class TopUpMintViewModel : ViewModel() { // The pipeline runs on the AccountViewModel scope, not this VM's, so it would // outlive the screen — cancel it when the screen goes away. job?.cancel() - super.onCleared() } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/wizard/CashuWalletWizardViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/wizard/CashuWalletWizardViewModel.kt index 2b3724c09b..9051c9a277 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/wizard/CashuWalletWizardViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/wizard/CashuWalletWizardViewModel.kt @@ -293,7 +293,6 @@ class CashuWalletWizardViewModel : ViewModel() { } override fun onCleared() { - super.onCleared() discovery?.cancel() } } diff --git a/amethyst/src/main/res/values/colors.xml b/amethyst/src/main/res/values/colors.xml index 611066da6b..1f20970d04 100644 --- a/amethyst/src/main/res/values/colors.xml +++ b/amethyst/src/main/res/values/colors.xml @@ -1,13 +1,7 @@ - #FFBB86FC #FF6200EE #FF3700B3 - #FF03DAC5 - #FF018786 - #FF000000 - #FFFFFFFF - #00FFFFFF diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/FeedViewModel.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/FeedViewModel.kt index 172614a573..5465931342 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/FeedViewModel.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/FeedViewModel.kt @@ -68,6 +68,5 @@ abstract class FeedViewModel( override fun onCleared() { Log.d("Init") { "OnCleared: ${this::class.simpleName}" } - super.onCleared() } } diff --git a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/NestViewModel.kt b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/NestViewModel.kt index 6fb1a8088a..80ad79160f 100644 --- a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/NestViewModel.kt +++ b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/NestViewModel.kt @@ -838,7 +838,6 @@ class NestViewModel( closed = true teardownBroadcast(BroadcastUiState.Idle, finalCleanup = true) teardown(targetState = ConnectionUiState.Closed, finalCleanup = true) - super.onCleared() } private fun observeSpeakerState(s: NestsSpeaker) { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0b02920047..266e447dd3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -28,6 +28,7 @@ uiautomator = "2.4.0" biometricKtx = "1.4.0-alpha02" coil = "3.6.2" composeBom = "2026.09.00" +tracingPerfetto = "1.0.1" composeRuntimeAnnotation = "1.12.1" coreKtx = "1.19.0" datastore = "1.2.1" @@ -136,6 +137,9 @@ androidx-camera-extensions = { module = "androidx.camera:camera-extensions", ver androidx-camera-view = { module = "androidx.camera:camera-view", version.ref = "androidxCamera" } androidx-camera-lifecycle = { module = "androidx.camera:camera-lifecycle", version.ref = "androidxCamera" } androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } +androidx-compose-runtime-tracing = { group = "androidx.compose.runtime", name = "runtime-tracing" } +androidx-tracing-perfetto = { group = "androidx.tracing", name = "tracing-perfetto", version.ref = "tracingPerfetto" } +androidx-tracing-perfetto-binary = { group = "androidx.tracing", name = "tracing-perfetto-binary", version.ref = "tracingPerfetto" } androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation" } androidx-compose-runtime-annotation = { group = "androidx.compose.runtime", name = "runtime-annotation", version.ref = "composeRuntimeAnnotation" } androidx-collection = { group = "androidx.collection", name = "collection", version.ref = "androidxCollection" }