com.bumptech.glide.request.target.NotificationTarget Java Examples
The following examples show how to use
com.bumptech.glide.request.target.NotificationTarget.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java From Android-Tech with Apache License 2.0 | 5 votes |
private void testNotification() { final RemoteViews rv = new RemoteViews(this.getPackageName(), R.layout.remoteview_notification); rv.setImageViewResource(R.id.remoteview_notification_icon, R.mipmap.ic_launcher); rv.setTextViewText(R.id.remoteview_notification_headline, "Headline"); rv.setTextViewText(R.id.remoteview_notification_short_message, "Short Message"); // build notification NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle("Content Title") .setContentText("Content Text") .setContent(rv) .setPriority(NotificationCompat.PRIORITY_MIN); final Notification notification = mBuilder.build(); // set big content view for newer androids if (Build.VERSION.SDK_INT >= 16) { notification.bigContentView = rv; } NotificationManager mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(NOTIFICATION_ID, notification); NotificationTarget notificationTarget = new NotificationTarget(this, rv, R.id.remoteview_notification_icon, notification, NOTIFICATION_ID); Glide.with(this.getApplicationContext())// safer! .load(eatFoodyImages[3]).asBitmap().into(notificationTarget); }
Example #2
Source File: ImageLoader.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
public NotificationTarget loadImageToNotification(NotificationTarget notificationTarget, String url) { Context context = weakContext.get(); if (context != null) { return Glide.with(context.getApplicationContext()) .asBitmap() .load(url) .apply(getRequestOptions()) .into(notificationTarget); } else { Log.e(TAG, "::loadImageToNotification() Context is null"); } return notificationTarget; }
Example #3
Source File: SystemNotificationShower.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
private void loadImage(Context context, int notificationId, Notification notification, String url, RemoteViews expandedView, @IdRes int viewId) { NotificationTarget notificationTarget = new NotificationTarget(context, viewId, expandedView, notification, notificationId); ImageLoader.with(context) .loadImageToNotification(notificationTarget, url); }
Example #4
Source File: DefaultNotificationPanel.java From uPods-android with Apache License 2.0 | 4 votes |
public DefaultNotificationPanel(Context mContext, MediaItem playableMediaItem) { super(mContext, playableMediaItem); this.currentState = UniversalPlayer.State.PLAYING; this.nBuilder = new NotificationCompat.Builder(mContext); this.nBuilder.setContentTitle(playableMediaItem.getName()); this.nBuilder.setContentInfo(playableMediaItem.getName()); this.nBuilder.setContentText(playableMediaItem.getName()); this.nBuilder.setSmallIcon(R.drawable.ic_pause_white); this.nBuilder.setAutoCancel(false); this.nBuilder.setOngoing(true); Intent intentOpen = new Intent(mContext, ActivityPlayer.class); PendingIntent piOpen = PendingIntent.getActivity(mContext, 0, intentOpen, 0); this.nBuilder.setContentIntent(piOpen); this.nBuilder.setOngoing(false); this.remoteView = new RemoteViews(mContext.getPackageName(), R.layout.player_notification); this.remoteView.setTextViewText(R.id.tvPlayerTitleNtBar, playableMediaItem.getName()); this.remoteView.setTextViewText(R.id.tvPlayerSubTitleNtBar, playableMediaItem.getSubHeader()); setListeners(); this.nBuilder.setContent(remoteView); Notification notification = nBuilder.build(); this.nManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); this.nManager.notify(NOTIFICATION_ID, notification); if (playableMediaItem.getCoverImageUrl() != null) { Glide.with(mContext) .load(playableMediaItem.getCoverImageUrl()) .asBitmap() .into(new NotificationTarget( mContext, remoteView, R.id.imgPlayerNtBar, notification, NOTIFICATION_ID)); } else { final LetterBitmap letterBitmap = new LetterBitmap(mContext); Bitmap letterTile = letterBitmap.getLetterTile(playableMediaItem.getName(), playableMediaItem.getName(), COVER_IMAGE_SIZE, COVER_IMAGE_SIZE); remoteView.setImageViewBitmap(R.id.imgPlayerNtBar, letterTile); this.nManager.notify(NOTIFICATION_ID, notification); } }
Example #5
Source File: UsageExampleTargetsAndRemoteViews.java From android-tutorials-glide with MIT License | 4 votes |
private void loadImageNotification() { // create RemoteViews final RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.remoteview_notification); remoteViews.setImageViewResource(R.id.remoteview_notification_icon, R.mipmap.future_studio_launcher); remoteViews.setTextViewText(R.id.remoteview_notification_headline, "Headline"); remoteViews.setTextViewText(R.id.remoteview_notification_short_message, "Short Message"); remoteViews.setTextColor(R.id.remoteview_notification_headline, context.getResources().getColor( android.R.color.black)); remoteViews.setTextColor(R.id.remoteview_notification_short_message, context.getResources().getColor(android.R.color.black)); // build notification NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context) .setSmallIcon(R.mipmap.future_studio_launcher) .setContentTitle("Content Title") .setContentText("Content Text") .setContent(remoteViews) .setPriority( NotificationCompat.PRIORITY_MIN); final Notification notification = mBuilder.build(); // set big content view for newer androids if (android.os.Build.VERSION.SDK_INT >= 16) { notification.bigContentView = remoteViews; } NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(NOTIFICATION_ID, notification); notificationTarget = new NotificationTarget( context, remoteViews, R.id.remoteview_notification_icon, notification, NOTIFICATION_ID); Glide .with( context.getApplicationContext() ) // safer! .load( eatFoodyImages[3] ) .asBitmap() .into( notificationTarget ); }