Skip to content

Commit 08fa43f

Browse files
committed
Add an info box with explainations for additional images; show the scrollbar by default if there is scrolling necessary
1 parent fd29a48 commit 08fa43f

File tree

2 files changed

+75
-6
lines changed

2 files changed

+75
-6
lines changed

openandroidinstaller/views/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(self, state: AppState, image: str = "placeholder.png"):
3434
# right part of the display, add content here.
3535
self.right_view_header = Column(width=self.column_width, height=120, spacing=30)
3636
self.right_view = Column(
37-
alignment="center", width=self.column_width, height=650, scroll="auto"
37+
alignment="center", width=self.column_width, height=650, scroll="adaptive"
3838
)
3939
# left part of the display: used for displaying the images
4040
self.left_view = Column(

openandroidinstaller/views/select_view.py

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ def build(self):
154154
]
155155
)
156156

157-
# create help/info button to show the help dialog
158-
info_button = OutlinedButton(
157+
# create help/info button to show the help dialog for the image and recovery selection
158+
explain_images_button = OutlinedButton(
159159
"What is this?",
160160
on_click=self.open_explain_images_dlg,
161161
expand=True,
@@ -168,7 +168,7 @@ def build(self):
168168
self.right_view_header.controls.append(
169169
get_title(
170170
"Now pick an OS image and a recovery file:",
171-
info_button=info_button,
171+
info_button=explain_images_button,
172172
step_indicator_img="steps-header-select.png",
173173
)
174174
)
@@ -289,7 +289,10 @@ def build(self):
289289
return self.view
290290

291291
def get_notes(self) -> str:
292-
"""Prepare and get notes for the specific device from config."""
292+
"""Prepare and get notes for the specific device from config.
293+
294+
These notes should be displayed to the user.
295+
"""
293296
notes = []
294297

295298
brand = self.state.config.metadata.get("brand", "")
@@ -311,12 +314,67 @@ def get_notes(self) -> str:
311314

312315
def toggle_additional_image_selection(self):
313316
"""Toggle the visibility of the additional image selection controls."""
317+
# dialogue box to explain additional required images
318+
self.dlg_explain_additional_images = AlertDialog(
319+
modal=True,
320+
title=Text("Why do I need additional images and where do I get them?"),
321+
content=Markdown(
322+
f"""## About additional images
323+
Some devices require additional images to be flashed before the recovery and OS image can be flashed.
324+
Not all images explained below are required for all devices. The installer will tell you which images are required for your device.
325+
326+
### dtbo.img
327+
The `dtbo.img` is a partition image that contains the device tree overlay.
328+
329+
### vbmeta.img
330+
The `vbmeta.img` is a partition image that contains the verified boot metadata.
331+
This is required to prevent issues with the verified boot process.
332+
333+
### super_empty.img
334+
The `super_empty.img` is used to wipe the super partition. This is required to
335+
prevent issues with the super partition when flashing a new ROM.
336+
337+
### vendor_boot.img
338+
The `vendor_boot.img` is a partition image that contains the vendor boot image.
339+
340+
## Where do I get these images?
341+
You can download the required images for your device from the [LineageOS downloads page](https://download.lineageos.org/devices/{self.state.config.device_code}/builds).
342+
If this download page does not contain the required images, you can try to find them on the [XDA developers forum](https://forum.xda-developers.com/).
343+
""",
344+
auto_follow_links=True,
345+
),
346+
actions=[
347+
TextButton(
348+
"Close", on_click=self.close_close_explain_additional_images_dlg
349+
),
350+
],
351+
actions_alignment="end",
352+
shape=CountinuosRectangleBorder(radius=0),
353+
)
354+
355+
# create help/info button to show the help dialog for the image and recovery selection
356+
explain_additional_images_button = OutlinedButton(
357+
"Why do I need this and where do I get it?",
358+
on_click=self.open_explain_additional_images_dlg,
359+
expand=True,
360+
icon=icons.HELP_OUTLINE_OUTLINED,
361+
icon_color=colors.DEEP_ORANGE_500,
362+
tooltip="Get more details on additional images and download links.",
363+
)
364+
314365
# attach the controls for uploading others partitions, like dtbo, vbmeta & super_empty
315366
additional_image_selection = []
316367
if self.state.config.metadata["additional_steps"]:
317368
additional_image_selection.extend(
318369
[
319-
Text("Select required additional images:", style="titleSmall"),
370+
Row(
371+
[
372+
Text(
373+
"Select required additional images:", style="titleSmall"
374+
),
375+
explain_additional_images_button,
376+
]
377+
),
320378
Markdown(
321379
"""
322380
Your selected device and ROM requires flashing of additional partitions. Please select the required images below.
@@ -403,6 +461,17 @@ def close_close_explain_images_dlg(self, e):
403461
self.dlg_explain_images.open = False
404462
self.page.update()
405463

464+
def open_explain_additional_images_dlg(self, e):
465+
"""Open the dialog to explain additional images."""
466+
self.page.dialog = self.dlg_explain_additional_images
467+
self.dlg_explain_additional_images.open = True
468+
self.page.update()
469+
470+
def close_close_explain_additional_images_dlg(self, e):
471+
"""Close the dialog to explain additional images."""
472+
self.dlg_explain_additional_images.open = False
473+
self.page.update()
474+
406475
def pick_image_result(self, e: FilePickerResultEvent):
407476
path = ", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!"
408477
# update the textfield with the name of the file

0 commit comments

Comments
 (0)