我正在尝试更改通知中的imagviews的可见性,当其中一个点击时,即使接收器上的点击触发器已经调用也没有任何反应。
我的收件人代码:
public class NotificationInteractionReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (context instanceof ExoPlayerService){
ExoPlayerService service= (ExoPlayerService) context;
RemoteViews views=NotificationHelper.remoteViews;
if (views==null){
return;
}
if (intent.getAction().equals(NotificationHelper.NOTIFY_DELETE)){
Log.e("NotificationReceiver","delete button clicked");
}
if (intent.getAction().equals(NotificationHelper.NOTIFY_NEXT)){
Log.e("NotificationReceiver","next button clicked");
}
if (intent.getAction().equals(NotificationHelper.NOTIFY_PREVIOUS)){
Log.e("NotificationReceiver","previous button clicked");
}
if (intent.getAction().equals(NotificationHelper.NOTIFY_PAUSE)){
Log.e("NotificationReceiver","pause button clicked");
views.setViewVisibility(R.id.pauseBtn_notification, View.GONE);
views.setViewVisibility(R.id.playBtn_notification, View.VISIBLE);
}
if (intent.getAction().equals(NotificationHelper.NOTIFY_PLAY)){
Log.e("NotificationReceiver","play button clicked");
views.setViewVisibility(R.id.playBtn_notification,View.GONE);
views.setViewVisibility(R.id.pauseBtn_notification, View.VISIBLE);
}
}
}
}