From 014b3d0a2b4e9c3d041a81e159ed04fe0733f93b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 9 Oct 2013 16:26:15 +0200 Subject: [PATCH] Better vertical layout for home screen --- UI/MainScreen.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index eb4403adf1..99bdf98cb6 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -100,7 +100,7 @@ public: private: bool gridStyle_; std::string gamePath_; - + int holdFrameCount_; }; @@ -476,15 +476,14 @@ void MainScreen::CreateViews() { // Scrolling action menu to the right. using namespace UI; + bool vertical = dp_yres > dp_xres; + I18NCategory *m = GetI18NCategory("MainMenu"); Margins actionMenuMargins(0, 10, 10, 0); - root_ = new LinearLayout(ORIENT_HORIZONTAL); - - TabHolder *leftColumn = new TabHolder(ORIENT_HORIZONTAL, 64, new LinearLayoutParams(1.0)); + TabHolder *leftColumn = new TabHolder(ORIENT_HORIZONTAL, 64); leftColumn->SetClip(true); - root_->Add(leftColumn); ScrollView *scrollRecentGames = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); ScrollView *scrollAllGames = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); @@ -524,10 +523,8 @@ void MainScreen::CreateViews() { } */ - ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins)); - root_->Add(rightColumn); - - LinearLayout *rightColumnItems = new LinearLayout(ORIENT_VERTICAL); + ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL); + LinearLayout *rightColumnItems = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); rightColumn->Add(rightColumnItems); char versionString[256]; @@ -552,6 +549,20 @@ void MainScreen::CreateViews() { rightColumnItems->Add(new Choice(m->T("www.ppsspp.org")))->OnClick.Handle(this, &MainScreen::OnPPSSPPOrg); #endif rightColumnItems->Add(new Choice(m->T("Support PPSSPP")))->OnClick.Handle(this, &MainScreen::OnSupport); + + if (vertical) { + root_ = new LinearLayout(ORIENT_VERTICAL); + rightColumn->ReplaceLayoutParams(new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + leftColumn->ReplaceLayoutParams(new LinearLayoutParams(1.0)); + root_->Add(rightColumn); + root_->Add(leftColumn); + } else { + root_ = new LinearLayout(ORIENT_HORIZONTAL); + leftColumn->ReplaceLayoutParams(new LinearLayoutParams(1.0)); + rightColumn->ReplaceLayoutParams(new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins)); + root_->Add(leftColumn); + root_->Add(rightColumn); + } } void MainScreen::sendMessage(const char *message, const char *value) {