|
@@ -19,6 +19,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
|
|
import eu.kanade.tachiyomi.util.lang.plusAssign
|
|
|
import eu.kanade.tachiyomi.util.system.acquireWakeLock
|
|
|
import eu.kanade.tachiyomi.util.system.connectivityManager
|
|
|
+import eu.kanade.tachiyomi.util.system.isServiceRunning
|
|
|
import eu.kanade.tachiyomi.util.system.notification
|
|
|
import eu.kanade.tachiyomi.util.system.toast
|
|
|
import rx.android.schedulers.AndroidSchedulers
|
|
@@ -58,6 +59,16 @@ class DownloadService : Service() {
|
|
|
fun stop(context: Context) {
|
|
|
context.stopService(Intent(context, DownloadService::class.java))
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns the status of the service.
|
|
|
+ *
|
|
|
+ * @param context the application context.
|
|
|
+ * @return true if the service is running, false otherwise.
|
|
|
+ */
|
|
|
+ fun isRunning(context: Context): Boolean {
|
|
|
+ return context.isServiceRunning(DownloadService::class.java)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private val downloadManager: DownloadManager by injectLazy()
|