Misc small fixes
This commit is contained in:
@@ -106,6 +106,7 @@
|
||||
|
||||
<receiver
|
||||
android:name="org.koitharu.kotatsu.widget.shelf.ShelfWidgetProvider"
|
||||
android:exported="true"
|
||||
android:label="@string/manga_shelf">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
@@ -116,6 +117,7 @@
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="org.koitharu.kotatsu.widget.recent.RecentWidgetProvider"
|
||||
android:exported="true"
|
||||
android:label="@string/recent_manga">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
@@ -125,6 +127,11 @@
|
||||
android:resource="@xml/widget_recent" />
|
||||
</receiver>
|
||||
|
||||
<meta-data android:name="android.webkit.WebView.EnableSafeBrowsing"
|
||||
android:value="false" />
|
||||
<meta-data android:name="android.webkit.WebView.MetricsOptOut"
|
||||
android:value="true" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -7,6 +7,8 @@ import android.webkit.MimeTypeMap
|
||||
import androidx.collection.ArraySet
|
||||
import androidx.core.net.toFile
|
||||
import androidx.core.net.toUri
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.koitharu.kotatsu.core.model.*
|
||||
import org.koitharu.kotatsu.core.parser.MangaRepository
|
||||
import org.koitharu.kotatsu.local.data.CbzFilter
|
||||
@@ -127,14 +129,16 @@ class LocalMangaRepository(private val context: Context) : MangaRepository {
|
||||
)
|
||||
}
|
||||
|
||||
fun getRemoteManga(localManga: Manga): Manga? {
|
||||
suspend fun getRemoteManga(localManga: Manga): Manga? {
|
||||
val file = runCatching {
|
||||
Uri.parse(localManga.url).toFile()
|
||||
}.getOrNull() ?: return null
|
||||
val zip = ZipFile(file)
|
||||
val entry = zip.getEntry(MangaZip.INDEX_ENTRY)
|
||||
val index = entry?.let(zip::readText)?.let(::MangaIndex) ?: return null
|
||||
return index.getMangaInfo()
|
||||
return withContext(Dispatchers.IO) {
|
||||
val zip = ZipFile(file)
|
||||
val entry = zip.getEntry(MangaZip.INDEX_ENTRY)
|
||||
val index = entry?.let(zip::readText)?.let(::MangaIndex) ?: return@withContext null
|
||||
index.getMangaInfo()
|
||||
}
|
||||
}
|
||||
|
||||
private fun zipUri(file: File, entryName: String) =
|
||||
|
||||
@@ -99,6 +99,7 @@ class LocalListViewModel(
|
||||
runCatching {
|
||||
historyRepository.deleteOrSwap(manga, original)
|
||||
}
|
||||
mangaList.value = mangaList.value?.filterNot { it.id == manga.id }
|
||||
}
|
||||
shortcutsRepository.updateShortcuts()
|
||||
onMangaRemoved.call(manga)
|
||||
|
||||
@@ -28,13 +28,8 @@ class TrackingRepository(
|
||||
}
|
||||
val tracks = db.tracksDao.findAll().groupBy { it.mangaId }
|
||||
return mangaList
|
||||
.mapNotNull {
|
||||
if (it.source == MangaSource.LOCAL) {
|
||||
localMangaRepository.getRemoteManga(it)
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}.distinctBy { it.id }
|
||||
.filterNot { it.source == MangaSource.LOCAL }
|
||||
.distinctBy { it.id }
|
||||
.map { manga ->
|
||||
val track = tracks[manga.id]?.singleOrNull()
|
||||
MangaTracking(
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:padding="6dp"
|
||||
app:chipSpacingHorizontal="4dp"
|
||||
app:chipSpacingVertical="6dp"
|
||||
app:layout_constraintEnd_toEndOf="@id/imageView_cover"
|
||||
app:layout_constraintStart_toStartOf="@id/imageView_cover"
|
||||
app:layout_constraintTop_toBottomOf="@id/imageView_cover" />
|
||||
|
||||
@@ -8,5 +8,6 @@
|
||||
<item name="badgeStyle">@style/Widget.MaterialComponents.Badge</item>
|
||||
<item name="android:statusBarColor">@color/status_bar</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="colorOnPrimary">@android:color/white</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -8,6 +8,7 @@
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
|
||||
<item name="badgeStyle">@style/Widget.MaterialComponents.Badge</item>
|
||||
<item name="android:statusBarColor">@color/status_bar</item>
|
||||
<item name="colorOnPrimary">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme" parent="BaseAppTheme">
|
||||
|
||||
Reference in New Issue
Block a user