我的问题是我向应用程序中添加了一个Exoplayer通知,并且希望在我按下“暂停”按钮时停止MainActivity中的动画。我有一个动画到ImageButton。我知道在正常情况下如何停止动画, 但我不知道如何从通知中停止动画。在下面,我将向您添加我的通知代码。 预先谢谢你!
notificationManager = PlayerNotificationManager.createWithNotificationChannel(
this,
CHANNEL_ID,
R.string.exo_download_notification_channel_name,
NOTIFICATION_ID,
new PlayerNotificationManager.MediaDescriptionAdapter() {
@Override
public String getCurrentContentTitle(Player player) {
return text_song;
}
@Nullable
@Override
public PendingIntent createCurrentContentIntent(Player player) {
Intent intent = new Intent(MainActivity.this, MainActivity.class);
PendingIntent contentPendingIntent = PendingIntent.getActivity
(MainActivity.this, 0, intent, 0);
return contentPendingIntent;
}
@Nullable
@Override
public String getCurrentContentText(Player player) {
return null;
}
@Nullable
@Override
public Bitmap getCurrentLargeIcon(Player player, PlayerNotificationManager.BitmapCallback callback) {
return null;
}
}
);
notificationManager.setUseChronometer(true);
notificationManager.setUseNavigationActions(false);
notificationManager.setFastForwardIncrementMs(0);
notificationManager.setRewindIncrementMs(0);
notificationManager.setPriority(NotificationCompat.PRIORITY_HIGH);
notificationManager.setPlayer(player);