From 56388e09b71c780997b634f30aeff1d61d170080 Mon Sep 17 00:00:00 2001 From: Louis CAD Date: Sun, 28 Apr 2019 18:49:45 +0200 Subject: [PATCH] Move android-app sample and change its package name --- {sample => samples/android-app}/.gitignore | 0 {sample => samples/android-app}/README.md | 0 .../android-app}/build.gradle.kts | 1 - .../android-app}/proguard-rules.pro | 0 .../src/androidMain/AndroidManifest.xml | 34 ++++----- .../kotlin/com/example/splitties}/AppInit.kt | 2 +- .../com/example/splitties}/AppInitProvider.kt | 2 +- .../kotlin/com/example/splitties}/DemoApp.kt | 2 +- .../splitties}/SecondProcessInitProvider.kt | 2 +- .../example/splitties}/about/AboutActivity.kt | 2 +- .../com/example/splitties}/about/AboutUi.kt | 6 +- .../splitties}/about/AboutUiWithLabels.kt | 6 +- .../example/splitties}/demo/DemoActivity.kt | 4 +- .../example/splitties}/demo/DemoAdapter.kt | 4 +- .../com/example/splitties}/demo/DemoItem.kt | 2 +- .../com/example/splitties}/demo/DemoUi.kt | 4 +- .../splitties}/demo/ImmutableBasicItem.kt | 2 +- .../example/splitties}/examples/ViewModel.kt | 2 +- .../extensions/HtmlStringToSpanned.kt | 2 +- .../example/splitties}/extensions/Intents.kt | 2 +- .../example/splitties}/extensions/NoGetter.kt | 2 +- .../example/splitties}/extensions/UiMode.kt | 2 +- .../coroutines/BroadcastReceiverChannels.kt | 2 +- .../extensions/coroutines/Channels.kt | 2 +- .../extensions/coroutines/ConflatedValues.kt | 2 +- .../extensions/coroutines/LiveDataChannel.kt | 2 +- .../extensions/coroutines/Racing.kt | 2 +- .../extensions/coroutines/ScopeLoops.kt | 2 +- .../extensions/coroutines/SendChannel.kt | 2 +- .../extensions/coroutines/SuspendLazy.kt | 2 +- .../extensions/coroutines/SuspendLazyRoom.kt | 2 +- .../extensions/dialog/ShowDialogInScope.kt | 4 +- .../extensions/drawables/GradientDrawable.kt | 6 +- .../splitties}/extensions/drawables/Shape.kt | 2 +- .../extensions/drawables/ShapeDrawable.kt | 2 +- .../extensions/drawables/StateListDrawable.kt | 2 +- .../splitties}/extensions/menu/Menu.kt | 2 +- .../splitties}/extensions/menu/MenuItem.kt | 2 +- .../extensions/receiver/BroadcastReceiver.kt | 2 +- .../splitties}/extensions/ui/AppBar.kt | 4 +- .../example/splitties}/main/MainActivity.kt | 24 +++--- .../com/example/splitties}/main/MainUi.kt | 4 +- .../MaterialComponentsCheatSheetUi.kt | 6 +- .../splitties}/prefs/GamePreferences.kt | 4 +- .../permissions/PermissionsExampleActivity.kt | 4 +- .../permissions/SampleEnsurePermission.kt | 72 +++++++++++------- .../splitties}/preview/sound/MediaPlayer.kt | 2 +- .../splitties}/preview/sound/ResourcesUri.kt | 2 +- .../preview/vibrator/VibrationEffect.kt | 2 +- .../splitties}/sayhello/SayHelloActivity.kt | 2 +- .../example/splitties}/sayhello/SayHelloUi.kt | 6 +- .../res/drawable/ic_bug_report_white_24dp.xml | 0 .../res/drawable/ic_computer_white_24dp.xml | 0 .../res/drawable/ic_favorite_white_24dp.xml | 0 .../drawable/ic_invert_colors_white_24dp.xml | 0 .../res/mipmap-hdpi/ic_launcher.png | Bin .../res/mipmap-mdpi/ic_launcher.png | Bin .../res/mipmap-xhdpi/ic_launcher.png | Bin .../res/mipmap-xxhdpi/ic_launcher.png | Bin .../res/mipmap-xxxhdpi/ic_launcher.png | Bin .../androidMain/res/values-night/styles.xml | 0 .../androidMain/res/values-w820dp/dimens.xml | 0 .../src/androidMain/res/values/colors.xml | 0 .../src/androidMain/res/values/dimens.xml | 0 .../src/androidMain/res/values/menu_ids.xml | 0 .../src/androidMain/res/values/strings.xml | 0 .../res/values/strings_ensure_permission.xml | 0 .../res/values/strings_large_text.xml | 0 .../src/androidMain/res/values/styles.xml | 0 .../src/androidMain/res/values/view_ids.xml | 0 .../src/debug/res/layout/preview_about_ui.xml | 0 .../layout/preview_about_ui_with_labels.xml | 0 .../src/debug/res/layout/preview_demo_ui.xml | 0 .../src/debug/res/layout/preview_main_ui.xml | 0 settings.gradle.kts | 9 ++- tests/src/main/AndroidManifest.xml | 2 +- 76 files changed, 141 insertions(+), 125 deletions(-) rename {sample => samples/android-app}/.gitignore (100%) rename {sample => samples/android-app}/README.md (100%) rename {sample => samples/android-app}/build.gradle.kts (98%) rename {sample => samples/android-app}/proguard-rules.pro (100%) rename {sample => samples/android-app}/src/androidMain/AndroidManifest.xml (69%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/AppInit.kt (92%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/AppInitProvider.kt (87%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/DemoApp.kt (90%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/SecondProcessInitProvider.kt (93%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/about/AboutActivity.kt (91%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/about/AboutUi.kt (92%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/about/AboutUiWithLabels.kt (94%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/demo/DemoActivity.kt (94%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/demo/DemoAdapter.kt (96%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/demo/DemoItem.kt (90%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/demo/DemoUi.kt (95%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/demo/ImmutableBasicItem.kt (91%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/examples/ViewModel.kt (91%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/HtmlStringToSpanned.kt (95%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/Intents.kt (90%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/NoGetter.kt (89%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/UiMode.kt (94%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/coroutines/BroadcastReceiverChannels.kt (96%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/coroutines/Channels.kt (95%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/coroutines/ConflatedValues.kt (96%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/coroutines/LiveDataChannel.kt (93%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/coroutines/Racing.kt (97%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/coroutines/ScopeLoops.kt (85%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/coroutines/SendChannel.kt (83%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/coroutines/SuspendLazy.kt (90%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/coroutines/SuspendLazyRoom.kt (88%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/dialog/ShowDialogInScope.kt (94%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/drawables/GradientDrawable.kt (84%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/drawables/Shape.kt (85%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/drawables/ShapeDrawable.kt (89%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/drawables/StateListDrawable.kt (98%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/menu/Menu.kt (93%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/menu/MenuItem.kt (93%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/receiver/BroadcastReceiver.kt (94%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/extensions/ui/AppBar.kt (92%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/main/MainActivity.kt (77%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/main/MainUi.kt (97%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/material/MaterialComponentsCheatSheetUi.kt (96%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/prefs/GamePreferences.kt (84%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/preview/permissions/PermissionsExampleActivity.kt (95%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/preview/permissions/SampleEnsurePermission.kt (56%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/preview/sound/MediaPlayer.kt (93%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/preview/sound/ResourcesUri.kt (86%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/preview/vibrator/VibrationEffect.kt (98%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/sayhello/SayHelloActivity.kt (90%) rename {sample/src/androidMain/kotlin/com/louiscad/splittiessample => samples/android-app/src/androidMain/kotlin/com/example/splitties}/sayhello/SayHelloUi.kt (93%) rename {sample => samples/android-app}/src/androidMain/res/drawable/ic_bug_report_white_24dp.xml (100%) rename {sample => samples/android-app}/src/androidMain/res/drawable/ic_computer_white_24dp.xml (100%) rename {sample => samples/android-app}/src/androidMain/res/drawable/ic_favorite_white_24dp.xml (100%) rename {sample => samples/android-app}/src/androidMain/res/drawable/ic_invert_colors_white_24dp.xml (100%) rename {sample => samples/android-app}/src/androidMain/res/mipmap-hdpi/ic_launcher.png (100%) rename {sample => samples/android-app}/src/androidMain/res/mipmap-mdpi/ic_launcher.png (100%) rename {sample => samples/android-app}/src/androidMain/res/mipmap-xhdpi/ic_launcher.png (100%) rename {sample => samples/android-app}/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png (100%) rename {sample => samples/android-app}/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png (100%) rename {sample => samples/android-app}/src/androidMain/res/values-night/styles.xml (100%) rename {sample => samples/android-app}/src/androidMain/res/values-w820dp/dimens.xml (100%) rename {sample => samples/android-app}/src/androidMain/res/values/colors.xml (100%) rename {sample => samples/android-app}/src/androidMain/res/values/dimens.xml (100%) rename {sample => samples/android-app}/src/androidMain/res/values/menu_ids.xml (100%) rename {sample => samples/android-app}/src/androidMain/res/values/strings.xml (100%) rename {sample => samples/android-app}/src/androidMain/res/values/strings_ensure_permission.xml (100%) rename {sample => samples/android-app}/src/androidMain/res/values/strings_large_text.xml (100%) rename {sample => samples/android-app}/src/androidMain/res/values/styles.xml (100%) rename {sample => samples/android-app}/src/androidMain/res/values/view_ids.xml (100%) rename {sample => samples/android-app}/src/debug/res/layout/preview_about_ui.xml (100%) rename {sample => samples/android-app}/src/debug/res/layout/preview_about_ui_with_labels.xml (100%) rename {sample => samples/android-app}/src/debug/res/layout/preview_demo_ui.xml (100%) rename {sample => samples/android-app}/src/debug/res/layout/preview_main_ui.xml (100%) diff --git a/sample/.gitignore b/samples/android-app/.gitignore similarity index 100% rename from sample/.gitignore rename to samples/android-app/.gitignore diff --git a/sample/README.md b/samples/android-app/README.md similarity index 100% rename from sample/README.md rename to samples/android-app/README.md diff --git a/sample/build.gradle.kts b/samples/android-app/build.gradle.kts similarity index 98% rename from sample/build.gradle.kts rename to samples/android-app/build.gradle.kts index 7584141a0..651825fa2 100644 --- a/sample/build.gradle.kts +++ b/samples/android-app/build.gradle.kts @@ -63,7 +63,6 @@ kotlin { } getByName("commonMain").dependencies { api(kotlin("stdlib-common")) - implementation(project(":samples:base-app")) } getByName("androidMain").dependencies { implementation(project(":fun-packs:android-material-components-with-views-dsl")) diff --git a/sample/proguard-rules.pro b/samples/android-app/proguard-rules.pro similarity index 100% rename from sample/proguard-rules.pro rename to samples/android-app/proguard-rules.pro diff --git a/sample/src/androidMain/AndroidManifest.xml b/samples/android-app/src/androidMain/AndroidManifest.xml similarity index 69% rename from sample/src/androidMain/AndroidManifest.xml rename to samples/android-app/src/androidMain/AndroidManifest.xml index 51259b138..c60211ffc 100644 --- a/sample/src/androidMain/AndroidManifest.xml +++ b/samples/android-app/src/androidMain/AndroidManifest.xml @@ -2,7 +2,7 @@ - @@ -10,7 +10,7 @@ @@ -30,53 +30,53 @@ + android:parentActivityName="com.example.splitties.main.MainActivity"> + android:value="com.example.splitties.main.MainActivity"/> + android:parentActivityName="com.example.splitties.main.MainActivity"> + android:value="com.example.splitties.main.MainActivity"/> + android:parentActivityName="com.example.splitties.main.MainActivity"> + android:value="com.example.splitties.main.MainActivity"/> + android:parentActivityName="com.example.splitties.main.MainActivity"> + android:value="com.example.splitties.main.MainActivity"/> Nothing ): Unit = ensurePermission( + activity = this, + fragmentManager = supportFragmentManager, + lifecycle = lifecycle, permission = permission, - showRationaleAndContinueOrReturn = { - alertDialog( - title = askDialogTitle, - message = askDialogMessage - ).showAndAwait( - okValue = true, - negativeButton = DialogButton(returnButtonText, false), - dismissValue = true - ) - }, + askDialogTitle = askDialogTitle, + askDialogMessage = askDialogMessage, showRationaleBeforeFirstAsk = showRationaleBeforeFirstAsk, - askOpenSettingsOrReturn = { - alertDialog( - message = txt(R.string.permission_denied_permanently_go_to_settings) - ).showAndAwait( - okValue = true, - negativeButton = DialogButton(returnButtonText, false), - dismissValue = true - ) - }, + returnButtonText = returnButtonText, returnOrThrowBlock = returnOrThrowBlock ) @@ -54,26 +43,51 @@ suspend inline fun Fragment.ensurePermission( returnButtonText: CharSequence = txt(R.string.quit), returnOrThrowBlock: () -> Nothing ): Unit = ensurePermission( + activity = requireActivity(), + fragmentManager = requireFragmentManager(), + lifecycle = lifecycle, + permission = permission, + askDialogTitle = askDialogTitle, + askDialogMessage = askDialogMessage, + showRationaleBeforeFirstAsk = showRationaleBeforeFirstAsk, + returnButtonText = returnButtonText, + returnOrThrowBlock = returnOrThrowBlock +) + +suspend inline fun ensurePermission( + activity: Activity, + fragmentManager: FragmentManager, + lifecycle: Lifecycle, + permission: String, + askDialogTitle: CharSequence, + askDialogMessage: CharSequence, + showRationaleBeforeFirstAsk: Boolean = true, + returnButtonText: CharSequence = activity.txt(R.string.quit), + returnOrThrowBlock: () -> Nothing +): Unit = ensurePermission( + activity = activity, + fragmentManager = fragmentManager, + lifecycle = lifecycle, permission = permission, showRationaleAndContinueOrReturn = { - activity?.alertDialog( + activity.alertDialog( title = askDialogTitle, message = askDialogMessage - )?.showAndAwait( + ).showAndAwait( okValue = true, negativeButton = DialogButton(returnButtonText, false), dismissValue = true - ) ?: throw CancellationException() // Not fatal in coroutines world. No need to catch it. + ) }, showRationaleBeforeFirstAsk = showRationaleBeforeFirstAsk, askOpenSettingsOrReturn = { - activity?.alertDialog( - message = txt(R.string.permission_denied_permanently_go_to_settings) - )?.showAndAwait( + activity.alertDialog( + message = activity.txt(R.string.permission_denied_permanently_go_to_settings) + ).showAndAwait( okValue = true, negativeButton = DialogButton(returnButtonText, false), dismissValue = true - ) ?: throw CancellationException() // Not fatal in coroutines world. No need to catch it. + ) }, returnOrThrowBlock = returnOrThrowBlock ) diff --git a/sample/src/androidMain/kotlin/com/louiscad/splittiessample/preview/sound/MediaPlayer.kt b/samples/android-app/src/androidMain/kotlin/com/example/splitties/preview/sound/MediaPlayer.kt similarity index 93% rename from sample/src/androidMain/kotlin/com/louiscad/splittiessample/preview/sound/MediaPlayer.kt rename to samples/android-app/src/androidMain/kotlin/com/example/splitties/preview/sound/MediaPlayer.kt index d11e1cbaa..aa0df64c3 100644 --- a/sample/src/androidMain/kotlin/com/louiscad/splittiessample/preview/sound/MediaPlayer.kt +++ b/samples/android-app/src/androidMain/kotlin/com/example/splitties/preview/sound/MediaPlayer.kt @@ -2,7 +2,7 @@ * Copyright 2019 Louis Cognault Ayeva Derman. Use of this source code is governed by the Apache 2.0 license. */ -package com.louiscad.splittiessample.preview.sound +package com.example.splitties.preview.sound import android.media.MediaPlayer import kotlinx.coroutines.suspendCancellableCoroutine diff --git a/sample/src/androidMain/kotlin/com/louiscad/splittiessample/preview/sound/ResourcesUri.kt b/samples/android-app/src/androidMain/kotlin/com/example/splitties/preview/sound/ResourcesUri.kt similarity index 86% rename from sample/src/androidMain/kotlin/com/louiscad/splittiessample/preview/sound/ResourcesUri.kt rename to samples/android-app/src/androidMain/kotlin/com/example/splitties/preview/sound/ResourcesUri.kt index 2cb49da0f..094a71686 100644 --- a/sample/src/androidMain/kotlin/com/louiscad/splittiessample/preview/sound/ResourcesUri.kt +++ b/samples/android-app/src/androidMain/kotlin/com/example/splitties/preview/sound/ResourcesUri.kt @@ -2,7 +2,7 @@ * Copyright 2019 Louis Cognault Ayeva Derman. Use of this source code is governed by the Apache 2.0 license. */ -package com.louiscad.splittiessample.preview.sound +package com.example.splitties.preview.sound import android.net.Uri import androidx.annotation.RawRes diff --git a/sample/src/androidMain/kotlin/com/louiscad/splittiessample/preview/vibrator/VibrationEffect.kt b/samples/android-app/src/androidMain/kotlin/com/example/splitties/preview/vibrator/VibrationEffect.kt similarity index 98% rename from sample/src/androidMain/kotlin/com/louiscad/splittiessample/preview/vibrator/VibrationEffect.kt rename to samples/android-app/src/androidMain/kotlin/com/example/splitties/preview/vibrator/VibrationEffect.kt index f03b51378..71a91d8bd 100644 --- a/sample/src/androidMain/kotlin/com/louiscad/splittiessample/preview/vibrator/VibrationEffect.kt +++ b/samples/android-app/src/androidMain/kotlin/com/example/splitties/preview/vibrator/VibrationEffect.kt @@ -1,7 +1,7 @@ /* * Copyright 2019 Louis Cognault Ayeva Derman. Use of this source code is governed by the Apache 2.0 license. */ -package com.louiscad.splittiessample.preview.vibrator +package com.example.splitties.preview.vibrator import android.Manifest import android.annotation.SuppressLint diff --git a/sample/src/androidMain/kotlin/com/louiscad/splittiessample/sayhello/SayHelloActivity.kt b/samples/android-app/src/androidMain/kotlin/com/example/splitties/sayhello/SayHelloActivity.kt similarity index 90% rename from sample/src/androidMain/kotlin/com/louiscad/splittiessample/sayhello/SayHelloActivity.kt rename to samples/android-app/src/androidMain/kotlin/com/example/splitties/sayhello/SayHelloActivity.kt index bc9888fac..31bac8658 100644 --- a/sample/src/androidMain/kotlin/com/louiscad/splittiessample/sayhello/SayHelloActivity.kt +++ b/samples/android-app/src/androidMain/kotlin/com/example/splitties/sayhello/SayHelloActivity.kt @@ -1,7 +1,7 @@ /* * Copyright 2019 Louis Cognault Ayeva Derman. Use of this source code is governed by the Apache 2.0 license. */ -package com.louiscad.splittiessample.sayhello +package com.example.splitties.sayhello import android.os.Bundle import androidx.appcompat.app.AppCompatActivity diff --git a/sample/src/androidMain/kotlin/com/louiscad/splittiessample/sayhello/SayHelloUi.kt b/samples/android-app/src/androidMain/kotlin/com/example/splitties/sayhello/SayHelloUi.kt similarity index 93% rename from sample/src/androidMain/kotlin/com/louiscad/splittiessample/sayhello/SayHelloUi.kt rename to samples/android-app/src/androidMain/kotlin/com/example/splitties/sayhello/SayHelloUi.kt index 2353cda38..91f4a5eb2 100644 --- a/sample/src/androidMain/kotlin/com/louiscad/splittiessample/sayhello/SayHelloUi.kt +++ b/samples/android-app/src/androidMain/kotlin/com/example/splitties/sayhello/SayHelloUi.kt @@ -1,12 +1,12 @@ /* * Copyright 2019 Louis Cognault Ayeva Derman. Use of this source code is governed by the Apache 2.0 license. */ -package com.louiscad.splittiessample.sayhello +package com.example.splitties.sayhello import android.content.Context import androidx.coordinatorlayout.widget.CoordinatorLayout -import com.louiscad.splittiessample.R -import com.louiscad.splittiessample.extensions.ui.addDefaultAppBar +import com.example.splitties.R +import com.example.splitties.extensions.ui.addDefaultAppBar import splitties.dimensions.dip import splitties.experimental.ExperimentalSplittiesApi import splitties.snackbar.snack diff --git a/sample/src/androidMain/res/drawable/ic_bug_report_white_24dp.xml b/samples/android-app/src/androidMain/res/drawable/ic_bug_report_white_24dp.xml similarity index 100% rename from sample/src/androidMain/res/drawable/ic_bug_report_white_24dp.xml rename to samples/android-app/src/androidMain/res/drawable/ic_bug_report_white_24dp.xml diff --git a/sample/src/androidMain/res/drawable/ic_computer_white_24dp.xml b/samples/android-app/src/androidMain/res/drawable/ic_computer_white_24dp.xml similarity index 100% rename from sample/src/androidMain/res/drawable/ic_computer_white_24dp.xml rename to samples/android-app/src/androidMain/res/drawable/ic_computer_white_24dp.xml diff --git a/sample/src/androidMain/res/drawable/ic_favorite_white_24dp.xml b/samples/android-app/src/androidMain/res/drawable/ic_favorite_white_24dp.xml similarity index 100% rename from sample/src/androidMain/res/drawable/ic_favorite_white_24dp.xml rename to samples/android-app/src/androidMain/res/drawable/ic_favorite_white_24dp.xml diff --git a/sample/src/androidMain/res/drawable/ic_invert_colors_white_24dp.xml b/samples/android-app/src/androidMain/res/drawable/ic_invert_colors_white_24dp.xml similarity index 100% rename from sample/src/androidMain/res/drawable/ic_invert_colors_white_24dp.xml rename to samples/android-app/src/androidMain/res/drawable/ic_invert_colors_white_24dp.xml diff --git a/sample/src/androidMain/res/mipmap-hdpi/ic_launcher.png b/samples/android-app/src/androidMain/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from sample/src/androidMain/res/mipmap-hdpi/ic_launcher.png rename to samples/android-app/src/androidMain/res/mipmap-hdpi/ic_launcher.png diff --git a/sample/src/androidMain/res/mipmap-mdpi/ic_launcher.png b/samples/android-app/src/androidMain/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from sample/src/androidMain/res/mipmap-mdpi/ic_launcher.png rename to samples/android-app/src/androidMain/res/mipmap-mdpi/ic_launcher.png diff --git a/sample/src/androidMain/res/mipmap-xhdpi/ic_launcher.png b/samples/android-app/src/androidMain/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from sample/src/androidMain/res/mipmap-xhdpi/ic_launcher.png rename to samples/android-app/src/androidMain/res/mipmap-xhdpi/ic_launcher.png diff --git a/sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png b/samples/android-app/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png rename to samples/android-app/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png diff --git a/sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png b/samples/android-app/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png rename to samples/android-app/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/sample/src/androidMain/res/values-night/styles.xml b/samples/android-app/src/androidMain/res/values-night/styles.xml similarity index 100% rename from sample/src/androidMain/res/values-night/styles.xml rename to samples/android-app/src/androidMain/res/values-night/styles.xml diff --git a/sample/src/androidMain/res/values-w820dp/dimens.xml b/samples/android-app/src/androidMain/res/values-w820dp/dimens.xml similarity index 100% rename from sample/src/androidMain/res/values-w820dp/dimens.xml rename to samples/android-app/src/androidMain/res/values-w820dp/dimens.xml diff --git a/sample/src/androidMain/res/values/colors.xml b/samples/android-app/src/androidMain/res/values/colors.xml similarity index 100% rename from sample/src/androidMain/res/values/colors.xml rename to samples/android-app/src/androidMain/res/values/colors.xml diff --git a/sample/src/androidMain/res/values/dimens.xml b/samples/android-app/src/androidMain/res/values/dimens.xml similarity index 100% rename from sample/src/androidMain/res/values/dimens.xml rename to samples/android-app/src/androidMain/res/values/dimens.xml diff --git a/sample/src/androidMain/res/values/menu_ids.xml b/samples/android-app/src/androidMain/res/values/menu_ids.xml similarity index 100% rename from sample/src/androidMain/res/values/menu_ids.xml rename to samples/android-app/src/androidMain/res/values/menu_ids.xml diff --git a/sample/src/androidMain/res/values/strings.xml b/samples/android-app/src/androidMain/res/values/strings.xml similarity index 100% rename from sample/src/androidMain/res/values/strings.xml rename to samples/android-app/src/androidMain/res/values/strings.xml diff --git a/sample/src/androidMain/res/values/strings_ensure_permission.xml b/samples/android-app/src/androidMain/res/values/strings_ensure_permission.xml similarity index 100% rename from sample/src/androidMain/res/values/strings_ensure_permission.xml rename to samples/android-app/src/androidMain/res/values/strings_ensure_permission.xml diff --git a/sample/src/androidMain/res/values/strings_large_text.xml b/samples/android-app/src/androidMain/res/values/strings_large_text.xml similarity index 100% rename from sample/src/androidMain/res/values/strings_large_text.xml rename to samples/android-app/src/androidMain/res/values/strings_large_text.xml diff --git a/sample/src/androidMain/res/values/styles.xml b/samples/android-app/src/androidMain/res/values/styles.xml similarity index 100% rename from sample/src/androidMain/res/values/styles.xml rename to samples/android-app/src/androidMain/res/values/styles.xml diff --git a/sample/src/androidMain/res/values/view_ids.xml b/samples/android-app/src/androidMain/res/values/view_ids.xml similarity index 100% rename from sample/src/androidMain/res/values/view_ids.xml rename to samples/android-app/src/androidMain/res/values/view_ids.xml diff --git a/sample/src/debug/res/layout/preview_about_ui.xml b/samples/android-app/src/debug/res/layout/preview_about_ui.xml similarity index 100% rename from sample/src/debug/res/layout/preview_about_ui.xml rename to samples/android-app/src/debug/res/layout/preview_about_ui.xml diff --git a/sample/src/debug/res/layout/preview_about_ui_with_labels.xml b/samples/android-app/src/debug/res/layout/preview_about_ui_with_labels.xml similarity index 100% rename from sample/src/debug/res/layout/preview_about_ui_with_labels.xml rename to samples/android-app/src/debug/res/layout/preview_about_ui_with_labels.xml diff --git a/sample/src/debug/res/layout/preview_demo_ui.xml b/samples/android-app/src/debug/res/layout/preview_demo_ui.xml similarity index 100% rename from sample/src/debug/res/layout/preview_demo_ui.xml rename to samples/android-app/src/debug/res/layout/preview_demo_ui.xml diff --git a/sample/src/debug/res/layout/preview_main_ui.xml b/samples/android-app/src/debug/res/layout/preview_main_ui.xml similarity index 100% rename from sample/src/debug/res/layout/preview_main_ui.xml rename to samples/android-app/src/debug/res/layout/preview_main_ui.xml diff --git a/settings.gradle.kts b/settings.gradle.kts index f3a52ac76..e3bfeffa2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,7 +4,7 @@ * Copyright 2019 Louis Cognault Ayeva Derman. Use of this source code is governed by the Apache 2.0 license. */ -listOf( +arrayOf( ":activities", ":alertdialog", ":alertdialog-appcompat", @@ -55,7 +55,7 @@ listOf( ":views-selectable-constraintlayout" ).forEach { include(":modules$it") } -listOf( +arrayOf( "android-base", "android-base-with-views-dsl", "android-appcompat", @@ -64,7 +64,10 @@ listOf( "android-material-components-with-views-dsl" ).forEach { include(":fun-packs:$it") } -include(":sample") +arrayOf( + "android-app" +).forEach { include(":samples:$it") } + include(":tests") enableFeaturePreview("GRADLE_METADATA") diff --git a/tests/src/main/AndroidManifest.xml b/tests/src/main/AndroidManifest.xml index 67ad1ef13..7681fffd9 100644 --- a/tests/src/main/AndroidManifest.xml +++ b/tests/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ -