From 63e021707a801fbd9750091e00dc583ff3149cf2 Mon Sep 17 00:00:00 2001 From: panpf Date: Thu, 27 Jun 2024 10:48:37 +0800 Subject: [PATCH] build: Improve run configuration (2) --- .../sample/ui/test/FetcherTestScreen.android.kt | 2 +- .../sketch/sample/ui/common/list/LoadState.kt | 4 ++-- .../sketch/sample/ui/gallery/HomeScreen.common.kt | 10 +++++----- .../panpf/sketch/sample/ui/gallery/MainMenu.kt | 12 ++++++------ .../sample/ui/gallery/PhotoGridItem.common.kt | 8 ++++---- .../sketch/sample/ui/gallery/PhotoPager.common.kt | 8 ++++---- .../sample/ui/setting/AppSettingsDialog.common.kt | 4 ++-- .../sample/ui/test/ExifOrientationTestScreen.kt | 4 ++-- .../sample/ui/test/ProgressIndicatorTestScreen.kt | 4 ++-- .../panpf/sketch/sample/ui/test/TempTestScreen.kt | 4 ++-- .../panpf/sketch/sample/ui/test/TestPage.common.kt | 4 ++-- .../sketch/sample/ui/preview/AsyncImagePreview.kt | 4 ++-- .../sample/ui/test/FetcherTestScreen.desktop.kt | 2 +- .../sketch/sample/ui/test/FetcherTestScreen.ios.kt | 2 +- .../sample/ui/test/FetcherTestScreen.jsCommon.kt | 2 +- .../sketch/sample/ui/gallery/PhotoViewer.jvm.kt | 14 +++++++------- .../sketch/sample/ui/gallery/PhotoViewer.nonJvm.kt | 12 ++++++------ settings.gradle.kts | 3 +++ 18 files changed, 53 insertions(+), 50 deletions(-) diff --git a/sample/src/androidMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.android.kt b/sample/src/androidMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.android.kt index 84daf79dd1..21bab0faf9 100644 --- a/sample/src/androidMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.android.kt +++ b/sample/src/androidMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.android.kt @@ -24,7 +24,7 @@ import okio.buffer import okio.source import okio.use import org.jetbrains.compose.resources.ExperimentalResourceApi -import sketch_root.sample.generated.resources.Res +import sketch.sample.generated.resources.Res @OptIn(ExperimentalResourceApi::class) actual suspend fun buildFetcherTestItems( diff --git a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/common/list/LoadState.kt b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/common/list/LoadState.kt index 625d4cf52c..7a23a9ce97 100644 --- a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/common/list/LoadState.kt +++ b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/common/list/LoadState.kt @@ -20,8 +20,8 @@ import com.github.panpf.sketch.AsyncImageState import com.github.panpf.sketch.request.LoadState import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource -import sketch_root.sample.generated.resources.Res.drawable -import sketch_root.sample.generated.resources.ic_error_baseline +import sketch.sample.generated.resources.Res.drawable +import sketch.sample.generated.resources.ic_error_baseline @Composable fun LoadState(imageState: AsyncImageState, modifier: Modifier = Modifier) { diff --git a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/HomeScreen.common.kt b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/HomeScreen.common.kt index 9e455c9860..d3e1610720 100644 --- a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/HomeScreen.common.kt +++ b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/HomeScreen.common.kt @@ -33,11 +33,11 @@ import kotlinx.coroutines.launch import org.jetbrains.compose.resources.DrawableResource import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource -import sketch_root.sample.generated.resources.Res -import sketch_root.sample.generated.resources.ic_debug -import sketch_root.sample.generated.resources.ic_giphy -import sketch_root.sample.generated.resources.ic_pexels -import sketch_root.sample.generated.resources.ic_phone +import sketch.sample.generated.resources.Res +import sketch.sample.generated.resources.ic_debug +import sketch.sample.generated.resources.ic_giphy +import sketch.sample.generated.resources.ic_pexels +import sketch.sample.generated.resources.ic_phone expect val gridCellsMinSize: Dp diff --git a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/MainMenu.kt b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/MainMenu.kt index 2921a753b7..d12d907470 100644 --- a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/MainMenu.kt +++ b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/MainMenu.kt @@ -25,12 +25,12 @@ import com.github.panpf.sketch.sample.ui.setting.AppSettingsDialog import com.github.panpf.sketch.sample.ui.setting.Page.LIST import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource -import sketch_root.sample.generated.resources.Res.drawable -import sketch_root.sample.generated.resources.ic_layout_grid -import sketch_root.sample.generated.resources.ic_layout_grid_staggered -import sketch_root.sample.generated.resources.ic_pause -import sketch_root.sample.generated.resources.ic_play -import sketch_root.sample.generated.resources.ic_settings +import sketch.sample.generated.resources.Res.drawable +import sketch.sample.generated.resources.ic_layout_grid +import sketch.sample.generated.resources.ic_layout_grid_staggered +import sketch.sample.generated.resources.ic_pause +import sketch.sample.generated.resources.ic_play +import sketch.sample.generated.resources.ic_settings @OptIn(ExperimentalResourceApi::class) @Composable diff --git a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoGridItem.common.kt b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoGridItem.common.kt index be9baf9913..5839e429ea 100644 --- a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoGridItem.common.kt +++ b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoGridItem.common.kt @@ -41,10 +41,10 @@ import com.github.panpf.sketch.sample.util.ifLet import com.github.panpf.sketch.state.StateImage import com.github.panpf.sketch.state.rememberIconPainterStateImage import com.github.panpf.sketch.state.saveCellularTrafficError -import sketch_root.sample.generated.resources.Res -import sketch_root.sample.generated.resources.ic_image_outline -import sketch_root.sample.generated.resources.ic_image_outline_broken -import sketch_root.sample.generated.resources.ic_signal_cellular +import sketch.sample.generated.resources.Res +import sketch.sample.generated.resources.ic_image_outline +import sketch.sample.generated.resources.ic_image_outline_broken +import sketch.sample.generated.resources.ic_signal_cellular @Composable expect fun rememberAnimatedPlaceholderStateImage(context: PlatformContext): StateImage? diff --git a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoPager.common.kt b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoPager.common.kt index a3df4e8324..c07d99283a 100644 --- a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoPager.common.kt +++ b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoPager.common.kt @@ -65,10 +65,10 @@ import com.github.panpf.sketch.transform.BlurTransformation import kotlinx.coroutines.launch import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource -import sketch_root.sample.generated.resources.Res.drawable -import sketch_root.sample.generated.resources.ic_image2_baseline -import sketch_root.sample.generated.resources.ic_image2_outline -import sketch_root.sample.generated.resources.ic_settings +import sketch.sample.generated.resources.Res.drawable +import sketch.sample.generated.resources.ic_image2_baseline +import sketch.sample.generated.resources.ic_image2_outline +import sketch.sample.generated.resources.ic_settings @Composable @OptIn(ExperimentalFoundationApi::class) diff --git a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/setting/AppSettingsDialog.common.kt b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/setting/AppSettingsDialog.common.kt index 0f0c617dc0..58c8e7c667 100644 --- a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/setting/AppSettingsDialog.common.kt +++ b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/setting/AppSettingsDialog.common.kt @@ -61,8 +61,8 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource -import sketch_root.sample.generated.resources.Res.drawable -import sketch_root.sample.generated.resources.ic_expand_more +import sketch.sample.generated.resources.Res.drawable +import sketch.sample.generated.resources.ic_expand_more @Composable expect fun getSettingsDialogHeight(): Dp diff --git a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/ExifOrientationTestScreen.kt b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/ExifOrientationTestScreen.kt index f056acfd1b..55e553137a 100644 --- a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/ExifOrientationTestScreen.kt +++ b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/ExifOrientationTestScreen.kt @@ -32,8 +32,8 @@ import com.github.panpf.sketch.sample.ui.base.ToolbarScaffold import com.github.panpf.sketch.sample.ui.components.MyAsyncImage import com.github.panpf.sketch.state.rememberIconPainterStateImage import org.jetbrains.compose.resources.ExperimentalResourceApi -import sketch_root.sample.generated.resources.Res.drawable -import sketch_root.sample.generated.resources.ic_image_outline +import sketch.sample.generated.resources.Res.drawable +import sketch.sample.generated.resources.ic_image_outline class ExifOrientationTestScreen : BaseScreen() { diff --git a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/ProgressIndicatorTestScreen.kt b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/ProgressIndicatorTestScreen.kt index a6f611aa3e..07f8a12134 100644 --- a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/ProgressIndicatorTestScreen.kt +++ b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/ProgressIndicatorTestScreen.kt @@ -48,8 +48,8 @@ import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.isActive import kotlinx.coroutines.launch import org.jetbrains.compose.resources.ExperimentalResourceApi -import sketch_root.sample.generated.resources.Res.drawable -import sketch_root.sample.generated.resources.ic_image_outline +import sketch.sample.generated.resources.Res.drawable +import sketch.sample.generated.resources.ic_image_outline import kotlin.random.Random diff --git a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/TempTestScreen.kt b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/TempTestScreen.kt index dc2d55ec0e..bcf83ce1b1 100644 --- a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/TempTestScreen.kt +++ b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/TempTestScreen.kt @@ -15,8 +15,8 @@ import com.github.panpf.sketch.sample.ui.base.BaseScreen import com.github.panpf.sketch.sample.ui.base.ToolbarScaffold import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource -import sketch_root.sample.generated.resources.Res -import sketch_root.sample.generated.resources.ic_image_outline +import sketch.sample.generated.resources.Res +import sketch.sample.generated.resources.ic_image_outline class TempTestScreen : BaseScreen() { diff --git a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/TestPage.common.kt b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/TestPage.common.kt index 290fe3c083..d130009f0b 100644 --- a/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/TestPage.common.kt +++ b/sample/src/commonMain/kotlin/com/github/panpf/sketch/sample/ui/test/TestPage.common.kt @@ -36,8 +36,8 @@ import cafe.adriel.voyager.navigator.LocalNavigator import com.github.panpf.sketch.sample.ui.components.AutoLinkText import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource -import sketch_root.sample.generated.resources.Res -import sketch_root.sample.generated.resources.ic_github +import sketch.sample.generated.resources.Res +import sketch.sample.generated.resources.ic_github expect val testItemGridCells: Int diff --git a/sample/src/desktopMain/kotlin/com/github/panpf/sketch/sample/ui/preview/AsyncImagePreview.kt b/sample/src/desktopMain/kotlin/com/github/panpf/sketch/sample/ui/preview/AsyncImagePreview.kt index cfa05095ed..da8e4218b7 100644 --- a/sample/src/desktopMain/kotlin/com/github/panpf/sketch/sample/ui/preview/AsyncImagePreview.kt +++ b/sample/src/desktopMain/kotlin/com/github/panpf/sketch/sample/ui/preview/AsyncImagePreview.kt @@ -19,8 +19,8 @@ import com.github.panpf.sketch.request.ImageRequest import com.github.panpf.sketch.request.placeholder import com.github.panpf.sketch.sample.ui.util.PreviewWrapper import com.github.panpf.sketch.state.rememberPainterStateImage -import sketch_root.sample.generated.resources.Res -import sketch_root.sample.generated.resources.ic_image2_outline +import sketch.sample.generated.resources.Res +import sketch.sample.generated.resources.ic_image2_outline @Preview diff --git a/sample/src/desktopMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.desktop.kt b/sample/src/desktopMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.desktop.kt index fb280d01c5..6f4705467b 100644 --- a/sample/src/desktopMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.desktop.kt +++ b/sample/src/desktopMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.desktop.kt @@ -14,7 +14,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import net.harawata.appdirs.AppDirsFactory import org.jetbrains.compose.resources.ExperimentalResourceApi -import sketch_root.sample.generated.resources.Res +import sketch.sample.generated.resources.Res import java.io.File @OptIn(ExperimentalResourceApi::class) diff --git a/sample/src/iosMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.ios.kt b/sample/src/iosMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.ios.kt index d8c9d53f7f..f4553258fd 100644 --- a/sample/src/iosMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.ios.kt +++ b/sample/src/iosMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.ios.kt @@ -20,7 +20,7 @@ import platform.Foundation.NSBundle import platform.Foundation.NSCachesDirectory import platform.Foundation.NSSearchPathForDirectoriesInDomains import platform.Foundation.NSUserDomainMask -import sketch_root.sample.generated.resources.Res +import sketch.sample.generated.resources.Res @OptIn(ExperimentalResourceApi::class) actual suspend fun buildFetcherTestItems(context: PlatformContext, fromCompose: Boolean): List { diff --git a/sample/src/jsCommonMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.jsCommon.kt b/sample/src/jsCommonMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.jsCommon.kt index 2c700547bf..187b59041b 100644 --- a/sample/src/jsCommonMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.jsCommon.kt +++ b/sample/src/jsCommonMain/kotlin/com/github/panpf/sketch/sample/ui/test/FetcherTestScreen.jsCommon.kt @@ -4,7 +4,7 @@ import com.github.panpf.sketch.PlatformContext import com.github.panpf.sketch.fetch.newComposeResourceUri import com.github.panpf.sketch.images.MyImages import org.jetbrains.compose.resources.ExperimentalResourceApi -import sketch_root.sample.generated.resources.Res +import sketch.sample.generated.resources.Res @OptIn(ExperimentalResourceApi::class) actual suspend fun buildFetcherTestItems( diff --git a/sample/src/jvmCommonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoViewer.jvm.kt b/sample/src/jvmCommonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoViewer.jvm.kt index f25b0afe91..85be399a0e 100644 --- a/sample/src/jvmCommonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoViewer.jvm.kt +++ b/sample/src/jvmCommonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoViewer.jvm.kt @@ -50,13 +50,13 @@ import com.github.panpf.zoomimage.zoom.valueOf import kotlinx.coroutines.launch import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource -import sketch_root.sample.generated.resources.Res.drawable -import sketch_root.sample.generated.resources.ic_info_baseline -import sketch_root.sample.generated.resources.ic_rotate_right -import sketch_root.sample.generated.resources.ic_save -import sketch_root.sample.generated.resources.ic_share -import sketch_root.sample.generated.resources.ic_zoom_in -import sketch_root.sample.generated.resources.ic_zoom_out +import sketch.sample.generated.resources.Res.drawable +import sketch.sample.generated.resources.ic_info_baseline +import sketch.sample.generated.resources.ic_rotate_right +import sketch.sample.generated.resources.ic_save +import sketch.sample.generated.resources.ic_share +import sketch.sample.generated.resources.ic_zoom_in +import sketch.sample.generated.resources.ic_zoom_out import kotlin.math.roundToInt @Composable diff --git a/sample/src/nonJvmCommonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoViewer.nonJvm.kt b/sample/src/nonJvmCommonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoViewer.nonJvm.kt index fc1817d215..85b9feaf92 100644 --- a/sample/src/nonJvmCommonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoViewer.nonJvm.kt +++ b/sample/src/nonJvmCommonMain/kotlin/com/github/panpf/sketch/sample/ui/gallery/PhotoViewer.nonJvm.kt @@ -44,12 +44,12 @@ import com.github.panpf.sketch.state.ThumbnailMemoryCacheStateImage import kotlinx.coroutines.launch import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource -import sketch_root.sample.generated.resources.Res.drawable -import sketch_root.sample.generated.resources.ic_info_baseline -import sketch_root.sample.generated.resources.ic_rotate_right -import sketch_root.sample.generated.resources.ic_save -import sketch_root.sample.generated.resources.ic_share -import sketch_root.sample.generated.resources.ic_zoom_in +import sketch.sample.generated.resources.Res.drawable +import sketch.sample.generated.resources.ic_info_baseline +import sketch.sample.generated.resources.ic_rotate_right +import sketch.sample.generated.resources.ic_save +import sketch.sample.generated.resources.ic_share +import sketch.sample.generated.resources.ic_zoom_in @Composable actual fun PhotoViewer( diff --git a/settings.gradle.kts b/settings.gradle.kts index 554c37a0f9..fcff343e1f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,4 +1,7 @@ +// The name of the root project cannot be changed because the sample app needs to rely on +// it when generating compose resources. rootProject.name = "sketch" + enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") dependencyResolutionManagement {