Changeset View
Changeset View
Standalone View
Standalone View
src/notifybyandroid.cpp
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Line(s) | 103 | { | |||
---|---|---|---|---|---|
123 | } | 123 | } | ||
124 | QByteArray iconData; | 124 | QByteArray iconData; | ||
125 | QBuffer buffer(&iconData); | 125 | QBuffer buffer(&iconData); | ||
126 | buffer.open(QIODevice::WriteOnly); | 126 | buffer.open(QIODevice::WriteOnly); | ||
127 | pixmap.save(&buffer, "PNG"); | 127 | pixmap.save(&buffer, "PNG"); | ||
128 | auto jIconData = env->NewByteArray(iconData.length()); | 128 | auto jIconData = env->NewByteArray(iconData.length()); | ||
129 | env->SetByteArrayRegion(jIconData, 0, iconData.length(), reinterpret_cast<const jbyte*>(iconData.constData())); | 129 | env->SetByteArrayRegion(jIconData, 0, iconData.length(), reinterpret_cast<const jbyte*>(iconData.constData())); | ||
130 | n.callMethod<void>("setIconFromData", "([BI)V", jIconData, iconData.length()); | 130 | n.callMethod<void>("setIconFromData", "([BI)V", jIconData, iconData.length()); | ||
131 | env->DeleteLocalRef(jIconData); | ||||
131 | 132 | | |||
132 | // actions | 133 | // actions | ||
133 | const auto actions = notification->actions(); | 134 | const auto actions = notification->actions(); | ||
134 | for (const auto &action : actions) { | 135 | for (const auto &action : actions) { | ||
135 | n.callMethod<void>("addAction", "(Ljava/lang/String;)V", QAndroidJniObject::fromString(action).object<jstring>()); | 136 | n.callMethod<void>("addAction", "(Ljava/lang/String;)V", QAndroidJniObject::fromString(action).object<jstring>()); | ||
136 | } | 137 | } | ||
137 | 138 | | |||
138 | m_notifications.insert(notification->id(), notification); | 139 | m_notifications.insert(notification->id(), notification); | ||
Show All 28 Lines |