Skip to content

Commit 7c808ad

Browse files
committed
add dialog to help finding the android or firmware version
1 parent 74b974c commit 7c808ad

2 files changed

Lines changed: 75 additions & 8 deletions

File tree

openandroidinstaller/views/requirements_view.py

Lines changed: 73 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,14 @@
2424
ElevatedButton,
2525
Markdown,
2626
Row,
27+
colors,
28+
OutlinedButton,
2729
Text,
2830
icons,
31+
TextButton,
32+
AlertDialog,
2933
)
34+
from flet.buttons import CountinuosRectangleBorder
3035

3136
from views import BaseView
3237
from app_state import AppState
@@ -44,7 +49,19 @@ def __init__(
4449
super().__init__(state=state, image="requirements-default.png")
4550
self.on_confirm = on_confirm
4651

52+
def open_find_version_dlg(self, e):
53+
"""Open the dialog to explain how to find the android and firmware version."""
54+
self.page.dialog = self.dlg_howto_find_versions
55+
self.dlg_howto_find_versions.open = True
56+
self.page.update()
57+
58+
def close_find_version_dlg(self, e):
59+
"""Close the dialog to explain how to find the android and firmware version."""
60+
self.dlg_howto_find_versions.open = False
61+
self.page.update()
62+
4763
def build(self):
64+
# continue button
4865
self.continue_button = ElevatedButton(
4966
"Continue",
5067
on_click=self.on_confirm,
@@ -53,6 +70,40 @@ def build(self):
5370
expand=True,
5471
)
5572

73+
# dialog to explain howto find the android and firmware version
74+
self.dlg_howto_find_versions = AlertDialog(
75+
modal=True,
76+
title=Text("Where to find the current Android and/or firmware version?"),
77+
content=Markdown(
78+
"""
79+
## Find your current Android Version
80+
Scroll down on the Settings screen and look for an "About phone", "About tablet", or "System" option.
81+
You'll usually find this at the very bottom of the main Settings screen, under System, but depending
82+
on your phone it could be different. If you do find a specific option for System, you can usually
83+
find the "About Phone" underneath that.
84+
85+
On the resulting screen, look for "Android version" to find the version of Android installed on your device.
86+
87+
## Find your current device firmware version
88+
On the same screen you find the "Android version" you can also find the Firmware Version.
89+
On some devices, the build version is basically the firmware version.""",
90+
),
91+
actions=[
92+
TextButton("Close", on_click=self.close_find_version_dlg),
93+
],
94+
actions_alignment="end",
95+
shape=CountinuosRectangleBorder(radius=0),
96+
)
97+
# create help/info button to show the help dialog
98+
info_button = OutlinedButton(
99+
"How to Find the version",
100+
on_click=self.open_find_version_dlg,
101+
expand=False,
102+
icon=icons.HELP_OUTLINE_OUTLINED,
103+
icon_color=colors.DEEP_ORANGE_500,
104+
tooltip="How to find the firmware and android version of your device.",
105+
)
106+
56107
# build up the main view
57108
self.right_view.controls.extend(
58109
[
@@ -91,10 +142,18 @@ def enable_continue_button(e):
91142
Container(
92143
content=Column(
93144
[
145+
Row(
146+
[
147+
Text(
148+
f"Android Version {required_android_version}:",
149+
style="titleSmall",
150+
),
151+
info_button,
152+
],
153+
alignment="spaceBetween",
154+
),
94155
Markdown(
95-
f"""
96-
#### Android Version {required_android_version}:
97-
Before following these instructions please ensure that the device is currently using Android {required_android_version} firmware.
156+
f"""Before following these instructions please ensure that the device is currently using Android {required_android_version} firmware.
98157
If the vendor provided multiple updates for that version, e.g. security updates, make sure you are on the latest!
99158
If your current installation is newer or older than Android {required_android_version}, please upgrade or downgrade to the required
100159
version before proceeding (guides can be found on the internet!).
@@ -120,10 +179,18 @@ def enable_continue_button(e):
120179
Container(
121180
content=Column(
122181
[
182+
Row(
183+
[
184+
Text(
185+
f"Firmware Version {required_firmware_version}:",
186+
style="titleSmall",
187+
),
188+
info_button,
189+
],
190+
alignment="spaceBetween",
191+
),
123192
Markdown(
124-
f"""
125-
#### Firmware Version {required_firmware_version}:
126-
Before following these instructions please ensure that the device is on firmware version {required_firmware_version}.
193+
f"""Before following these instructions please ensure that the device is on firmware version {required_firmware_version}.
127194
To discern this, you can run the command `adb shell getprop ro.build.display.id` on the stock ROM.
128195
If the device is not on the specified version, please follow the instructions below to install it.
129196
"""

openandroidinstaller/views/select_view.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def build(self):
7878
on_tap_link=lambda e: self.page.launch_url(e.data),
7979
),
8080
actions=[
81-
TextButton("Close", on_click=self.close_developer_options_dlg),
81+
TextButton("Close", on_click=self.close_close_explain_images_dlg),
8282
],
8383
actions_alignment="end",
8484
shape=CountinuosRectangleBorder(radius=0),
@@ -225,7 +225,7 @@ def open_explain_images_dlg(self, e):
225225
self.dlg_explain_images.open = True
226226
self.page.update()
227227

228-
def close_developer_options_dlg(self, e):
228+
def close_close_explain_images_dlg(self, e):
229229
"""Close the dialog to explain OS and recovery image."""
230230
self.dlg_explain_images.open = False
231231
self.page.update()

0 commit comments

Comments
 (0)