This repository has been archived on 2021-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
ui/go/gothings/android/CwtchActivity.go

67 lines
1.5 KiB
Go

package android
import (
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"github.com/therecipe/qt/androidextras"
"github.com/therecipe/qt/core"
)
type CwtchActivity struct {
core.QObject
_ func() `constructor:"init"`
_ string `property:"notification"`
_ func(string) `slot:"updateAndroidNotification"`
_ func() `signal:"rootHomeButtonHandle,auto"`
}
func (c *CwtchActivity) init() {
log.Debugln("CwtchActivity.init()")
c.createOngoingNotification()
c.ConnectNotificationChanged(c.updateAndroidNotification)
}
func (c *CwtchActivity) updateAndroidNotification(n string) {
var err = androidextras.QAndroidJniObject_CallStaticMethodVoid2Caught(
"ca/openprivacy/cwtch/ui/CwtchActivity",
"notify",
"(Ljava/lang/String;)V",
n,
)
if err != nil {
log.Errorf("Error calling Java CwtchActivity.notify(): %v\n", err.Error())
}
}
func (c *CwtchActivity) createOngoingNotification() {
var err = androidextras.QAndroidJniObject_CallStaticMethodVoid2Caught(
"ca/openprivacy/cwtch/ui/CwtchActivity",
"ongoingNotify",
"(Ljava/lang/String;)V",
"Cwtch is running",
)
if err != nil {
log.Errorf("Error calling Java CwtchActivity.ongoingNotify(): %v\n", err.Error())
}
}
func (c *CwtchActivity) rootHomeButtonHandle() {
log.Infoln("CwtchActivity.rootHomeButtonHandle()!")
var err = androidextras.QAndroidJniObject_CallStaticMethodVoid2Caught(
"ca/openprivacy/cwtch/ui/CwtchActivity",
"rootHomeHandle",
"()V",
)
if err != nil {
log.Errorf("Error calling Java CwtchActivity.rootHomeButtonHandle(): %v\n", err.Error())
}
}