Update to newer nswrap, gogio.

This commit is contained in:
Greg 2019-10-07 10:41:51 -04:00
parent f434092233
commit b311ea29d6
9 changed files with 3646 additions and 1063 deletions

View File

@ -7,6 +7,6 @@ in `examples/sensors`. To try it on your Android device:
go install gioui.org/cmd/gogio
go get git.wow.st/gmp/android-go/examples/sensors
cd $GOPATH/src/git.wow.st/gmp/android-go/examples/sensors
gogio -target android .
gogio -target android -minsdk 27 .
adb install -r sensors.apk
```

View File

@ -25,7 +25,7 @@ functionignore:
- wcstoimax
- wcstoumax
- imaxdiv
- __system_property_get
# - __system_property_get
enums:
- .*
typesubs:

File diff suppressed because it is too large Load Diff

34
android28.yaml Normal file
View File

@ -0,0 +1,34 @@
package: android28
libraries: [android, log, nativewindow, m]
inputfiles:
- $ANDROID_HOME/ndk-bundle/sysroot/usr/include/android/native_window.h
- $ANDROID_HOME/ndk-bundle/sysroot/usr/include/android/log.h
- $ANDROID_HOME/ndk-bundle/sysroot/usr/include/android/sensor.h
- $ANDROID_HOME/ndk-bundle/sysroot/usr/include/jni.h
- $ANDROID_HOME/ndk-bundle/sysroot/usr/include/sys/stat.h
sysimports:
- android/native_window.h
- android/log.h
- android/sensor.h
- jni.h
- stdlib.h
- sys/stat.h
functions:
- .*
functionignore:
- JNI_CreateJavaVM
- JNI_GetCreatedJavaVMs
- JNI_GetDefaultJavaVMInitArgs
- JNI_OnLoad
- JNI_OnUnload
- AHardwareBuffer_lockPlanes
- wcstoimax
- wcstoumax
- imaxdiv
# - __system_property_get
enums:
- .*
typesubs:
Stat: Stat_t
Stat64: Stat64_t
clang: $ANDROID_HOME/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android28-clang

1274
android28/main.go Normal file

File diff suppressed because it is too large Load Diff

34
android29.yaml Normal file
View File

@ -0,0 +1,34 @@
package: android29
libraries: [android, log, nativewindow, m]
inputfiles:
- $ANDROID_HOME/ndk-bundle/sysroot/usr/include/android/native_window.h
- $ANDROID_HOME/ndk-bundle/sysroot/usr/include/android/log.h
- $ANDROID_HOME/ndk-bundle/sysroot/usr/include/android/sensor.h
- $ANDROID_HOME/ndk-bundle/sysroot/usr/include/jni.h
- $ANDROID_HOME/ndk-bundle/sysroot/usr/include/sys/stat.h
sysimports:
- android/native_window.h
- android/log.h
- android/sensor.h
- jni.h
- stdlib.h
- sys/stat.h
functions:
- .*
functionignore:
- JNI_CreateJavaVM
- JNI_GetCreatedJavaVMs
- JNI_GetDefaultJavaVMInitArgs
- JNI_OnLoad
- JNI_OnUnload
- AHardwareBuffer_lockPlanes
- wcstoimax
- wcstoumax
- imaxdiv
# - __system_property_get
enums:
- .*
typesubs:
Stat: Stat_t
Stat64: Stat64_t
clang: $ANDROID_HOME/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android29-clang

1284
android29/main.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -9,8 +9,8 @@ import (
"log"
"os"
ndk "git.wow.st/gmp/android-go/android27"
"gioui.org/app"
ndk "git.wow.st/gmp/android-go/android27"
)
var (
@ -22,7 +22,7 @@ func mkHomeDir() {
ndk.AndroidLogWrite(ndk.ANDROID_LOG_WARN, tag, msg)
msg.Free()
godir,_ := app.DataDir()
godir, _ := app.DataDir()
labchan <- fmt.Sprintf("DataDir is %s", godir)
msg = ndk.CharWithGoString("ok. calling mkdir")

View File

@ -3,8 +3,8 @@
package main
import (
"log"
"image/color"
"log"
"gioui.org/app"
"gioui.org/layout"
@ -12,8 +12,8 @@ import (
"gioui.org/text/shape"
"gioui.org/unit"
"golang.org/x/image/font/sfnt"
"golang.org/x/image/font/gofont/goregular"
"golang.org/x/image/font/sfnt"
)
var (
@ -49,7 +49,9 @@ func eventloop() {
var faces shape.Faces
regular, err := sfnt.Parse(goregular.TTF)
if err != nil { log.Fatal("Cannot parse font.") }
if err != nil {
log.Fatal("Cannot parse font.")
}
face = faces.For(regular, unit.Sp(16))
sysinset := &layout.Inset{}
@ -67,7 +69,7 @@ func eventloop() {
for {
select {
case x := <-labchan:
labels = append(labels,&text.Label{Face: face, Text: x})
labels = append(labels, &text.Label{Face: face, Text: x})
case e := <-w.Events():
switch e := e.(type) {
case app.DestroyEvent:
@ -90,4 +92,3 @@ func eventloop() {
}
}
}