Differential D10951 Diff 28510 src/org/kde/kdeconnect/Plugins/ReceiveNotificationsPlugin/ReceiveNotificationsPlugin.java
Changeset View
Changeset View
Standalone View
Standalone View
src/org/kde/kdeconnect/Plugins/ReceiveNotificationsPlugin/ReceiveNotificationsPlugin.java
Show All 29 Lines | |||||
30 | import android.os.Build; | 30 | import android.os.Build; | ||
31 | import android.support.v4.app.NotificationCompat; | 31 | import android.support.v4.app.NotificationCompat; | ||
32 | import android.support.v4.app.TaskStackBuilder; | 32 | import android.support.v4.app.TaskStackBuilder; | ||
33 | import android.util.Log; | 33 | import android.util.Log; | ||
34 | 34 | | |||
35 | import org.kde.kdeconnect.Helpers.NotificationHelper; | 35 | import org.kde.kdeconnect.Helpers.NotificationHelper; | ||
36 | import org.kde.kdeconnect.NetworkPackage; | 36 | import org.kde.kdeconnect.NetworkPackage; | ||
37 | import org.kde.kdeconnect.Plugins.Plugin; | 37 | import org.kde.kdeconnect.Plugins.Plugin; | ||
38 | import org.kde.kdeconnect.UserInterface.MaterialActivity; | 38 | import org.kde.kdeconnect.UserInterface.MainActivity; | ||
39 | import org.kde.kdeconnect_tp.R; | 39 | import org.kde.kdeconnect_tp.R; | ||
40 | 40 | | |||
41 | import java.io.InputStream; | 41 | import java.io.InputStream; | ||
42 | 42 | | |||
43 | public class ReceiveNotificationsPlugin extends Plugin { | 43 | public class ReceiveNotificationsPlugin extends Plugin { | ||
44 | 44 | | |||
45 | public final static String PACKAGE_TYPE_NOTIFICATION = "kdeconnect.notification"; | 45 | public final static String PACKAGE_TYPE_NOTIFICATION = "kdeconnect.notification"; | ||
46 | public final static String PACKAGE_TYPE_NOTIFICATION_REQUEST = "kdeconnect.notification.request"; | 46 | public final static String PACKAGE_TYPE_NOTIFICATION_REQUEST = "kdeconnect.notification.request"; | ||
Show All 24 Lines | |||||
71 | 71 | | |||
72 | @Override | 72 | @Override | ||
73 | public boolean onPackageReceived(final NetworkPackage np) { | 73 | public boolean onPackageReceived(final NetworkPackage np) { | ||
74 | 74 | | |||
75 | if (!np.has("ticker") || !np.has("appName") || !np.has("id")) { | 75 | if (!np.has("ticker") || !np.has("appName") || !np.has("id")) { | ||
76 | Log.e("NotificationsPlugin", "Received notification package lacks properties"); | 76 | Log.e("NotificationsPlugin", "Received notification package lacks properties"); | ||
77 | } else { | 77 | } else { | ||
78 | TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); | 78 | TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); | ||
79 | stackBuilder.addParentStack(MaterialActivity.class); | 79 | stackBuilder.addParentStack(MainActivity.class); | ||
80 | stackBuilder.addNextIntent(new Intent(context, MaterialActivity.class)); | 80 | stackBuilder.addNextIntent(new Intent(context, MainActivity.class)); | ||
81 | PendingIntent resultPendingIntent = stackBuilder.getPendingIntent( | 81 | PendingIntent resultPendingIntent = stackBuilder.getPendingIntent( | ||
82 | 0, | 82 | 0, | ||
83 | PendingIntent.FLAG_UPDATE_CURRENT | 83 | PendingIntent.FLAG_UPDATE_CURRENT | ||
84 | ); | 84 | ); | ||
85 | 85 | | |||
86 | Bitmap largeIcon = null; | 86 | Bitmap largeIcon = null; | ||
87 | if (np.hasPayload()) { | 87 | if (np.hasPayload()) { | ||
88 | int width = 64; // default icon dimensions | 88 | int width = 64; // default icon dimensions | ||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |