fix: clear pressed icon state on focus/launch

Add handling to fully clear press visuals when focus returns or a launch transition ends. BubbleTextView now overrides onWindowFocusChanged to call a new clearPressedIconState() method, which clears framework pressed/stay-pressed state and resets the icon tap scale. Launcher was updated to call the new method reference instead of only clearing stay-pressed, ensuring icons match neighbors and covering ordering gaps when resume callbacks run before window focus is restored.
This commit is contained in:
MrSluffy committed 2026-04-03 09:32:56 +08:00
1 parent 657f388368
commit 64e20c90cc
2 files changed
+20 -1

No files matched your search

@@ -724,11 +724,30 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
}
}
@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
super.onWindowFocusChanged(hasWindowFocus);
// Resume callbacks can run before the window is focused again (e.g. back / predictive
// back). Clearing when focus returns covers that ordering gap.
if (hasWindowFocus) {
clearPressedIconState();
}
}
public void clearPressedBackground() {
setPressed(false);
setStayPressed(false);
}
/**
* Clears framework pressed state, synthetic stay-pressed, and {@link FastBitmapDrawable} tap
* scale. Use when a launch transition ends so the icon matches neighbors again.
*/
public void clearPressedIconState() {
clearPressedBackground();
resetIconScale();
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
// Unlike touch events, keypress event propagate pressed state change immediately,