Rename project from Tokusho to Etsudoku
tokusho means profit :trollface:
This commit is contained in:
2
.idea/deploymentTargetDropDown.xml
generated
2
.idea/deploymentTargetDropDown.xml
generated
@@ -18,7 +18,7 @@
|
|||||||
</deviceKey>
|
</deviceKey>
|
||||||
</Target>
|
</Target>
|
||||||
</targetSelectedWithDropDown>
|
</targetSelectedWithDropDown>
|
||||||
<timeTargetWasSelectedWithDropDown value="2024-03-27T16:43:21.742325100Z" />
|
<timeTargetWasSelectedWithDropDown value="2024-03-30T18:28:38.815975400Z" />
|
||||||
</State>
|
</State>
|
||||||
</entry>
|
</entry>
|
||||||
</value>
|
</value>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Tokusho
|
# Etsudoku
|
||||||
|
|
||||||
An attempt to write an Android manga reading application on Jetpack Compose using the [Kotatsu parser library](https://github.com/KotatsuApp/kotatsu-parsers).
|
An attempt to write an Android manga reading application on Jetpack Compose using the [Kotatsu parser library](https://github.com/KotatsuApp/kotatsu-parsers).
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ val acraAuthLogin: String = gradleLocalProperties(rootDir).getProperty("authLogi
|
|||||||
val acraAuthPassword: String = gradleLocalProperties(rootDir).getProperty("authPassword") ?: "\"acra_password\""
|
val acraAuthPassword: String = gradleLocalProperties(rootDir).getProperty("authPassword") ?: "\"acra_password\""
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "org.xtimms.tokusho"
|
namespace = "org.xtimms.etsudoku"
|
||||||
compileSdk = 34
|
compileSdk = 34
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "org.xtimms.tokusho"
|
applicationId = "org.xtimms.etsudoku"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
@@ -37,7 +37,7 @@ android {
|
|||||||
buildConfigField("String", "ACRA_AUTH_LOGIN", acraAuthLogin)
|
buildConfigField("String", "ACRA_AUTH_LOGIN", acraAuthLogin)
|
||||||
buildConfigField("String", "ACRA_AUTH_PASSWORD", acraAuthPassword)
|
buildConfigField("String", "ACRA_AUTH_PASSWORD", acraAuthPassword)
|
||||||
|
|
||||||
testInstrumentationRunner = "org.xtimms.tokusho.HiltTestRunner"
|
testInstrumentationRunner = "org.xtimms.etsudoku.HiltTestRunner"
|
||||||
vectorDrawables {
|
vectorDrawables {
|
||||||
useSupportLibrary = true
|
useSupportLibrary = true
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,7 @@ android {
|
|||||||
}
|
}
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
compose = true
|
compose = true
|
||||||
|
viewBinding = true
|
||||||
buildConfig = true
|
buildConfig = true
|
||||||
}
|
}
|
||||||
composeOptions {
|
composeOptions {
|
||||||
@@ -100,7 +101,7 @@ dependencies {
|
|||||||
implementation("androidx.compose.ui:ui")
|
implementation("androidx.compose.ui:ui")
|
||||||
implementation("androidx.compose.ui:ui-graphics")
|
implementation("androidx.compose.ui:ui-graphics")
|
||||||
implementation("androidx.compose.ui:ui-tooling-preview")
|
implementation("androidx.compose.ui:ui-tooling-preview")
|
||||||
implementation("androidx.compose.material:material-icons-extended:1.6.3")
|
implementation("androidx.compose.material:material-icons-extended:1.6.5")
|
||||||
implementation("androidx.compose.material3:material3-android:1.2.1")
|
implementation("androidx.compose.material3:material3-android:1.2.1")
|
||||||
implementation("androidx.compose.material3:material3-window-size-class:1.2.1")
|
implementation("androidx.compose.material3:material3-window-size-class:1.2.1")
|
||||||
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
|
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho
|
package org.xtimms.etsudoku
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho
|
package org.xtimms.etsudoku
|
||||||
|
|
||||||
import android.app.Instrumentation
|
import android.app.Instrumentation
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho
|
package org.xtimms.etsudoku
|
||||||
|
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
import com.squareup.moshi.FromJson
|
import com.squareup.moshi.FromJson
|
||||||
@@ -11,7 +11,7 @@ import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
|||||||
import okio.buffer
|
import okio.buffer
|
||||||
import okio.source
|
import okio.source
|
||||||
import org.koitharu.kotatsu.parsers.model.Manga
|
import org.koitharu.kotatsu.parsers.model.Manga
|
||||||
import org.xtimms.tokusho.core.model.FavouriteCategory
|
import org.xtimms.etsudoku.core.model.FavouriteCategory
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.sections.settings.backup
|
package org.xtimms.etsudoku.sections.settings.backup
|
||||||
|
|
||||||
import android.content.res.AssetManager
|
import android.content.res.AssetManager
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
@@ -12,12 +12,12 @@ import org.junit.Before
|
|||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.xtimms.tokusho.SampleData
|
import org.xtimms.etsudoku.SampleData
|
||||||
import org.xtimms.tokusho.core.database.TokushoDatabase
|
import org.xtimms.etsudoku.core.database.EtsudokuDatabase
|
||||||
import org.xtimms.tokusho.core.database.entity.toMangaTags
|
import org.xtimms.etsudoku.core.database.entity.toMangaTags
|
||||||
import org.xtimms.tokusho.data.repository.FavouritesRepository
|
import org.xtimms.etsudoku.data.repository.FavouritesRepository
|
||||||
import org.xtimms.tokusho.data.repository.HistoryRepository
|
import org.xtimms.etsudoku.data.repository.HistoryRepository
|
||||||
import org.xtimms.tokusho.data.repository.backup.BackupRepository
|
import org.xtimms.etsudoku.data.repository.backup.BackupRepository
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ class AppBackupAgentTest {
|
|||||||
lateinit var backupRepository: BackupRepository
|
lateinit var backupRepository: BackupRepository
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var database: TokushoDatabase
|
lateinit var database: EtsudokuDatabase
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:largeHeap="true"
|
android:largeHeap="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.Tokusho.Starting"
|
android:theme="@style/Theme.Etsudoku.Starting"
|
||||||
android:networkSecurityConfig="@xml/network_security_config"
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
tools:targetApi="tiramisu">
|
tools:targetApi="tiramisu">
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/Theme.Tokusho">
|
android:theme="@style/Theme.Etsudoku">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho
|
package org.xtimms.etsudoku
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
@@ -20,12 +20,12 @@ import org.acra.data.StringFormat
|
|||||||
import org.acra.ktx.initAcra
|
import org.acra.ktx.initAcra
|
||||||
import org.acra.sender.HttpSender
|
import org.acra.sender.HttpSender
|
||||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||||
import org.xtimms.tokusho.core.database.TokushoDatabase
|
import org.xtimms.etsudoku.core.database.EtsudokuDatabase
|
||||||
import org.xtimms.tokusho.core.prefs.AppSettings
|
import org.xtimms.etsudoku.core.prefs.AppSettings
|
||||||
import org.xtimms.tokusho.core.prefs.KotatsuAppSettings
|
import org.xtimms.etsudoku.core.prefs.KotatsuAppSettings
|
||||||
import org.xtimms.tokusho.core.updates.Updater
|
import org.xtimms.etsudoku.core.updates.Updater
|
||||||
import org.xtimms.tokusho.utils.lang.processLifecycleScope
|
import org.xtimms.etsudoku.utils.lang.processLifecycleScope
|
||||||
import org.xtimms.tokusho.work.WorkScheduleManager
|
import org.xtimms.etsudoku.work.WorkScheduleManager
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Provider
|
import javax.inject.Provider
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ import javax.inject.Provider
|
|||||||
class App : Application(), Configuration.Provider {
|
class App : Application(), Configuration.Provider {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var database: Provider<TokushoDatabase>
|
lateinit var database: Provider<EtsudokuDatabase>
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var settings: KotatsuAppSettings
|
lateinit var settings: KotatsuAppSettings
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho
|
package org.xtimms.etsudoku
|
||||||
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
@@ -11,13 +11,13 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import org.xtimms.tokusho.ui.theme.SEED
|
import org.xtimms.etsudoku.ui.theme.SEED
|
||||||
import org.xtimms.tokusho.core.prefs.AppSettings
|
import org.xtimms.etsudoku.core.prefs.AppSettings
|
||||||
import org.xtimms.tokusho.core.prefs.DarkThemePreference
|
import org.xtimms.etsudoku.core.prefs.DarkThemePreference
|
||||||
import org.xtimms.tokusho.core.prefs.paletteStyles
|
import org.xtimms.etsudoku.core.prefs.paletteStyles
|
||||||
import org.xtimms.tokusho.ui.monet.LocalTonalPalettes
|
import org.xtimms.etsudoku.ui.monet.LocalTonalPalettes
|
||||||
import org.xtimms.tokusho.ui.monet.PaletteStyle
|
import org.xtimms.etsudoku.ui.monet.PaletteStyle
|
||||||
import org.xtimms.tokusho.ui.monet.TonalPalettes.Companion.toTonalPalettes
|
import org.xtimms.etsudoku.ui.monet.TonalPalettes.Companion.toTonalPalettes
|
||||||
|
|
||||||
data class BottomSheetScrollState(
|
data class BottomSheetScrollState(
|
||||||
val topPadding: Dp,
|
val topPadding: Dp,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho
|
package org.xtimms.etsudoku
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
@@ -20,28 +20,28 @@ import kotlinx.coroutines.flow.SharedFlow
|
|||||||
import kotlinx.coroutines.flow.asSharedFlow
|
import kotlinx.coroutines.flow.asSharedFlow
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||||
import org.xtimms.tokusho.core.cache.CacheDir
|
import org.xtimms.etsudoku.core.cache.CacheDir
|
||||||
import org.xtimms.tokusho.core.cache.ContentCache
|
import org.xtimms.etsudoku.core.cache.ContentCache
|
||||||
import org.xtimms.tokusho.core.cache.MemoryContentCache
|
import org.xtimms.etsudoku.core.cache.MemoryContentCache
|
||||||
import org.xtimms.tokusho.core.cache.StubContentCache
|
import org.xtimms.etsudoku.core.cache.StubContentCache
|
||||||
import org.xtimms.tokusho.core.database.TokushoDatabase
|
import org.xtimms.etsudoku.core.database.EtsudokuDatabase
|
||||||
import org.xtimms.tokusho.core.model.LocalManga
|
import org.xtimms.etsudoku.core.model.LocalManga
|
||||||
import org.xtimms.tokusho.core.network.MangaHttpClient
|
import org.xtimms.etsudoku.core.network.MangaHttpClient
|
||||||
import org.xtimms.tokusho.core.network.interceptors.ImageProxyInterceptor
|
import org.xtimms.etsudoku.core.network.interceptors.ImageProxyInterceptor
|
||||||
import org.xtimms.tokusho.core.os.NetworkState
|
import org.xtimms.etsudoku.core.os.NetworkState
|
||||||
import org.xtimms.tokusho.core.parser.MangaLoaderContextImpl
|
import org.xtimms.etsudoku.core.parser.MangaLoaderContextImpl
|
||||||
import org.xtimms.tokusho.core.parser.MangaRepository
|
import org.xtimms.etsudoku.core.parser.MangaRepository
|
||||||
import org.xtimms.tokusho.core.parser.favicon.FaviconFetcher
|
import org.xtimms.etsudoku.core.parser.favicon.FaviconFetcher
|
||||||
import org.xtimms.tokusho.core.parser.local.LocalStorageChanges
|
import org.xtimms.etsudoku.core.parser.local.LocalStorageChanges
|
||||||
import org.xtimms.tokusho.sections.reader.thumbnails.MangaPageFetcher
|
import org.xtimms.etsudoku.sections.reader.thumbnails.MangaPageFetcher
|
||||||
import org.xtimms.tokusho.utils.CoilImageGetter
|
import org.xtimms.etsudoku.utils.CoilImageGetter
|
||||||
import org.xtimms.tokusho.utils.system.connectivityManager
|
import org.xtimms.etsudoku.utils.system.connectivityManager
|
||||||
import org.xtimms.tokusho.utils.system.isLowRamDevice
|
import org.xtimms.etsudoku.utils.system.isLowRamDevice
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
interface TokushoModule {
|
interface EtsudokuModule {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
fun bindMangaLoaderContext(mangaLoaderContextImpl: MangaLoaderContextImpl): MangaLoaderContext
|
fun bindMangaLoaderContext(mangaLoaderContextImpl: MangaLoaderContextImpl): MangaLoaderContext
|
||||||
@@ -61,8 +61,8 @@ interface TokushoModule {
|
|||||||
@Singleton
|
@Singleton
|
||||||
fun provideMangaDatabase(
|
fun provideMangaDatabase(
|
||||||
@ApplicationContext context: Context,
|
@ApplicationContext context: Context,
|
||||||
): TokushoDatabase {
|
): EtsudokuDatabase {
|
||||||
return TokushoDatabase(context)
|
return EtsudokuDatabase(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho
|
package org.xtimms.etsudoku
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
@@ -11,6 +11,7 @@ import androidx.activity.compose.rememberLauncherForActivityResult
|
|||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
import androidx.activity.enableEdgeToEdge
|
import androidx.activity.enableEdgeToEdge
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
import androidx.compose.animation.animateColorAsState
|
||||||
import androidx.compose.animation.core.Animatable
|
import androidx.compose.animation.core.Animatable
|
||||||
import androidx.compose.animation.core.animateFloatAsState
|
import androidx.compose.animation.core.animateFloatAsState
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
@@ -24,9 +25,12 @@ import androidx.compose.foundation.layout.only
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.statusBarsPadding
|
import androidx.compose.foundation.layout.statusBarsPadding
|
||||||
import androidx.compose.foundation.layout.systemBars
|
import androidx.compose.foundation.layout.systemBars
|
||||||
import androidx.compose.foundation.lazy.grid.LazyGridState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import androidx.compose.foundation.lazy.grid.rememberLazyGridState
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
|
import androidx.compose.material3.surfaceColorAtElevation
|
||||||
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
|
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
|
||||||
import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass
|
import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass
|
||||||
import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass
|
import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass
|
||||||
@@ -35,15 +39,14 @@ import androidx.compose.runtime.LaunchedEffect
|
|||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
import androidx.compose.runtime.derivedStateOf
|
import androidx.compose.runtime.derivedStateOf
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableFloatStateOf
|
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.platform.LocalDensity
|
|
||||||
import androidx.compose.ui.platform.LocalLayoutDirection
|
import androidx.compose.ui.platform.LocalLayoutDirection
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||||
@@ -55,18 +58,18 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.xtimms.tokusho.core.Navigation
|
import org.xtimms.etsudoku.core.Navigation
|
||||||
import org.xtimms.tokusho.core.components.BottomNavBar
|
import org.xtimms.etsudoku.core.components.BottomNavBar
|
||||||
import org.xtimms.tokusho.core.components.ContinueReadingButton
|
import org.xtimms.etsudoku.core.components.ContinueReadingButton
|
||||||
import org.xtimms.tokusho.core.components.NavigationRail
|
import org.xtimms.etsudoku.core.components.NavigationRail
|
||||||
import org.xtimms.tokusho.core.components.TopAppBar
|
import org.xtimms.etsudoku.core.components.TopAppBar
|
||||||
import org.xtimms.tokusho.core.logs.FileLogger
|
import org.xtimms.etsudoku.core.logs.FileLogger
|
||||||
import org.xtimms.tokusho.core.prefs.AppSettings
|
import org.xtimms.etsudoku.core.prefs.AppSettings
|
||||||
import org.xtimms.tokusho.core.screens.UpdateDialogImpl
|
import org.xtimms.etsudoku.core.screens.UpdateDialogImpl
|
||||||
import org.xtimms.tokusho.core.updates.Updater
|
import org.xtimms.etsudoku.core.updates.Updater
|
||||||
import org.xtimms.tokusho.ui.theme.TokushoTheme
|
import org.xtimms.etsudoku.ui.theme.EtsudokuTheme
|
||||||
import org.xtimms.tokusho.utils.system.setLanguage
|
import org.xtimms.etsudoku.utils.system.setLanguage
|
||||||
import org.xtimms.tokusho.utils.system.suspendToast
|
import org.xtimms.etsudoku.utils.system.suspendToast
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
|
@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
|
||||||
@@ -139,7 +142,7 @@ class MainActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
if (isReady.value) {
|
if (isReady.value) {
|
||||||
SettingsProvider {
|
SettingsProvider {
|
||||||
TokushoTheme(
|
EtsudokuTheme(
|
||||||
darkTheme = LocalDarkTheme.current.isDarkTheme(),
|
darkTheme = LocalDarkTheme.current.isDarkTheme(),
|
||||||
isDynamicColorEnabled = LocalDynamicColorSwitch.current,
|
isDynamicColorEnabled = LocalDynamicColorSwitch.current,
|
||||||
isHighContrastModeEnabled = LocalDarkTheme.current.isHighContrastModeEnabled,
|
isHighContrastModeEnabled = LocalDarkTheme.current.isHighContrastModeEnabled,
|
||||||
@@ -218,6 +221,7 @@ class MainActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun MainView(
|
fun MainView(
|
||||||
coil: ImageLoader,
|
coil: ImageLoader,
|
||||||
@@ -225,13 +229,10 @@ fun MainView(
|
|||||||
isCompactScreen: Boolean,
|
isCompactScreen: Boolean,
|
||||||
navController: NavHostController,
|
navController: NavHostController,
|
||||||
) {
|
) {
|
||||||
val density = LocalDensity.current
|
|
||||||
|
|
||||||
val bottomBarState = remember { mutableStateOf(true) }
|
val bottomBarState = remember { mutableStateOf(true) }
|
||||||
var topBarHeightPx by remember { mutableFloatStateOf(0f) }
|
|
||||||
val topBarOffsetY = remember { Animatable(0f) }
|
val topBarOffsetY = remember { Animatable(0f) }
|
||||||
|
|
||||||
val scroll: LazyGridState = rememberLazyGridState()
|
val scroll = rememberLazyListState()
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
@@ -243,12 +244,17 @@ fun MainView(
|
|||||||
if (isScrolled) 1f else 0f,
|
if (isScrolled) 1f else 0f,
|
||||||
label = "Top Bar Background",
|
label = "Top Bar Background",
|
||||||
)
|
)
|
||||||
|
val animatedSearchBarColor by animateColorAsState(
|
||||||
|
if (isScrolled) MaterialTheme.colorScheme.surface else MaterialTheme.colorScheme.surfaceColorAtElevation(6.dp),
|
||||||
|
label = "Top Bar Background",
|
||||||
|
)
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
navController = navController,
|
navController = navController,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.statusBarsPadding()
|
.statusBarsPadding()
|
||||||
.padding(0.dp, 16.dp),
|
.padding(0.dp, 16.dp),
|
||||||
backgroundAlphaProvider = { animatedBgAlpha },
|
backgroundAlphaProvider = { animatedBgAlpha },
|
||||||
|
searchBarColorProvider = { animatedSearchBarColor }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -280,21 +286,17 @@ fun MainView(
|
|||||||
loggers = loggers,
|
loggers = loggers,
|
||||||
navController = navController,
|
navController = navController,
|
||||||
isCompactScreen = false,
|
isCompactScreen = false,
|
||||||
modifier = Modifier,
|
modifier = Modifier.nestedScroll(TopAppBarDefaults.pinnedScrollBehavior().nestedScrollConnection),
|
||||||
padding = PaddingValues(
|
padding = PaddingValues(
|
||||||
start = padding.calculateStartPadding(LocalLayoutDirection.current),
|
start = padding.calculateStartPadding(LocalLayoutDirection.current),
|
||||||
top = systemBarsPadding.calculateTopPadding(),
|
top = systemBarsPadding.calculateTopPadding(),
|
||||||
end = padding.calculateEndPadding(LocalLayoutDirection.current),
|
end = padding.calculateEndPadding(LocalLayoutDirection.current),
|
||||||
bottom = systemBarsPadding.calculateBottomPadding()
|
bottom = systemBarsPadding.calculateBottomPadding()
|
||||||
),
|
),
|
||||||
topBarHeightPx = topBarHeightPx,
|
|
||||||
listState = scroll
|
listState = scroll
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LaunchedEffect(padding) {
|
|
||||||
topBarHeightPx = density.run { padding.calculateTopPadding().toPx() }
|
|
||||||
}
|
|
||||||
Navigation(
|
Navigation(
|
||||||
coil = coil,
|
coil = coil,
|
||||||
loggers = loggers,
|
loggers = loggers,
|
||||||
@@ -305,7 +307,6 @@ fun MainView(
|
|||||||
end = padding.calculateEndPadding(LocalLayoutDirection.current),
|
end = padding.calculateEndPadding(LocalLayoutDirection.current),
|
||||||
),
|
),
|
||||||
padding = padding,
|
padding = padding,
|
||||||
topBarHeightPx = topBarHeightPx,
|
|
||||||
listState = scroll
|
listState = scroll
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core
|
package org.xtimms.etsudoku.core
|
||||||
|
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -14,8 +14,8 @@ import androidx.compose.ui.res.painterResource
|
|||||||
import coil.ImageLoader
|
import coil.ImageLoader
|
||||||
import coil.compose.AsyncImage
|
import coil.compose.AsyncImage
|
||||||
import coil.compose.AsyncImagePainter
|
import coil.compose.AsyncImagePainter
|
||||||
import org.xtimms.tokusho.R
|
import org.xtimms.etsudoku.R
|
||||||
import org.xtimms.tokusho.utils.composable.rememberResourceBitmapPainter
|
import org.xtimms.etsudoku.utils.composable.rememberResourceBitmapPainter
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AsyncImageImpl(
|
fun AsyncImageImpl(
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core
|
package org.xtimms.etsudoku.core
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
@@ -11,10 +11,10 @@ import androidx.compose.material.icons.outlined.LocalLibrary
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import org.xtimms.tokusho.R
|
import org.xtimms.etsudoku.R
|
||||||
import org.xtimms.tokusho.sections.explore.EXPLORE_DESTINATION
|
import org.xtimms.etsudoku.sections.explore.EXPLORE_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.history.HISTORY_DESTINATION
|
import org.xtimms.etsudoku.sections.history.HISTORY_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.shelf.SHELF_DESTINATION
|
import org.xtimms.etsudoku.sections.shelf.SHELF_DESTINATION
|
||||||
|
|
||||||
sealed class BottomNavDestination(
|
sealed class BottomNavDestination(
|
||||||
val value: String,
|
val value: String,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core
|
package org.xtimms.etsudoku.core
|
||||||
|
|
||||||
import androidx.compose.animation.core.Animatable
|
import androidx.compose.animation.core.Animatable
|
||||||
import androidx.compose.animation.core.AnimationVector1D
|
import androidx.compose.animation.core.AnimationVector1D
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core
|
package org.xtimms.etsudoku.core
|
||||||
|
|
||||||
import android.graphics.Path
|
import android.graphics.Path
|
||||||
import android.view.animation.PathInterpolator
|
import android.view.animation.PathInterpolator
|
||||||
@@ -9,7 +9,7 @@ import androidx.compose.animation.fadeOut
|
|||||||
import androidx.compose.animation.slideInHorizontally
|
import androidx.compose.animation.slideInHorizontally
|
||||||
import androidx.compose.animation.slideOutHorizontally
|
import androidx.compose.animation.slideOutHorizontally
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.lazy.grid.LazyGridState
|
import androidx.compose.foundation.lazy.LazyListState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.IntOffset
|
import androidx.compose.ui.unit.IntOffset
|
||||||
@@ -20,69 +20,69 @@ import androidx.navigation.compose.composable
|
|||||||
import androidx.navigation.navArgument
|
import androidx.navigation.navArgument
|
||||||
import coil.ImageLoader
|
import coil.ImageLoader
|
||||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||||
import org.xtimms.tokusho.core.logs.FileLogger
|
import org.xtimms.etsudoku.core.logs.FileLogger
|
||||||
import org.xtimms.tokusho.sections.details.DETAILS_DESTINATION
|
import org.xtimms.etsudoku.sections.details.DETAILS_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.details.DetailsView
|
import org.xtimms.etsudoku.sections.details.DetailsView
|
||||||
import org.xtimms.tokusho.sections.details.FULL_POSTER_DESTINATION
|
import org.xtimms.etsudoku.sections.details.FULL_POSTER_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.details.FullImageView
|
import org.xtimms.etsudoku.sections.details.FullImageView
|
||||||
import org.xtimms.tokusho.sections.details.MANGA_ID_ARGUMENT
|
import org.xtimms.etsudoku.sections.details.MANGA_ID_ARGUMENT
|
||||||
import org.xtimms.tokusho.sections.details.PICTURES_ARGUMENT
|
import org.xtimms.etsudoku.sections.details.PICTURES_ARGUMENT
|
||||||
import org.xtimms.tokusho.sections.explore.ExploreView
|
import org.xtimms.etsudoku.sections.explore.ExploreView
|
||||||
import org.xtimms.tokusho.sections.feed.FEED_DESTINATION
|
import org.xtimms.etsudoku.sections.feed.FEED_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.feed.FeedView
|
import org.xtimms.etsudoku.sections.feed.FeedView
|
||||||
import org.xtimms.tokusho.sections.history.HistoryView
|
import org.xtimms.etsudoku.sections.history.HistoryView
|
||||||
import org.xtimms.tokusho.sections.list.LIST_DESTINATION
|
import org.xtimms.etsudoku.sections.list.LIST_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.list.MangaListView
|
import org.xtimms.etsudoku.sections.list.MangaListView
|
||||||
import org.xtimms.tokusho.sections.list.PROVIDER_ARGUMENT
|
import org.xtimms.etsudoku.sections.list.PROVIDER_ARGUMENT
|
||||||
import org.xtimms.tokusho.sections.reader.READER_DESTINATION
|
import org.xtimms.etsudoku.sections.reader.READER_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.reader.ReaderView
|
import org.xtimms.etsudoku.sections.reader.ReaderView
|
||||||
import org.xtimms.tokusho.sections.search.SEARCH_DESTINATION
|
import org.xtimms.etsudoku.sections.search.SEARCH_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.search.SearchHostView
|
import org.xtimms.etsudoku.sections.search.SearchHostView
|
||||||
import org.xtimms.tokusho.sections.settings.SETTINGS_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.SETTINGS_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.SettingsView
|
import org.xtimms.etsudoku.sections.settings.SettingsView
|
||||||
import org.xtimms.tokusho.sections.settings.about.ABOUT_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.about.ABOUT_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.about.AboutView
|
import org.xtimms.etsudoku.sections.settings.about.AboutView
|
||||||
import org.xtimms.tokusho.sections.settings.about.LICENSES_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.about.LICENSES_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.about.LICENSE_CONTENT_ARGUMENT
|
import org.xtimms.etsudoku.sections.settings.about.LICENSE_CONTENT_ARGUMENT
|
||||||
import org.xtimms.tokusho.sections.settings.about.LICENSE_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.about.LICENSE_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.about.LICENSE_NAME_ARGUMENT
|
import org.xtimms.etsudoku.sections.settings.about.LICENSE_NAME_ARGUMENT
|
||||||
import org.xtimms.tokusho.sections.settings.about.LICENSE_WEBSITE_ARGUMENT
|
import org.xtimms.etsudoku.sections.settings.about.LICENSE_WEBSITE_ARGUMENT
|
||||||
import org.xtimms.tokusho.sections.settings.about.LicenseView
|
import org.xtimms.etsudoku.sections.settings.about.LicenseView
|
||||||
import org.xtimms.tokusho.sections.settings.about.OpenSourceLicensesView
|
import org.xtimms.etsudoku.sections.settings.about.OpenSourceLicensesView
|
||||||
import org.xtimms.tokusho.sections.settings.about.UPDATES_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.about.UPDATES_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.about.UpdateView
|
import org.xtimms.etsudoku.sections.settings.about.UpdateView
|
||||||
import org.xtimms.tokusho.sections.settings.advanced.ADVANCED_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.advanced.ADVANCED_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.advanced.AdvancedView
|
import org.xtimms.etsudoku.sections.settings.advanced.AdvancedView
|
||||||
import org.xtimms.tokusho.sections.settings.appearance.APPEARANCE_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.appearance.APPEARANCE_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.appearance.AppearanceView
|
import org.xtimms.etsudoku.sections.settings.appearance.AppearanceView
|
||||||
import org.xtimms.tokusho.sections.settings.appearance.DARK_THEME_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.appearance.DARK_THEME_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.appearance.DarkThemeView
|
import org.xtimms.etsudoku.sections.settings.appearance.DarkThemeView
|
||||||
import org.xtimms.tokusho.sections.settings.appearance.LANGUAGES_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.appearance.LANGUAGES_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.appearance.LanguagesView
|
import org.xtimms.etsudoku.sections.settings.appearance.LanguagesView
|
||||||
import org.xtimms.tokusho.sections.settings.backup.BACKUP_RESTORE_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.backup.BACKUP_RESTORE_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.backup.BackupRestoreView
|
import org.xtimms.etsudoku.sections.settings.backup.BackupRestoreView
|
||||||
import org.xtimms.tokusho.sections.settings.backup.RESTORE_ARGUMENT
|
import org.xtimms.etsudoku.sections.settings.backup.RESTORE_ARGUMENT
|
||||||
import org.xtimms.tokusho.sections.settings.backup.RESTORE_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.backup.RESTORE_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.backup.RestoreItemsView
|
import org.xtimms.etsudoku.sections.settings.backup.RestoreItemsView
|
||||||
import org.xtimms.tokusho.sections.settings.network.NETWORK_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.network.NETWORK_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.network.NetworkView
|
import org.xtimms.etsudoku.sections.settings.network.NetworkView
|
||||||
import org.xtimms.tokusho.sections.settings.shelf.SHELF_SETTINGS_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.shelf.SHELF_SETTINGS_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.shelf.ShelfSettingsView
|
import org.xtimms.etsudoku.sections.settings.shelf.ShelfSettingsView
|
||||||
import org.xtimms.tokusho.sections.settings.shelf.categories.CATEGORIES_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.shelf.categories.CATEGORIES_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.shelf.categories.CategoriesView
|
import org.xtimms.etsudoku.sections.settings.shelf.categories.CategoriesView
|
||||||
import org.xtimms.tokusho.sections.settings.sources.SOURCES_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.sources.SOURCES_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.sources.SourcesView
|
import org.xtimms.etsudoku.sections.settings.sources.SourcesView
|
||||||
import org.xtimms.tokusho.sections.settings.sources.catalog.CATALOG_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.sources.catalog.CATALOG_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.sources.catalog.SourcesCatalogView
|
import org.xtimms.etsudoku.sections.settings.sources.catalog.SourcesCatalogView
|
||||||
import org.xtimms.tokusho.sections.settings.storage.STORAGE_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.storage.STORAGE_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.settings.storage.StorageView
|
import org.xtimms.etsudoku.sections.settings.storage.StorageView
|
||||||
import org.xtimms.tokusho.sections.shelf.ShelfView
|
import org.xtimms.etsudoku.sections.shelf.ShelfView
|
||||||
import org.xtimms.tokusho.sections.stats.STATS_DESTINATION
|
import org.xtimms.etsudoku.sections.stats.STATS_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.stats.StatsView
|
import org.xtimms.etsudoku.sections.stats.StatsView
|
||||||
import org.xtimms.tokusho.sections.suggestions.SUGGESTIONS_DESTINATION
|
import org.xtimms.etsudoku.sections.suggestions.SUGGESTIONS_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.suggestions.SuggestionsView
|
import org.xtimms.etsudoku.sections.suggestions.SuggestionsView
|
||||||
import org.xtimms.tokusho.utils.StringArrayNavType
|
import org.xtimms.etsudoku.utils.StringArrayNavType
|
||||||
import org.xtimms.tokusho.utils.lang.removeFirstAndLast
|
import org.xtimms.etsudoku.utils.lang.removeFirstAndLast
|
||||||
|
|
||||||
const val DURATION_ENTER = 400
|
const val DURATION_ENTER = 400
|
||||||
const val DURATION_EXIT = 200
|
const val DURATION_EXIT = 200
|
||||||
@@ -100,8 +100,7 @@ fun Navigation(
|
|||||||
isCompactScreen: Boolean,
|
isCompactScreen: Boolean,
|
||||||
modifier: Modifier,
|
modifier: Modifier,
|
||||||
padding: PaddingValues,
|
padding: PaddingValues,
|
||||||
topBarHeightPx: Float,
|
listState: LazyListState,
|
||||||
listState: LazyGridState,
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val navigateBack: () -> Unit = { navController.popBackStack() }
|
val navigateBack: () -> Unit = { navController.popBackStack() }
|
||||||
@@ -166,9 +165,8 @@ fun Navigation(
|
|||||||
currentPage = { 2 },
|
currentPage = { 2 },
|
||||||
showPageTabs = true,
|
showPageTabs = true,
|
||||||
padding = padding,
|
padding = padding,
|
||||||
topBarHeightPx = topBarHeightPx,
|
|
||||||
navigateToDetails = navigateToDetails,
|
navigateToDetails = navigateToDetails,
|
||||||
onRefresh = { true }
|
onRefresh = { true },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,9 +174,9 @@ fun Navigation(
|
|||||||
HistoryView(
|
HistoryView(
|
||||||
coil = coil,
|
coil = coil,
|
||||||
padding = padding,
|
padding = padding,
|
||||||
topBarHeightPx = topBarHeightPx,
|
|
||||||
navigateToDetails = navigateToDetails,
|
navigateToDetails = navigateToDetails,
|
||||||
navigateToReader = { navController.navigate(READER_DESTINATION) }
|
navigateToReader = { navController.navigate(READER_DESTINATION) },
|
||||||
|
listState = listState
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,7 +191,6 @@ fun Navigation(
|
|||||||
},
|
},
|
||||||
navigateToSuggestions = { navController.navigate(SUGGESTIONS_DESTINATION) },
|
navigateToSuggestions = { navController.navigate(SUGGESTIONS_DESTINATION) },
|
||||||
padding = padding,
|
padding = padding,
|
||||||
topBarHeightPx = topBarHeightPx,
|
|
||||||
listState = listState
|
listState = listState
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package org.xtimms.etsudoku.core.base
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.annotation.CallSuper
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import androidx.fragment.app.DialogFragment
|
||||||
|
import androidx.viewbinding.ViewBinding
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
|
||||||
|
abstract class AlertDialogFragment<B : ViewBinding> : DialogFragment() {
|
||||||
|
|
||||||
|
var viewBinding: B? = null
|
||||||
|
private set
|
||||||
|
|
||||||
|
@Deprecated("", ReplaceWith("requireViewBinding()"))
|
||||||
|
protected val binding: B
|
||||||
|
get() = requireViewBinding()
|
||||||
|
|
||||||
|
final override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
|
val binding = onCreateViewBinding(layoutInflater, null)
|
||||||
|
viewBinding = binding
|
||||||
|
return MaterialAlertDialogBuilder(requireContext(), theme)
|
||||||
|
.setView(binding.root)
|
||||||
|
.run(::onBuildDialog)
|
||||||
|
.create()
|
||||||
|
.also(::onDialogCreated)
|
||||||
|
}
|
||||||
|
|
||||||
|
final override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?,
|
||||||
|
) = viewBinding?.root
|
||||||
|
|
||||||
|
final override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
onViewBindingCreated(requireViewBinding(), savedInstanceState)
|
||||||
|
}
|
||||||
|
|
||||||
|
@CallSuper
|
||||||
|
override fun onDestroyView() {
|
||||||
|
viewBinding = null
|
||||||
|
super.onDestroyView()
|
||||||
|
}
|
||||||
|
|
||||||
|
open fun onBuildDialog(builder: MaterialAlertDialogBuilder): MaterialAlertDialogBuilder = builder
|
||||||
|
|
||||||
|
open fun onDialogCreated(dialog: AlertDialog) = Unit
|
||||||
|
|
||||||
|
@Deprecated("", ReplaceWith("viewBinding"))
|
||||||
|
protected fun bindingOrNull() = viewBinding
|
||||||
|
|
||||||
|
fun requireViewBinding(): B = checkNotNull(viewBinding) {
|
||||||
|
"Fragment $this did not return a ViewBinding from onCreateView() or this was called before onCreateView()."
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract fun onCreateViewBinding(inflater: LayoutInflater, container: ViewGroup?): B
|
||||||
|
|
||||||
|
protected open fun onViewBindingCreated(binding: B, savedInstanceState: Bundle?) = Unit
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package org.xtimms.etsudoku.core.base
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.content.res.Configuration
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.view.WindowCompat
|
||||||
|
import androidx.viewbinding.ViewBinding
|
||||||
|
|
||||||
|
@Suppress("LeakingThis")
|
||||||
|
abstract class BaseActivity<B : ViewBinding> :
|
||||||
|
AppCompatActivity() {
|
||||||
|
|
||||||
|
lateinit var viewBinding: B
|
||||||
|
private set
|
||||||
|
|
||||||
|
private var defaultStatusBarColor = Color.TRANSPARENT
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
putDataToExtras(intent)
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNewIntent(intent: Intent?) {
|
||||||
|
putDataToExtras(intent)
|
||||||
|
super.onNewIntent(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("Use ViewBinding", level = DeprecationLevel.ERROR)
|
||||||
|
override fun setContentView(layoutResID: Int) {
|
||||||
|
super.setContentView(layoutResID)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("Use ViewBinding", level = DeprecationLevel.ERROR)
|
||||||
|
override fun setContentView(view: View?) {
|
||||||
|
super.setContentView(view)
|
||||||
|
}
|
||||||
|
|
||||||
|
protected fun setContentView(binding: B) {
|
||||||
|
this.viewBinding = binding
|
||||||
|
super.setContentView(binding.root)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSupportNavigateUp(): Boolean {
|
||||||
|
dispatchNavigateUp()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
protected fun isDarkAmoledTheme(): Boolean {
|
||||||
|
val uiMode = resources.configuration.uiMode
|
||||||
|
return uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES
|
||||||
|
}
|
||||||
|
|
||||||
|
protected open fun dispatchNavigateUp() {
|
||||||
|
val upIntent = parentActivityIntent
|
||||||
|
if (upIntent != null) {
|
||||||
|
if (!navigateUpTo(upIntent)) {
|
||||||
|
startActivity(upIntent)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
finishAfterTransition()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun putDataToExtras(intent: Intent?) {
|
||||||
|
intent?.putExtra(EXTRA_DATA, intent.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
const val EXTRA_DATA = "data"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.base.event
|
package org.xtimms.etsudoku.core.base.event
|
||||||
|
|
||||||
interface PagedUiEvent : UiEvent {
|
interface PagedUiEvent : UiEvent {
|
||||||
fun loadMore()
|
fun loadMore()
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.base.event
|
package org.xtimms.etsudoku.core.base.event
|
||||||
|
|
||||||
interface UiEvent {
|
interface UiEvent {
|
||||||
fun showMessage(message: String?)
|
fun showMessage(message: String?)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.base.state
|
package org.xtimms.etsudoku.core.base.state
|
||||||
|
|
||||||
abstract class PagedUiState : UiState() {
|
abstract class PagedUiState : UiState() {
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.base.state
|
package org.xtimms.etsudoku.core.base.state
|
||||||
|
|
||||||
abstract class UiState {
|
abstract class UiState {
|
||||||
abstract val isLoading: Boolean
|
abstract val isLoading: Boolean
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.base.viewmodel
|
package org.xtimms.etsudoku.core.base.viewmodel
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
@@ -11,11 +11,11 @@ import kotlinx.coroutines.flow.StateFlow
|
|||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.xtimms.tokusho.core.base.event.UiEvent
|
import org.xtimms.etsudoku.core.base.event.UiEvent
|
||||||
import org.xtimms.tokusho.core.base.state.UiState
|
import org.xtimms.etsudoku.core.base.state.UiState
|
||||||
import org.xtimms.tokusho.utils.lang.EventFlow
|
import org.xtimms.etsudoku.utils.lang.EventFlow
|
||||||
import org.xtimms.tokusho.utils.lang.MutableEventFlow
|
import org.xtimms.etsudoku.utils.lang.MutableEventFlow
|
||||||
import org.xtimms.tokusho.utils.lang.call
|
import org.xtimms.etsudoku.utils.lang.call
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
import kotlin.coroutines.EmptyCoroutineContext
|
import kotlin.coroutines.EmptyCoroutineContext
|
||||||
import kotlin.coroutines.cancellation.CancellationException
|
import kotlin.coroutines.cancellation.CancellationException
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.base.viewmodel
|
package org.xtimms.etsudoku.core.base.viewmodel
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
@@ -17,9 +17,9 @@ import kotlinx.coroutines.flow.onStart
|
|||||||
import kotlinx.coroutines.flow.stateIn
|
import kotlinx.coroutines.flow.stateIn
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.xtimms.tokusho.utils.lang.EventFlow
|
import org.xtimms.etsudoku.utils.lang.EventFlow
|
||||||
import org.xtimms.tokusho.utils.lang.MutableEventFlow
|
import org.xtimms.etsudoku.utils.lang.MutableEventFlow
|
||||||
import org.xtimms.tokusho.utils.lang.call
|
import org.xtimms.etsudoku.utils.lang.call
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
import kotlin.coroutines.EmptyCoroutineContext
|
import kotlin.coroutines.EmptyCoroutineContext
|
||||||
import kotlin.coroutines.cancellation.CancellationException
|
import kotlin.coroutines.cancellation.CancellationException
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.cache
|
package org.xtimms.etsudoku.core.cache
|
||||||
|
|
||||||
enum class CacheDir(val dir: String) {
|
enum class CacheDir(val dir: String) {
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.cache
|
package org.xtimms.etsudoku.core.cache
|
||||||
|
|
||||||
import org.koitharu.kotatsu.parsers.model.Manga
|
import org.koitharu.kotatsu.parsers.model.Manga
|
||||||
import org.koitharu.kotatsu.parsers.model.MangaPage
|
import org.koitharu.kotatsu.parsers.model.MangaPage
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.cache
|
package org.xtimms.etsudoku.core.cache
|
||||||
|
|
||||||
import androidx.collection.LruCache
|
import androidx.collection.LruCache
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.cache
|
package org.xtimms.etsudoku.core.cache
|
||||||
|
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.cache
|
package org.xtimms.etsudoku.core.cache
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.ComponentCallbacks2
|
import android.content.ComponentCallbacks2
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.cache
|
package org.xtimms.etsudoku.core.cache
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
@@ -13,13 +13,13 @@ import okio.buffer
|
|||||||
import okio.sink
|
import okio.sink
|
||||||
import org.koitharu.kotatsu.parsers.util.SuspendLazy
|
import org.koitharu.kotatsu.parsers.util.SuspendLazy
|
||||||
import org.koitharu.kotatsu.parsers.util.runCatchingCancellable
|
import org.koitharu.kotatsu.parsers.util.runCatchingCancellable
|
||||||
import org.xtimms.tokusho.utils.FileSize
|
import org.xtimms.etsudoku.utils.FileSize
|
||||||
import org.xtimms.tokusho.utils.lang.longHashCode
|
import org.xtimms.etsudoku.utils.lang.longHashCode
|
||||||
import org.xtimms.tokusho.utils.lang.writeAllCancellable
|
import org.xtimms.etsudoku.utils.lang.writeAllCancellable
|
||||||
import org.xtimms.tokusho.utils.system.compressToPNG
|
import org.xtimms.etsudoku.utils.system.compressToPNG
|
||||||
import org.xtimms.tokusho.utils.system.subdir
|
import org.xtimms.etsudoku.utils.system.subdir
|
||||||
import org.xtimms.tokusho.utils.system.takeIfReadable
|
import org.xtimms.etsudoku.utils.system.takeIfReadable
|
||||||
import org.xtimms.tokusho.utils.system.takeIfWriteable
|
import org.xtimms.etsudoku.utils.system.takeIfWriteable
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.cache
|
package org.xtimms.etsudoku.core.cache
|
||||||
|
|
||||||
import kotlinx.coroutines.Deferred
|
import kotlinx.coroutines.Deferred
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.cache
|
package org.xtimms.etsudoku.core.cache
|
||||||
|
|
||||||
import org.koitharu.kotatsu.parsers.model.Manga
|
import org.koitharu.kotatsu.parsers.model.Manga
|
||||||
import org.koitharu.kotatsu.parsers.model.MangaPage
|
import org.koitharu.kotatsu.parsers.model.MangaPage
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.animation.core.animateDpAsState
|
import androidx.compose.animation.core.animateDpAsState
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
@@ -31,7 +31,7 @@ import androidx.compose.ui.platform.LocalDensity
|
|||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.min
|
import androidx.compose.ui.unit.min
|
||||||
import org.xtimms.tokusho.ui.theme.TokushoTheme
|
import org.xtimms.etsudoku.ui.theme.EtsudokuTheme
|
||||||
import java.lang.Integer.MAX_VALUE
|
import java.lang.Integer.MAX_VALUE
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ fun AnimatedButton(
|
|||||||
@Preview(name = "Icon")
|
@Preview(name = "Icon")
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreviewWithIcon() {
|
private fun PreviewWithIcon() {
|
||||||
TokushoTheme {
|
EtsudokuTheme {
|
||||||
AnimatedButton(
|
AnimatedButton(
|
||||||
type = ButtonType.PRIMARY,
|
type = ButtonType.PRIMARY,
|
||||||
icon = Icons.Outlined.Edit
|
icon = Icons.Outlined.Edit
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.animation.AnimatedContent
|
import androidx.compose.animation.AnimatedContent
|
||||||
import androidx.compose.animation.SizeTransform
|
import androidx.compose.animation.SizeTransform
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.animation.core.Animatable
|
import androidx.compose.animation.core.Animatable
|
||||||
import androidx.compose.animation.core.TweenSpec
|
import androidx.compose.animation.core.TweenSpec
|
||||||
@@ -14,19 +14,25 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.times
|
import androidx.compose.ui.unit.times
|
||||||
import org.xtimms.tokusho.core.components.shape.WavyShape
|
import org.xtimms.etsudoku.core.components.shape.WavyShape
|
||||||
import org.xtimms.tokusho.utils.lang.clamp
|
import org.xtimms.etsudoku.utils.lang.clamp
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun BackgroundProgress(
|
fun BackgroundProgress(
|
||||||
color: Color,
|
color: Color,
|
||||||
|
alpha: Float,
|
||||||
|
percent: Float,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val percentWithNewSpent = 0.2f // TODO
|
val animatedAlpha = animateFloatAsState(
|
||||||
|
label = "alpha",
|
||||||
|
targetValue = alpha,
|
||||||
|
animationSpec = TweenSpec(500)
|
||||||
|
).value
|
||||||
|
|
||||||
val percentWithNewSpentAnimated = animateFloatAsState(
|
val percentAnimated = animateFloatAsState(
|
||||||
label = "percentWithNewSpentAnimated",
|
label = "percentAnimated",
|
||||||
targetValue = percentWithNewSpent,
|
targetValue = percent,
|
||||||
animationSpec = TweenSpec(300),
|
animationSpec = TweenSpec(300),
|
||||||
).value
|
).value
|
||||||
|
|
||||||
@@ -36,15 +42,15 @@ fun BackgroundProgress(
|
|||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.background(
|
.background(
|
||||||
color.copy(alpha = 0.33f),
|
color.copy(alpha = animatedAlpha),
|
||||||
shape = WavyShape(
|
shape = WavyShape(
|
||||||
period = 30.dp,
|
period = 30.dp,
|
||||||
amplitude = percentWithNewSpentAnimated.clamp(0.96f, 1f) * 2.dp,
|
amplitude = percentAnimated.clamp(0.96f, 1f) * 2.dp,
|
||||||
shift = shift.value,
|
shift = shift.value,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.fillMaxHeight()
|
.fillMaxHeight()
|
||||||
.fillMaxWidth(percentWithNewSpentAnimated),
|
.fillMaxWidth(percentAnimated),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.core.Animatable
|
import androidx.compose.animation.core.Animatable
|
||||||
@@ -19,11 +19,11 @@ import androidx.navigation.NavController
|
|||||||
import androidx.navigation.NavGraph.Companion.findStartDestination
|
import androidx.navigation.NavGraph.Companion.findStartDestination
|
||||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.xtimms.tokusho.core.BottomNavDestination
|
import org.xtimms.etsudoku.core.BottomNavDestination
|
||||||
import org.xtimms.tokusho.core.BottomNavDestination.Companion.Icon
|
import org.xtimms.etsudoku.core.BottomNavDestination.Companion.Icon
|
||||||
import org.xtimms.tokusho.sections.explore.EXPLORE_DESTINATION
|
import org.xtimms.etsudoku.sections.explore.EXPLORE_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.history.HISTORY_DESTINATION
|
import org.xtimms.etsudoku.sections.history.HISTORY_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.shelf.SHELF_DESTINATION
|
import org.xtimms.etsudoku.sections.shelf.SHELF_DESTINATION
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun BottomNavBar(
|
fun BottomNavBar(
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@@ -12,7 +12,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
|
|||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import org.xtimms.tokusho.R
|
import org.xtimms.etsudoku.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ConfirmButton(
|
fun ConfirmButton(
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.core.animateFloatAsState
|
import androidx.compose.animation.core.animateFloatAsState
|
||||||
@@ -23,9 +23,9 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
import org.xtimms.tokusho.R
|
import org.xtimms.etsudoku.R
|
||||||
import org.xtimms.tokusho.sections.history.HISTORY_DESTINATION
|
import org.xtimms.etsudoku.sections.history.HISTORY_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.reader.READER_DESTINATION
|
import org.xtimms.etsudoku.sections.reader.READER_DESTINATION
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ContinueReadingButton(
|
fun ContinueReadingButton(
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.animation.core.animateDpAsState
|
import androidx.compose.animation.core.animateDpAsState
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
@@ -34,7 +34,7 @@ private val ButtonsCrossAxisSpacing = Arrangement.spacedBy(12.dp, Alignment.Top)
|
|||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
|
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun TokushoDialog(
|
fun EtsudokuDialog(
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
confirmButton: @Composable () -> Unit,
|
confirmButton: @Composable () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.core.CubicBezierEasing
|
import androidx.compose.animation.core.CubicBezierEasing
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
|
import android.text.Spanned
|
||||||
|
import android.text.style.BulletSpan
|
||||||
|
import android.text.style.ForegroundColorSpan
|
||||||
|
import android.text.style.RelativeSizeSpan
|
||||||
|
import android.text.style.StrikethroughSpan
|
||||||
|
import android.text.style.StyleSpan
|
||||||
|
import android.text.style.SubscriptSpan
|
||||||
|
import android.text.style.SuperscriptSpan
|
||||||
|
import android.text.style.TypefaceSpan
|
||||||
|
import android.text.style.URLSpan
|
||||||
|
import android.text.style.UnderlineSpan
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.compose.foundation.text.ClickableText
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.text.AnnotatedString
|
||||||
|
import androidx.compose.ui.text.SpanStyle
|
||||||
|
import androidx.compose.ui.text.TextLayoutResult
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.buildAnnotatedString
|
||||||
|
import androidx.compose.ui.text.style.TextDecoration
|
||||||
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.unit.TextUnit
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.core.text.HtmlCompat
|
||||||
|
import org.xtimms.etsudoku.utils.spanStyle
|
||||||
|
|
||||||
|
private const val URL_TAG = "url_tag"
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun HtmlTextField(
|
||||||
|
text: String,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
style: TextStyle = TextStyle.Default,
|
||||||
|
softWrap: Boolean = true,
|
||||||
|
overflow: TextOverflow = TextOverflow.Clip,
|
||||||
|
maxLines: Int = Int.MAX_VALUE,
|
||||||
|
onTextLayout: (TextLayoutResult) -> Unit = {},
|
||||||
|
linkClicked: ((String) -> Unit)? = null,
|
||||||
|
fontSize: TextUnit = 14.sp,
|
||||||
|
flags: Int = HtmlCompat.FROM_HTML_MODE_COMPACT,
|
||||||
|
urlSpanStyle: SpanStyle = SpanStyle(
|
||||||
|
color = linkTextColor(),
|
||||||
|
textDecoration = TextDecoration.Underline
|
||||||
|
),
|
||||||
|
customSpannedHandler: ((Spanned) -> AnnotatedString)? = null
|
||||||
|
) {
|
||||||
|
val content = text.asHTML(fontSize, flags, urlSpanStyle, customSpannedHandler)
|
||||||
|
if (linkClicked != null) {
|
||||||
|
ClickableText(
|
||||||
|
modifier = modifier,
|
||||||
|
text = content,
|
||||||
|
style = style,
|
||||||
|
softWrap = softWrap,
|
||||||
|
overflow = overflow,
|
||||||
|
maxLines = maxLines,
|
||||||
|
onTextLayout = onTextLayout,
|
||||||
|
onClick = {
|
||||||
|
content
|
||||||
|
.getStringAnnotations(URL_TAG, it, it)
|
||||||
|
.firstOrNull()
|
||||||
|
?.let { stringAnnotation -> linkClicked(stringAnnotation.item) }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Text(
|
||||||
|
modifier = modifier,
|
||||||
|
text = content,
|
||||||
|
style = style,
|
||||||
|
softWrap = softWrap,
|
||||||
|
overflow = overflow,
|
||||||
|
maxLines = maxLines,
|
||||||
|
onTextLayout = onTextLayout
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun linkTextColor() = Color(
|
||||||
|
TextView(LocalContext.current).linkTextColors.defaultColor
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun String.asHTML(
|
||||||
|
fontSize: TextUnit,
|
||||||
|
flags: Int,
|
||||||
|
URLSpanStyle: SpanStyle,
|
||||||
|
customSpannedHandler: ((Spanned) -> AnnotatedString)? = null
|
||||||
|
) = buildAnnotatedString {
|
||||||
|
val spanned = HtmlCompat.fromHtml(this@asHTML, flags)
|
||||||
|
val spans = spanned.getSpans(0, spanned.length, Any::class.java)
|
||||||
|
|
||||||
|
if (customSpannedHandler != null) {
|
||||||
|
append(customSpannedHandler(spanned))
|
||||||
|
} else {
|
||||||
|
append(spanned.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
spans
|
||||||
|
.filter { it !is BulletSpan }
|
||||||
|
.forEach { span ->
|
||||||
|
val start = spanned.getSpanStart(span)
|
||||||
|
val end = spanned.getSpanEnd(span)
|
||||||
|
when (span) {
|
||||||
|
is RelativeSizeSpan -> span.spanStyle(fontSize)
|
||||||
|
is StyleSpan -> span.spanStyle()
|
||||||
|
is UnderlineSpan -> span.spanStyle()
|
||||||
|
is ForegroundColorSpan -> span.spanStyle()
|
||||||
|
is TypefaceSpan -> span.spanStyle()
|
||||||
|
is StrikethroughSpan -> span.spanStyle()
|
||||||
|
is SuperscriptSpan -> span.spanStyle()
|
||||||
|
is SubscriptSpan -> span.spanStyle()
|
||||||
|
is URLSpan -> {
|
||||||
|
addStringAnnotation(
|
||||||
|
tag = URL_TAG,
|
||||||
|
annotation = span.url,
|
||||||
|
start = start,
|
||||||
|
end = end
|
||||||
|
)
|
||||||
|
URLSpanStyle
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}?.let { spanStyle ->
|
||||||
|
addStyle(spanStyle, start, end)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal fun UnderlineSpan.spanStyle(): SpanStyle =
|
||||||
|
SpanStyle(textDecoration = TextDecoration.Underline)
|
||||||
|
|
||||||
|
internal fun ForegroundColorSpan.spanStyle(): SpanStyle =
|
||||||
|
SpanStyle(color = Color(foregroundColor))
|
||||||
|
|
||||||
|
internal fun StrikethroughSpan.spanStyle(): SpanStyle =
|
||||||
|
SpanStyle(textDecoration = TextDecoration.LineThrough)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
@@ -14,7 +14,7 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import org.xtimms.tokusho.R
|
import org.xtimms.etsudoku.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun BackIconButton(
|
fun BackIconButton(
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
@@ -14,7 +14,7 @@ import androidx.compose.ui.layout.ContentScale
|
|||||||
import androidx.compose.ui.semantics.Role
|
import androidx.compose.ui.semantics.Role
|
||||||
import coil.ImageLoader
|
import coil.ImageLoader
|
||||||
import coil.compose.AsyncImage
|
import coil.compose.AsyncImage
|
||||||
import org.xtimms.tokusho.core.AsyncImageImpl
|
import org.xtimms.etsudoku.core.AsyncImageImpl
|
||||||
|
|
||||||
enum class MangaCover(val ratio: Float) {
|
enum class MangaCover(val ratio: Float) {
|
||||||
Square(1f / 1f),
|
Square(1f / 1f),
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
@@ -33,7 +33,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import coil.ImageLoader
|
import coil.ImageLoader
|
||||||
import org.koitharu.kotatsu.parsers.model.Manga
|
import org.koitharu.kotatsu.parsers.model.Manga
|
||||||
import org.xtimms.tokusho.core.AsyncImageImpl
|
import org.xtimms.etsudoku.core.AsyncImageImpl
|
||||||
|
|
||||||
private const val GridSelectedCoverAlpha = 0.76f
|
private const val GridSelectedCoverAlpha = 0.76f
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@@ -19,9 +19,9 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import androidx.navigation.NavGraph.Companion.findStartDestination
|
import androidx.navigation.NavGraph.Companion.findStartDestination
|
||||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
import org.xtimms.tokusho.core.BottomNavDestination
|
import org.xtimms.etsudoku.core.BottomNavDestination
|
||||||
import org.xtimms.tokusho.core.BottomNavDestination.Companion.Icon
|
import org.xtimms.etsudoku.core.BottomNavDestination.Companion.Icon
|
||||||
import org.xtimms.tokusho.sections.search.SEARCH_DESTINATION
|
import org.xtimms.etsudoku.sections.search.SEARCH_DESTINATION
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun NavigationRail(
|
fun NavigationRail(
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.animation.AnimatedContent
|
import androidx.compose.animation.AnimatedContent
|
||||||
import androidx.compose.animation.SizeTransform
|
import androidx.compose.animation.SizeTransform
|
||||||
@@ -65,14 +65,14 @@ import androidx.compose.ui.text.style.TextOverflow
|
|||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import org.xtimms.tokusho.ui.theme.FixedAccentColors
|
import org.xtimms.etsudoku.ui.theme.FixedAccentColors
|
||||||
import org.xtimms.tokusho.R
|
import org.xtimms.etsudoku.R
|
||||||
import org.xtimms.tokusho.ui.monet.LocalTonalPalettes
|
import org.xtimms.etsudoku.ui.monet.LocalTonalPalettes
|
||||||
import org.xtimms.tokusho.ui.monet.TonalPalettes.Companion.toTonalPalettes
|
import org.xtimms.etsudoku.ui.monet.TonalPalettes.Companion.toTonalPalettes
|
||||||
import org.xtimms.tokusho.ui.theme.PreviewThemeLight
|
import org.xtimms.etsudoku.ui.theme.PreviewThemeLight
|
||||||
import org.xtimms.tokusho.ui.theme.TokushoTheme
|
import org.xtimms.etsudoku.ui.theme.EtsudokuTheme
|
||||||
import org.xtimms.tokusho.ui.theme.applyOpacity
|
import org.xtimms.etsudoku.ui.theme.applyOpacity
|
||||||
import org.xtimms.tokusho.utils.FileSize
|
import org.xtimms.etsudoku.utils.FileSize
|
||||||
|
|
||||||
private const val horizontal = 8
|
private const val horizontal = 8
|
||||||
private const val vertical = 16
|
private const val vertical = 16
|
||||||
@@ -754,7 +754,7 @@ fun PreferenceStorageItem(
|
|||||||
@Composable
|
@Composable
|
||||||
@Preview(showBackground = true)
|
@Preview(showBackground = true)
|
||||||
fun PreferenceStorageHeaderPreview() {
|
fun PreferenceStorageHeaderPreview() {
|
||||||
TokushoTheme {
|
EtsudokuTheme {
|
||||||
PreferenceStorageHeader()
|
PreferenceStorageHeader()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -762,7 +762,7 @@ fun PreferenceStorageHeaderPreview() {
|
|||||||
@Composable
|
@Composable
|
||||||
@Preview(showBackground = true)
|
@Preview(showBackground = true)
|
||||||
fun PreferenceStorageItemPreview() {
|
fun PreferenceStorageItemPreview() {
|
||||||
TokushoTheme {
|
EtsudokuTheme {
|
||||||
PreferenceStorageItem(title = "Saved manga", icon = Icons.Outlined.Save, total = 0F)
|
PreferenceStorageItem(title = "Saved manga", icon = Icons.Outlined.Save, total = 0F)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.animation.core.animate
|
import androidx.compose.animation.core.animate
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
@@ -0,0 +1,244 @@
|
|||||||
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
|
import android.content.res.Configuration.UI_MODE_NIGHT_YES
|
||||||
|
import androidx.compose.animation.AnimatedContent
|
||||||
|
import androidx.compose.animation.animateColorAsState
|
||||||
|
import androidx.compose.animation.core.Animatable
|
||||||
|
import androidx.compose.animation.core.FloatTweenSpec
|
||||||
|
import androidx.compose.animation.core.LinearEasing
|
||||||
|
import androidx.compose.animation.core.RepeatMode
|
||||||
|
import androidx.compose.animation.core.TweenSpec
|
||||||
|
import androidx.compose.animation.core.VectorConverter
|
||||||
|
import androidx.compose.animation.core.animateValue
|
||||||
|
import androidx.compose.animation.core.infiniteRepeatable
|
||||||
|
import androidx.compose.animation.core.rememberInfiniteTransition
|
||||||
|
import androidx.compose.animation.core.tween
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.RowScope
|
||||||
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
|
import androidx.compose.material3.Card
|
||||||
|
import androidx.compose.material3.CardDefaults
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.drawWithContent
|
||||||
|
import androidx.compose.ui.geometry.Offset
|
||||||
|
import androidx.compose.ui.geometry.Size
|
||||||
|
import androidx.compose.ui.graphics.BlendMode
|
||||||
|
import androidx.compose.ui.graphics.Brush
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.drawscope.ContentDrawScope
|
||||||
|
import androidx.compose.ui.graphics.nativeCanvas
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import org.xtimms.etsudoku.R
|
||||||
|
import org.xtimms.etsudoku.core.model.MangaHistory
|
||||||
|
import org.xtimms.etsudoku.sections.details.model.HistoryInfo
|
||||||
|
import org.xtimms.etsudoku.ui.theme.EtsudokuTheme
|
||||||
|
import java.time.Instant
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun RowScope.ReadButton(
|
||||||
|
info: HistoryInfo,
|
||||||
|
estimatedReadTime: String
|
||||||
|
) {
|
||||||
|
|
||||||
|
val shift = remember { Animatable(0f) }
|
||||||
|
val coroutineScope = rememberCoroutineScope()
|
||||||
|
|
||||||
|
val animatedCardContainerColor = animateColorAsState(
|
||||||
|
label = "animatedCardContainerColor",
|
||||||
|
targetValue = if (info.totalChapters == 0) MaterialTheme.colorScheme.errorContainer else MaterialTheme.colorScheme.primaryContainer,
|
||||||
|
animationSpec = TweenSpec(500)
|
||||||
|
).value
|
||||||
|
|
||||||
|
val animatedCardContentColor = animateColorAsState(
|
||||||
|
label = "animatedCardContentColor",
|
||||||
|
targetValue = if (info.totalChapters == 0) MaterialTheme.colorScheme.onErrorContainer else MaterialTheme.colorScheme.onPrimaryContainer,
|
||||||
|
animationSpec = TweenSpec(500)
|
||||||
|
).value
|
||||||
|
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
fun anim() {
|
||||||
|
coroutineScope.launch {
|
||||||
|
shift.animateTo(
|
||||||
|
1f,
|
||||||
|
animationSpec = FloatTweenSpec(4000, 0, LinearEasing)
|
||||||
|
)
|
||||||
|
shift.snapTo(0f)
|
||||||
|
anim()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
anim()
|
||||||
|
}
|
||||||
|
|
||||||
|
Card(
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1F)
|
||||||
|
.height(54.dp),
|
||||||
|
shape = CircleShape,
|
||||||
|
colors = CardDefaults.cardColors(
|
||||||
|
containerColor = animatedCardContainerColor,
|
||||||
|
contentColor = animatedCardContentColor,
|
||||||
|
),
|
||||||
|
onClick = {
|
||||||
|
// todo
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.fillMaxHeight(),
|
||||||
|
contentAlignment = Alignment.CenterEnd,
|
||||||
|
) {
|
||||||
|
BackgroundProgress(
|
||||||
|
if (info.totalChapters == 0) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.primary,
|
||||||
|
if (!info.isValid) 0.1f else 0.33f,
|
||||||
|
info.history?.percent?.coerceIn(0f, 1f) ?: 0f
|
||||||
|
)
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.drawWithLayer {
|
||||||
|
drawContent()
|
||||||
|
val leftOffset = size.width - 20.dp.toPx()
|
||||||
|
drawRect(
|
||||||
|
topLeft = Offset(leftOffset, 0f),
|
||||||
|
size = Size(
|
||||||
|
20.dp.toPx(),
|
||||||
|
size.height,
|
||||||
|
),
|
||||||
|
blendMode = BlendMode.SrcIn,
|
||||||
|
brush = Brush.horizontalGradient(
|
||||||
|
colors = listOf(
|
||||||
|
Color.Black,
|
||||||
|
Color.Black.copy(alpha = 0f),
|
||||||
|
),
|
||||||
|
startX = leftOffset,
|
||||||
|
endX = leftOffset + 14.dp.toPx()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.Center,
|
||||||
|
) {
|
||||||
|
val infiniteTransition by rememberInfiniteTransition("infiniteTransition").animateValue(
|
||||||
|
label = "infiniteTransition",
|
||||||
|
initialValue = 0,
|
||||||
|
targetValue = 2,
|
||||||
|
typeConverter = Int.VectorConverter,
|
||||||
|
animationSpec = infiniteRepeatable(tween(15000), RepeatMode.Restart)
|
||||||
|
)
|
||||||
|
val chaptersSubtitle = when {
|
||||||
|
!info.isValid -> stringResource(R.string.loading_)
|
||||||
|
info.currentChapter >= 0 -> when (infiniteTransition) {
|
||||||
|
1 -> stringResource(
|
||||||
|
R.string.chapter_d_of_d,
|
||||||
|
info.currentChapter + 1,
|
||||||
|
info.totalChapters,
|
||||||
|
)
|
||||||
|
0 -> estimatedReadTime
|
||||||
|
else -> estimatedReadTime
|
||||||
|
}
|
||||||
|
|
||||||
|
info.totalChapters == 0 -> stringResource(R.string.no_chapters)
|
||||||
|
else -> LocalContext.current.resources.getQuantityString(
|
||||||
|
R.plurals.chapters,
|
||||||
|
info.totalChapters,
|
||||||
|
info.totalChapters,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
text = if (info.history != null) {
|
||||||
|
stringResource(R.string.continue_reading)
|
||||||
|
} else {
|
||||||
|
stringResource(R.string.read)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
AnimatedContent(targetState = chaptersSubtitle, label = "Subtitle animation") {
|
||||||
|
Text(
|
||||||
|
text = it,
|
||||||
|
style = MaterialTheme.typography.labelMedium,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ContentDrawScope.drawWithLayer(block: ContentDrawScope.() -> Unit) {
|
||||||
|
with(drawContext.canvas.nativeCanvas) {
|
||||||
|
val checkPoint = saveLayer(null, null)
|
||||||
|
block()
|
||||||
|
restoreToCount(checkPoint)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Modifier.drawWithLayer(block: ContentDrawScope.() -> Unit) = this.then(
|
||||||
|
Modifier.drawWithContent {
|
||||||
|
drawWithLayer {
|
||||||
|
block()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
private fun Preview() {
|
||||||
|
EtsudokuTheme {
|
||||||
|
Row {
|
||||||
|
ReadButton(
|
||||||
|
HistoryInfo(
|
||||||
|
100,
|
||||||
|
33,
|
||||||
|
MangaHistory(
|
||||||
|
Instant.now(),
|
||||||
|
Instant.now(),
|
||||||
|
1,
|
||||||
|
3,
|
||||||
|
1,
|
||||||
|
50f
|
||||||
|
)
|
||||||
|
),
|
||||||
|
"123"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview(name = "Night mode", uiMode = UI_MODE_NIGHT_YES)
|
||||||
|
@Composable
|
||||||
|
private fun PreviewNightMode() {
|
||||||
|
EtsudokuTheme {
|
||||||
|
Row {
|
||||||
|
ReadButton(
|
||||||
|
HistoryInfo(
|
||||||
|
100,
|
||||||
|
33,
|
||||||
|
MangaHistory(
|
||||||
|
Instant.now(),
|
||||||
|
Instant.now(),
|
||||||
|
1,
|
||||||
|
3,
|
||||||
|
1,
|
||||||
|
50f
|
||||||
|
)
|
||||||
|
),
|
||||||
|
"123"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.RowScope
|
import androidx.compose.foundation.layout.RowScope
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@@ -15,9 +15,9 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||||||
import androidx.compose.ui.unit.TextUnit
|
import androidx.compose.ui.unit.TextUnit
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import org.xtimms.tokusho.R
|
import org.xtimms.etsudoku.R
|
||||||
import org.xtimms.tokusho.ui.theme.TokushoTheme
|
import org.xtimms.etsudoku.ui.theme.EtsudokuTheme
|
||||||
import org.xtimms.tokusho.utils.lang.toStringPositiveValueOrUnknown
|
import org.xtimms.etsudoku.utils.lang.toStringPositiveValueOrUnknown
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SmallScoreIndicator(
|
fun SmallScoreIndicator(
|
||||||
@@ -48,7 +48,7 @@ fun SmallScoreIndicator(
|
|||||||
@Preview(showBackground = true)
|
@Preview(showBackground = true)
|
||||||
@Composable
|
@Composable
|
||||||
fun SmallScoreIndicatorPreview() {
|
fun SmallScoreIndicatorPreview() {
|
||||||
TokushoTheme {
|
EtsudokuTheme {
|
||||||
SmallScoreIndicator(score = 1f)
|
SmallScoreIndicator(score = 1f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
|
import androidx.compose.animation.animateContentSize
|
||||||
|
import androidx.compose.animation.core.Spring
|
||||||
|
import androidx.compose.animation.core.spring
|
||||||
|
import androidx.compose.foundation.layout.WindowInsets
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
|
||||||
|
import androidx.compose.material.icons.outlined.Close
|
||||||
|
import androidx.compose.material.icons.outlined.Search
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.SearchBar
|
||||||
|
import androidx.compose.material3.SearchBarDefaults
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import org.xtimms.etsudoku.R
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
fun EmbeddedSearchBar(
|
||||||
|
onQueryChange: (String) -> Unit,
|
||||||
|
isSearchActive: Boolean,
|
||||||
|
onActiveChanged: (Boolean) -> Unit,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
onSearch: ((String) -> Unit)? = null,
|
||||||
|
) {
|
||||||
|
var searchQuery by rememberSaveable { mutableStateOf("") }
|
||||||
|
val activeChanged: (Boolean) -> Unit = { active ->
|
||||||
|
searchQuery = ""
|
||||||
|
onQueryChange("")
|
||||||
|
onActiveChanged(active)
|
||||||
|
}
|
||||||
|
SearchBar(
|
||||||
|
query = searchQuery,
|
||||||
|
onQueryChange = { query ->
|
||||||
|
searchQuery = query
|
||||||
|
onQueryChange(query)
|
||||||
|
},
|
||||||
|
onSearch = onSearch ?: { activeChanged(false) },
|
||||||
|
active = isSearchActive,
|
||||||
|
onActiveChange = activeChanged,
|
||||||
|
modifier = if (isSearchActive) {
|
||||||
|
modifier
|
||||||
|
.animateContentSize(spring(stiffness = Spring.StiffnessHigh))
|
||||||
|
} else {
|
||||||
|
modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.animateContentSize(spring(stiffness = Spring.StiffnessHigh))
|
||||||
|
},
|
||||||
|
placeholder = { Text("Search") },
|
||||||
|
leadingIcon = {
|
||||||
|
if (isSearchActive) {
|
||||||
|
IconButton(
|
||||||
|
onClick = { activeChanged(false) },
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.AutoMirrored.Rounded.ArrowBack,
|
||||||
|
contentDescription = null,
|
||||||
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Outlined.Search,
|
||||||
|
contentDescription = null,
|
||||||
|
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trailingIcon = if (isSearchActive && searchQuery.isNotEmpty()) {
|
||||||
|
{
|
||||||
|
IconButton(
|
||||||
|
onClick = {
|
||||||
|
searchQuery = ""
|
||||||
|
onQueryChange("")
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Outlined.Close,
|
||||||
|
contentDescription = null,
|
||||||
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
},
|
||||||
|
colors = SearchBarDefaults.colors(
|
||||||
|
containerColor = if (isSearchActive) {
|
||||||
|
MaterialTheme.colorScheme.background
|
||||||
|
} else {
|
||||||
|
MaterialTheme.colorScheme.surfaceContainerLow
|
||||||
|
},
|
||||||
|
),
|
||||||
|
tonalElevation = 0.dp,
|
||||||
|
windowInsets = if (isSearchActive) {
|
||||||
|
SearchBarDefaults.windowInsets
|
||||||
|
} else {
|
||||||
|
WindowInsets(0.dp)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
// Search suggestions or results
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.animation.AnimatedContent
|
import androidx.compose.animation.AnimatedContent
|
||||||
import androidx.compose.animation.SizeTransform
|
import androidx.compose.animation.SizeTransform
|
||||||
@@ -20,7 +20,7 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import org.xtimms.tokusho.ui.theme.applyOpacity
|
import org.xtimms.etsudoku.ui.theme.applyOpacity
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SettingTitle(text: String) {
|
fun SettingTitle(text: String) {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
@@ -24,8 +24,8 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import coil.ImageLoader
|
import coil.ImageLoader
|
||||||
import org.xtimms.tokusho.core.AsyncImageImpl
|
import org.xtimms.etsudoku.core.AsyncImageImpl
|
||||||
import org.xtimms.tokusho.ui.theme.TokushoTheme
|
import org.xtimms.etsudoku.ui.theme.EtsudokuTheme
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SourceItem(
|
fun SourceItem(
|
||||||
@@ -38,15 +38,15 @@ fun SourceItem(
|
|||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.width(96.dp)
|
.width(88.dp)
|
||||||
.clip(RoundedCornerShape(8.dp))
|
.clip(RoundedCornerShape(8.dp))
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
.padding(start = 8.dp, end = 8.dp),
|
.padding(start = 8.dp, end = 8.dp),
|
||||||
horizontalAlignment = Alignment.Start
|
horizontalAlignment = Alignment.Start
|
||||||
) {
|
) {
|
||||||
Card(
|
Card(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.size(96.dp)
|
.size(88.dp)
|
||||||
.clip(MaterialTheme.shapes.large)
|
.clip(MaterialTheme.shapes.large)
|
||||||
.aspectRatio(1f)
|
.aspectRatio(1f)
|
||||||
) {
|
) {
|
||||||
@@ -55,7 +55,7 @@ fun SourceItem(
|
|||||||
model = faviconUrl,
|
model = faviconUrl,
|
||||||
contentDescription = "favicon",
|
contentDescription = "favicon",
|
||||||
contentScale = ContentScale.Crop,
|
contentScale = ContentScale.Crop,
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.clip(MaterialTheme.shapes.large)
|
.clip(MaterialTheme.shapes.large)
|
||||||
)
|
)
|
||||||
@@ -77,7 +77,7 @@ fun SourceItem(
|
|||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
fun SourceItemPreview() {
|
fun SourceItemPreview() {
|
||||||
TokushoTheme {
|
EtsudokuTheme {
|
||||||
SourceItem(
|
SourceItem(
|
||||||
coil = ImageLoader(LocalContext.current),
|
coil = ImageLoader(LocalContext.current),
|
||||||
faviconUrl = "".toUri(),
|
faviconUrl = "".toUri(),
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import androidx.compose.foundation.isSystemInDarkTheme
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
package org.xtimms.tokusho.core.components
|
package org.xtimms.etsudoku.core.components
|
||||||
|
|
||||||
import android.graphics.Path
|
import android.graphics.Path
|
||||||
import android.view.animation.PathInterpolator
|
import android.view.animation.PathInterpolator
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
|
import androidx.compose.animation.animateColorAsState
|
||||||
|
import androidx.compose.animation.core.FastOutLinearInEasing
|
||||||
|
import androidx.compose.animation.core.Spring
|
||||||
|
import androidx.compose.animation.core.spring
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.animation.fadeIn
|
import androidx.compose.animation.fadeIn
|
||||||
import androidx.compose.animation.fadeOut
|
import androidx.compose.animation.fadeOut
|
||||||
@@ -10,15 +14,28 @@ import androidx.compose.animation.slideInHorizontally
|
|||||||
import androidx.compose.animation.slideOutHorizontally
|
import androidx.compose.animation.slideOutHorizontally
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.basicMarquee
|
import androidx.compose.foundation.basicMarquee
|
||||||
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||||
|
import androidx.compose.foundation.layout.FlowRow
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.RowScope
|
import androidx.compose.foundation.layout.RowScope
|
||||||
|
import androidx.compose.foundation.layout.WindowInsets
|
||||||
|
import androidx.compose.foundation.layout.WindowInsetsSides
|
||||||
|
import androidx.compose.foundation.layout.consumeWindowInsets
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.navigationBars
|
||||||
|
import androidx.compose.foundation.layout.only
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.layout.statusBarsPadding
|
||||||
|
import androidx.compose.foundation.layout.systemBars
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.LazyRow
|
import androidx.compose.foundation.lazy.LazyRow
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
@@ -26,6 +43,7 @@ import androidx.compose.material.icons.Icons
|
|||||||
import androidx.compose.material.icons.filled.Menu
|
import androidx.compose.material.icons.filled.Menu
|
||||||
import androidx.compose.material.icons.outlined.RssFeed
|
import androidx.compose.material.icons.outlined.RssFeed
|
||||||
import androidx.compose.material.icons.outlined.Search
|
import androidx.compose.material.icons.outlined.Search
|
||||||
|
import androidx.compose.material.icons.outlined.SentimentSatisfiedAlt
|
||||||
import androidx.compose.material.icons.outlined.Settings
|
import androidx.compose.material.icons.outlined.Settings
|
||||||
import androidx.compose.material3.Card
|
import androidx.compose.material3.Card
|
||||||
import androidx.compose.material3.CardDefaults
|
import androidx.compose.material3.CardDefaults
|
||||||
@@ -36,11 +54,14 @@ import androidx.compose.material3.LargeTopAppBar
|
|||||||
import androidx.compose.material3.LocalMinimumInteractiveComponentEnforcement
|
import androidx.compose.material3.LocalMinimumInteractiveComponentEnforcement
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.MediumTopAppBar
|
import androidx.compose.material3.MediumTopAppBar
|
||||||
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.SuggestionChip
|
import androidx.compose.material3.SuggestionChip
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TopAppBarColors
|
import androidx.compose.material3.TopAppBarColors
|
||||||
import androidx.compose.material3.TopAppBarDefaults
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
import androidx.compose.material3.TopAppBarScrollBehavior
|
import androidx.compose.material3.TopAppBarScrollBehavior
|
||||||
|
import androidx.compose.material3.rememberTopAppBarState
|
||||||
import androidx.compose.material3.surfaceColorAtElevation
|
import androidx.compose.material3.surfaceColorAtElevation
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
@@ -49,34 +70,42 @@ import androidx.compose.runtime.getValue
|
|||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.Color.Companion.Blue
|
||||||
|
import androidx.compose.ui.graphics.Color.Companion.DarkGray
|
||||||
|
import androidx.compose.ui.graphics.lerp
|
||||||
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.IntOffset
|
import androidx.compose.ui.unit.IntOffset
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
|
import androidx.navigation.NavHostController
|
||||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import org.xtimms.etsudoku.R
|
||||||
import org.xtimms.tokusho.R
|
import org.xtimms.etsudoku.core.DURATION_ENTER
|
||||||
import org.xtimms.tokusho.core.DURATION_ENTER
|
import org.xtimms.etsudoku.core.DURATION_EXIT
|
||||||
import org.xtimms.tokusho.core.DURATION_EXIT
|
import org.xtimms.etsudoku.core.initialOffset
|
||||||
import org.xtimms.tokusho.core.initialOffset
|
import org.xtimms.etsudoku.core.toEasing
|
||||||
import org.xtimms.tokusho.core.motion.materialSharedAxisXIn
|
import org.xtimms.etsudoku.sections.explore.EXPLORE_DESTINATION
|
||||||
import org.xtimms.tokusho.core.motion.materialSharedAxisXOut
|
import org.xtimms.etsudoku.sections.feed.FEED_DESTINATION
|
||||||
import org.xtimms.tokusho.core.toEasing
|
import org.xtimms.etsudoku.sections.history.HISTORY_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.explore.EXPLORE_DESTINATION
|
import org.xtimms.etsudoku.sections.search.SEARCH_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.feed.FEED_DESTINATION
|
import org.xtimms.etsudoku.sections.settings.SETTINGS_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.history.HISTORY_DESTINATION
|
import org.xtimms.etsudoku.sections.shelf.SHELF_DESTINATION
|
||||||
import org.xtimms.tokusho.sections.search.SEARCH_DESTINATION
|
import org.xtimms.etsudoku.ui.theme.EtsudokuTheme
|
||||||
import org.xtimms.tokusho.sections.settings.SETTINGS_DESTINATION
|
import java.time.LocalDate
|
||||||
import org.xtimms.tokusho.sections.shelf.SHELF_DESTINATION
|
import java.time.format.DateTimeFormatter
|
||||||
import org.xtimms.tokusho.ui.theme.TokushoTheme
|
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun TopAppBar(
|
fun TopAppBar(
|
||||||
navController: NavController,
|
navController: NavController,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
backgroundAlphaProvider: () -> Float,
|
backgroundAlphaProvider: () -> Float,
|
||||||
|
searchBarColorProvider: () -> Color,
|
||||||
) {
|
) {
|
||||||
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
||||||
|
|
||||||
@@ -91,6 +120,12 @@ fun TopAppBar(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val aprilFoolsDay = LocalDate.of(LocalDate.now().year, 4, 1)
|
||||||
|
val dtStart = aprilFoolsDay.format(DateTimeFormatter.ISO_DATE)
|
||||||
|
val currentDt = LocalDate.now()
|
||||||
|
|
||||||
|
val isAprilFoolsDay = currentDt.format(DateTimeFormatter.ISO_DATE).equals(dtStart)
|
||||||
|
|
||||||
val path = Path().apply {
|
val path = Path().apply {
|
||||||
moveTo(0f, 0f)
|
moveTo(0f, 0f)
|
||||||
cubicTo(0.05F, 0F, 0.133333F, 0.06F, 0.166666F, 0.4F)
|
cubicTo(0.05F, 0F, 0.133333F, 0.06F, 0.166666F, 0.4F)
|
||||||
@@ -133,9 +168,7 @@ fun TopAppBar(
|
|||||||
.height(56.dp)
|
.height(56.dp)
|
||||||
.padding(start = 16.dp),
|
.padding(start = 16.dp),
|
||||||
shape = RoundedCornerShape(50),
|
shape = RoundedCornerShape(50),
|
||||||
colors = CardDefaults.cardColors(
|
colors = CardDefaults.cardColors().copy(containerColor = searchBarColorProvider()),
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(6.dp)
|
|
||||||
),
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -145,7 +178,7 @@ fun TopAppBar(
|
|||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Outlined.Search,
|
imageVector = if (isAprilFoolsDay) Icons.Outlined.SentimentSatisfiedAlt else Icons.Outlined.Search,
|
||||||
contentDescription = "search",
|
contentDescription = "search",
|
||||||
tint = MaterialTheme.colorScheme.outline
|
tint = MaterialTheme.colorScheme.outline
|
||||||
)
|
)
|
||||||
@@ -202,7 +235,7 @@ fun DefaultTopAppBar(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun SmallTopAppBarWithChips(
|
fun SmallTopAppBarWithChips(
|
||||||
title: String,
|
title: String,
|
||||||
@@ -295,78 +328,4 @@ fun AppBarTitle(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Preview
|
|
||||||
@Composable
|
|
||||||
fun DefaultTopAppBarPreview() {
|
|
||||||
TokushoTheme {
|
|
||||||
DefaultTopAppBar(
|
|
||||||
title = "Tokusho",
|
|
||||||
actions = {
|
|
||||||
IconButton(onClick = { /*TODO*/ }) {
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Filled.Menu,
|
|
||||||
contentDescription = "Localized description"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
navigateBack = {}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Preview
|
|
||||||
@Composable
|
|
||||||
fun DefaultTopAppBarWithChipsPreview() {
|
|
||||||
TokushoTheme {
|
|
||||||
SmallTopAppBarWithChips(
|
|
||||||
title = "Tokusho",
|
|
||||||
chips = listOf(
|
|
||||||
"Chip 1",
|
|
||||||
"Chip 2",
|
|
||||||
"Chip 3",
|
|
||||||
"Chip 4",
|
|
||||||
"Chip 1",
|
|
||||||
"Chip 2",
|
|
||||||
"Chip 3",
|
|
||||||
"Chip 4"
|
|
||||||
),
|
|
||||||
navigateBack = {}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Preview
|
|
||||||
@Composable
|
|
||||||
fun SmallTopAppBarPreview() {
|
|
||||||
TokushoTheme {
|
|
||||||
SmallTopAppBar(
|
|
||||||
title = "Tokusho",
|
|
||||||
navigateBack = {}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Preview
|
|
||||||
@Composable
|
|
||||||
fun ClassicTopAppBarPreview() {
|
|
||||||
TokushoTheme {
|
|
||||||
ClassicTopAppBar(
|
|
||||||
title = "Tokusho",
|
|
||||||
navigateBack = {},
|
|
||||||
actions = {
|
|
||||||
IconButton(onClick = { /*TODO*/ }) {
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Filled.Menu,
|
|
||||||
contentDescription = "Localized description"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components.effects
|
package org.xtimms.etsudoku.core.components.effects
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
@@ -22,7 +22,7 @@ import androidx.recyclerview.widget.DiffUtil
|
|||||||
import androidx.recyclerview.widget.ListUpdateCallback
|
import androidx.recyclerview.widget.ListUpdateCallback
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.xtimms.tokusho.core.model.ListModel
|
import org.xtimms.etsudoku.core.model.ListModel
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
enum class RowEntityType { Header, Item }
|
enum class RowEntityType { Header, Item }
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components.effects
|
package org.xtimms.etsudoku.core.components.effects
|
||||||
|
|
||||||
import androidx.compose.animation.core.LinearEasing
|
import androidx.compose.animation.core.LinearEasing
|
||||||
import androidx.compose.animation.core.RepeatMode
|
import androidx.compose.animation.core.RepeatMode
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components.icons
|
package org.xtimms.etsudoku.core.components.icons
|
||||||
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.materialIcon
|
import androidx.compose.material.icons.materialIcon
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components.icons
|
package org.xtimms.etsudoku.core.components.icons
|
||||||
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.materialIcon
|
import androidx.compose.material.icons.materialIcon
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components.icons
|
package org.xtimms.etsudoku.core.components.icons
|
||||||
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.components.shape
|
package org.xtimms.etsudoku.core.components.shape
|
||||||
|
|
||||||
import androidx.compose.ui.geometry.Offset
|
import androidx.compose.ui.geometry.Offset
|
||||||
import androidx.compose.ui.geometry.Rect
|
import androidx.compose.ui.geometry.Rect
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package org.xtimms.tokusho.core.database
|
package org.xtimms.etsudoku.core.database
|
||||||
|
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import androidx.room.RoomDatabase
|
import androidx.room.RoomDatabase
|
||||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
import org.koitharu.kotatsu.parsers.model.SortOrder
|
import org.koitharu.kotatsu.parsers.model.SortOrder
|
||||||
import org.xtimms.tokusho.R
|
import org.xtimms.etsudoku.R
|
||||||
|
|
||||||
class DatabasePrePopulateCallback(private val resources: Resources) : RoomDatabase.Callback() {
|
class DatabasePrePopulateCallback(private val resources: Resources) : RoomDatabase.Callback() {
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database
|
package org.xtimms.etsudoku.core.database
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.room.Database
|
import androidx.room.Database
|
||||||
@@ -10,28 +10,28 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.isActive
|
import kotlinx.coroutines.isActive
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.xtimms.tokusho.core.database.dao.BookmarksDao
|
import org.xtimms.etsudoku.core.database.dao.BookmarksDao
|
||||||
import org.xtimms.tokusho.core.database.dao.FavouriteCategoriesDao
|
import org.xtimms.etsudoku.core.database.dao.FavouriteCategoriesDao
|
||||||
import org.xtimms.tokusho.core.database.dao.FavouritesDao
|
import org.xtimms.etsudoku.core.database.dao.FavouritesDao
|
||||||
import org.xtimms.tokusho.core.database.dao.HistoryDao
|
import org.xtimms.etsudoku.core.database.dao.HistoryDao
|
||||||
import org.xtimms.tokusho.core.database.dao.MangaDao
|
import org.xtimms.etsudoku.core.database.dao.MangaDao
|
||||||
import org.xtimms.tokusho.core.database.dao.MangaSourcesDao
|
import org.xtimms.etsudoku.core.database.dao.MangaSourcesDao
|
||||||
import org.xtimms.tokusho.core.database.dao.SuggestionDao
|
import org.xtimms.etsudoku.core.database.dao.SuggestionDao
|
||||||
import org.xtimms.tokusho.core.database.dao.TagsDao
|
import org.xtimms.etsudoku.core.database.dao.TagsDao
|
||||||
import org.xtimms.tokusho.core.database.dao.TrackLogsDao
|
import org.xtimms.etsudoku.core.database.dao.TrackLogsDao
|
||||||
import org.xtimms.tokusho.core.database.dao.TracksDao
|
import org.xtimms.etsudoku.core.database.dao.TracksDao
|
||||||
import org.xtimms.tokusho.core.database.entity.BookmarkEntity
|
import org.xtimms.etsudoku.core.database.entity.BookmarkEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.FavouriteCategoryEntity
|
import org.xtimms.etsudoku.core.database.entity.FavouriteCategoryEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.FavouriteEntity
|
import org.xtimms.etsudoku.core.database.entity.FavouriteEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.HistoryEntity
|
import org.xtimms.etsudoku.core.database.entity.HistoryEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.MangaEntity
|
import org.xtimms.etsudoku.core.database.entity.MangaEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.MangaSourceEntity
|
import org.xtimms.etsudoku.core.database.entity.MangaSourceEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.MangaTagsEntity
|
import org.xtimms.etsudoku.core.database.entity.MangaTagsEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.SuggestionEntity
|
import org.xtimms.etsudoku.core.database.entity.SuggestionEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.TagEntity
|
import org.xtimms.etsudoku.core.database.entity.TagEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.TrackEntity
|
import org.xtimms.etsudoku.core.database.entity.TrackEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.TrackLogEntity
|
import org.xtimms.etsudoku.core.database.entity.TrackLogEntity
|
||||||
import org.xtimms.tokusho.utils.lang.processLifecycleScope
|
import org.xtimms.etsudoku.utils.lang.processLifecycleScope
|
||||||
|
|
||||||
const val DATABASE_VERSION = 1
|
const val DATABASE_VERSION = 1
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ const val DATABASE_VERSION = 1
|
|||||||
],
|
],
|
||||||
version = DATABASE_VERSION
|
version = DATABASE_VERSION
|
||||||
)
|
)
|
||||||
abstract class TokushoDatabase : RoomDatabase() {
|
abstract class EtsudokuDatabase : RoomDatabase() {
|
||||||
|
|
||||||
abstract fun getTagsDao(): TagsDao
|
abstract fun getTagsDao(): TagsDao
|
||||||
|
|
||||||
@@ -75,8 +75,8 @@ abstract class TokushoDatabase : RoomDatabase() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun TokushoDatabase(context: Context): TokushoDatabase = Room
|
fun EtsudokuDatabase(context: Context): EtsudokuDatabase = Room
|
||||||
.databaseBuilder(context, TokushoDatabase::class.java, "tokusho-db")
|
.databaseBuilder(context, EtsudokuDatabase::class.java, "etsudoku-db")
|
||||||
.addCallback(DatabasePrePopulateCallback(context.resources))
|
.addCallback(DatabasePrePopulateCallback(context.resources))
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database
|
package org.xtimms.etsudoku.core.database
|
||||||
|
|
||||||
const val TABLE_MANGA = "manga"
|
const val TABLE_MANGA = "manga"
|
||||||
const val TABLE_TAGS = "tags"
|
const val TABLE_TAGS = "tags"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.dao
|
package org.xtimms.etsudoku.core.database.dao
|
||||||
|
|
||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
import androidx.room.Delete
|
import androidx.room.Delete
|
||||||
@@ -7,8 +7,8 @@ import androidx.room.Query
|
|||||||
import androidx.room.Transaction
|
import androidx.room.Transaction
|
||||||
import androidx.room.Upsert
|
import androidx.room.Upsert
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import org.xtimms.tokusho.core.database.entity.BookmarkEntity
|
import org.xtimms.etsudoku.core.database.entity.BookmarkEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.MangaWithTags
|
import org.xtimms.etsudoku.core.database.entity.MangaWithTags
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
abstract class BookmarksDao {
|
abstract class BookmarksDao {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.dao
|
package org.xtimms.etsudoku.core.database.dao
|
||||||
|
|
||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
@@ -6,7 +6,7 @@ import androidx.room.OnConflictStrategy
|
|||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import androidx.room.Upsert
|
import androidx.room.Upsert
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import org.xtimms.tokusho.core.database.entity.FavouriteCategoryEntity
|
import org.xtimms.etsudoku.core.database.entity.FavouriteCategoryEntity
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
abstract class FavouriteCategoriesDao {
|
abstract class FavouriteCategoriesDao {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.dao
|
package org.xtimms.etsudoku.core.database.dao
|
||||||
|
|
||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
@@ -11,10 +11,10 @@ import androidx.sqlite.db.SimpleSQLiteQuery
|
|||||||
import androidx.sqlite.db.SupportSQLiteQuery
|
import androidx.sqlite.db.SupportSQLiteQuery
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import org.intellij.lang.annotations.Language
|
import org.intellij.lang.annotations.Language
|
||||||
import org.xtimms.tokusho.core.database.entity.FavouriteEntity
|
import org.xtimms.etsudoku.core.database.entity.FavouriteEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.MangaEntity
|
import org.xtimms.etsudoku.core.database.entity.MangaEntity
|
||||||
import org.xtimms.tokusho.core.model.ListSortOrder
|
import org.xtimms.etsudoku.core.model.ListSortOrder
|
||||||
import org.xtimms.tokusho.sections.shelf.FavouriteManga
|
import org.xtimms.etsudoku.sections.shelf.FavouriteManga
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
abstract class FavouritesDao {
|
abstract class FavouritesDao {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.dao
|
package org.xtimms.etsudoku.core.database.dao
|
||||||
|
|
||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
@@ -10,11 +10,11 @@ import androidx.sqlite.db.SimpleSQLiteQuery
|
|||||||
import androidx.sqlite.db.SupportSQLiteQuery
|
import androidx.sqlite.db.SupportSQLiteQuery
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import org.intellij.lang.annotations.Language
|
import org.intellij.lang.annotations.Language
|
||||||
import org.xtimms.tokusho.core.database.entity.HistoryEntity
|
import org.xtimms.etsudoku.core.database.entity.HistoryEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.HistoryWithManga
|
import org.xtimms.etsudoku.core.database.entity.HistoryWithManga
|
||||||
import org.xtimms.tokusho.core.database.entity.MangaEntity
|
import org.xtimms.etsudoku.core.database.entity.MangaEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.TagEntity
|
import org.xtimms.etsudoku.core.database.entity.TagEntity
|
||||||
import org.xtimms.tokusho.core.model.ListSortOrder
|
import org.xtimms.etsudoku.core.model.ListSortOrder
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
abstract class HistoryDao {
|
abstract class HistoryDao {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.dao
|
package org.xtimms.etsudoku.core.database.dao
|
||||||
|
|
||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
import androidx.room.Delete
|
import androidx.room.Delete
|
||||||
@@ -8,10 +8,10 @@ import androidx.room.Query
|
|||||||
import androidx.room.Transaction
|
import androidx.room.Transaction
|
||||||
import androidx.room.Update
|
import androidx.room.Update
|
||||||
import androidx.room.Upsert
|
import androidx.room.Upsert
|
||||||
import org.xtimms.tokusho.core.database.entity.MangaEntity
|
import org.xtimms.etsudoku.core.database.entity.MangaEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.MangaTagsEntity
|
import org.xtimms.etsudoku.core.database.entity.MangaTagsEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.MangaWithTags
|
import org.xtimms.etsudoku.core.database.entity.MangaWithTags
|
||||||
import org.xtimms.tokusho.core.database.entity.TagEntity
|
import org.xtimms.etsudoku.core.database.entity.TagEntity
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
abstract class MangaDao {
|
abstract class MangaDao {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.dao
|
package org.xtimms.etsudoku.core.database.dao
|
||||||
|
|
||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
@@ -9,8 +9,8 @@ import androidx.sqlite.db.SimpleSQLiteQuery
|
|||||||
import androidx.sqlite.db.SupportSQLiteQuery
|
import androidx.sqlite.db.SupportSQLiteQuery
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import org.intellij.lang.annotations.Language
|
import org.intellij.lang.annotations.Language
|
||||||
import org.xtimms.tokusho.core.database.entity.MangaSourceEntity
|
import org.xtimms.etsudoku.core.database.entity.MangaSourceEntity
|
||||||
import org.xtimms.tokusho.sections.explore.data.SourcesSortOrder
|
import org.xtimms.etsudoku.sections.explore.data.SourcesSortOrder
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
abstract class MangaSourcesDao {
|
abstract class MangaSourcesDao {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.dao
|
package org.xtimms.etsudoku.core.database.dao
|
||||||
|
|
||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
@@ -7,8 +7,8 @@ import androidx.room.Query
|
|||||||
import androidx.room.Transaction
|
import androidx.room.Transaction
|
||||||
import androidx.room.Update
|
import androidx.room.Update
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import org.xtimms.tokusho.core.database.entity.SuggestionEntity
|
import org.xtimms.etsudoku.core.database.entity.SuggestionEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.SuggestionWithManga
|
import org.xtimms.etsudoku.core.database.entity.SuggestionWithManga
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
abstract class SuggestionDao {
|
abstract class SuggestionDao {
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.xtimms.tokusho.core.database.dao
|
package org.xtimms.etsudoku.core.database.dao
|
||||||
|
|
||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import androidx.room.Upsert
|
import androidx.room.Upsert
|
||||||
import org.xtimms.tokusho.core.database.entity.TagEntity
|
import org.xtimms.etsudoku.core.database.entity.TagEntity
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
abstract class TagsDao {
|
abstract class TagsDao {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.dao
|
package org.xtimms.etsudoku.core.database.dao
|
||||||
|
|
||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
@@ -6,8 +6,8 @@ import androidx.room.OnConflictStrategy
|
|||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import androidx.room.Transaction
|
import androidx.room.Transaction
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import org.xtimms.tokusho.core.database.entity.TrackLogEntity
|
import org.xtimms.etsudoku.core.database.entity.TrackLogEntity
|
||||||
import org.xtimms.tokusho.core.database.entity.TrackLogWithManga
|
import org.xtimms.etsudoku.core.database.entity.TrackLogWithManga
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface TrackLogsDao {
|
interface TrackLogsDao {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.dao
|
package org.xtimms.etsudoku.core.database.dao
|
||||||
|
|
||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
import androidx.room.MapColumn
|
import androidx.room.MapColumn
|
||||||
@@ -6,8 +6,8 @@ import androidx.room.Query
|
|||||||
import androidx.room.Transaction
|
import androidx.room.Transaction
|
||||||
import androidx.room.Upsert
|
import androidx.room.Upsert
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import org.xtimms.tokusho.core.database.entity.MangaWithTags
|
import org.xtimms.etsudoku.core.database.entity.MangaWithTags
|
||||||
import org.xtimms.tokusho.core.database.entity.TrackEntity
|
import org.xtimms.etsudoku.core.database.entity.TrackEntity
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
abstract class TracksDao {
|
abstract class TracksDao {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import org.koitharu.kotatsu.parsers.model.Manga
|
import org.koitharu.kotatsu.parsers.model.Manga
|
||||||
import org.koitharu.kotatsu.parsers.model.MangaState
|
import org.koitharu.kotatsu.parsers.model.MangaState
|
||||||
@@ -6,14 +6,14 @@ import org.koitharu.kotatsu.parsers.model.MangaTag
|
|||||||
import org.koitharu.kotatsu.parsers.model.SortOrder
|
import org.koitharu.kotatsu.parsers.model.SortOrder
|
||||||
import org.koitharu.kotatsu.parsers.util.mapToSet
|
import org.koitharu.kotatsu.parsers.util.mapToSet
|
||||||
import org.koitharu.kotatsu.parsers.util.toTitleCase
|
import org.koitharu.kotatsu.parsers.util.toTitleCase
|
||||||
import org.xtimms.tokusho.core.model.Bookmark
|
import org.xtimms.etsudoku.core.model.Bookmark
|
||||||
import org.xtimms.tokusho.core.model.FavouriteCategory
|
import org.xtimms.etsudoku.core.model.FavouriteCategory
|
||||||
import org.xtimms.tokusho.core.model.ListSortOrder
|
import org.xtimms.etsudoku.core.model.ListSortOrder
|
||||||
import org.xtimms.tokusho.core.model.MangaHistory
|
import org.xtimms.etsudoku.core.model.MangaHistory
|
||||||
import org.xtimms.tokusho.core.model.MangaSource
|
import org.xtimms.etsudoku.core.model.MangaSource
|
||||||
import org.xtimms.tokusho.core.tracker.model.TrackingLogItem
|
import org.xtimms.etsudoku.core.tracker.model.TrackingLogItem
|
||||||
import org.xtimms.tokusho.sections.shelf.FavouriteManga
|
import org.xtimms.etsudoku.sections.shelf.FavouriteManga
|
||||||
import org.xtimms.tokusho.utils.lang.longHashCode
|
import org.xtimms.etsudoku.utils.lang.longHashCode
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
// Entity to model
|
// Entity to model
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import org.xtimms.tokusho.core.database.TABLE_FAVOURITE_CATEGORIES
|
import org.xtimms.etsudoku.core.database.TABLE_FAVOURITE_CATEGORIES
|
||||||
|
|
||||||
@Entity(tableName = TABLE_FAVOURITE_CATEGORIES)
|
@Entity(tableName = TABLE_FAVOURITE_CATEGORIES)
|
||||||
data class FavouriteCategoryEntity(
|
data class FavouriteCategoryEntity(
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import org.xtimms.tokusho.core.database.TABLE_FAVOURITES
|
import org.xtimms.etsudoku.core.database.TABLE_FAVOURITES
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
||||||
tableName = TABLE_FAVOURITES,
|
tableName = TABLE_FAVOURITES,
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import org.xtimms.tokusho.core.database.TABLE_HISTORY
|
import org.xtimms.etsudoku.core.database.TABLE_HISTORY
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
||||||
tableName = TABLE_HISTORY,
|
tableName = TABLE_HISTORY,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Junction
|
import androidx.room.Junction
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import org.xtimms.tokusho.core.database.TABLE_MANGA
|
import org.xtimms.etsudoku.core.database.TABLE_MANGA
|
||||||
|
|
||||||
@Entity(tableName = TABLE_MANGA)
|
@Entity(tableName = TABLE_MANGA)
|
||||||
data class MangaEntity(
|
data class MangaEntity(
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import org.xtimms.tokusho.core.database.TABLE_SOURCES
|
import org.xtimms.etsudoku.core.database.TABLE_SOURCES
|
||||||
|
|
||||||
@Entity(tableName = TABLE_SOURCES)
|
@Entity(tableName = TABLE_SOURCES)
|
||||||
data class MangaSourceEntity(
|
data class MangaSourceEntity(
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.ForeignKey
|
import androidx.room.ForeignKey
|
||||||
import org.xtimms.tokusho.core.database.TABLE_MANGA_TAGS
|
import org.xtimms.etsudoku.core.database.TABLE_MANGA_TAGS
|
||||||
|
|
||||||
@Entity(
|
@Entity(
|
||||||
tableName = TABLE_MANGA_TAGS,
|
tableName = TABLE_MANGA_TAGS,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Junction
|
import androidx.room.Junction
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.annotation.FloatRange
|
import androidx.annotation.FloatRange
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Junction
|
import androidx.room.Junction
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import org.xtimms.tokusho.core.database.TABLE_TAGS
|
import org.xtimms.etsudoku.core.database.TABLE_TAGS
|
||||||
|
|
||||||
@Entity(tableName = TABLE_TAGS)
|
@Entity(tableName = TABLE_TAGS)
|
||||||
data class TagEntity(
|
data class TagEntity(
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.ColumnInfo
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.database.entity
|
package org.xtimms.etsudoku.core.database.entity
|
||||||
|
|
||||||
import androidx.room.Embedded
|
import androidx.room.Embedded
|
||||||
import androidx.room.Junction
|
import androidx.room.Junction
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.exceptions
|
package org.xtimms.etsudoku.core.exceptions
|
||||||
|
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okio.IOException
|
import okio.IOException
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package org.xtimms.etsudoku.core.exceptions
|
||||||
|
|
||||||
|
class SyncApiException(
|
||||||
|
message: String,
|
||||||
|
val code: Int,
|
||||||
|
) : RuntimeException(message)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.exceptions
|
package org.xtimms.etsudoku.core.exceptions
|
||||||
|
|
||||||
import okio.IOException
|
import okio.IOException
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xtimms.tokusho.core.logs
|
package org.xtimms.etsudoku.core.logs
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.annotation.WorkerThread
|
import androidx.annotation.WorkerThread
|
||||||
@@ -14,9 +14,9 @@ import kotlinx.coroutines.sync.Mutex
|
|||||||
import kotlinx.coroutines.sync.withLock
|
import kotlinx.coroutines.sync.withLock
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.koitharu.kotatsu.parsers.util.runCatchingCancellable
|
import org.koitharu.kotatsu.parsers.util.runCatchingCancellable
|
||||||
import org.xtimms.tokusho.core.prefs.AppSettings
|
import org.xtimms.etsudoku.core.prefs.AppSettings
|
||||||
import org.xtimms.tokusho.utils.lang.processLifecycleScope
|
import org.xtimms.etsudoku.utils.lang.processLifecycleScope
|
||||||
import org.xtimms.tokusho.utils.system.subdir
|
import org.xtimms.etsudoku.utils.system.subdir
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user