Documentation ¶
Overview ¶
Package app implements a NativeActivity glue layer required to properly handle the startup process and the native activity events.
Import this package into your Go application to make it Android-compatible.
Index ¶
- Variables
- func HandleInputQueues(queueChan <-chan *android.InputQueue, onProcessed func(), ...)
- func Main(fn func(app NativeActivity))
- func SetLogTag(tag string)
- type ActivityEvent
- type ActivityEventKind
- type AssetReader
- type ContentRectEvent
- type InputQueueEvent
- type InputQueueEventKind
- type LifecycleEvent
- type LifecycleEventKind
- type NativeActivity
- type NativeWindowEvent
- type NativeWindowEventKind
- type SaveStateFunc
- type Signal
- type WindowFocusEvent
Constants ¶
This section is empty.
Variables ¶
View Source
var LogInputEvents = func(ev *android.InputEvent) { switch android.InputEventGetType(ev) { case android.InputEventTypeKey: key := android.KeyEventGetKeyCode(ev) log.Printf("key event [%d]", key) case android.InputEventTypeMotion: str := "motion event " fingers := android.MotionEventGetPointerCount(ev) for i := uint32(0); i < fingers; i++ { x := android.MotionEventGetX(ev, i) y := android.MotionEventGetY(ev, i) pressure := android.MotionEventGetPressure(ev, i) str += fmt.Sprintf("[%.0f; %.0f; %.2f]", x, y, pressure) } log.Println(str) } }
View Source
var SkipInputEvents = func(ev *android.InputEvent) {}
Functions ¶
func HandleInputQueues ¶
func HandleInputQueues(queueChan <-chan *android.InputQueue, onProcessed func(), evHandler func(ev *android.InputEvent))
func Main ¶
func Main(fn func(app NativeActivity))
Types ¶
type ActivityEvent ¶
type ActivityEvent struct { Activity *android.NativeActivity Kind ActivityEventKind }
type ActivityEventKind ¶
type ActivityEventKind string
const ( OnConfigurationChanged ActivityEventKind = "onConfigurationChanged" OnLowMemory ActivityEventKind = "onLowMemory" )
type AssetReader ¶
type AssetReader struct {
// contains filtered or unexported fields
}
AssetReader represents an asset opened for reading
func (*AssetReader) Close ¶
func (r *AssetReader) Close() error
Close frees the resources associated with the AssetReader, rendering it unusable. It always returns nil.
type ContentRectEvent ¶
type ContentRectEvent struct { Activity *android.NativeActivity Rect *android.Rect }
type InputQueueEvent ¶
type InputQueueEvent struct { Activity *android.NativeActivity Queue *android.InputQueue Kind InputQueueEventKind }
type InputQueueEventKind ¶
type InputQueueEventKind string
const ( QueueCreated InputQueueEventKind = "queueCreated" QueueDestroyed InputQueueEventKind = "queueDestroyed" )
type LifecycleEvent ¶
type LifecycleEvent struct { Activity *android.NativeActivity Kind LifecycleEventKind }
type LifecycleEventKind ¶
type LifecycleEventKind string
const ( OnCreate LifecycleEventKind = "onCreate" OnDestroy LifecycleEventKind = "onDestroy" OnStart LifecycleEventKind = "onStart" OnStop LifecycleEventKind = "onStop" OnPause LifecycleEventKind = "onPause" OnResume LifecycleEventKind = "onResume" )
type NativeActivity ¶
type NativeActivity interface { InitDone() NativeWindowRedrawDone() InputQueueHandled() NativeActivity() *android.NativeActivity LifecycleEvents() <-chan LifecycleEvent HandleSaveInstanceState(fn SaveStateFunc) HandleWindowFocusEvents(out chan<- WindowFocusEvent) HandleNativeWindowEvents(out chan<- NativeWindowEvent) HandleInputQueueEvents(out chan<- InputQueueEvent) HandleContentRectEvents(out chan<- ContentRectEvent) HandleActivityEvents(out chan<- ActivityEvent) GetAsset(name string) ([]byte, error) OpenAsset(name string) (*AssetReader, error) }
type NativeWindowEvent ¶
type NativeWindowEvent struct { Activity *android.NativeActivity Window *android.NativeWindow Kind NativeWindowEventKind }
type NativeWindowEventKind ¶
type NativeWindowEventKind string
const ( NativeWindowCreated NativeWindowEventKind = "nativeWindowCreated" NativeWindowRedrawNeeded NativeWindowEventKind = "nativeWindowRedrawNeeded" NativeWindowDestroyed NativeWindowEventKind = "nativeWindowDestroyed" )
type SaveStateFunc ¶
type SaveStateFunc func(activity *android.NativeActivity, size uintptr) unsafe.Pointer
type WindowFocusEvent ¶
type WindowFocusEvent struct { Activity *android.NativeActivity HasFocus bool }
Click to show internal directories.
Click to hide internal directories.