-
Notifications
You must be signed in to change notification settings - Fork 15
/
flashingscreen.go
51 lines (44 loc) · 1.81 KB
/
flashingscreen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import(
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/widget"
"github.com/amo13/anarchy-droid/device"
"github.com/amo13/anarchy-droid/logger"
)
var Lbl_flashing_title *widget.Label
var Lbl_flashing_instructions *widget.Label
var Lbl_boot_states *widget.Label
var Lbl_progressbar *widget.Label
var Progressbar *widget.ProgressBarInfinite
func btnCancelClicked() {
logger.Log("User clicked Cancel")
device.D1.Flashing = false
Progressbar.Stop()
Lbl_flashing_instructions.SetText("You cancelled.\n\nPlease restart the application.")
logger.Report(map[string]string{"progress":"Cancelled"})
}
func flashingScreen() fyne.CanvasObject {
Lbl_flashing_title := widget.NewLabelWithStyle("Installation", fyne.TextAlignCenter ,fyne.TextStyle{Bold: true})
Lbl_flashing_instructions = widget.NewLabel("Please wait.")
Lbl_flashing_instructions.Wrapping = fyne.TextWrapWord
Lbl_flashing_instructions.Alignment = fyne.TextAlignCenter
Lbl_boot_states = widget.NewLabel("")
Lbl_progressbar = widget.NewLabel("Some info about the progress here...")
Btn_cancel := widget.NewButton("Cancel", btnCancelClicked)
Progressbar = widget.NewProgressBarInfinite()
Progressbar.Stop()
Center_flashing_box := container.NewVBox(Lbl_flashing_title, Lbl_flashing_instructions)
progress_text_and_cancel := container.NewHBox(Lbl_progressbar, layout.NewSpacer(), Btn_cancel)
box := container.NewVBox(Center_flashing_box, layout.NewSpacer(), Lbl_boot_states, progress_text_and_cancel, Progressbar)
return box
}
func updateFlashingScreen() {
// Display requested and current device states
if device.D1.State_request != "" {
Lbl_boot_states.SetText("Trying to get the device into " + device.D1.State_request + ". Current state is " + device.D1.State + ".")
} else {
Lbl_boot_states.SetText("")
}
}