51 lines
983 B
Go
51 lines
983 B
Go
|
package gothings
|
||
|
|
||
|
import (
|
||
|
"github.com/therecipe/qt/androidextras"
|
||
|
"github.com/therecipe/qt/core"
|
||
|
)
|
||
|
|
||
|
type AndroidCwtchActivity struct {
|
||
|
core.QObject
|
||
|
|
||
|
_ func() `constructor:"init"`
|
||
|
|
||
|
_ string `property:"notification"`
|
||
|
|
||
|
_ func(string) `slot:"updateAndroidNotification"`
|
||
|
}
|
||
|
|
||
|
func (c *AndroidCwtchActivity) init() {
|
||
|
|
||
|
c.createOngoingNotification()
|
||
|
c.ConnectNotificationChanged(c.updateAndroidNotification)
|
||
|
}
|
||
|
|
||
|
func (c *AndroidCwtchActivity) updateAndroidNotification(n string) {
|
||
|
|
||
|
var err = androidextras.QAndroidJniObject_CallStaticMethodVoid2Caught(
|
||
|
"ca/openprivacy/cwtch/ui/CwtchActivity",
|
||
|
"notify",
|
||
|
"(Ljava/lang/String;)V",
|
||
|
n,
|
||
|
)
|
||
|
|
||
|
if err != nil {
|
||
|
println(err.Error())
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (c *AndroidCwtchActivity) createOngoingNotification() {
|
||
|
|
||
|
var err = androidextras.QAndroidJniObject_CallStaticMethodVoid2Caught(
|
||
|
"ca/openprivacy/cwtch/ui/CwtchActivity",
|
||
|
"ongoingNotify",
|
||
|
"(Ljava/lang/String;)V",
|
||
|
"Cwtch is running",
|
||
|
)
|
||
|
|
||
|
if err != nil {
|
||
|
println(err.Error())
|
||
|
}
|
||
|
}
|