-
Notifications
You must be signed in to change notification settings - Fork 15
/
starttab.go
72 lines (55 loc) · 1.95 KB
/
starttab.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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/logger"
)
var ReadyToStart bool
// Left side
var Btn_start *widget.Button
var Chk_gotbackups *widget.Check
var Lbl_device_detection *widget.Label
var Lbl_brand_codename *widget.Label
func btnStartClicked() {
go func() {
err := prepareFlash()
if err != nil {
logger.LogError("prepareFlash() failed:", err)
}
}()
}
func chkGotbackupsChanged(value bool) {
updateMainScreen()
}
// Right side
var Lbl_instructions *widget.Label
var initial_instructions = "Welcome to " + AppName + "!\n\nOn your connected Android device:\n1. In Settings > About Phone:\nTap 7 times on Build Number\n2. In Settings > Developer Options:\nActivate Android/USB Debugging\nand OEM Unlock (if you've got that)"
func initStarttabWidgets() {
Btn_start = widget.NewButton("Start", btnStartClicked)
Chk_gotbackups = widget.NewCheck("I've got backups of all I need", chkGotbackupsChanged)
Lbl_device_detection = widget.NewLabel("")
Lbl_brand_codename = widget.NewLabel("")
Lbl_instructions = widget.NewLabel("")
Lbl_instructions.Wrapping = fyne.TextWrapWord
}
func setDefaultsStarttab() {
Lbl_device_detection.SetText("No device detected")
Lbl_device_detection.Alignment = fyne.TextAlignCenter
Lbl_brand_codename.SetText("")
Lbl_brand_codename.Alignment = fyne.TextAlignCenter
Lbl_instructions.SetText(initial_instructions)
Btn_start.Disable()
}
func starttab() fyne.CanvasObject {
// Left side
empty := widget.NewLabel("")
leftside := container.NewVBox(Btn_start, Chk_gotbackups, empty, Lbl_device_detection, Lbl_brand_codename)
leftcard := widget.NewCard("", "", leftside)
// Right side
rightside := container.NewVBox(Lbl_instructions)
rightcard := widget.NewCard("", "", rightside)
grid := container.New(layout.NewGridLayout(2), leftcard, rightcard)
return container.NewVBox(layout.NewSpacer(), grid, layout.NewSpacer())
}