app: add RegisterFragment method on *Window for Android

RegisterFragment creates an instance of a Java class and registers
it as a Fragment in the window's Context.

Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
This commit is contained in:
Greg Pomerantz
2019-11-26 12:47:54 -05:00
committed by Elias Naur
parent ce76c2e996
commit 2ca2e5462f
8 changed files with 98 additions and 16 deletions
+11
View File
@@ -29,6 +29,10 @@ type Window struct {
driver window.Driver
gpu *gpu.GPU
// driverFuncs is a channel of functions to run when
// the Window has a valid driver.
driverFuncs chan func()
out chan event.Event
in chan event.Event
ack chan struct{}
@@ -95,6 +99,7 @@ func NewWindow(options ...Option) *Window {
invalidates: make(chan struct{}, 1),
frames: make(chan *op.Ops),
frameAck: make(chan struct{}),
driverFuncs: make(chan func()),
}
w.callbacks.w = w
go w.run(opts)
@@ -227,6 +232,10 @@ func (w *Window) run(opts *window.Options) {
return
}
for {
var driverFuncs chan func() = nil
if w.driver != nil {
driverFuncs = w.driverFuncs
}
var timer <-chan time.Time
if w.delayedDraw != nil {
timer = w.delayedDraw.C
@@ -238,6 +247,8 @@ func (w *Window) run(opts *window.Options) {
case <-w.invalidates:
w.setNextFrame(time.Time{})
w.updateAnimation()
case f := <-driverFuncs:
f()
case e := <-w.in:
switch e2 := e.(type) {
case system.StageEvent: