Skip to content

Commit e0fea38

Browse files
committed
Unify help buttons
1 parent 5080221 commit e0fea38

3 files changed

Lines changed: 37 additions & 22 deletions

File tree

openandroidinstaller/views/select_view.py

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
Column,
2222
Divider,
2323
ElevatedButton,
24+
OutlinedButton,
25+
FilledButton,
2426
Markdown,
2527
Row,
2628
Text,
27-
IconButton,
2829
colors,
2930
icons,
3031
TextButton,
@@ -72,10 +73,10 @@ def build(self):
7273
which is a type of non-volatile memory used in computers for storing software that is
7374
rarely changed during the life of the system, also known as firmware.
7475
75-
# Recovery Image
76+
## Recovery Image
7677
A custom recovery is used for installing custom software on your device.
7778
This custom software can include smaller modifications like rooting your device or even
78-
replacing the firmware of the device with a completely custom ROM. .
79+
replacing the firmware of the device with a completely custom ROM.
7980
8081
OpenAndroidInstaller works with the [TWRP recovery project](https://twrp.me/about/).""",
8182
on_tap_link=lambda e: self.page.launch_url(e.data),
@@ -108,13 +109,21 @@ def build(self):
108109
self.right_view.controls.append(self.pick_recovery_dialog)
109110

110111
# create help/info button to show the help dialog
111-
info_button = IconButton(
112-
icon=icons.HELP_OUTLINE_OUTLINED,
113-
icon_color="blue400",
114-
icon_size=20,
112+
info_button = OutlinedButton(
113+
"What is this?",
115114
on_click=self.open_explain_images_dlg,
116-
tooltip="What is an OS image and a recovery file?",
115+
expand=True,
116+
icon=icons.HELP_OUTLINE_OUTLINED,
117+
icon_color=colors.DEEP_ORANGE_500,
118+
tooltip="Get more details on custom operating system images and recoveries.",
117119
)
120+
#info_button = IconButton(
121+
# icon=icons.HELP_OUTLINE_OUTLINED,
122+
# icon_color=colors.DEEP_ORANGE_500,
123+
# icon_size=30,
124+
# on_click=self.open_explain_images_dlg,
125+
# tooltip="What is an OS image and a recovery file?",
126+
#)
118127
# add title and progressbar
119128
self.right_view.controls.append(
120129
get_title("Now pick an OS image and a recovery file:", info_button=info_button)
@@ -166,7 +175,7 @@ def build(self):
166175
),
167176
Row(
168177
[
169-
ElevatedButton(
178+
FilledButton(
170179
"Pick OS image",
171180
icon=icons.UPLOAD_FILE,
172181
on_click=lambda _: self.pick_image_dialog.pick_files(
@@ -188,7 +197,7 @@ def build(self):
188197
),
189198
Row(
190199
[
191-
ElevatedButton(
200+
FilledButton(
192201
"Pick recovery file",
193202
icon=icons.UPLOAD_FILE,
194203
on_click=lambda _: self.pick_recovery_dialog.pick_files(
@@ -232,11 +241,12 @@ def pick_image_result(self, e: FilePickerResultEvent):
232241
else:
233242
logger.info("No image selected.")
234243
# check if the image works with the device and show the filename in different colors accordingly
235-
device_code = self.state.config.metadata.get("devicecode")
236-
if image_works_with_device(device_code=device_code, image_path=self.state.image_path):
237-
self.selected_image.color = colors.GREEN
238-
else:
239-
self.selected_image.color = colors.RED
244+
if e.files:
245+
device_code = self.state.config.metadata.get("devicecode")
246+
if image_works_with_device(device_code=device_code, image_path=self.state.image_path):
247+
self.selected_image.color = colors.GREEN
248+
else:
249+
self.selected_image.color = colors.RED
240250
# update
241251
self.selected_image.update()
242252

@@ -253,11 +263,12 @@ def pick_recovery_result(self, e: FilePickerResultEvent):
253263
else:
254264
logger.info("No image selected.")
255265
# check if the recovery works with the device and show the filename in different colors accordingly
256-
device_code = self.state.config.metadata.get("devicecode")
257-
if recovery_works_with_device(device_code=device_code, recovery_path=self.state.recovery_path):
258-
self.selected_recovery.color = colors.GREEN
259-
else:
260-
self.selected_recovery.color = colors.RED
266+
if e.files:
267+
device_code = self.state.config.metadata.get("devicecode")
268+
if recovery_works_with_device(device_code=device_code, recovery_path=self.state.recovery_path):
269+
self.selected_recovery.color = colors.GREEN
270+
else:
271+
self.selected_recovery.color = colors.RED
261272
# update
262273
self.selected_recovery.update()
263274

@@ -280,6 +291,7 @@ def enable_button_if_ready(self, e):
280291
color=colors.RED, weight="bold",
281292
)
282293
]
294+
self.confirm_button.disabled = True
283295
self.right_view.update()
284296
return
285297
logger.info("Image and recovery work with the device. You can continue.")

openandroidinstaller/views/start_view.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
Column,
2323
Divider,
2424
ElevatedButton,
25+
OutlinedButton,
2526
FilledButton,
2627
Markdown,
2728
Row,
@@ -122,10 +123,12 @@ def check_bootloader_unlocked(e):
122123
),
123124
Row(
124125
[
125-
ElevatedButton(
126+
OutlinedButton(
126127
"How do I enable developer options?",
127128
on_click=self.open_developer_options_dlg,
128129
expand=True,
130+
icon=icons.HELP_OUTLINE_OUTLINED,
131+
icon_color=colors.DEEP_ORANGE_500,
129132
tooltip="Get help to enable developer options and OEM unlocking.",
130133
)
131134
]

openandroidinstaller/widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def get_title(title: str, info_button: IconButton=None) -> Container:
3030
margin=0,
3131
padding=0,
3232
alignment=alignment.center,
33-
width=400,
33+
width=600,
3434
height=50,
3535
border_radius=1,
3636
)

0 commit comments

Comments
 (0)