forked from fyne-io/fyne
-
Notifications
You must be signed in to change notification settings - Fork 0
/
device.go
54 lines (42 loc) · 1.02 KB
/
device.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
package mobile
import (
"fyne.io/fyne/v2/driver/mobile"
"fyne.io/fyne/v2/internal/driver/mobile/event/size"
"fyne.io/fyne/v2"
)
type device struct {
safeTop, safeLeft, safeWidth, safeHeight int
}
//lint:file-ignore U1000 Var currentDPI is used in other files, but not here
var (
currentOrientation size.Orientation
currentDPI float32
)
// Declare conformity with Device
var _ fyne.Device = (*device)(nil)
func (*device) Orientation() fyne.DeviceOrientation {
switch currentOrientation {
case size.OrientationLandscape:
return fyne.OrientationHorizontalLeft
default:
return fyne.OrientationVertical
}
}
func (*device) IsMobile() bool {
return true
}
func (*device) IsBrowser() bool {
return false
}
func (*device) HasKeyboard() bool {
return false
}
func (*device) ShowVirtualKeyboard() {
showVirtualKeyboard(mobile.DefaultKeyboard)
}
func (*device) ShowVirtualKeyboardType(keyboard mobile.KeyboardType) {
showVirtualKeyboard(keyboard)
}
func (*device) HideVirtualKeyboard() {
hideVirtualKeyboard()
}