Skip to content

Commit

Permalink
[modify]修正文件夹类的命名错误,去除无用的代码
Browse files Browse the repository at this point in the history
  • Loading branch information
cy745 committed Jan 1, 2025
1 parent a839771 commit 783795b
Show file tree
Hide file tree
Showing 24 changed files with 147 additions and 174 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ dependencies {
implementation(project(":lhistory"))
implementation(project(":lartist"))
implementation(project(":lalbum"))
implementation(project(":ldictionary"))
implementation(project(":lfolder"))
ksp(libs.koin.compiler)

implementation(libs.room.ktx)
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/lalilu/lmusic/LMusicApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import coil3.SingletonImageLoader
import com.blankj.utilcode.util.LogUtils
import com.lalilu.lalbum.AlbumModule
import com.lalilu.lartist.ArtistModule
import com.lalilu.ldictionary.DictionaryModule
import com.lalilu.lfolder.FolderModule
import com.lalilu.lhistory.HistoryModule
import com.lalilu.lmedia.LMedia
import com.lalilu.lmusic.utils.extension.ignoreSSLVerification
Expand Down Expand Up @@ -40,7 +40,7 @@ class LMusicApp : Application(), ViewModelStoreOwner {
PlaylistModule.module,
ArtistModule.module,
AlbumModule.module,
DictionaryModule,
FolderModule,
LMedia.module,
MPlayer.module,
)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/lalilu/lmusic/aop/LogOverride.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.blankj.utilcode.util.LogUtils
import com.flyjingfish.android_aop_annotation.anno.AndroidAopReplaceClass
import com.flyjingfish.android_aop_annotation.anno.AndroidAopReplaceMethod

@AndroidAopReplaceClass("android.util.Log")
//@AndroidAopReplaceClass("android.util.Log")
class LogOverride {

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,29 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import cafe.adriel.voyager.core.screen.Screen
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.Navigator
import cafe.adriel.voyager.navigator.currentOrThrow
import com.lalilu.R
import com.lalilu.component.base.CustomScreen
import com.lalilu.component.base.ScreenInfo
import com.lalilu.component.base.screen.ScreenInfo
import com.lalilu.component.base.screen.ScreenInfoFactory
import kotlin.system.exitProcess

class AgreementScreen(
private val nextScreen: Screen
) : CustomScreen {
) : Screen, ScreenInfoFactory {

override fun getScreenInfo(): ScreenInfo = ScreenInfo(title = R.string.screen_title_agreement)
@Composable
override fun provideScreenInfo(): ScreenInfo {
return remember {
ScreenInfo(title = { stringResource(R.string.screen_title_agreement) })
}
}

@Composable
override fun Content() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import cafe.adriel.voyager.navigator.Navigator
import com.lalilu.R
import com.lalilu.component.base.CustomScreen
import com.lalilu.component.base.LocalWindowSize
import com.lalilu.component.base.screen.ScreenInfoFactory
import com.lalilu.component.extension.rememberIsPad
import com.lalilu.component.navigation.CustomTransition

Expand All @@ -63,14 +62,10 @@ fun GuidingScreen() {
val navigatorState = remember { mutableStateOf<Navigator?>(null) }
val backStackSize = remember { derivedStateOf { navigatorState.value?.items?.size ?: 0 } }
val showPopUpBtn = remember { derivedStateOf { backStackSize.value > 1 } }
val currentScreenTitleRes by remember {
derivedStateOf {
(navigatorState.value?.lastItemOrNull as? CustomScreen)
?.getScreenInfo()
?.title
?: R.string.app_name
}
}
val currentScreen by remember { derivedStateOf { (navigatorState.value?.lastItemOrNull as? ScreenInfoFactory) } }
val currentScreenTitle = currentScreen
?.provideScreenInfo()
?.title?.invoke()

Surface(color = MaterialTheme.colors.background) {
Box(
Expand Down Expand Up @@ -107,13 +102,17 @@ fun GuidingScreen() {
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.Start
) {
AnimatedContent(targetState = currentScreenTitleRes, transitionSpec = {
((slideInVertically { height -> height } + fadeIn()).togetherWith(
slideOutVertically { height -> -height } + fadeOut())).using(
SizeTransform(clip = false)
)
}, label = "") {
Text(text = stringResource(id = it), fontSize = 22.sp)
AnimatedContent(
targetState = currentScreenTitle,
transitionSpec = {
((slideInVertically { height -> height } + fadeIn()).togetherWith(
slideOutVertically { height -> -height } + fadeOut())).using(
SizeTransform(clip = false)
)
},
label = ""
) { title ->
Text(text = title ?: "", fontSize = 22.sp)
}
Text(
text = "${backStackSize.value} / 3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import cafe.adriel.voyager.core.screen.Screen
import com.blankj.utilcode.util.ActivityUtils
import com.google.accompanist.permissions.ExperimentalPermissionsApi
import com.google.accompanist.permissions.PermissionStatus
import com.google.accompanist.permissions.rememberPermissionState
import com.lalilu.R
import com.lalilu.component.base.CustomScreen
import com.lalilu.component.base.ScreenInfo
import com.lalilu.component.base.screen.ScreenInfo
import com.lalilu.component.base.screen.ScreenInfoFactory
import com.lalilu.lmedia.LMedia
import com.lalilu.lmusic.Config.REQUIRE_PERMISSIONS
import com.lalilu.lmusic.MainActivity
Expand All @@ -23,11 +26,14 @@ import com.lalilu.lmusic.utils.extension.getActivity
import org.koin.compose.koinInject
import kotlin.system.exitProcess

class PermissionsScreen(
) : CustomScreen {
override fun getScreenInfo(): ScreenInfo = ScreenInfo(
title = R.string.screen_title_permissions
)
class PermissionsScreen : Screen, ScreenInfoFactory {

@Composable
override fun provideScreenInfo(): ScreenInfo {
return remember {
ScreenInfo(title = { stringResource(R.string.screen_title_permissions) })
}
}

@Composable
override fun Content() {
Expand Down
21 changes: 8 additions & 13 deletions app/src/main/java/com/lalilu/lmusic/extension/EntryPanel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,14 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import cafe.adriel.voyager.core.screen.Screen
import com.lalilu.component.LazyGridContent
import com.lalilu.component.base.LocalWindowSize
import com.lalilu.component.base.screen.ScreenInfoFactory
import com.lalilu.component.divider
import com.lalilu.component.navigation.AppRouter
import com.lalilu.component.navigation.NavIntent
import com.lalilu.component.rememberGridItemPadding
import com.lalilu.lalbum.screen.AlbumsScreen
import com.lalilu.ldictionary.screen.DictionaryScreen
import com.lalilu.lhistory.screen.HistoryScreen
import com.lalilu.lmusic.compose.new_screen.SettingsScreen
import com.lalilu.lmusic.compose.screen.songs.SongsScreen
import com.lalilu.lplaylist.screen.PlaylistScreen
import com.zhangke.krouter.KRouter


Expand All @@ -42,14 +37,14 @@ object EntryPanel : LazyGridContent {
@Composable
override fun register(): LazyGridScope.() -> Unit {
val screenEntry = remember {
listOfNotNull(
SongsScreen(),
listOfNotNull<Screen>(
KRouter.route("/pages/songs"),
KRouter.route("/pages/artists"),
AlbumsScreen(),
PlaylistScreen,
HistoryScreen,
DictionaryScreen,
SettingsScreen
KRouter.route("/pages/albums"),
KRouter.route("/pages/playlist"),
KRouter.route("/pages/history"),
KRouter.route("/pages/folders"),
KRouter.route("/pages/settings")
)
}
val defaultString = "Undefined"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,48 +1,11 @@
package com.lalilu.component.base

import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.Color
import cafe.adriel.voyager.core.screen.Screen
import com.lalilu.component.base.screen.ScreenInfoFactory
import kotlinx.coroutines.CoroutineScope

/**
* 定义一个页面的信息
*/
@Deprecated("弃用", replaceWith = ReplaceWith("com.lalilu.component.base.screen.ScreenInfo"))
data class ScreenInfo(
@StringRes val title: Int,
@DrawableRes val icon: Int? = null,
val immerseStatusBar: Boolean = true,
)

/**
* 定义某个页面可执行的动作
*/
@Deprecated("弃用")
sealed interface ScreenAction {
data class StaticAction(
@StringRes val title: Int,
@DrawableRes val icon: Int? = null,
@StringRes val info: Int? = null,
val color: Color = Color.White,
val isLongClickAction: Boolean = false,
val onAction: () -> Unit
) : ScreenAction
}

data class ScreenBarComponent(
val key: String,
val content: @Composable () -> Unit
)

interface CustomScreen : Screen {
fun getScreenInfo(): ScreenInfo? = null
}

@Deprecated("弃用,待移除")
interface TabScreen : Screen, ScreenInfoFactory

interface UiState
Expand All @@ -52,12 +15,3 @@ interface UiPresenter<T : UiState> : CoroutineScope {
fun presentState(): T
fun onAction(action: UiAction)
}

@Deprecated("TODO 替换完成后删除")
abstract class DynamicScreen : CustomScreen {
@Composable
open fun registerActions(): List<ScreenAction> {
return remember { emptyList() }
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateMapOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.lalilu.component.base.ScreenBarComponent

data class ScreenBarComponent(
val key: String,
val content: @Composable () -> Unit
)

class ComponentStack {
var stack: List<ScreenBarComponent> by mutableStateOf(emptyList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.unit.dp
import cafe.adriel.voyager.navigator.LocalNavigator
import com.lalilu.component.base.ScreenBarComponent
import com.lalilu.component.base.screen.ScreenBarComponent
import com.lalilu.component.base.TabScreen
import com.lalilu.component.base.screen.ScreenBarFactory
import com.lalilu.component.base.screen.ScreenInfoFactory
Expand Down
18 changes: 9 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
compile_version = "35"
min_sdk_version = "21"

agp_version = "8.6.0"
kotlin_version = "2.0.0"
ksp_version = "2.0.0-1.0.22"
agp_version = "8.6.1"
kotlin_version = "2.1.0"
ksp_version = "2.1.0-1.0.29"

koin_version = "4.0.0"
koin_ksp_version = "1.4.0"
compose_bom_alpha_version = "2024.11.00"
compose_bom_version = "2024.11.00"
compose_bom_alpha_version = "2024.12.01"
compose_bom_version = "2024.12.01"
accompanist_version = "0.32.0"
voyager = "1.1.0-beta03"
lottie-compose = "5.2.0"
lottie-compose = "6.6.0"

coil3_version = "3.0.0-alpha07"
coil3_version = "3.0.2"
utilcodex_version = "1.31.1"

# androidx
Expand All @@ -24,9 +24,9 @@ palette-ktx = "1.0.0"
dynamicanimation-ktx = "1.0.0-alpha03"
startup-runtime = "1.2.0"
activity-compose = "1.9.3"
room_version = "2.5.2"
room_version = "2.6.1"
media = "1.7.0"
media3 = "1.5.0"
media3 = "1.5.1"
gson = "2.11.0"
flyjingfish-aop = "1.9.7"
paging_version = "3.3.5"
Expand Down

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion ldictionary/build.gradle.kts → lfolder/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

android {
namespace = "com.lalilu.ldictionary"
namespace = "com.lalilu.lfolder"
compileSdk = libs.versions.compile.version.get().toIntOrNull()

defaultConfig {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions lfolder/src/main/java/com/lalilu/lfolder/FolderModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.lalilu.lfolder

import com.lalilu.lfolder.screen.DictionaryScreenModel
import org.koin.core.module.dsl.factoryOf
import org.koin.dsl.module

val FolderModule = module {
factoryOf(::DictionaryScreenModel)
}
Loading

0 comments on commit 783795b

Please sign in to comment.