Skip to content

Commit a2871fe

Browse files
committed
Split the welcome/start view
1 parent 6fb6914 commit a2871fe

5 files changed

Lines changed: 96 additions & 22 deletions

File tree

openandroidinstaller/openandroidinstaller.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from loguru import logger
3939

4040
from app_state import AppState
41-
from views import SelectFilesView, StepView, SuccessView, StartView, RequirementsView
41+
from views import SelectFilesView, StepView, SuccessView, StartView, RequirementsView, WelcomeView
4242
from tooling import run_command
4343

4444
# where to write the logs
@@ -75,7 +75,11 @@ def __init__(self):
7575
self.view = Column(expand=True, width=1200)
7676

7777
# create default starter views
78-
welcome_view = StartView(
78+
welcome_view = WelcomeView(
79+
on_confirm=self.confirm,
80+
state=self.state,
81+
)
82+
start_view = StartView(
7983
on_confirm=self.confirm,
8084
state=self.state,
8185
)
@@ -88,7 +92,7 @@ def __init__(self):
8892
state=self.state,
8993
)
9094
# ordered to allow for pop
91-
self.default_views = [select_files_view, requirements_view, welcome_view]
95+
self.default_views = [select_files_view, requirements_view, start_view, welcome_view]
9296
# create the final success view
9397
self.final_view = SuccessView(state=self.state)
9498

openandroidinstaller/views/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from .base import BaseView # noqa
2+
from .welcome_view import WelcomeView # noqa
23
from .start_view import StartView # noqa
34
from .requirements_view import RequirementsView # noqa
45
from .select_view import SelectFilesView # noqa

openandroidinstaller/views/requirements_view.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
)
3030

3131
from views import BaseView
32+
from components import ConfirmButton
3233
from app_state import AppState
3334
from widgets import get_title
3435

openandroidinstaller/views/start_view.py

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from flet.buttons import CountinuosRectangleBorder
3434

3535
from views import BaseView
36+
from components import ConfirmButton
3637
from app_state import AppState
3738
from widgets import get_title
3839
from tooling import search_device
@@ -62,9 +63,12 @@ def build(self):
6263
title=Text("How to enable developer options and OEM unlocking"),
6364
content=Markdown(
6465
"""
65-
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`.
66-
Then go back to the main menu and look for 'developer options'. You can also search for it in your phone.
67-
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.
66+
To do this,
67+
- **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`.
68+
- Then go back to the main menu and look for **'developer options'**. You can also search for it in your phone.
69+
- When you are in developer options, **toggle OEM unlocking and USB-Debugging**.
70+
- If your phone is already connected to your PC, a pop-up might appear. **Allow USB debugging in the pop-up on your phone.**
71+
6872
Now you are ready to continue.
6973
"""
7074
),
@@ -74,6 +78,7 @@ def build(self):
7478
actions_alignment="end",
7579
shape=CountinuosRectangleBorder(radius=0),
7680
)
81+
7782
# toggleswitch to allow skipping unlocking the bootloader
7883
def check_bootloader_unlocked(e):
7984
"""Enable skipping unlocking the bootloader if selected."""
@@ -107,22 +112,7 @@ def check_bootloader_unlocked(e):
107112
# build up the main view
108113
self.right_view.controls.extend(
109114
[
110-
get_title("Welcome to the OpenAndroidInstaller!"),
111-
Text(
112-
"We will walk you through the installation process nice and easy."
113-
),
114-
Divider(),
115-
Markdown(
116-
"""
117-
Before you continue, make sure
118-
- your devices is on the latest system update.
119-
- you have a backup of all your important data, since this procedure will **erase all data from the phone**.
120-
- to not store the backup on the phone!
121-
122-
Please note, that vendor specific back-ups will most likely not work on LineageOS!
123-
"""
124-
),
125-
Divider(),
115+
get_title("Get the phone ready"),
126116
Markdown(
127117
"""
128118
To get started you need to
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
"""Contains the welcome view."""
2+
3+
# This file is part of OpenAndroidInstaller.
4+
# OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of
5+
# the GNU General Public License as published by the Free Software Foundation,
6+
# either version 3 of the License, or (at your option) any later version.
7+
8+
# OpenAndroidInstaller is distributed in the hope that it will be useful, but WITHOUT ANY
9+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
10+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
11+
12+
# You should have received a copy of the GNU General Public License along with OpenAndroidInstaller.
13+
# If not, see <https://www.gnu.org/licenses/>."""
14+
# Author: Tobias Sterbak
15+
16+
from loguru import logger
17+
from typing import Callable
18+
19+
from flet import (
20+
Divider,
21+
ElevatedButton,
22+
Markdown,
23+
Row,
24+
Text,
25+
icons,
26+
)
27+
28+
from views import BaseView
29+
from app_state import AppState
30+
from widgets import get_title
31+
32+
33+
class WelcomeView(BaseView):
34+
def __init__(
35+
self,
36+
state: AppState,
37+
on_confirm: Callable,
38+
):
39+
super().__init__(state=state, image="connect-to-usb.png")
40+
self.on_confirm = on_confirm
41+
42+
def build(self):
43+
self.continue_button = ElevatedButton(
44+
"Let's start!",
45+
on_click=self.on_confirm,
46+
icon=icons.NEXT_PLAN_OUTLINED,
47+
disabled=False,
48+
expand=True,
49+
)
50+
51+
# build up the main view
52+
self.right_view.controls.extend(
53+
[
54+
get_title("Welcome to the OpenAndroidInstaller!"),
55+
Text(
56+
"We will walk you through the installation process nice and easy."
57+
),
58+
Divider(),
59+
Markdown(
60+
"""
61+
Before you continue, make sure
62+
- your devices is on the latest system update.
63+
- you have a backup of all your important data, since this procedure will **erase all data from the phone**.
64+
- to not store the backup on the phone!
65+
66+
Please note, that vendor specific back-ups will most likely not work on LineageOS!
67+
"""
68+
),
69+
Divider(),
70+
Row(
71+
[
72+
self.continue_button,
73+
],
74+
alignment="center",
75+
),
76+
]
77+
)
78+
return self.view

0 commit comments

Comments
 (0)