github.com/gop9/olt@v0.0.0-20200202132135-d956aad50b08/gio/app/app_android.go (about)

     1  package app
     2  
     3  import (
     4  	"github.com/gop9/olt/gio/app/internal/window"
     5  )
     6  
     7  type Handle window.Handle
     8  
     9  // PlatformHandle returns the Android platform-specific Handle.
    10  func PlatformHandle() *Handle {
    11  	return (*Handle)(window.PlatformHandle)
    12  }
    13  
    14  // androidDriver is an interface that allows the Window's run method
    15  // to call the RegisterFragment method of the Android window driver.
    16  type androidDriver interface {
    17  	RegisterFragment(string)
    18  }
    19  
    20  // RegisterFragment constructs a Java instance of the specified class
    21  // and registers it as a Fragment in the Context in which the View was
    22  // created.
    23  func (w *Window) RegisterFragment(del string) {
    24  	go func() {
    25  		w.driverFuncs <- func() {
    26  			d := w.driver.(androidDriver)
    27  			d.RegisterFragment(del)
    28  		}
    29  	}()
    30  }