List of usage examples for android.app Notification CATEGORY_RECOMMENDATION
String CATEGORY_RECOMMENDATION
To view the source code for android.app Notification CATEGORY_RECOMMENDATION.
Click Source Link
From source file:com.example.android.dragonTV.recommendation.RecommendationBuilder.java
public Notification build() { Log.d(TAG, "Building notification - " + this.toString()); Bundle extras = new Bundle(); if (mBackgroundUri != null) { Log.d(TAG, "Background - " + mBackgroundUri); extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI, mBackgroundUri); }/*from w w w .jav a 2s . c o m*/ Notification notification = new NotificationCompat.BigPictureStyle(new NotificationCompat.Builder(mContext) .setContentTitle(mTitle).setContentText(mDescription).setPriority(mPriority).setLocalOnly(true) .setOngoing(true).setColor(mContext.getResources().getColor(R.color.fastlane_background)) .setCategory(Notification.CATEGORY_RECOMMENDATION).setLargeIcon(mBitmap).setSmallIcon(mSmallIcon) .setContentIntent(mIntent).setExtras(extras)).build(); return notification; }
From source file:com.jerrellmardis.amphitheatre.util.RecommendationBuilder.java
public Notification build() throws IOException { if (mNotificationManager == null) { mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); }/*from w w w. j a va 2 s . co m*/ Bundle extras = new Bundle(); if (mBackgroundUri != null) { extras.putString(EXTRA_BACKGROUND_IMAGE_URL, mBackgroundUri); } Bitmap image = Picasso.with(mContext).load(mImageUri) .resize(Utils.dpToPx(CARD_WIDTH, mContext), Utils.dpToPx(CARD_HEIGHT, mContext)).get(); Notification notification = new NotificationCompat.BigPictureStyle(new NotificationCompat.Builder(mContext) .setContentTitle(mTitle).setContentText(mDescription).setPriority(mPriority).setLocalOnly(true) .setOngoing(true).setColor(mContext.getResources().getColor(R.color.fastlane_background)) .setCategory(Notification.CATEGORY_RECOMMENDATION).setLargeIcon(image).setSmallIcon(mSmallIcon) .setContentIntent(mIntent).setExtras(extras)).build(); mNotificationManager.notify(mId, notification); mNotificationManager = null; return notification; }
From source file:com.github.pedrovgs.tuentitv.recommendation.builder.RecommendationBuilder.java
public Notification build() throws IOException { if (notificationManager == null) { notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); }//from w w w. j a v a 2s.c om Bundle extras = new Bundle(); if (backgroundUri != null) { extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI, backgroundUri); } Bitmap image = Picasso.with(context).load(imageUri).get(); Notification notification = new NotificationCompat.BigPictureStyle(new NotificationCompat.Builder(context) .setContentTitle(title).setContentText(description).setPriority(priority).setLocalOnly(true) .setOngoing(true).setColor(context.getResources().getColor(R.color.primary_color)) .setCategory(Notification.CATEGORY_RECOMMENDATION).setLargeIcon(image).setSmallIcon(smallIcon) .setContentIntent(pendingIntent).setExtras(extras)).build(); notificationManager.notify(id, notification); notificationManager = null; return notification; }
From source file:com.aorura.familyphoto.leanback.recommendations.RecommendationBuilder.java
public Notification build() throws IOException { Log.d(TAG, "Building notification - " + this.toString()); if (mNotificationManager == null) { mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); }// w ww. ja v a 2 s . c o m Bundle extras = new Bundle(); if (mBackgroundUri != null) { extras.putString(EXTRA_BACKGROUND_IMAGE_URL, mBackgroundUri); } Bitmap image = Picasso.with(mContext).load(mImageUri) .resize(Utils.dpToPx(CARD_WIDTH, mContext), Utils.dpToPx(CARD_HEIGHT, mContext)).get(); Notification notification = new NotificationCompat.BigPictureStyle(new NotificationCompat.Builder(mContext) .setContentTitle(mTitle).setContentText(mDescription).setPriority(mPriority).setLocalOnly(true) .setOngoing(true).setColor(mContext.getResources().getColor(R.color.fastlane_background)) .setCategory(Notification.CATEGORY_RECOMMENDATION).setLargeIcon(image).setSmallIcon(mSmallIcon) .setContentIntent(mIntent).setExtras(extras)).build(); mNotificationManager.notify(mId, notification); mNotificationManager = null; return notification; }
From source file:com.androideasyapps.phoenix.recommend.RecommendationBuilder.java
public Notification build() throws IOException { Log.d(TAG, "Building notification - " + this.toString()); if (mNotificationManager == null) { mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); }//from ww w . j a va 2 s . c om Bundle extras = new Bundle(); if (mBackgroundUri != null) { Log.d(TAG, "Background - " + mBackgroundUri); extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI, mBackgroundUri); } Bitmap image = Picasso.with(mContext).load(mImageUri) .resize(Utils.convertDpToPixel(mContext, CARD_WIDTH), Utils.convertDpToPixel(mContext, CARD_HEIGHT)) .get(); Notification notification = new NotificationCompat.BigPictureStyle(new NotificationCompat.Builder(mContext) .setContentTitle(mTitle).setContentText(mDescription).setPriority(mPriority).setLocalOnly(true) .setOngoing(true).setColor(mContext.getResources().getColor(R.color.fastlane_background)) .setCategory(Notification.CATEGORY_RECOMMENDATION).setLargeIcon(image).setSmallIcon(mSmallIcon) .setContentIntent(mIntent).setExtras(extras)).build(); mNotificationManager.notify(mId, notification); mNotificationManager = null; return notification; }
From source file:cm.aptoidetv.pt.RecommendationBuilder.java
public Notification build() throws IOException { Log.d(TAG, "Building notification - " + this.toString()); if (mNotificationManager == null) { mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); }/* w ww . java 2 s. c o m*/ Bundle extras = new Bundle(); if (mBackgroundUri != null) { Log.d(TAG, "Background - " + mBackgroundUri); extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI, mBackgroundUri); } Bitmap image = Picasso.with(mContext).load(mImageUri) .resize(Utils.convertDpToPixel(mContext, CARD_WIDTH), Utils.convertDpToPixel(mContext, CARD_HEIGHT)) .get(); TypedArray typedArray = mContext.getTheme().obtainStyledAttributes(ThemePicker.getThemePicker(), new int[] { R.attr.brandColor }); int brandColorResourceId = typedArray.getResourceId(0, 0); typedArray.recycle(); Notification notification = new NotificationCompat.BigPictureStyle(new NotificationCompat.Builder(mContext) .setContentTitle(mTitle).setContentText(mDescription).setPriority(mPriority).setLocalOnly(true) .setOngoing(true).setColor(mContext.getResources().getColor(brandColorResourceId)) .setCategory(Notification.CATEGORY_RECOMMENDATION).setLargeIcon(image).setSmallIcon(mSmallIcon) .setContentIntent(mIntent).setExtras(extras)).build(); mNotificationManager.notify(mId, notification); mNotificationManager = null; return notification; }
From source file:butter.droid.tv.service.recommendation.RecommendationBuilder.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public Notification build() throws IOException { if (VersionUtils.isLollipop()) { Log.d(TAG, "Building notification - " + this.toString()); if (mNotificationManager == null) { mNotificationManager = (NotificationManager) mContext .getSystemService(Context.NOTIFICATION_SERVICE); }//from w ww . jav a 2 s. c om Bundle extras = new Bundle(); if (mBackgroundUri != null) { extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI, mBackgroundUri); } Bitmap image = Picasso.with(mContext).load(mImageUri) .resize((int) mContext.getResources().getDimension(R.dimen.card_width), (int) mContext.getResources().getDimension(R.dimen.card_height)) .get(); Notification notification = new NotificationCompat.BigPictureStyle( new NotificationCompat.Builder(mContext).setContentTitle(mTitle).setContentText(mDescription) .setPriority(mPriority).setLocalOnly(true).setOngoing(true) .setColor(mContext.getResources().getColor(R.color.primary)) .setCategory(Notification.CATEGORY_RECOMMENDATION).setLargeIcon(image) .setSmallIcon(mSmallIcon).setContentIntent(mIntent).setExtras(extras)).build(); mNotificationManager.notify(mId, notification); mNotificationManager = null; return notification; } return null; }
From source file:us.nineworlds.serenity.core.RecommendationBuilder.java
public Notification build() throws IOException { Log.d(TAG, "Building notification - " + this.toString()); if (mNotificationManager == null) { mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); }// w ww . j av a 2s.c om Bundle extras = new Bundle(); if (mBackgroundUri != null) { if (backgroundContentUri != null) { extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI, backgroundContentUri); } } ImageLoader imageLoader = serenityImageLoader.getImageLoader(); Bitmap image = imageLoader.loadImageSync(mImageUri, new ImageSize(176, 313), serenityImageLoader.getSycnOptions()); NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext); builder = builder.setContentTitle(mTitle).setContentText(mDescription).setPriority(mPriority) .setOngoing(true).setLocalOnly(true).setColor(cardColor) .setCategory(Notification.CATEGORY_RECOMMENDATION).setLargeIcon(image).setSmallIcon(mSmallIcon) .setContentIntent(mIntent).setExtras(extras); Notification notification = new NotificationCompat.BigPictureStyle(builder).build(); try { mNotificationManager.notify(mId, notification); } catch (Exception ex) { Log.e(getClass().getName(), ex.getMessage(), ex); } mNotificationManager = null; return notification; }
From source file:org.messic.android.smarttv.activities.recommendations.RecommendationBuilder.java
public Notification build() { Bundle extras = new Bundle(); File bitmapFile = getNotificationBackground(mContext, mId); if (mBackgroundUri != null) { extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI, Uri.parse(BACKGROUND_URI_PREFIX + Long.toString(mId)).toString()); }/*from w w w .j a va2s .c o m*/ // the following simulates group assignment into "Top", "Middle", "Bottom" // by checking mId and similarly sort order mGroupKey = (mId < 3) ? "Top" : (mId < 5) ? "Middle" : "Bottom"; mSort = (mId < 3) ? "1.0" : (mId < 5) ? "0.7" : "0.3"; // save bitmap into files for content provider to serve later try { bitmapFile.createNewFile(); FileOutputStream fOut = new FileOutputStream(bitmapFile); mBitmap.compress(Bitmap.CompressFormat.PNG, 85, fOut); fOut.flush(); fOut.close(); } catch (IOException ioe) { Log.d(TAG, "Exception caught writing bitmap to file!", ioe); } Notification notification = new NotificationCompat.BigPictureStyle( new NotificationCompat.Builder(mContext).setAutoCancel(true).setContentTitle(mTitle) .setContentText(mDescription).setPriority(mPriority).setLocalOnly(true).setOngoing(true) /* groupKey (optional): Can be used to group together recommendations, so they are ranked by the launcher as a separate group. Can be useful if the application has different sources for recommendations, like "trending", "subscriptions", and "new music" categories for YouTube, where the user can be more interested in recommendations from one group than another. */ .setGroup(mGroupKey) /* sortKey (optional): A float number between 0.0 and 1.0, used to indicate the relative importance (and sort order) of a single recommendation within its specified group. The recommendations will be ordered in decreasing order of importance within a given group. */ .setSortKey(mSort) // .setColor(mContext.getResources().getColor(R.color.fastlane_background)) .setCategory(Notification.CATEGORY_RECOMMENDATION).setLargeIcon(mBitmap) .setSmallIcon(mSmallIcon).setContentIntent(mIntent).setExtras(extras)).build(); Log.d(TAG, "Building notification - " + this.toString()); return notification; }
From source file:com.example.android.tvleanback.recommendation.RecommendationBuilder.java
public Notification build() { Bundle extras = new Bundle(); File bitmapFile = getNotificationBackground(mContext, mId); if (mBackgroundUri != null) { extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI, Uri.parse(BACKGROUND_URI_PREFIX + Integer.toString(mId)).toString()); }//from w ww. jav a 2 s .co m // the following simulates group assignment into "Top", "Middle", "Bottom" // by checking mId and similarly sort order mGroupKey = (mId < 3) ? "Top" : (mId < 5) ? "Middle" : "Bottom"; mSort = (mId < 3) ? "1.0" : (mId < 5) ? "0.7" : "0.3"; // save bitmap into files for content provider to serve later try { bitmapFile.createNewFile(); FileOutputStream fOut = new FileOutputStream(bitmapFile); mBitmap.compress(Bitmap.CompressFormat.PNG, 85, fOut); fOut.flush(); fOut.close(); } catch (IOException ioe) { Log.d(TAG, "Exception caught writing bitmap to file!", ioe); } Notification notification = new NotificationCompat.BigPictureStyle( new NotificationCompat.Builder(mContext).setAutoCancel(true).setContentTitle(mTitle) .setContentText(mDescription).setPriority(mPriority).setLocalOnly(true).setOngoing(true) /* groupKey (optional): Can be used to group together recommendations, so they are ranked by the launcher as a separate group. Can be useful if the application has different sources for recommendations, like "trending", "subscriptions", and "new music" categories for YouTube, where the user can be more interested in recommendations from one group than another. */ .setGroup(mGroupKey) /* sortKey (optional): A float number between 0.0 and 1.0, used to indicate the relative importance (and sort order) of a single recommendation within its specified group. The recommendations will be ordered in decreasing order of importance within a given group. */ .setSortKey(mSort).setColor(mContext.getResources().getColor(R.color.fastlane_background)) .setCategory(Notification.CATEGORY_RECOMMENDATION).setLargeIcon(mBitmap) .setSmallIcon(mSmallIcon).setContentIntent(mIntent).setExtras(extras)).build(); Log.d(TAG, "Building notification - " + this.toString()); return notification; }