-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivity.go
More file actions
71 lines (57 loc) · 2.06 KB
/
activity.go
File metadata and controls
71 lines (57 loc) · 2.06 KB
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
// Code generated by idiomgen. DO NOT EDIT.
package activity
import (
"unsafe"
capi "github.com/AndroidGoLab/ndk/capi/nativeactivity"
)
// Activity wraps the NDK ANativeActivity handle.
type Activity struct {
ptr *capi.ANativeActivity
}
// cptr returns the underlying C pointer, or nil if h is nil.
// This allows passing optional (nullable) handle parameters to capi functions.
func (h *Activity) cptr() *capi.ANativeActivity {
if h == nil {
return nil
}
return h.ptr
}
// NewActivityFromPointer wraps a raw ANativeActivity pointer.
func NewActivityFromPointer(ptr unsafe.Pointer) *Activity {
return &Activity{ptr: (*capi.ANativeActivity)(ptr)}
}
// Pointer returns the underlying pointer as unsafe.Pointer.
func (h *Activity) Pointer() unsafe.Pointer {
return unsafe.Pointer(h.ptr)
}
// UintPtr returns the underlying pointer as a uintptr.
// This is useful for interop with gomobile bind, golang.org/x/mobile,
// gioui.org, and other packages that represent native handles as uintptr.
func (h *Activity) UintPtr() uintptr {
return uintptr(unsafe.Pointer(h.ptr))
}
// NewActivityFromUintPtr wraps a uintptr as a Activity.
// The caller must ensure ptr points to a valid ANativeActivity.
func NewActivityFromUintPtr(ptr uintptr) *Activity {
return &Activity{ptr: (*capi.ANativeActivity)(unsafe.Pointer(ptr))}
}
// Finish calls the underlying NDK function.
func (h *Activity) Finish() {
capi.ANativeActivity_finish(h.ptr)
}
// HideSoftInput calls the underlying NDK function.
func (h *Activity) HideSoftInput(flags uint32) {
capi.ANativeActivity_hideSoftInput(h.ptr, flags)
}
// SetWindowFlags calls the underlying NDK function.
func (h *Activity) SetWindowFlags(addFlags uint32, removeFlags uint32) {
capi.ANativeActivity_setWindowFlags(h.ptr, addFlags, removeFlags)
}
// SetWindowFormat calls the underlying NDK function.
func (h *Activity) SetWindowFormat(format int32) {
capi.ANativeActivity_setWindowFormat(h.ptr, format)
}
// ShowSoftInput calls the underlying NDK function.
func (h *Activity) ShowSoftInput(flags uint32) {
capi.ANativeActivity_showSoftInput(h.ptr, flags)
}