Add "show entry" action to download notifications (#1159)
* Add 'show entry' to download notifications Signed-off-by: Catting <5874051+mm12@users.noreply.github.com> * fixup! Add 'show entry' to download notifications Signed-off-by: Catting <5874051+mm12@users.noreply.github.com> * fixup! Add 'show entry' to download notifications Signed-off-by: Catting <5874051+mm12@users.noreply.github.com> * spotless! Add 'show entry' to download notifications Signed-off-by: Catting <5874051+mm12@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> * fixup! spotless- Apply suggestions from code review Signed-off-by: Catting <5874051+mm12@users.noreply.github.com> --------- Signed-off-by: Catting <5874051+mm12@users.noreply.github.com> Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
@@ -248,6 +248,8 @@ class NotificationReceiver : BroadcastReceiver() {
|
||||
private const val ACTION_OPEN_CHAPTER = "$ID.$NAME.ACTION_OPEN_CHAPTER"
|
||||
private const val ACTION_DOWNLOAD_CHAPTER = "$ID.$NAME.ACTION_DOWNLOAD_CHAPTER"
|
||||
|
||||
private const val ACTION_OPEN_ENTRY = "$ID.$NAME.ACTION_OPEN_ENTRY"
|
||||
|
||||
private const val ACTION_RESUME_DOWNLOADS = "$ID.$NAME.ACTION_RESUME_DOWNLOADS"
|
||||
private const val ACTION_PAUSE_DOWNLOADS = "$ID.$NAME.ACTION_PAUSE_DOWNLOADS"
|
||||
private const val ACTION_CLEAR_DOWNLOADS = "$ID.$NAME.ACTION_CLEAR_DOWNLOADS"
|
||||
@@ -484,6 +486,26 @@ class NotificationReceiver : BroadcastReceiver() {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns [PendingIntent] that opens the manga info controller
|
||||
*
|
||||
* @param context context of application
|
||||
* @param mangaId id of the entry to open
|
||||
*/
|
||||
internal fun openEntryPendingActivity(context: Context, mangaId: Long): PendingIntent {
|
||||
val newIntent = Intent(context, MainActivity::class.java).setAction(Constants.SHORTCUT_MANGA)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
.putExtra(Constants.MANGA_EXTRA, mangaId)
|
||||
.putExtra("notificationId", mangaId.hashCode())
|
||||
|
||||
return PendingIntent.getActivity(
|
||||
context,
|
||||
mangaId.hashCode(),
|
||||
newIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns [PendingIntent] that starts a service which stops the library update
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user