Skip to content

Commit a1ea9f8

Browse files
authored
Improve resizing/scaling support (#402)
Now the right size of the installer scales with the screen when resizing.
2 parents 40c9838 + 2bb71a6 commit a1ea9f8

File tree

4 files changed

+27
-22
lines changed

4 files changed

+27
-22
lines changed

openandroidinstaller/openandroidinstaller.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def __init__(self, state: AppState):
7272
super().__init__()
7373
self.state = state
7474
# create the main columns
75-
self.view = Column(expand=True, width=1200)
75+
self.view = Column(expand=True) # , width=1200)
7676

7777
# create default starter views
7878
welcome_view = WelcomeView(
@@ -216,7 +216,7 @@ def log_version_infos(bin_path):
216216
]
217217
try:
218218
logger.info(f"Heimdall version: {hdversion[1].strip()}")
219-
except:
219+
except IndexError:
220220
logger.info(f"Issue with heimdall: {hdversion}")
221221

222222

openandroidinstaller/views/base.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@
1515

1616
from app_state import AppState
1717

18-
from flet import (
19-
Column,
20-
Image,
21-
Row,
22-
UserControl,
23-
VerticalDivider,
24-
)
18+
from flet import Column, Container, Image, Row, UserControl, VerticalDivider, margin
2519

2620

2721
class BaseView(UserControl):
@@ -30,27 +24,35 @@ def __init__(self, state: AppState, image: str = "placeholder.png"):
3024
self.state = state
3125

3226
# configs
33-
self.column_width = 600
27+
# self.column_width = 600
3428
# right part of the display, add content here.
35-
self.right_view_header = Column(width=self.column_width, height=120, spacing=30)
29+
self.right_view_header = Column(
30+
spacing=30
31+
) # , width=self.column_width, height=120)
3632
self.right_view = Column(
37-
alignment="center", width=self.column_width, height=650, scroll="adaptive"
33+
alignment="center",
34+
scroll="adaptive", # , width=self.column_width, height=650
3835
)
3936
# left part of the display: used for displaying the images
4037
self.left_view = Column(
41-
width=self.column_width,
38+
# width=self.column_width,
4239
controls=[Image(src=f"/imgs/{image}", height=600)],
4340
expand=True,
4441
horizontal_alignment="center",
4542
)
4643
# main view row
47-
self.view = Row(
48-
[
49-
self.left_view,
50-
VerticalDivider(),
51-
Column(expand=True, controls=[self.right_view_header, self.right_view]),
52-
],
53-
alignment="spaceEvenly",
44+
self.view = Container(
45+
content=Row(
46+
[
47+
self.left_view,
48+
VerticalDivider(),
49+
Column(
50+
expand=True, controls=[self.right_view_header, self.right_view]
51+
),
52+
],
53+
alignment="spaceEvenly",
54+
),
55+
margin=margin.only(left=10, top=0, right=50, bottom=5),
5456
)
5557

5658
def clear(

openandroidinstaller/views/requirements_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def build(self):
139139
required_android_version = self.state.config.requirements.get("android")
140140
if required_android_version:
141141
android_checkbox = Checkbox(
142-
label="The required android version is installed. (Or I know the risk of continuing)",
142+
label="The required android version is installed.\n(Or I know the risk of continuing)",
143143
on_change=self.enable_continue_button,
144144
)
145145
android_version_check = Card(

openandroidinstaller/views/start_view.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
OutlinedButton,
2727
FilledButton,
2828
Row,
29+
ResponsiveRow,
2930
TextButton,
3031
colors,
3132
icons,
@@ -106,6 +107,7 @@ def check_bootloader_unlocked(e):
106107
disabled=True,
107108
inactive_thumb_color=colors.YELLOW,
108109
active_color=colors.GREEN,
110+
col={"xl": 6},
109111
)
110112

111113
# toggleswitch to allow skipping flashing recovery
@@ -119,6 +121,7 @@ def check_recovery_already_flashed(e):
119121
disabled=True,
120122
inactive_thumb_color=colors.YELLOW,
121123
active_color=colors.GREEN,
124+
col={"xl": 6},
122125
)
123126

124127
# inform the user about the device detection
@@ -202,7 +205,7 @@ def build(self):
202205
alignment="center",
203206
),
204207
Divider(),
205-
Row([self.bootloader_switch, self.recovery_switch]),
208+
ResponsiveRow([self.bootloader_switch, self.recovery_switch]),
206209
]
207210
)
208211
return self.view

0 commit comments

Comments
 (0)