Skip to content

Commit 3d456a4

Browse files
Tony WuTony Wu
authored andcommitted
Fix number counter will keep going after window losed focus.
Use Time pick in AlarmClock, long press on + or -, make an incoming call or press power key to suspend the device, after resumed, the counter will keep going without press. Change-Id: I5e69d5e17d3be9aa78648e6f8e28665ec305b36f
1 parent 75a2ae9 commit 3d456a4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/java/android/widget/NumberPickerButton.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,12 @@ private void cancelLongpress() {
8585
mNumberPicker.cancelDecrement();
8686
}
8787
}
88+
89+
public void onWindowFocusChanged(boolean hasWindowFocus) {
90+
super.onWindowFocusChanged(hasWindowFocus);
91+
if (!hasWindowFocus) {
92+
cancelLongpress();
93+
}
94+
}
95+
8896
}

0 commit comments

Comments
 (0)