|
@@ -1,6 +1,7 @@
|
|
package eu.kanade.tachiyomi.extension
|
|
package eu.kanade.tachiyomi.extension
|
|
|
|
|
|
import android.content.Context
|
|
import android.content.Context
|
|
|
|
+import android.graphics.drawable.Drawable
|
|
import com.jakewharton.rxrelay.BehaviorRelay
|
|
import com.jakewharton.rxrelay.BehaviorRelay
|
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
|
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
|
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
|
@@ -11,6 +12,7 @@ import eu.kanade.tachiyomi.extension.model.LoadResult
|
|
import eu.kanade.tachiyomi.extension.util.ExtensionInstallReceiver
|
|
import eu.kanade.tachiyomi.extension.util.ExtensionInstallReceiver
|
|
import eu.kanade.tachiyomi.extension.util.ExtensionInstaller
|
|
import eu.kanade.tachiyomi.extension.util.ExtensionInstaller
|
|
import eu.kanade.tachiyomi.extension.util.ExtensionLoader
|
|
import eu.kanade.tachiyomi.extension.util.ExtensionLoader
|
|
|
|
+import eu.kanade.tachiyomi.source.Source
|
|
import eu.kanade.tachiyomi.source.SourceManager
|
|
import eu.kanade.tachiyomi.source.SourceManager
|
|
import eu.kanade.tachiyomi.util.lang.launchNow
|
|
import eu.kanade.tachiyomi.util.lang.launchNow
|
|
import kotlinx.coroutines.async
|
|
import kotlinx.coroutines.async
|
|
@@ -57,6 +59,12 @@ class ExtensionManager(
|
|
installedExtensionsRelay.call(value)
|
|
installedExtensionsRelay.call(value)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ fun getAppIconForSource(source: Source): Drawable? {
|
|
|
|
+ val pkgName = installedExtensions.find { ext -> ext.sources.any { it.id == source.id } }?.pkgName
|
|
|
|
+ return if (pkgName != null) context.packageManager.getApplicationIcon(pkgName)
|
|
|
|
+ else null
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Relay used to notify the available extensions.
|
|
* Relay used to notify the available extensions.
|
|
*/
|
|
*/
|