@ -29,4 +29,13 @@ object IntentHelp {
PendingIntent.FLAG_UPDATE_CURRENT
)
}
inline fun <reified T> activityPendingIntent(context: Context, action: String): PendingIntent? {
return PendingIntent.getActivity(
context,
0,
Intent(context, T::class.java).apply { this.action = action },
@ -291,7 +291,7 @@ abstract class BaseReadAloudService : BaseService(),
.setContentTitle(nTitle)
.setContentText(nSubtitle)
.setContentIntent(
IntentHelp.servicePendingIntent<ReadBookActivity>(this, "activity")
IntentHelp.activityPendingIntent<ReadBookActivity>(this, "activity")
if (pause) {
builder.addAction(
@ -36,7 +36,7 @@ class CheckSourceService : BaseService() {
.setContentTitle(getString(R.string.check_book_source))
.setContentText(msg)
IntentHelp.servicePendingIntent<BookSourceActivity>(this, "activity")
IntentHelp.activityPendingIntent<BookSourceActivity>(this, "activity")
.addAction(
R.drawable.ic_stop_black_24dp,