add share action to screenshots in notification
Now you can brag with your pebble watchfaces and send them straight to Conversations.
This commit is contained in:
parent
c16510003c
commit
27e611c583
|
@ -164,6 +164,13 @@ public abstract class AbstractDeviceSupport implements DeviceSupport {
|
||||||
|
|
||||||
PendingIntent pIntent = PendingIntent.getActivity(context, 0, intent, 0);
|
PendingIntent pIntent = PendingIntent.getActivity(context, 0, intent, 0);
|
||||||
|
|
||||||
|
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||||
|
shareIntent.setType("image/*");
|
||||||
|
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(fullpath)));
|
||||||
|
|
||||||
|
PendingIntent pendingShareIntent = PendingIntent.getActivity(context, 0, Intent.createChooser(shareIntent, "share screenshot"),
|
||||||
|
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
Notification notif = new Notification.Builder(context)
|
Notification notif = new Notification.Builder(context)
|
||||||
.setContentTitle("Screenshot taken")
|
.setContentTitle("Screenshot taken")
|
||||||
.setTicker("Screenshot taken")
|
.setTicker("Screenshot taken")
|
||||||
|
@ -172,7 +179,10 @@ public abstract class AbstractDeviceSupport implements DeviceSupport {
|
||||||
.setStyle(new Notification.BigPictureStyle()
|
.setStyle(new Notification.BigPictureStyle()
|
||||||
.bigPicture(bmp))
|
.bigPicture(bmp))
|
||||||
.setContentIntent(pIntent)
|
.setContentIntent(pIntent)
|
||||||
|
.addAction(android.R.drawable.ic_menu_share, "share", pendingShareIntent)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
notif.flags |= Notification.FLAG_AUTO_CANCEL;
|
notif.flags |= Notification.FLAG_AUTO_CANCEL;
|
||||||
|
|
||||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
|
Loading…
Reference in New Issue