From 9b1307bdd3512cbb3f740ef0d1da8040bb3a5cc7 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Thu, 4 Dec 2014 08:05:06 +0100 Subject: [PATCH] Added Background bitmap (white square). Changed notification title. --- .../amine/bou/sendtowear/app/MainActivity.java | 17 +++++++++++++++-- app/src/main/res/drawable-nodpi/background.png | Bin 0 -> 1134 bytes 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/drawable-nodpi/background.png diff --git a/app/src/main/java/com/amine/bou/sendtowear/app/MainActivity.java b/app/src/main/java/com/amine/bou/sendtowear/app/MainActivity.java index b030142..b37ce89 100644 --- a/app/src/main/java/com/amine/bou/sendtowear/app/MainActivity.java +++ b/app/src/main/java/com/amine/bou/sendtowear/app/MainActivity.java @@ -3,6 +3,8 @@ package com.amine.bou.sendtowear.app; import android.app.Activity; import android.app.NotificationManager; import android.content.Intent; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.os.Bundle; import android.support.v4.app.NotificationCompat; import android.view.View; @@ -48,11 +50,22 @@ public class MainActivity extends Activity { } private void createNotification(String sharedText) { + Bitmap icon = BitmapFactory.decodeResource(this.getResources(), + R.drawable.background); + + NotificationCompat.WearableExtender wearableExtender = + new NotificationCompat.WearableExtender() + .setHintHideIcon(true) + .setBackground(icon); + NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) - .setContentTitle("My notification") - .setContentText(sharedText); + .setContentTitle("Send To Wear") + .setContentText(sharedText) + .extend(wearableExtender) + .setStyle(new NotificationCompat.BigTextStyle() + .bigText(sharedText)); int mNotificationId = 001; NotificationManager mNotifyMgr = diff --git a/app/src/main/res/drawable-nodpi/background.png b/app/src/main/res/drawable-nodpi/background.png new file mode 100644 index 0000000000000000000000000000000000000000..a049f5dc54b345796cce4c7fcfe17d8165d8d53b GIT binary patch literal 1134 zcmeAS@N?(olHy`uVBq!ia0y~yV4MKL985qF{<{lj11Zh|kH}&M25w;xW@MN(M*=9w zUgGKN%6^ZBh0Tc3pkwPFppa~4NJNQqer|4RUI~!Pz~Eeznpl#WqEMb$lA+-4=^K!u zm&(q-!2HD1#WAGf*4rzFybKH+EQSa6KX+$k_SAmZ_F9GY!$A)Q39*Jm#x~Z32!=LR zFk3!mbb)bhuOYurX!2 YnAk-&S;<8|r-BLsPgg&ebxsLQ0GB}*%m4rY literal 0 HcmV?d00001