mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 02:34:39 +00:00
refactor: Use AboutLibraries
Should unblock GH-124 from being merged, no thanks to Google.
This commit is contained in:
parent
fa1f780b47
commit
6c93deacca
7 changed files with 123 additions and 15 deletions
|
@ -12,7 +12,7 @@ plugins {
|
||||||
alias(kotlinx.plugins.compose.compiler)
|
alias(kotlinx.plugins.compose.compiler)
|
||||||
alias(kotlinx.plugins.serialization)
|
alias(kotlinx.plugins.serialization)
|
||||||
alias(kotlinx.plugins.parcelize)
|
alias(kotlinx.plugins.parcelize)
|
||||||
alias(libs.plugins.google.oss)
|
alias(libs.plugins.aboutlibraries)
|
||||||
alias(libs.plugins.firebase.crashlytics) apply false
|
alias(libs.plugins.firebase.crashlytics) apply false
|
||||||
alias(libs.plugins.google.services) apply false
|
alias(libs.plugins.google.services) apply false
|
||||||
}
|
}
|
||||||
|
@ -236,6 +236,8 @@ dependencies {
|
||||||
// Sort
|
// Sort
|
||||||
implementation(libs.java.nat.sort)
|
implementation(libs.java.nat.sort)
|
||||||
|
|
||||||
|
implementation(libs.aboutlibraries)
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
implementation(libs.material.design.dimens)
|
implementation(libs.material.design.dimens)
|
||||||
implementation(libs.loading.button)
|
implementation(libs.loading.button)
|
||||||
|
@ -268,8 +270,6 @@ dependencies {
|
||||||
// Text distance
|
// Text distance
|
||||||
implementation(libs.java.string.similarity)
|
implementation(libs.java.string.similarity)
|
||||||
|
|
||||||
implementation(libs.play.services.oss.licenses)
|
|
||||||
|
|
||||||
// TLS 1.3 support for Android < 10
|
// TLS 1.3 support for Android < 10
|
||||||
implementation(libs.conscrypt)
|
implementation(libs.conscrypt)
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import androidx.core.content.getSystemService
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import co.touchlab.kermit.Logger
|
import co.touchlab.kermit.Logger
|
||||||
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
|
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
import eu.kanade.tachiyomi.data.updater.AppDownloadInstallJob
|
import eu.kanade.tachiyomi.data.updater.AppDownloadInstallJob
|
||||||
import eu.kanade.tachiyomi.data.updater.AppUpdateChecker
|
import eu.kanade.tachiyomi.data.updater.AppUpdateChecker
|
||||||
|
@ -37,6 +36,7 @@ import eu.kanade.tachiyomi.util.view.setNegativeButton
|
||||||
import eu.kanade.tachiyomi.util.view.setPositiveButton
|
import eu.kanade.tachiyomi.util.view.setPositiveButton
|
||||||
import eu.kanade.tachiyomi.util.view.setTitle
|
import eu.kanade.tachiyomi.util.view.setTitle
|
||||||
import eu.kanade.tachiyomi.util.view.snack
|
import eu.kanade.tachiyomi.util.view.snack
|
||||||
|
import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
||||||
import io.noties.markwon.Markwon
|
import io.noties.markwon.Markwon
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
@ -126,7 +126,7 @@ class AboutController : SettingsLegacyController() {
|
||||||
titleMRes = MR.strings.open_source_licenses
|
titleMRes = MR.strings.open_source_licenses
|
||||||
|
|
||||||
onClick {
|
onClick {
|
||||||
startActivity(Intent(activity, OssLicensesMenuActivity::class.java))
|
router.pushController(AboutLicenseController().withFadeTransaction())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
package eu.kanade.tachiyomi.ui.more
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.outlined.Public
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
|
import androidx.compose.material3.rememberTopAppBarState
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.platform.LocalUriHandler
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.viewinterop.AndroidView
|
||||||
|
import androidx.core.text.HtmlCompat
|
||||||
|
import com.google.android.material.textview.MaterialTextView
|
||||||
|
import dev.icerock.moko.resources.compose.stringResource
|
||||||
|
import eu.kanade.tachiyomi.ui.base.controller.BaseComposeController
|
||||||
|
import yokai.i18n.MR
|
||||||
|
import yokai.presentation.AppBarType
|
||||||
|
import yokai.presentation.YokaiScaffold
|
||||||
|
import yokai.presentation.component.ToolTipButton
|
||||||
|
|
||||||
|
class AboutLibraryLicenseController(
|
||||||
|
private val name: String,
|
||||||
|
private val website: String?,
|
||||||
|
private val license: String,
|
||||||
|
) : BaseComposeController() {
|
||||||
|
@Composable
|
||||||
|
override fun ScreenContent() {
|
||||||
|
val uriHandler = LocalUriHandler.current
|
||||||
|
|
||||||
|
YokaiScaffold(
|
||||||
|
onNavigationIconClicked = router::handleBack,
|
||||||
|
title = name,
|
||||||
|
appBarType = AppBarType.SMALL,
|
||||||
|
scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior(
|
||||||
|
state = rememberTopAppBarState(),
|
||||||
|
),
|
||||||
|
actions = {
|
||||||
|
if (website != null) {
|
||||||
|
ToolTipButton(
|
||||||
|
toolTipLabel = stringResource(MR.strings.website),
|
||||||
|
icon = Icons.Outlined.Public,
|
||||||
|
buttonClicked = { uriHandler.openUri(website) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) { innerPadding ->
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.verticalScroll(rememberScrollState())
|
||||||
|
.padding(innerPadding)
|
||||||
|
.padding(16.dp),
|
||||||
|
) {
|
||||||
|
HtmlLicenseText(html = license)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun HtmlLicenseText(html: String) {
|
||||||
|
AndroidView(
|
||||||
|
factory = {
|
||||||
|
MaterialTextView(it)
|
||||||
|
},
|
||||||
|
update = {
|
||||||
|
it.text = HtmlCompat.fromHtml(html, HtmlCompat.FROM_HTML_MODE_COMPACT)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package eu.kanade.tachiyomi.ui.more
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import com.mikepenz.aboutlibraries.ui.compose.m3.LibrariesContainer
|
||||||
|
import com.mikepenz.aboutlibraries.ui.compose.m3.util.htmlReadyLicenseContent
|
||||||
|
import dev.icerock.moko.resources.compose.stringResource
|
||||||
|
import eu.kanade.tachiyomi.ui.base.controller.BaseComposeController
|
||||||
|
import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
||||||
|
import yokai.i18n.MR
|
||||||
|
import yokai.presentation.AppBarType
|
||||||
|
import yokai.presentation.YokaiScaffold
|
||||||
|
|
||||||
|
class AboutLicenseController : BaseComposeController() {
|
||||||
|
@Composable
|
||||||
|
override fun ScreenContent() {
|
||||||
|
YokaiScaffold(
|
||||||
|
onNavigationIconClicked = router::handleBack,
|
||||||
|
title = stringResource(MR.strings.open_source_licenses),
|
||||||
|
appBarType = AppBarType.SMALL,
|
||||||
|
scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(),
|
||||||
|
) { innerPadding ->
|
||||||
|
LibrariesContainer(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentPadding = innerPadding,
|
||||||
|
onLibraryClick = {
|
||||||
|
router.pushController(
|
||||||
|
AboutLibraryLicenseController(
|
||||||
|
it.name,
|
||||||
|
it.website,
|
||||||
|
it.licenses.firstOrNull()?.htmlReadyLicenseContent.orEmpty(),
|
||||||
|
).withFadeTransaction(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,8 +15,8 @@ plugins {
|
||||||
alias(kotlinx.plugins.multiplatform) apply false
|
alias(kotlinx.plugins.multiplatform) apply false
|
||||||
alias(kotlinx.plugins.parcelize) apply false
|
alias(kotlinx.plugins.parcelize) apply false
|
||||||
alias(kotlinx.plugins.serialization) apply false
|
alias(kotlinx.plugins.serialization) apply false
|
||||||
|
alias(libs.plugins.aboutlibraries) apply false
|
||||||
alias(libs.plugins.firebase.crashlytics) apply false
|
alias(libs.plugins.firebase.crashlytics) apply false
|
||||||
alias(libs.plugins.google.oss) apply false
|
|
||||||
alias(libs.plugins.google.services) apply false
|
alias(libs.plugins.google.services) apply false
|
||||||
alias(libs.plugins.moko) apply false
|
alias(libs.plugins.moko) apply false
|
||||||
alias(libs.plugins.sqldelight) apply false
|
alias(libs.plugins.sqldelight) apply false
|
||||||
|
|
|
@ -13,8 +13,11 @@ sqlite = "2.4.0"
|
||||||
sqldelight = "2.0.2"
|
sqldelight = "2.0.2"
|
||||||
junit = "5.8.2"
|
junit = "5.8.2"
|
||||||
kermit = "2.0.3"
|
kermit = "2.0.3"
|
||||||
|
aboutlibraries = "11.2.2"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
aboutlibraries = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "aboutlibraries" }
|
||||||
|
|
||||||
accompanist-webview = { module = "com.google.accompanist:accompanist-webview", version = "0.30.1" }
|
accompanist-webview = { module = "com.google.accompanist:accompanist-webview", version = "0.30.1" }
|
||||||
chucker-library-no-op = { module = "com.github.ChuckerTeam.Chucker:library-no-op", version.ref = "chucker" }
|
chucker-library-no-op = { module = "com.github.ChuckerTeam.Chucker:library-no-op", version.ref = "chucker" }
|
||||||
chucker-library = { module = "com.github.ChuckerTeam.Chucker:library", version.ref = "chucker" }
|
chucker-library = { module = "com.github.ChuckerTeam.Chucker:library", version.ref = "chucker" }
|
||||||
|
@ -69,7 +72,6 @@ okhttp-dnsoverhttps = { module = "com.squareup.okhttp3:okhttp-dnsoverhttps", ver
|
||||||
okhttp-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" }
|
okhttp-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" }
|
||||||
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
|
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
|
||||||
play-services-gcm = { module = "com.google.android.gms:play-services-gcm", version = "17.0.0" }
|
play-services-gcm = { module = "com.google.android.gms:play-services-gcm", version = "17.0.0" }
|
||||||
play-services-oss-licenses = { module = "com.google.android.gms:play-services-oss-licenses", version = "17.1.0" }
|
|
||||||
photoview = { module = "com.github.chrisbanes:PhotoView", version = "2.3.0" }
|
photoview = { module = "com.github.chrisbanes:PhotoView", version = "2.3.0" }
|
||||||
quickjs-android = { module = "app.cash.quickjs:quickjs-android", version = "0.9.2" }
|
quickjs-android = { module = "app.cash.quickjs:quickjs-android", version = "0.9.2" }
|
||||||
rxrelay = { module = "com.jakewharton.rxrelay:rxrelay", version = "1.2.0" }
|
rxrelay = { module = "com.jakewharton.rxrelay:rxrelay", version = "1.2.0" }
|
||||||
|
@ -96,8 +98,8 @@ viewstatepageradapter = { module = "com.nightlynexus.viewstatepageradapter:views
|
||||||
viewtooltip = { module = "com.github.florent37:viewtooltip", version = "1.2.2" }
|
viewtooltip = { module = "com.github.florent37:viewtooltip", version = "1.2.2" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
|
aboutlibraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutlibraries" }
|
||||||
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version = "3.0.2" }
|
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version = "3.0.2" }
|
||||||
google-oss = { id = "com.google.android.gms.oss-licenses-plugin", version = "0.10.6" }
|
|
||||||
google-services = { id = "com.google.gms.google-services", version = "4.4.2" }
|
google-services = { id = "com.google.gms.google-services", version = "4.4.2" }
|
||||||
gradle-versions = { id = "com.github.ben-manes.versions", version = "0.42.0" }
|
gradle-versions = { id = "com.github.ben-manes.versions", version = "0.42.0" }
|
||||||
kotlinter = { id = "org.jmailen.kotlinter", version = "4.1.1" }
|
kotlinter = { id = "org.jmailen.kotlinter", version = "4.1.1" }
|
||||||
|
|
|
@ -4,13 +4,6 @@ pluginManagement {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
resolutionStrategy {
|
|
||||||
eachPlugin {
|
|
||||||
if (requested.id.id == "com.google.android.gms.oss-licenses-plugin") {
|
|
||||||
useModule("com.google.android.gms:oss-licenses-plugin:${requested.version}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue