Handle inset adjustements on the C++ side, handle them better in the UI.

This commit is contained in:
Henrik Rydgård committed 2026-03-14 18:13:37 +01:00
1 parent 13698f81fb
commit 75453632f9
32 files changed
+210 -84

No files matched your search

+18 -8
View File
@@ -4,12 +4,13 @@
#include "Common/UI/PopupScreens.h"
#include "UI/MiscViews.h"
ViewLayoutMode UISimpleBaseDialogScreen::LayoutMode() const {
return (flags_ & SimpleDialogFlags::ContentsCanScroll) ? ViewLayoutMode::IgnoreBottomInset : ViewLayoutMode::ApplyInsets;
}
void UISimpleBaseDialogScreen::CreateViews() {
using namespace UI;
const bool canScroll = flags_ & SimpleDialogFlags::ContentsCanScroll;
ignoreBottomInset_ = canScroll;
const bool portrait = GetDeviceOrientation() == DeviceOrientation::Portrait;
root_ = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT));
@@ -29,7 +30,7 @@ void UISimpleBaseDialogScreen::CreateViews() {
});
}
if (canScroll) {
if (flags_ & SimpleDialogFlags::ContentsCanScroll) {
ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT, 1.0f));
LinearLayout *contents = new LinearLayoutList(ORIENT_VERTICAL, new LinearLayoutParams(Margins(0, 0, 8, 0)));
contents->SetSpacing(0);
@@ -41,6 +42,19 @@ void UISimpleBaseDialogScreen::CreateViews() {
}
}
ViewLayoutMode UITwoPaneBaseDialogScreen::LayoutMode() const {
const bool portrait = GetDeviceOrientation() == DeviceOrientation::Portrait;
if (portrait) {
if (flags_ & TwoPaneFlags::SettingsCanScroll) {
return ViewLayoutMode::IgnoreBottomInset;
} else {
return ViewLayoutMode::ApplyInsets;
}
} else {
return ViewLayoutMode::ApplyInsets;
}
}
void UITwoPaneBaseDialogScreen::CreateViews() {
using namespace UI;
@@ -72,9 +86,6 @@ void UITwoPaneBaseDialogScreen::CreateViews() {
if (portrait) {
// Portrait layout is just a vertical stack.
if (flags_ & TwoPaneFlags::SettingsCanScroll) {
ignoreBottomInset_ = true;
}
LinearLayout *root = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT));
TopBarFlags topBarFlags = TopBarFlags::Portrait;
@@ -114,7 +125,6 @@ void UITwoPaneBaseDialogScreen::CreateViews() {
}
root_ = root;
} else {
ignoreBottomInset_ = false;
LinearLayout *root = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT));
std::string title(GetTitle());
TopBarFlags topBarFlags = portrait ? TopBarFlags::Portrait : TopBarFlags::Default;