diff --git a/CodenameOne/src/com/codename1/ui/spinner/Picker.java b/CodenameOne/src/com/codename1/ui/spinner/Picker.java index eb6a497756..779fb88323 100644 --- a/CodenameOne/src/com/codename1/ui/spinner/Picker.java +++ b/CodenameOne/src/com/codename1/ui/spinner/Picker.java @@ -43,6 +43,7 @@ import com.codename1.ui.VirtualInputDevice; import com.codename1.ui.events.ActionEvent; import com.codename1.ui.events.ActionListener; +import com.codename1.ui.geom.Rectangle; import com.codename1.ui.layouts.BorderLayout; import com.codename1.ui.layouts.BoxLayout; import com.codename1.ui.layouts.FlowLayout; @@ -864,6 +865,21 @@ public void actionPerformed(ActionEvent evt) { throw new RuntimeException("Attempt to show interaction dialog while button is not on form. Illegal state"); } + // The popup is anchored to the very bottom of the screen, so on devices with a + // bottom inset (e.g. the iPhone home indicator) its bottom-most row would be drawn + // underneath the inset. Reserve that inset as bottom padding so the whole popup stays + // inside the safe area. When BELOW_SPINNER custom buttons exist the padding goes on + // their bar (so the bar's background extends through the inset and the buttons remain + // tappable above it); otherwise it goes on the content pane. See issue #5152. + Rectangle safeArea = form.getSafeArea(); + int bottomInset = Display.getInstance().getDisplayHeight() - (safeArea.getY() + safeArea.getHeight()); + if (bottomInset > 0) { + Container insetTarget = bottomCustomButtons != null ? bottomCustomButtons : dlg.getContentPane(); + Style insetStyle = insetTarget.getAllStyles(); + insetStyle.setPaddingUnitBottom(Style.UNIT_TYPE_PIXELS); + insetStyle.setPaddingBottom(insetTarget.getStyle().getPaddingBottom() + bottomInset); + } + final int top = Math.max(0, form.getContentPane().getHeight() - dlg.getPreferredH()); if (top == 0) { wrapper.getUnselectedStyle().setPaddingTop(0); diff --git a/scripts/android/screenshots/LightweightPickerButtons.png b/scripts/android/screenshots/LightweightPickerButtons.png index d9ec09b31e..4454c2e503 100644 Binary files a/scripts/android/screenshots/LightweightPickerButtons.png and b/scripts/android/screenshots/LightweightPickerButtons.png differ diff --git a/scripts/android/screenshots/LightweightPickerButtons_above_center.png b/scripts/android/screenshots/LightweightPickerButtons_above_center.png index 77525ff127..c335dc9902 100644 Binary files a/scripts/android/screenshots/LightweightPickerButtons_above_center.png and b/scripts/android/screenshots/LightweightPickerButtons_above_center.png differ diff --git a/scripts/android/screenshots/LightweightPickerButtons_below_right.png b/scripts/android/screenshots/LightweightPickerButtons_below_right.png index 478e7795ac..1fcea487d1 100644 Binary files a/scripts/android/screenshots/LightweightPickerButtons_below_right.png and b/scripts/android/screenshots/LightweightPickerButtons_below_right.png differ diff --git a/scripts/android/screenshots/LightweightPickerButtons_between_mixed.png b/scripts/android/screenshots/LightweightPickerButtons_between_mixed.png index 40daec275b..9364445d59 100644 Binary files a/scripts/android/screenshots/LightweightPickerButtons_between_mixed.png and b/scripts/android/screenshots/LightweightPickerButtons_between_mixed.png differ diff --git a/scripts/android/screenshots/ValidatorLightweightPicker.png b/scripts/android/screenshots/ValidatorLightweightPicker.png index fbcecc0166..81e92528b2 100644 Binary files a/scripts/android/screenshots/ValidatorLightweightPicker.png and b/scripts/android/screenshots/ValidatorLightweightPicker.png differ diff --git a/scripts/ios/screenshots-metal/LightweightPickerButtons.png b/scripts/ios/screenshots-metal/LightweightPickerButtons.png index a15691252b..9a7ef78f0a 100644 Binary files a/scripts/ios/screenshots-metal/LightweightPickerButtons.png and b/scripts/ios/screenshots-metal/LightweightPickerButtons.png differ diff --git a/scripts/ios/screenshots-metal/LightweightPickerButtons_above_center.png b/scripts/ios/screenshots-metal/LightweightPickerButtons_above_center.png index 307d7f77ab..c146b1568e 100644 Binary files a/scripts/ios/screenshots-metal/LightweightPickerButtons_above_center.png and b/scripts/ios/screenshots-metal/LightweightPickerButtons_above_center.png differ diff --git a/scripts/ios/screenshots-metal/LightweightPickerButtons_below_right.png b/scripts/ios/screenshots-metal/LightweightPickerButtons_below_right.png index 49f6221b8a..f2779b69df 100644 Binary files a/scripts/ios/screenshots-metal/LightweightPickerButtons_below_right.png and b/scripts/ios/screenshots-metal/LightweightPickerButtons_below_right.png differ diff --git a/scripts/ios/screenshots-metal/LightweightPickerButtons_between_mixed.png b/scripts/ios/screenshots-metal/LightweightPickerButtons_between_mixed.png index 823e97098b..d33bb9e04a 100644 Binary files a/scripts/ios/screenshots-metal/LightweightPickerButtons_between_mixed.png and b/scripts/ios/screenshots-metal/LightweightPickerButtons_between_mixed.png differ diff --git a/scripts/ios/screenshots-metal/ValidatorLightweightPicker.png b/scripts/ios/screenshots-metal/ValidatorLightweightPicker.png index 190788b9dc..37602dcbcb 100644 Binary files a/scripts/ios/screenshots-metal/ValidatorLightweightPicker.png and b/scripts/ios/screenshots-metal/ValidatorLightweightPicker.png differ diff --git a/scripts/ios/screenshots/LightweightPickerButtons.png b/scripts/ios/screenshots/LightweightPickerButtons.png index 14a328f59c..dccaf4cc86 100644 Binary files a/scripts/ios/screenshots/LightweightPickerButtons.png and b/scripts/ios/screenshots/LightweightPickerButtons.png differ diff --git a/scripts/ios/screenshots/LightweightPickerButtons_above_center.png b/scripts/ios/screenshots/LightweightPickerButtons_above_center.png index 53c54d3607..481f77c22a 100644 Binary files a/scripts/ios/screenshots/LightweightPickerButtons_above_center.png and b/scripts/ios/screenshots/LightweightPickerButtons_above_center.png differ diff --git a/scripts/ios/screenshots/LightweightPickerButtons_below_right.png b/scripts/ios/screenshots/LightweightPickerButtons_below_right.png index 33763e0663..1b20bab739 100644 Binary files a/scripts/ios/screenshots/LightweightPickerButtons_below_right.png and b/scripts/ios/screenshots/LightweightPickerButtons_below_right.png differ diff --git a/scripts/ios/screenshots/LightweightPickerButtons_between_mixed.png b/scripts/ios/screenshots/LightweightPickerButtons_between_mixed.png index bb4604f752..4b3e33703c 100644 Binary files a/scripts/ios/screenshots/LightweightPickerButtons_between_mixed.png and b/scripts/ios/screenshots/LightweightPickerButtons_between_mixed.png differ diff --git a/scripts/ios/screenshots/ValidatorLightweightPicker.png b/scripts/ios/screenshots/ValidatorLightweightPicker.png index f47a03ab69..4238548844 100644 Binary files a/scripts/ios/screenshots/ValidatorLightweightPicker.png and b/scripts/ios/screenshots/ValidatorLightweightPicker.png differ