#android #remoteview #custom-notification
Вопрос:
В уведомлении Android мы можем создать пользовательское уведомление, используя RemoteView в качестве этого кода
val mRemoteViews = RemoteViews(packageName, R.layout.notifi_video_view)
val mRemoteViewsExpand = RemoteViews(packageName, R.layout.notifi_video_view_expand)
а затем поместите его в конструктор уведомлений, чтобы использовать свой дизайн макета вместо Android по умолчанию, как это
notificationCompatBuilder
.setCustomContentView(mRemoteViews)
.setCustomBigContentView(mRemoteViewsExpand)
.setContentIntent(pendingIntent)
смотрите изображение с моим дизайном для моего пользовательского уведомления по умолчанию и развернутое
это дизайн по умолчанию
as you can see I added arrow in the right as the regular notification with changing arrow direction bottom and top,
and then after this description for what I did, this is my question
as you can see in these images I draw a red circle around the notification arrow so how can I make an action when click on this arrow I change the notification from default to expanded and vise-versa as the regular android notification do ?
of course I know how to add action on click event in the notification like below code
val actionPendingIntent: PendingIntent =
Intent(this, MainActivity::class.java).apply {
action = ACTION_END_ACTION
}
.let { notificationIntent ->
PendingIntent.getService(this, 0, notificationIntent, 0)
}
mRemoteViewsExpand.setOnClickPendingIntent(R.id.btn_end, endCallPendingIntent)
но я не знаю, как выполнить действие, меняющее уведомление с развернутого на свернутое и наоборот
Спасибо вам за ваше время и за всех, кто пытается мне помочь