55 lines
1.0 KiB
Go
55 lines
1.0 KiB
Go
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()
|
|
}
|