The manager type is not required, because the APIs don't allow
more than one event sources as they used to. In this CL, I am
flattening out the underlying implementations by removing the
manager type.
Change-Id: I3b606ac160b9cecd85cb657e3df1d7d789604764
Reviewed-on: https://go-review.googlesource.com/14293
Reviewed-by: Nigel Tao <nigeltao@golang.org>
I'm about to add one to the tree.
Change-Id: Iad25d8965d1095349588e11a5050f986e5ad2e76
Reviewed-on: https://go-review.googlesource.com/14260
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
The former Reader inspired APIs were designed to timeout if no events
occur after an excessive amount of time. As we switch to the app
event based model, timing out is not required. We can block on
pollAll forever until new events arrive.
Change-Id: I086fc908ebfe6ae9bd96ce9199636ad0242bbec5
Reviewed-on: https://go-review.googlesource.com/14223
Reviewed-by: Nigel Tao <nigeltao@golang.org>
The CL provides accelerometer events only, upcoming CLs will add
support for gyroscope and magnetometer.
Change-Id: Ib5629ca7c49c9dfc8ca533fe7acde371efc102b2
Reviewed-on: https://go-review.googlesource.com/14036
Reviewed-by: Nigel Tao <nigeltao@golang.org>
1) Clear button did not shrink the WebView size. It's an old bug in
Android WebView, and fixed recently (android-L, maybe). This CL avoids
the problem by replacing the webview with a freshly allocated new webview
object. It's heavy-weight, but the Clear event should be rare.
2) ScrollToBottom from the java side and the java script side interacted
strangely and prevented long results from displayed properly.
Also,
- now the gomobile bind generates the Java class in the
org.golang.ivy package. (ivy/build.gradle)
- modified the javascript in tape.html so long result texts are not
shortened initially. (tape.html)
Change-Id: I60660f3392cf17719daad4af89e05c2d82788175
Reviewed-on: https://go-review.googlesource.com/14201
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This version is not yet released to Play store.
Compared to the version in the play store
- fixed the reappearing keyboard bug
- allows app install on SD card
- when demo is enabled, the demo mode message is displayed
- when demo is enabled, the submit action button appears next to the
edit text.
- use robpike.io/ivy/mobile instead of the wrapper in my personal repo.
- the demo script read code was moved from go to java.
- use the up-to-date help message retrieved with mobile.Help.
- textview was replaced with webview with javascript.
TODO: the app built from this code doesn't work in old android devices.
Next cl will fix it.
TODO: build instruction - not very different from
golang.org/x/mobile/example/bind/android.
Change-Id: Ifb594b79f31091b6864ec3e0d8dbaff7986a5afc
Reviewed-on: https://go-review.googlesource.com/13870
Reviewed-by: David Crawshaw <crawshaw@golang.org>
New option -javapkg for -target=android, and -prefix for -target=ios.
Fixesgolang/go#9660.
Change-Id: I9143f30672672527876524b38f450629452a3161
Reviewed-on: https://go-review.googlesource.com/14023
Reviewed-by: David Crawshaw <crawshaw@golang.org>
To improve readability for default numeric types
represented as strings, use 0.0 for floating point types.
(No tests make use of this change so golden update
not necessary; not significant enough for new test/test mod.)
Fix spelling on error statement; this was the only
instance of that spelling error in the repository.
Change-Id: I373890725b33da11c6780ba93674d89541bf758c
Reviewed-on: https://go-review.googlesource.com/13645
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
We are also limiting the number of sensor managers to one.
The application provide sensor events to third-party packages
by consuming them in the main.
An application will be able to consume the sensor events similar
to the other events.
package main
func main() {
app.Main(func(a app.App) {
// enables the accelerometer
sensor.Enable(a, sensor.Accelerometer, 100*time.Millisecond)
var sz size.Event
for e := range a.Events() {
switch e := app.Filter(e).(type) {
case sensor.Event:
log.Println(e)
}
}
})
}
Change-Id: Iaad1c59f8d2322c7620df62ed9b9283c91746fa8
Reviewed-on: https://go-review.googlesource.com/13983
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This is similar to the Event.Bounds method. Some functions in other
packages take an image.Rectangle (i.e. bounds), others take an
image.Point (i.e size).
Change-Id: Ie892a8902992d4e6b9edfbf6d12342297fae4068
Reviewed-on: https://go-review.googlesource.com/14003
Reviewed-by: David Crawshaw <crawshaw@golang.org>
There is no change to GoNativeActivity.java in cl/14039, so there
should be no change to the generated dex file. Confirmed with go
generate in a clean client.
Change-Id: I37ad615716d6ab6cd6e492b2145e1a71228f79ae
Reviewed-on: https://go-review.googlesource.com/14078
Reviewed-by: David Crawshaw <crawshaw@golang.org>
It seems like shared library terminology has left as a legacy
from the days bind command only supported Android and bind was
generating shared libraries as an output.
Additionally, rewording the mention of apks and apps.
These libraries aren't generated for apk or apps but Android IDE
or Xcode projects.
Change-Id: I46dd56ddccde2d2526fa9b69f700c48c5dd474db
Reviewed-on: https://go-review.googlesource.com/14039
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Introduce options -javapkg and -prefix for gobind command.
The following generates java class Testpkg with package name com.example.
gobind -lang=java -javapkg=com.example testpkg
The following generates objective-c files where function and type names
are prefixed with ExampleTestpkg.
gobind -lang=objc -prefix=Example testpkg
As discussed in golang/go#9660 and golang/go#12245.
Gomobile support is not yet implemented.
Change-Id: Ib9e39997ce915580a5a2e25643c0c28373f27ee1
Reviewed-on: https://go-review.googlesource.com/13969
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Unfortunately GLES is not a common package for a linux desktop
to have installed. To avoid bind-based users having to jump
through the hoop of installing GL, disable this performance
optimization on linux for now.
Change-Id: Ic00baef6237dca360f191ec291b6c165eda7ad6e
Reviewed-on: https://go-review.googlesource.com/13874
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
I often forget to do this. I can't be the only one.
Change-Id: Ia5dfaa6811242758f996de614f80cb42badf327b
Reviewed-on: https://go-review.googlesource.com/13742
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
os.Rename in init fails in Windows for various reasons. One of them
is the temporary files extracted from NDK, OpenAL archives. For
some reason, some of them have read-only properties.
(golang/go#12212)
> gomobile init
gomobile: rename
C:\Users\foo\pkg\gomobile\work-427911983\openal\include\AL
C:\Users\foo\pkg\gomobile\android-ndk-r10e\arm\sysroot\usr\include\AL:
Access is denied.
We reset the read-only bits of all the extracted files.
Change-Id: Ib958cbedf1b7527ecb5b9318f23fe9437dc7c241
Reviewed-on: https://go-review.googlesource.com/12970
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Also remove an unnecessary constant type conversion.
Change-Id: Iff466553fac450bd531785f4fb4e2be97a991a52
Reviewed-on: https://go-review.googlesource.com/13715
Reviewed-by: Burcu Dogan <jbd@google.com>
Fixes an issue where the full NDK could not be downloaded due to a missing execute permission.
Fixesgolang/go#12208
Change-Id: I6f432b5021b082693a02a293f50caf6da4d4e379
Reviewed-on: https://go-review.googlesource.com/13669
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Hoping to learn more so I can debug or replicate the darwin/amd64
builder failure, which is not creating a GL context.
Change-Id: I9f2fe54fbd9a072c65cd37c3b711554d4c71171f
Reviewed-on: https://go-review.googlesource.com/13693
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Tests now pass on OS X.
Change-Id: Id2e6c5bd9ddd4070962ff9bc121d7902e8c9a647
Reviewed-on: https://go-review.googlesource.com/13694
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This is only the first half of physical key event mapping. The
modifiers and hardware key codes will be in a followup CL. I'm
splitting this out because it covers two other parts of the problem:
first is maintaining a JNIEnv pointer for the main routine, the
second is access to the Android unicode key map. The NDK does not have
a method to give us the key mapping, so we get to it via
GoNativeActivity.
Tested with a USB keyboard. I'll attempt an abd-based unit test later,
but I suspect it will be difficult to set a device ID.
Change-Id: Ie93700d1f2a5d382a9b17cdd668cb4acaa6e4bcc
Reviewed-on: https://go-review.googlesource.com/13649
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Also catches any bugs that cause painting to lock up after
rotation (of which there have been many).
Change-Id: I3783030efd2c342afebf2b861e9e9dc32e96f659
Reviewed-on: https://go-review.googlesource.com/13616
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Ran into this while working on keyboard events. I'm a little surprised
this hasn't been a problem so far -- my understanding of the NDK
functions for working with a NativeActivity is that the require you
hold a valid JNI context before calling them.
Change-Id: Ifd322ef5e8406df648d1a8f667e5ce08ffef954d
Reviewed-on: https://go-review.googlesource.com/13648
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>