本文整理汇总了Java中com.bumptech.glide.request.target.NotificationTarget类的典型用法代码示例。如果您正苦于以下问题:Java NotificationTarget类的具体用法?Java NotificationTarget怎么用?Java NotificationTarget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NotificationTarget类属于com.bumptech.glide.request.target包,在下文中一共展示了NotificationTarget类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testNotification
import com.bumptech.glide.request.target.NotificationTarget; //导入依赖的package包/类
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);
}
开发者ID:devilWwj,项目名称:Android-Tech,代码行数:30,代码来源:MainActivity.java
示例2: loadImageToNotification
import com.bumptech.glide.request.target.NotificationTarget; //导入依赖的package包/类
public NotificationTarget loadImageToNotification(NotificationTarget notificationTarget,
String url) {
Context context = weakContext.get();
if (context != null) {
return Glide.with(context.getApplicationContext())
.load(url)
.asBitmap()
.into(notificationTarget);
} else {
Log.e(TAG, "::loadImageToNotification() Context is null");
}
return notificationTarget;
}
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:14,代码来源:ImageLoader.java
示例3: loadImage
import com.bumptech.glide.request.target.NotificationTarget; //导入依赖的package包/类
private void loadImage(Context context, int notificationId, Notification notification, String url,
RemoteViews expandedView, @IdRes int viewId) {
NotificationTarget notificationTarget =
new NotificationTarget(context, expandedView, viewId, notification, notificationId);
ImageLoader.with(context)
.loadImageToNotification(notificationTarget, url);
}
开发者ID:Aptoide,项目名称:aptoide-client-v8,代码行数:8,代码来源:SystemNotificationShower.java
示例4: popNotification
import com.bumptech.glide.request.target.NotificationTarget; //导入依赖的package包/类
private void popNotification() {
// if (musics != null && musics.size() > current) {
// Music music = musics.get(current);
if (hadLoadMusics) {
final Music music = musics.get(current);
Intent intent = MainActivity.newIntent(PlayService.this);
PendingIntent pi = PendingIntent.getActivity(PlayService.this, 0, intent, 0);
RemoteViews rv = new RemoteViews(getPackageName(), R.layout.notification_layout);
rv.setImageViewResource(R.id.notification_play, mp.isPlaying() ? R.drawable.pause_icon : R.drawable.play_icon);
rv.setTextViewText(R.id.notification_title, music.getTitle() == null ? music.getName() : music.getTitle());
rv.setTextViewText(R.id.notification_artist, music.getArtist());
Intent playIntent = new Intent(getPackageName() + "PLAY");
PendingIntent playPi = PendingIntent.getBroadcast(PlayService.this, 0, playIntent, 0);
Intent nextIntent = new Intent(getPackageName() + "NEXT");
PendingIntent nextPi = PendingIntent.getBroadcast(PlayService.this, 0, nextIntent, 0);
Intent previousIntent = new Intent(getPackageName() + "PREVIOUS");
PendingIntent previousPi = PendingIntent.getBroadcast(PlayService.this, 0, previousIntent, 0);
rv.setOnClickPendingIntent(R.id.notification_play, playPi);
rv.setOnClickPendingIntent(R.id.notification_next, nextPi);
rv.setOnClickPendingIntent(R.id.notification_previous, previousPi);
Notification notification = new NotificationCompat.Builder(PlayService.this)
.setContentTitle(music.getTitle() == null ? music.getName() : music.getTitle())
.setContentText(music.getArtist())
// .setLargeIcon((Bitmap) message.obj)
.setContentIntent(pi)
.setSmallIcon(R.drawable.ic_album)
.setCustomBigContentView(rv)
.build();
startForeground(1, notification);
final NotificationTarget bigTarget = new NotificationTarget(
this, rv, R.id.notification_cover, notification, 1
);
final Handler handler = new Handler();
new Thread(new Runnable() {
@Override
public void run() {
final byte[] model = Music.getAlbumByte(music.getPath());
handler.post(new Runnable() {
@Override
public void run() {
Glide.with(PlayService.this)
.load(model)
.asBitmap()
.error(R.drawable.ic_notification)
.into(bigTarget);
}
});
}
}).start();
}
}
开发者ID:Zackratos,项目名称:PureMusic,代码行数:64,代码来源:PlayService.java
示例5: DefaultNotificationPanel
import com.bumptech.glide.request.target.NotificationTarget; //导入依赖的package包/类
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);
}
}
开发者ID:KKorvin,项目名称:uPods-android,代码行数:45,代码来源:DefaultNotificationPanel.java
示例6: loadImageNotification
import com.bumptech.glide.request.target.NotificationTarget; //导入依赖的package包/类
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 );
}
开发者ID:fs-opensource,项目名称:android-tutorials-glide,代码行数:45,代码来源:UsageExampleTargetsAndRemoteViews.java
注:本文中的com.bumptech.glide.request.target.NotificationTarget类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论