diff --git a/app/build.gradle b/app/build.gradle index bc252f6..29753f7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -22,7 +22,7 @@ android { minSdk 24 targetSdk 34 versionCode 31 - versionName "1.5-beta06" + versionName "1.5-beta07" flavorDimensions = ["versionName"] testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/com/skyd/rays/model/bean/MiniToolBean.kt b/app/src/main/java/com/skyd/rays/model/bean/MiniToolBean.kt index 25bc5a7..1a3be4f 100644 --- a/app/src/main/java/com/skyd/rays/model/bean/MiniToolBean.kt +++ b/app/src/main/java/com/skyd/rays/model/bean/MiniToolBean.kt @@ -5,6 +5,7 @@ import androidx.compose.ui.graphics.vector.ImageVector data class MiniToolBean( val title: String, val icon: ImageVector, + val experimental: Boolean = false, val action: () -> Unit ) : BaseBean diff --git a/app/src/main/java/com/skyd/rays/ui/component/lazyverticalgrid/adapter/proxy/MiniTool1Proxy.kt b/app/src/main/java/com/skyd/rays/ui/component/lazyverticalgrid/adapter/proxy/MiniTool1Proxy.kt index b5427f1..ca9d4b6 100644 --- a/app/src/main/java/com/skyd/rays/ui/component/lazyverticalgrid/adapter/proxy/MiniTool1Proxy.kt +++ b/app/src/main/java/com/skyd/rays/ui/component/lazyverticalgrid/adapter/proxy/MiniTool1Proxy.kt @@ -7,6 +7,8 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Science import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedCard @@ -14,8 +16,10 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp +import com.skyd.rays.R import com.skyd.rays.model.bean.MiniTool1Bean import com.skyd.rays.ui.component.lazyverticalgrid.adapter.LazyGridAdapter @@ -63,6 +67,12 @@ fun MiniTool1Item( maxLines = 1, textAlign = TextAlign.Center ) + if (data.experimental) { + Icon( + imageVector = Icons.Default.Science, + contentDescription = stringResource(R.string.mini_tool_experimental), + ) + } } } } diff --git a/app/src/main/java/com/skyd/rays/ui/screen/MainScreen.kt b/app/src/main/java/com/skyd/rays/ui/screen/MainScreen.kt index df2b7de..eb20423 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/MainScreen.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/MainScreen.kt @@ -1,12 +1,10 @@ package com.skyd.rays.ui.screen -import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.only -import androidx.compose.foundation.layout.padding import androidx.compose.foundation.pager.HorizontalPager import androidx.compose.foundation.pager.PagerState import androidx.compose.foundation.pager.rememberPagerState @@ -22,8 +20,6 @@ import androidx.compose.material3.NavigationBar import androidx.compose.material3.NavigationBarItem import androidx.compose.material3.NavigationRail import androidx.compose.material3.NavigationRailItem -import androidx.compose.material3.Scaffold -import androidx.compose.material3.SearchBarDefaults import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass @@ -44,14 +40,9 @@ const val MAIN_SCREEN_ROUTE = "mainScreen" @Composable fun getMainScreenTopBarWindowInsets(): WindowInsets = - if (LocalWindowSizeClass.current.isCompact) WindowInsets(0) + if (LocalWindowSizeClass.current.isCompact) TopAppBarDefaults.windowInsets else TopAppBarDefaults.windowInsets.only(WindowInsetsSides.End + WindowInsetsSides.Top) -@Composable -fun getMainScreenSearchBarWindowInsets(): WindowInsets = - if (LocalWindowSizeClass.current.isCompact) WindowInsets(0) - else SearchBarDefaults.windowInsets - @Composable fun MainScreen() { val windowSizeClass = LocalWindowSizeClass.current @@ -67,28 +58,19 @@ fun MainScreen() { } ) } - val contentPager = @Composable { - ContentPager(pagerState = pagerState) + val contentPager: @Composable (modifier: Modifier) -> Unit = @Composable { modifier -> + ContentPager(modifier = modifier, pagerState = pagerState) } - Scaffold( - bottomBar = if (windowSizeClass.widthSizeClass == WindowWidthSizeClass.Compact) { - navigationBarOrRail - } else { - {} + if (windowSizeClass.isCompact) { + Column { + contentPager(modifier = Modifier.weight(1f)) + navigationBarOrRail() } - ) { innerPadding -> - if (windowSizeClass.widthSizeClass != WindowWidthSizeClass.Compact) { - Row(modifier = Modifier.fillMaxSize()) { - navigationBarOrRail() - Box(modifier = Modifier.weight(1f)) { - contentPager() - } - } - } else { - Box(modifier = Modifier.padding(innerPadding)) { - contentPager() - } + } else { + Row { + navigationBarOrRail() + contentPager(modifier = Modifier.weight(1f)) } } } @@ -139,10 +121,10 @@ private fun NavigationBarOrRail( } @Composable -private fun ContentPager(pagerState: PagerState) { +private fun ContentPager(modifier: Modifier, pagerState: PagerState) { HorizontalPager( state = pagerState, - modifier = Modifier.fillMaxSize(), + modifier = modifier, userScrollEnabled = false ) { page -> when (page) { diff --git a/app/src/main/java/com/skyd/rays/ui/screen/add/AddEvent.kt b/app/src/main/java/com/skyd/rays/ui/screen/add/AddEvent.kt index a62ae93..ff322e4 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/add/AddEvent.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/add/AddEvent.kt @@ -3,23 +3,23 @@ package com.skyd.rays.ui.screen.add import com.skyd.rays.base.IUiEvent import com.skyd.rays.model.bean.StickerWithTags -data class AddEvent( +class AddEvent( val getStickersWithTagsUiEvent: GetStickersWithTagsUiEvent? = null, val addStickersResultUiEvent: AddStickersResultUiEvent? = null, val recognizeTextUiEvent: RecognizeTextUiEvent? = null, ) : IUiEvent sealed class GetStickersWithTagsUiEvent { - data class Success(val stickerWithTags: StickerWithTags) : GetStickersWithTagsUiEvent() + class Success(val stickerWithTags: StickerWithTags) : GetStickersWithTagsUiEvent() object Init : GetStickersWithTagsUiEvent() object Failed : GetStickersWithTagsUiEvent() } sealed class AddStickersResultUiEvent { object Duplicate : AddStickersResultUiEvent() - data class Success(val stickerUuid: String) : AddStickersResultUiEvent() + class Success(val stickerUuid: String) : AddStickersResultUiEvent() } sealed class RecognizeTextUiEvent { - data class Success(val texts: Set) : RecognizeTextUiEvent() + class Success(val texts: Set) : RecognizeTextUiEvent() } \ No newline at end of file diff --git a/app/src/main/java/com/skyd/rays/ui/screen/home/HomeEvent.kt b/app/src/main/java/com/skyd/rays/ui/screen/home/HomeEvent.kt index 168cdad..b2e1fc0 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/home/HomeEvent.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/home/HomeEvent.kt @@ -2,10 +2,10 @@ package com.skyd.rays.ui.screen.home import com.skyd.rays.base.IUiEvent -data class HomeEvent( +class HomeEvent( val homeResultUiEvent: HomeResultUiEvent? = null, ) : IUiEvent sealed class HomeResultUiEvent { - data class Success(val successCount: Int) : HomeResultUiEvent() + class Success(val successCount: Int) : HomeResultUiEvent() } diff --git a/app/src/main/java/com/skyd/rays/ui/screen/home/HomeScreen.kt b/app/src/main/java/com/skyd/rays/ui/screen/home/HomeScreen.kt index 8cb9edd..ae9b511 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/home/HomeScreen.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/home/HomeScreen.kt @@ -200,7 +200,7 @@ fun HomeScreen(viewModel: HomeViewModel = hiltViewModel()) { homeResultUiEvent.successCount, homeResultUiEvent.successCount ), - key2 = homeResultUiEvent + key2 = homeResultUiEvent, ) } diff --git a/app/src/main/java/com/skyd/rays/ui/screen/home/searchbar/RaysSearchBar.kt b/app/src/main/java/com/skyd/rays/ui/screen/home/searchbar/RaysSearchBar.kt index 4ff3798..a1f41a8 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/home/searchbar/RaysSearchBar.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/home/searchbar/RaysSearchBar.kt @@ -69,7 +69,6 @@ import com.skyd.rays.ui.local.LocalNavController import com.skyd.rays.ui.local.LocalShowPopularTags import com.skyd.rays.ui.local.LocalWindowSizeClass import com.skyd.rays.ui.screen.add.ADD_SCREEN_ROUTE -import com.skyd.rays.ui.screen.getMainScreenSearchBarWindowInsets import com.skyd.rays.ui.screen.home.HomeIntent import com.skyd.rays.ui.screen.home.HomeState import com.skyd.rays.ui.screen.home.HomeViewModel @@ -138,7 +137,6 @@ fun RaysSearchBar( .padding(horizontal = searchBarHorizontalPadding) ) { SearchBar( - windowInsets = getMainScreenSearchBarWindowInsets(), onQueryChange = onQueryChange, query = query, onSearch = { keyword -> diff --git a/app/src/main/java/com/skyd/rays/ui/screen/minitool/MiniToolScreen.kt b/app/src/main/java/com/skyd/rays/ui/screen/minitool/MiniToolScreen.kt index 8036ee9..e335b91 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/minitool/MiniToolScreen.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/minitool/MiniToolScreen.kt @@ -1,5 +1,6 @@ package com.skyd.rays.ui.screen.minitool +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material.icons.Icons @@ -8,19 +9,23 @@ import androidx.compose.material.icons.filled.Style import androidx.compose.material3.Scaffold import androidx.compose.material3.ScaffoldDefaults import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.skyd.rays.R +import com.skyd.rays.ext.plus import com.skyd.rays.ext.screenIsLand import com.skyd.rays.model.bean.MiniTool1Bean import com.skyd.rays.ui.component.RaysIconButton import com.skyd.rays.ui.component.RaysTopBar +import com.skyd.rays.ui.component.RaysTopBarStyle import com.skyd.rays.ui.component.lazyverticalgrid.RaysLazyVerticalGrid import com.skyd.rays.ui.component.lazyverticalgrid.adapter.LazyGridAdapter import com.skyd.rays.ui.component.lazyverticalgrid.adapter.proxy.MiniTool1Proxy @@ -32,12 +37,15 @@ const val MINI_TOOL_SCREEN_ROUTE = "miniToolScreen" @Composable fun MiniToolScreen() { + val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior() val navController = LocalNavController.current val context = LocalContext.current Scaffold( topBar = { RaysTopBar( + style = RaysTopBarStyle.Large, + scrollBehavior = scrollBehavior, title = { Text(text = stringResource(id = R.string.mini_tool_screen_name)) }, navigationIcon = { RaysIconButton(imageVector = Icons.Default.Extension, onClick = { }) @@ -61,6 +69,7 @@ fun MiniToolScreen() { MiniTool1Bean( title = stringResource(R.string.style_transfer_screen_name), icon = Icons.Default.Style, + experimental = true, action = { navController.navigate(STYLE_TRANSFER_SCREEN_ROUTE) } ), ) @@ -71,10 +80,12 @@ fun MiniToolScreen() { ) } RaysLazyVerticalGrid( - modifier = Modifier.fillMaxSize(), + modifier = Modifier + .fillMaxSize() + .nestedScroll(scrollBehavior.nestedScrollConnection), dataList = miniToolList, adapter = adapter, - contentPadding = it + contentPadding = it + PaddingValues(vertical = 10.dp), ) } } \ No newline at end of file diff --git a/app/src/main/java/com/skyd/rays/ui/screen/more/MoreScreen.kt b/app/src/main/java/com/skyd/rays/ui/screen/more/MoreScreen.kt index 4f8f162..fb9bafb 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/more/MoreScreen.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/more/MoreScreen.kt @@ -1,5 +1,6 @@ package com.skyd.rays.ui.screen.more +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material.icons.Icons @@ -11,19 +12,23 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.ScaffoldDefaults import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.skyd.rays.R +import com.skyd.rays.ext.plus import com.skyd.rays.ext.screenIsLand import com.skyd.rays.model.bean.More1Bean import com.skyd.rays.ui.component.RaysIconButton import com.skyd.rays.ui.component.RaysTopBar +import com.skyd.rays.ui.component.RaysTopBarStyle import com.skyd.rays.ui.component.lazyverticalgrid.RaysLazyVerticalGrid import com.skyd.rays.ui.component.lazyverticalgrid.adapter.LazyGridAdapter import com.skyd.rays.ui.component.lazyverticalgrid.adapter.proxy.More1Proxy @@ -38,12 +43,15 @@ import com.skyd.rays.ui.screen.settings.data.importexport.IMPORT_EXPORT_SCREEN_R @Composable fun MoreScreen() { + val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior() val navController = LocalNavController.current val context = LocalContext.current Scaffold( topBar = { RaysTopBar( + style = RaysTopBarStyle.Large, + scrollBehavior = scrollBehavior, title = { Text(text = stringResource(id = R.string.more_screen_name)) }, navigationIcon = { RaysIconButton(imageVector = Icons.Default.Egg, onClick = { }) }, windowInsets = getMainScreenTopBarWindowInsets(), @@ -101,10 +109,12 @@ fun MoreScreen() { ) } RaysLazyVerticalGrid( - modifier = Modifier.fillMaxSize(), + modifier = Modifier + .fillMaxSize() + .nestedScroll(scrollBehavior.nestedScrollConnection), dataList = moreList, adapter = adapter, - contentPadding = it + contentPadding = it + PaddingValues(vertical = 10.dp), ) } } \ No newline at end of file diff --git a/app/src/main/java/com/skyd/rays/ui/screen/settings/api/apigrant/ApiGrantEvent.kt b/app/src/main/java/com/skyd/rays/ui/screen/settings/api/apigrant/ApiGrantEvent.kt index 766ac7d..a9336d6 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/settings/api/apigrant/ApiGrantEvent.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/settings/api/apigrant/ApiGrantEvent.kt @@ -2,11 +2,11 @@ package com.skyd.rays.ui.screen.settings.api.apigrant import com.skyd.rays.base.IUiEvent -data class ApiGrantEvent( +class ApiGrantEvent( val addPackageNameUiEvent: AddPackageNameUiEvent? = null, ) : IUiEvent sealed class AddPackageNameUiEvent { object Success : AddPackageNameUiEvent() - data class Failed(val msg: String) : AddPackageNameUiEvent() + class Failed(val msg: String) : AddPackageNameUiEvent() } diff --git a/app/src/main/java/com/skyd/rays/ui/screen/settings/data/DataEvent.kt b/app/src/main/java/com/skyd/rays/ui/screen/settings/data/DataEvent.kt index 55e82bc..76e3980 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/settings/data/DataEvent.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/settings/data/DataEvent.kt @@ -2,10 +2,10 @@ package com.skyd.rays.ui.screen.settings.data import com.skyd.rays.base.IUiEvent -data class DataEvent( +class DataEvent( val deleteAllResultUiEvent: DeleteAllResultUiEvent? = null, ) : IUiEvent sealed class DeleteAllResultUiEvent { - data class Success(val time: Long) : DeleteAllResultUiEvent() + class Success(val time: Long) : DeleteAllResultUiEvent() } \ No newline at end of file diff --git a/app/src/main/java/com/skyd/rays/ui/screen/settings/data/importexport/cloud/webdav/WebDavEvent.kt b/app/src/main/java/com/skyd/rays/ui/screen/settings/data/importexport/cloud/webdav/WebDavEvent.kt index 6c15a63..cfd8a05 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/settings/data/importexport/cloud/webdav/WebDavEvent.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/settings/data/importexport/cloud/webdav/WebDavEvent.kt @@ -3,15 +3,15 @@ package com.skyd.rays.ui.screen.settings.data.importexport.cloud.webdav import com.skyd.rays.base.IUiEvent import com.skyd.rays.model.bean.WebDavInfo -data class WebDavEvent( +class WebDavEvent( val uploadResultUiEvent: UploadResultUiEvent? = null, val downloadResultUiEvent: DownloadResultUiEvent? = null, ) : IUiEvent sealed class UploadResultUiEvent { - data class Success(val result: WebDavInfo) : UploadResultUiEvent() + class Success(val result: WebDavInfo) : UploadResultUiEvent() } sealed class DownloadResultUiEvent { - data class Success(val result: WebDavInfo) : DownloadResultUiEvent() + class Success(val result: WebDavInfo) : DownloadResultUiEvent() } \ No newline at end of file diff --git a/app/src/main/java/com/skyd/rays/ui/screen/settings/ml/classification/model/ClassificationModelEvent.kt b/app/src/main/java/com/skyd/rays/ui/screen/settings/ml/classification/model/ClassificationModelEvent.kt index 7db7f82..371f459 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/settings/ml/classification/model/ClassificationModelEvent.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/settings/ml/classification/model/ClassificationModelEvent.kt @@ -3,15 +3,15 @@ package com.skyd.rays.ui.screen.settings.ml.classification.model import android.net.Uri import com.skyd.rays.base.IUiEvent -data class ClassificationModelEvent( +class ClassificationModelEvent( val deleteUiEvent: DeleteUiEvent? = null, val importUiEvent: ImportUiEvent? = null, ) : IUiEvent sealed class DeleteUiEvent { - data class Success(val path: String) : DeleteUiEvent() + class Success(val path: String) : DeleteUiEvent() } sealed class ImportUiEvent { - data class Success(val uri: Uri) : ImportUiEvent() + class Success(val uri: Uri) : ImportUiEvent() } \ No newline at end of file diff --git a/app/src/main/java/com/skyd/rays/ui/screen/settings/shareconfig/uristringshare/UriStringShareEvent.kt b/app/src/main/java/com/skyd/rays/ui/screen/settings/shareconfig/uristringshare/UriStringShareEvent.kt index 4dae19c..c44fbec 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/settings/shareconfig/uristringshare/UriStringShareEvent.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/settings/shareconfig/uristringshare/UriStringShareEvent.kt @@ -2,11 +2,11 @@ package com.skyd.rays.ui.screen.settings.shareconfig.uristringshare import com.skyd.rays.base.IUiEvent -data class UriStringShareEvent( +class UriStringShareEvent( val addPackageNameUiEvent: AddPackageNameUiEvent? = null, ) : IUiEvent sealed class AddPackageNameUiEvent { object Success : AddPackageNameUiEvent() - data class Failed(val msg: String) : AddPackageNameUiEvent() + class Failed(val msg: String) : AddPackageNameUiEvent() } diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index cc2d69e..487a4d3 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -206,7 +206,8 @@ 文件扩展名 分享表情包时为文件添加扩展名 小工具 - 风格转移(实验性) + 实验性 + 风格转移 转移 请选择目标风格图片和内容图片后再进行转换 风格 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7279cf0..0b6e461 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -209,7 +209,8 @@ File extension Add the file extension name when sharing a sticker Mini Tool - Style Transfer (Experimental) + Experimental + Style Transfer Transfer Please select the target style image and content image before transferring Style