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