Skip to content

Commit 73fdc27

Browse files
authored
Add recomposition heatmap data clear (#125)
* Add recomposition heatmap data clear * Rollback the comments
1 parent 518cef0 commit 73fdc27

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

compose-stability-analyzer-idea/src/main/kotlin/com/skydoves/compose/stability/idea/heatmap/AdbLogcatService.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ internal class AdbLogcatService(
188188
"Parsed recomposition event: ${event.composableName} #${event.recompositionCount}" +
189189
" (${event.parameterEntries.size} params, unstable: ${event.unstableParameters})",
190190
)
191+
191192
val maxRecent = settings.heatmapMaxRecentEvents
192193
dataMap.compute(event.composableName) { _, existing ->
193194
if (existing == null) {

compose-stability-analyzer-idea/src/main/kotlin/com/skydoves/compose/stability/idea/heatmap/HeatmapActions.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ internal class ToggleHeatmapAction : AnAction() {
137137
/**
138138
* Action to clear all accumulated recomposition heatmap data.
139139
*/
140-
internal class ClearHeatmapDataAction : AnAction() {
140+
internal class ClearHeatmapDataAction : AnAction(
141+
"Clear Recomposition Data",
142+
"Clear all accumulated recomposition heatmap data",
143+
AllIcons.Actions.GC,
144+
) {
141145

142146
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT
143147

compose-stability-analyzer-idea/src/main/kotlin/com/skydoves/compose/stability/idea/toolwindow/StabilityToolWindowFactory.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,14 @@ public class StabilityToolWindowFactory : ToolWindowFactory {
6262
)
6363
toolWindow.contentManager.addContent(heatmapContent)
6464

65-
// Add toggle heatmap button to tool window title bar
66-
val toggleAction = ActionManager.getInstance()
67-
.getAction("com.skydoves.compose.stability.idea.heatmap.ToggleHeatmapAction")
68-
if (toggleAction != null) {
69-
toolWindow.setTitleActions(listOf(toggleAction))
65+
// Add toggle heatmap and clear buttons to tool window title bar
66+
val actionManager = ActionManager.getInstance()
67+
val titleActions = listOfNotNull(
68+
actionManager.getAction("com.skydoves.compose.stability.idea.heatmap.ToggleHeatmapAction"),
69+
actionManager.getAction("com.skydoves.compose.stability.idea.heatmap.ClearHeatmapDataAction"),
70+
)
71+
if (titleActions.isNotEmpty()) {
72+
toolWindow.setTitleActions(titleActions)
7073
}
7174
}
7275

0 commit comments

Comments
 (0)