Skip to content

Commit 605eec1

Browse files
committed
Add modal box to explaine os images and recovery
1 parent 7d6e722 commit 605eec1

1 file changed

Lines changed: 48 additions & 1 deletion

File tree

openandroidinstaller/views/select_view.py

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
Row,
2626
Text,
2727
icons,
28+
TextButton,
29+
AlertDialog,
2830
FilePicker,
2931
FilePickerResultEvent,
3032
)
@@ -48,6 +50,25 @@ def __init__(
4850
self.on_confirm = on_confirm
4951

5052
def build(self):
53+
# dialog box to explain OS images and recovery
54+
self.dlg_explain_images = AlertDialog(
55+
modal=True,
56+
title=Text("What is an OS image and recovery and why do I need it?"),
57+
content=Markdown(
58+
"""
59+
To do this, tap seven times on the build number in the 'System'- or 'About the phone'-Menu in Settings. You can also use the phones own search to look for `build number`.
60+
Then go back to the main menu and look for 'developer options'. You can also search for it in your phone.
61+
When you are in developer options, toggle OEM unlocking and USB-Debugging. If your phone is already connected to your PC, a pop-up might appear. Allow USB debugging in the pop-up on your phone.
62+
Now you are ready to continue.
63+
"""
64+
),
65+
actions=[
66+
TextButton("Close", on_click=self.close_developer_options_dlg),
67+
],
68+
actions_alignment="end",
69+
)
70+
71+
# download link
5172
self.download_link = get_download_link(
5273
self.state.config.metadata.get("devicecode", "ERROR")
5374
)
@@ -67,12 +88,27 @@ def build(self):
6788
self.right_view.controls.append(self.pick_image_dialog)
6889
self.right_view.controls.append(self.pick_recovery_dialog)
6990
# add title and progressbar
70-
self.right_view.controls.append(get_title("Pick image and recovery files:"))
91+
self.right_view.controls.append(get_title("Now pick an OS image and a recovery file:"))
7192
self.right_view.controls.append(self.state.progressbar)
93+
# button to show the explainaition dialoge
94+
self.right_view.controls.append(
95+
Row(
96+
[
97+
ElevatedButton(
98+
"What is an OS image and a recovery file?",
99+
on_click=self.open_explain_images_dlg,
100+
expand=True,
101+
tooltip="Get some details about those files and why you need them.",
102+
)
103+
]
104+
)
105+
)
106+
72107
# text row to show infos during the process
73108
self.info_field = Row()
74109
# if there is an available download, show the button to the page
75110
if self.download_link:
111+
self.right_view.controls.append(Divider())
76112
self.right_view.controls.append(
77113
Column(
78114
[
@@ -155,6 +191,17 @@ def build(self):
155191
)
156192
return self.view
157193

194+
def open_explain_images_dlg(self, e):
195+
"""Open the dialog to explain OS and recovery image."""
196+
self.page.dialog = self.dlg_explain_images
197+
self.dlg_explain_images.open = True
198+
self.page.update()
199+
200+
def close_developer_options_dlg(self, e):
201+
"""Close the dialog to explain OS and recovery image."""
202+
self.dlg_explain_images.open = False
203+
self.page.update()
204+
158205
def pick_image_result(self, e: FilePickerResultEvent):
159206
path = ", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!"
160207
self.selected_image.value = (

0 commit comments

Comments
 (0)