mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Add back button for tab page screen in landscape mode
This commit is contained in:
@@ -176,6 +176,10 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
|
|||||||
if (Forge.isLandscapeMode()) {
|
if (Forge.isLandscapeMode()) {
|
||||||
//in landscape mode, draw left border for header
|
//in landscape mode, draw left border for header
|
||||||
g.drawLine(LINE_THICKNESS, LINE_COLOR, 0, 0, 0, getHeight());
|
g.drawLine(LINE_THICKNESS, LINE_COLOR, 0, 0, 0, getHeight());
|
||||||
|
if (btnBack != null) { //draw top border for back button
|
||||||
|
float y = btnBack.getTop() - LINE_THICKNESS / 2;
|
||||||
|
g.drawLine(LINE_THICKNESS, SEPARATOR_COLOR, 0, y, getWidth(), y);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,10 +197,17 @@ public class TabPageScreen<T extends TabPageScreen<T>> extends FScreen {
|
|||||||
@Override
|
@Override
|
||||||
protected void doLayout(float width, float height) {
|
protected void doLayout(float width, float height) {
|
||||||
float x = 0;
|
float x = 0;
|
||||||
if (btnBack != null && !Forge.isLandscapeMode()) {
|
if (btnBack != null) {
|
||||||
btnBack.setIconScaleAuto(COMPACT_TABS);
|
if (Forge.isLandscapeMode()) { //show back button at bottom for landscape mode
|
||||||
btnBack.setSize(BACK_BUTTON_WIDTH, height);
|
float backButtonHeight = HEIGHT * 0.75f;
|
||||||
x += BACK_BUTTON_WIDTH;
|
btnBack.setBounds(0, height - backButtonHeight, width, backButtonHeight);
|
||||||
|
height -= backButtonHeight;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
btnBack.setIconScaleAuto(COMPACT_TABS);
|
||||||
|
btnBack.setSize(BACK_BUTTON_WIDTH, height);
|
||||||
|
x += BACK_BUTTON_WIDTH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scroller.setBounds(x, 0, width - x, height);
|
scroller.setBounds(x, 0, width - x, height);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user