File: KNotification.java

package info (click to toggle)
kf6-knotifications 6.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 22,072 kB
  • sloc: cpp: 3,183; java: 304; xml: 122; python: 24; sh: 14; makefile: 7; ansic: 4
file content (54 lines) | stat: -rw-r--r-- 1,355 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
    SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org>

    SPDX-License-Identifier: LGPL-2.0-or-later
*/

package org.kde.knotifications;

import android.graphics.drawable.Icon;
import android.os.Build;

import java.lang.Object;
import java.util.ArrayList;
import java.util.HashMap;

/** Java side of KNotification.
 *  Used to convey the relevant notification data to Java.
 */
public class KNotification
{
    public int id;
    public String text;
    public String richText;
    public String title;
    public Object icon;
    public HashMap<String, String> actions = new HashMap<>();
    public String channelId;
    public String channelName;
    public String channelDescription;
    public String group;
    public int urgency;
    public String visibility;

    public String inlineReplyLabel;
    public String inlineReplyPlaceholder;

    // see knotification.h
    public static final int LowUrgency = 10;
    public static final int NormalUrgency = 50;
    public static final int HighUrgency = 70;
    public static final int CriticalUrgency = 90;

    public void setIconFromData(byte[] data, int length)
    {
        if (Build.VERSION.SDK_INT >= 23) {
            icon = Icon.createWithData(data, 0, length);
        }
    }

    public void addAction(String id, String label)
    {
        actions.put(id, label);
    }
}