diff --git a/.fleet/receipt.json b/.fleet/receipt.json
new file mode 100644
index 0000000..f2be352
--- /dev/null
+++ b/.fleet/receipt.json
@@ -0,0 +1,29 @@
+// Project generated by Kotlin Multiplatform Wizard
+{
+ "spec": {
+ "template_id": "kmt",
+ "targets": {
+ "android": {
+ "ui": [
+ "compose"
+ ]
+ },
+ "ios": {
+ "ui": [
+ "compose"
+ ]
+ },
+ "desktop": {
+ "ui": [
+ "compose"
+ ]
+ },
+ "web": {
+ "ui": [
+ "compose"
+ ]
+ }
+ }
+ },
+ "timestamp": "2024-05-12T01:09:16.901418563Z"
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 10cfdbf..33e4c75 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,17 @@
*.iml
.gradle
-/local.properties
-/.idea
+**/build/
+xcuserdata
+!src/**/build/
+local.properties
+.idea
.DS_Store
-/build
-/captures
+captures
.externalNativeBuild
.cxx
-local.properties
+*.xcodeproj/*
+!*.xcodeproj/project.pbxproj
+!*.xcodeproj/xcshareddata/
+!*.xcodeproj/project.xcworkspace/
+!*.xcworkspace/contents.xcworkspacedata
+**/xcshareddata/WorkspaceSettings.xcsettings
diff --git a/README.md b/README.md
index 3bc1ced..bcf2535 100644
--- a/README.md
+++ b/README.md
@@ -14,33 +14,32 @@ Indicators #1 |
|
-
## Usage
- #### Step 1
Add it in settings.gradle:
-
- ```bash
+
+ ```kotlin
allprojects {
repositories {
...
- maven { url 'https://jitpack.io' }
+ maven("https://s01.oss.sonatype.org")
}
}
- #### Step 2
Add the dependency
-
- ```bash
- dependencies {
- implementation 'com.github.MahboubehSeyedpour:jetpack-loading:1.1.0'
+
+ ```kotlin
+ commonMain.dependencies {
+ implementation('com.github.MahboubehSeyedpour:jetpack-loading:$version')
}
-- #### Step 3
+- #### Step 3
It's very simple to use. Just add component where you want
- ```bash
+ ```kotlin
@Composable
fun Greeting() {
...
@@ -48,9 +47,9 @@ Indicators #1 |
...
}
```
-
+
You can also control the details of the animations using parameters
- ```bash
+ ```kotlin
@Composable
fun Greeting() {
...
@@ -60,66 +59,66 @@ Indicators #1 |
```
Enjoy JetpackLoading 😊
-
+
## Indicators
The indicators are as follows:
1. Indicators #1
-
- Row 1
- - `PulsatingDot`
- - `GridPulsatingDot`
- - `CircularPulsatingIndicator`
- - `BallClipRotatePulseIndicator`
-
- Row 2
- - `SquareSpinIndicator`
- - `BallClipRotateMultipleIndicator`
- - `BallPulseRiseIndicator`
- - `BallRotateIndicator`
-
- Row 3
- - `CubeTransitionIndicator`
- - `BallZigZagIndicator`
- - `BallZigZagDeflectIndicator`
- - `BallTrianglePathIndicator`
-
- Row 4
- - `BallScaleIndicator`
- - `LineScaleIndicator`
- - `LineScaleIndicator`
- - `BallScaleMultipleIndicator`
-
- Row 5
- - `BallPulseSyncIndicator`
- - `BallBeatIndicator`
- - `LineScaleIndicator`
- - `LineScaleIndicator`
-
- Row 6
- - `BallScaleRippleIndicator`
- - `BallScaleRippleMultipleIndicator`
- - `BallSpinFadeLoaderIndicator`
- - `LineSpinFadeLoaderIndicator`
-
- Row 7
- - `TriangleSpinIndicator`
- - `PacmanIndicator`
- - `BallGridBeatIndicator`
- - `SemiCircleSpinIndicator`
+
+ Row 1
+ - `PulsatingDot`
+ - `GridPulsatingDot`
+ - `CircularPulsatingIndicator`
+ - `BallClipRotatePulseIndicator`
+
+ Row 2
+ - `SquareSpinIndicator`
+ - `BallClipRotateMultipleIndicator`
+ - `BallPulseRiseIndicator`
+ - `BallRotateIndicator`
+
+ Row 3
+ - `CubeTransitionIndicator`
+ - `BallZigZagIndicator`
+ - `BallZigZagDeflectIndicator`
+ - `BallTrianglePathIndicator`
+
+ Row 4
+ - `BallScaleIndicator`
+ - `LineScaleIndicator`
+ - `LineScaleIndicator`
+ - `BallScaleMultipleIndicator`
+
+ Row 5
+ - `BallPulseSyncIndicator`
+ - `BallBeatIndicator`
+ - `LineScaleIndicator`
+ - `LineScaleIndicator`
+
+ Row 6
+ - `BallScaleRippleIndicator`
+ - `BallScaleRippleMultipleIndicator`
+ - `BallSpinFadeLoaderIndicator`
+ - `LineSpinFadeLoaderIndicator`
+
+ Row 7
+ - `TriangleSpinIndicator`
+ - `PacmanIndicator`
+ - `BallGridBeatIndicator`
+ - `SemiCircleSpinIndicator`
2. Indicators #2
-
- Row 1
- - `GridFadeDiagonal`
- - `GridFadeAntiDiagonal`
- - `BallRespectivelyExitIndicator`
- - `TriangleShapeIndicator`
- Row 2
- - `CircleShapeIndicator`
+ Row 1
+ - `GridFadeDiagonal`
+ - `GridFadeAntiDiagonal`
+ - `BallRespectivelyExitIndicator`
+ - `TriangleShapeIndicator`
+
+ Row 2
+ - `CircleShapeIndicator`
## 🔗 Contact
@@ -144,4 +143,4 @@ Copyright 2023 Mahboubeh Seyedpour
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-```
+```
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
deleted file mode 100644
index 42afabf..0000000
--- a/app/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
deleted file mode 100644
index cda4427..0000000
--- a/app/build.gradle
+++ /dev/null
@@ -1,57 +0,0 @@
-plugins {
- id 'com.android.application'
- id 'org.jetbrains.kotlin.android'
-}
-
-android {
- namespace 'com.example.jetpackloading'
- compileSdk 34
-
- defaultConfig {
- applicationId "com.example.jetpackloading"
- minSdk 24
- targetSdk 34
- versionCode 1
- versionName "0.1.0"
-
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- vectorDrawables {
- useSupportLibrary true
- }
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- kotlinOptions {
- jvmTarget = '1.8'
- }
- buildFeatures {
- compose true
- }
- composeOptions {
- kotlinCompilerExtensionVersion '1.5.3'
- }
- packagingOptions {
- resources {
- excludes += '/META-INF/{AL2.0,LGPL2.1}'
- }
- }
-}
-
-dependencies {
-
- implementation 'androidx.core:core-ktx:1.12.0'
- implementation 'androidx.activity:activity-compose:1.7.2'
- implementation platform('androidx.compose:compose-bom:2022.10.00')
- implementation 'androidx.compose.material3:material3'
-
- implementation project(":jetpack-loading")
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/spr/jetpackloading/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/spr/jetpackloading/ExampleInstrumentedTest.kt
deleted file mode 100644
index c3dd2e3..0000000
--- a/app/src/androidTest/java/com/spr/jetpackloading/ExampleInstrumentedTest.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.spr.jetpackloading
-
-import androidx.test.platform.app.InstrumentationRegistry
-import androidx.test.ext.junit.runners.AndroidJUnit4
-
-import org.junit.Test
-import org.junit.runner.RunWith
-
-import org.junit.Assert.*
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * See [testing documentation](http://d.android.com/tools/testing).
- */
-@RunWith(AndroidJUnit4::class)
-class ExampleInstrumentedTest {
- @Test
- fun useAppContext() {
- // Context of the app under test.
- val appContext = InstrumentationRegistry.getInstrumentation().targetContext
- assertEquals("com.example.jetpackloading", appContext.packageName)
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/spr/jetpackloading/MainActivity.kt b/app/src/main/java/com/spr/jetpackloading/MainActivity.kt
deleted file mode 100644
index f12aa32..0000000
--- a/app/src/main/java/com/spr/jetpackloading/MainActivity.kt
+++ /dev/null
@@ -1,180 +0,0 @@
-package com.spr.jetpackloading
-
-import android.os.Bundle
-import androidx.activity.ComponentActivity
-import androidx.activity.compose.setContent
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.height
-import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.Surface
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.platform.LocalConfiguration
-import androidx.compose.ui.unit.Dp
-import androidx.compose.ui.unit.dp
-import com.spr.jetpack_loading.enums.PunchType
-import com.example.jetpackloading.ui.theme.JetpackLoadingTheme
-import com.spr.jetpack_loading.components.indicators.lineScaleIndicator.LineScaleIndicator
-import com.spr.jetpack_loading.components.indicators.BallClipRotateMultipleIndicator
-import com.spr.jetpack_loading.components.indicators.BallClipRotatePulseIndicator
-import com.spr.jetpack_loading.components.indicators.BallPulseRiseIndicator
-import com.spr.jetpack_loading.components.indicators.BallPulseSyncIndicator
-import com.spr.jetpack_loading.components.indicators.BallRotateIndicator
-import com.spr.jetpack_loading.components.indicators.BallScaleIndicator
-import com.spr.jetpack_loading.components.indicators.BallScaleMultipleIndicator
-import com.spr.jetpack_loading.components.indicators.BallScaleRippleIndicator
-import com.spr.jetpack_loading.components.indicators.BallScaleRippleMultipleIndicator
-import com.spr.jetpack_loading.components.indicators.BallSpinFadeLoaderIndicator
-import com.spr.jetpack_loading.components.indicators.BallTrianglePathIndicator
-import com.spr.jetpack_loading.components.indicators.BallZigZagDeflectIndicator
-import com.spr.jetpack_loading.components.indicators.BallZigZagIndicator
-import com.spr.jetpack_loading.components.indicators.CircularPulsatingIndicator
-import com.spr.jetpack_loading.components.indicators.CubeTransitionIndicator
-import com.spr.jetpack_loading.components.indicators.LineSpinFadeLoaderIndicator
-import com.spr.jetpack_loading.components.indicators.PacmanIndicator
-import com.spr.jetpack_loading.components.indicators.PulsatingDot
-import com.spr.jetpack_loading.components.indicators.SemiCircleSpinIndicator
-import com.spr.jetpack_loading.components.indicators.SquareSpinIndicator
-import com.spr.jetpack_loading.components.indicators.TriangleSpinIndicator
-import com.spr.jetpack_loading.components.indicators.BallBeatIndicator
-import com.spr.jetpack_loading.components.indicators.gridIndicator.GridIndicator
-import com.spr.jetpack_loading.enums.GridAnimationType
-import com.spr.jetpackloading.theme.background
-
-class MainActivity : ComponentActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContent {
- JetpackLoadingTheme {
- Surface(
- modifier = Modifier
- .fillMaxSize(),
- color = MaterialTheme.colorScheme.background
- ) {
- Greeting()
- }
- }
- }
- }
-}
-
-@Composable
-fun Greeting() {
-
- val rowHeight: Dp = 50.dp
-
- // get screen height and width
- val configuration = LocalConfiguration.current
- val screenWidthDp = configuration.screenWidthDp.dp
-
- Column(
- modifier = Modifier
- .fillMaxSize()
- .background(background),
- verticalArrangement = Arrangement.SpaceEvenly
- ) {
- // ------------------ Row #1 ----------------------
- Row(
- modifier = Modifier
- .height(rowHeight)
- .fillMaxWidth(),
- horizontalArrangement = Arrangement.SpaceEvenly,
- verticalAlignment = Alignment.CenterVertically
- ) {
- PulsatingDot()
- GridIndicator(animationType = GridAnimationType.PULSATING)
- CircularPulsatingIndicator()
- BallClipRotatePulseIndicator()
- }
-
- // ------------------ Row #2 ----------------------
- Row(
- modifier = Modifier
- .height(rowHeight)
- .fillMaxWidth(),
- horizontalArrangement = Arrangement.SpaceEvenly,
- verticalAlignment = Alignment.CenterVertically
- ) {
- SquareSpinIndicator()
- BallClipRotateMultipleIndicator()
- BallPulseRiseIndicator()
- BallRotateIndicator()
- }
-
- // ------------------ Row #3 ----------------------
- Row(
- modifier = Modifier
- .height(rowHeight)
- .fillMaxWidth(),
- horizontalArrangement = Arrangement.SpaceEvenly,
- verticalAlignment = Alignment.CenterVertically
- ) {
- CubeTransitionIndicator()
- BallZigZagIndicator()
- BallZigZagDeflectIndicator()
- BallTrianglePathIndicator()
- }
-
- // ------------------ Row #4 ----------------------
- Row(
- modifier = Modifier
- .height(rowHeight)
- .fillMaxWidth(),
- horizontalArrangement = Arrangement.SpaceEvenly,
- verticalAlignment = Alignment.CenterVertically
- ) {
- BallScaleIndicator()
- LineScaleIndicator(punchType = PunchType.ACCORDION_PUNCH)
- LineScaleIndicator(punchType = PunchType.RANDOM_PUNCH)
- BallScaleMultipleIndicator()
- }
-
- // ------------------ Row #5 ----------------------
- Row(
- modifier = Modifier
- .height(rowHeight)
- .fillMaxWidth(),
- horizontalArrangement = Arrangement.SpaceEvenly,
- verticalAlignment = Alignment.CenterVertically
- ) {
- BallPulseSyncIndicator()
- BallBeatIndicator()
- LineScaleIndicator(punchType = PunchType.SYMMETRIC_PUNCH)
- LineScaleIndicator(punchType = PunchType.PULSE_OUT_PUNCH)
- }
-
- // ------------------ Row #6 ----------------------
- Row(
- modifier = Modifier
- .height(rowHeight)
- .fillMaxWidth(),
- horizontalArrangement = Arrangement.SpaceEvenly,
- verticalAlignment = Alignment.CenterVertically
- ) {
- BallScaleRippleIndicator()
- BallScaleRippleMultipleIndicator()
- BallSpinFadeLoaderIndicator()
- LineSpinFadeLoaderIndicator()
- }
-
- // ------------------ Row #7 ----------------------
- Row(
- modifier = Modifier
- .height(rowHeight)
- .fillMaxWidth(),
- horizontalArrangement = Arrangement.SpaceEvenly,
- verticalAlignment = Alignment.CenterVertically
- ) {
- TriangleSpinIndicator()
- PacmanIndicator()
- GridIndicator(animationType = GridAnimationType.BEATING)
- SemiCircleSpinIndicator(canvasSize = screenWidthDp / 9)
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/spr/jetpackloading/theme/Color.kt b/app/src/main/java/com/spr/jetpackloading/theme/Color.kt
deleted file mode 100644
index c929cb7..0000000
--- a/app/src/main/java/com/spr/jetpackloading/theme/Color.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.spr.jetpackloading.theme
-
-import androidx.compose.ui.graphics.Color
-
-val Purple80 = Color(0xFFD0BCFF)
-val PurpleGrey80 = Color(0xFFCCC2DC)
-val Pink80 = Color(0xFFEFB8C8)
-
-val Purple40 = Color(0xFF6650a4)
-val PurpleGrey40 = Color(0xFF625b71)
-val Pink40 = Color(0xFF7D5260)
-val background = Color(0xFFE75764)
\ No newline at end of file
diff --git a/app/src/main/java/com/spr/jetpackloading/theme/Theme.kt b/app/src/main/java/com/spr/jetpackloading/theme/Theme.kt
deleted file mode 100644
index 3a2a830..0000000
--- a/app/src/main/java/com/spr/jetpackloading/theme/Theme.kt
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.example.jetpackloading.ui.theme
-
-import android.app.Activity
-import android.os.Build
-import androidx.compose.foundation.isSystemInDarkTheme
-import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.darkColorScheme
-import androidx.compose.material3.dynamicDarkColorScheme
-import androidx.compose.material3.dynamicLightColorScheme
-import androidx.compose.material3.lightColorScheme
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.SideEffect
-import androidx.compose.ui.graphics.toArgb
-import androidx.compose.ui.platform.LocalContext
-import androidx.compose.ui.platform.LocalView
-import androidx.core.view.WindowCompat
-import com.spr.jetpackloading.theme.Pink40
-import com.spr.jetpackloading.theme.Pink80
-import com.spr.jetpackloading.theme.Purple40
-import com.spr.jetpackloading.theme.Purple80
-import com.spr.jetpackloading.theme.PurpleGrey40
-import com.spr.jetpackloading.theme.PurpleGrey80
-
-private val DarkColorScheme = darkColorScheme(
- primary = Purple80,
- secondary = PurpleGrey80,
- tertiary = Pink80
-)
-
-private val LightColorScheme = lightColorScheme(
- primary = Purple40,
- secondary = PurpleGrey40,
- tertiary = Pink40
-
- /* Other default colors to override
- background = Color(0xFFFFFBFE),
- surface = Color(0xFFFFFBFE),
- onPrimary = Color.White,
- onSecondary = Color.White,
- onTertiary = Color.White,
- onBackground = Color(0xFF1C1B1F),
- onSurface = Color(0xFF1C1B1F),
- */
-)
-
-@Composable
-fun JetpackLoadingTheme(
- darkTheme: Boolean = isSystemInDarkTheme(),
- // Dynamic color is available on Android 12+
- dynamicColor: Boolean = true,
- content: @Composable () -> Unit
-) {
- val colorScheme = when {
- dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
- val context = LocalContext.current
- if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
- }
-
- darkTheme -> DarkColorScheme
- else -> LightColorScheme
- }
- val view = LocalView.current
- if (!view.isInEditMode) {
- SideEffect {
- val window = (view.context as Activity).window
- window.statusBarColor = colorScheme.primary.toArgb()
- WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
- }
- }
-
- MaterialTheme(
- colorScheme = colorScheme,
- typography = Typography,
- content = content
- )
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/spr/jetpackloading/theme/Type.kt b/app/src/main/java/com/spr/jetpackloading/theme/Type.kt
deleted file mode 100644
index 535cce4..0000000
--- a/app/src/main/java/com/spr/jetpackloading/theme/Type.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.example.jetpackloading.ui.theme
-
-import androidx.compose.material3.Typography
-import androidx.compose.ui.text.TextStyle
-import androidx.compose.ui.text.font.FontFamily
-import androidx.compose.ui.text.font.FontWeight
-import androidx.compose.ui.unit.sp
-
-// Set of Material typography styles to start with
-val Typography = Typography(
- bodyLarge = TextStyle(
- fontFamily = FontFamily.Default,
- fontWeight = FontWeight.Normal,
- fontSize = 16.sp,
- lineHeight = 24.sp,
- letterSpacing = 0.5.sp
- )
- /* Other default text styles to override
- titleLarge = TextStyle(
- fontFamily = FontFamily.Default,
- fontWeight = FontWeight.Normal,
- fontSize = 22.sp,
- lineHeight = 28.sp,
- letterSpacing = 0.sp
- ),
- labelSmall = TextStyle(
- fontFamily = FontFamily.Default,
- fontWeight = FontWeight.Medium,
- fontSize = 11.sp,
- lineHeight = 16.sp,
- letterSpacing = 0.5.sp
- )
- */
-)
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp
deleted file mode 100644
index c209e78..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
deleted file mode 100644
index b2dfe3d..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp
deleted file mode 100644
index 4f0f1d6..0000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
deleted file mode 100644
index 62b611d..0000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
deleted file mode 100644
index 948a307..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
deleted file mode 100644
index 1b9a695..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
deleted file mode 100644
index 28d4b77..0000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 9287f50..0000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
deleted file mode 100644
index aa7d642..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 9126ae3..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
deleted file mode 100644
index f8c6127..0000000
--- a/app/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- #FFBB86FC
- #FF6200EE
- #FF3700B3
- #FF03DAC5
- #FF018786
- #FF000000
- #FFFFFFFF
-
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
deleted file mode 100644
index 6ab69f3..0000000
--- a/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- JetpackLoading
-
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
deleted file mode 100644
index 7b39579..0000000
--- a/app/src/main/res/values/themes.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml
deleted file mode 100644
index fa0f996..0000000
--- a/app/src/main/res/xml/backup_rules.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml
deleted file mode 100644
index 9ee9997..0000000
--- a/app/src/main/res/xml/data_extraction_rules.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/test/java/com/spr/jetpackloading/ExampleUnitTest.kt b/app/src/test/java/com/spr/jetpackloading/ExampleUnitTest.kt
deleted file mode 100644
index c343e5d..0000000
--- a/app/src/test/java/com/spr/jetpackloading/ExampleUnitTest.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.spr.jetpackloading
-
-import org.junit.Test
-
-import org.junit.Assert.*
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * See [testing documentation](http://d.android.com/tools/testing).
- */
-class ExampleUnitTest {
- @Test
- fun addition_isCorrect() {
- assertEquals(4, 2 + 2)
- }
-}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index ef5eef1..0000000
--- a/build.gradle
+++ /dev/null
@@ -1,6 +0,0 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-plugins {
- id 'com.android.application' version '8.1.1' apply false
- id 'com.android.library' version '8.1.1' apply false
- id 'org.jetbrains.kotlin.android' version '1.9.10' apply false
-}
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..52cf9fa
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,8 @@
+plugins {
+ // this is necessary to avoid the plugins to be loaded multiple times
+ // in each subproject's classloader
+ alias(libs.plugins.androidApplication) apply false
+ alias(libs.plugins.androidLibrary) apply false
+ alias(libs.plugins.jetbrainsCompose) apply false
+ alias(libs.plugins.kotlinMultiplatform) apply false
+}
\ No newline at end of file
diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts
new file mode 100644
index 0000000..3d7c53c
--- /dev/null
+++ b/composeApp/build.gradle.kts
@@ -0,0 +1,122 @@
+import org.jetbrains.compose.desktop.application.dsl.TargetFormat
+import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
+import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
+
+plugins {
+ alias(libs.plugins.kotlinMultiplatform)
+ alias(libs.plugins.androidApplication)
+ alias(libs.plugins.jetbrainsCompose)
+}
+
+kotlin {
+ @OptIn(ExperimentalWasmDsl::class)
+ wasmJs {
+ moduleName = "composeApp"
+ browser {
+ commonWebpackConfig {
+ outputFileName = "composeApp.js"
+ devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply {
+ static = (static ?: mutableListOf()).apply {
+ // Serve sources to debug inside browser
+ add(project.projectDir.path)
+ }
+ }
+ }
+ }
+ binaries.executable()
+ }
+
+ androidTarget {
+ compilations.all {
+ kotlinOptions {
+ jvmTarget = "11"
+ }
+ }
+ }
+
+ jvm("desktop")
+
+ listOf(
+ iosX64(),
+ iosArm64(),
+ iosSimulatorArm64()
+ ).forEach { iosTarget ->
+ iosTarget.binaries.framework {
+ baseName = "ComposeApp"
+ isStatic = true
+ }
+ }
+
+ sourceSets {
+ val desktopMain by getting
+
+ androidMain.dependencies {
+ implementation(libs.compose.ui.tooling.preview)
+ implementation(libs.androidx.activity.compose)
+ }
+ commonMain.dependencies {
+ implementation(compose.runtime)
+ implementation(compose.foundation)
+ implementation(compose.material3)
+ implementation(compose.ui)
+ implementation(compose.components.resources)
+ implementation(compose.components.uiToolingPreview)
+
+ // from mavenLocal
+ implementation("com.github.MahboubehSeyedpour:jetpack-loading:0.1.1.2-SNAPSHORT")
+ }
+ desktopMain.dependencies {
+ implementation(compose.desktop.currentOs)
+ }
+ }
+}
+
+android {
+ namespace = "com.spr.jetpack_loading"
+ compileSdk = libs.versions.android.compileSdk.get().toInt()
+
+ sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
+ sourceSets["main"].res.srcDirs("src/androidMain/res")
+ sourceSets["main"].resources.srcDirs("src/commonMain/resources")
+
+ defaultConfig {
+ applicationId = "com.spr.jetpack_loading"
+ minSdk = libs.versions.android.minSdk.get().toInt()
+ targetSdk = libs.versions.android.targetSdk.get().toInt()
+ versionCode = 1
+ versionName = "1.0"
+ }
+ packaging {
+ resources {
+ excludes += "/META-INF/{AL2.0,LGPL2.1}"
+ }
+ }
+ buildTypes {
+ getByName("release") {
+ isMinifyEnabled = false
+ }
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_11
+ targetCompatibility = JavaVersion.VERSION_11
+ }
+ dependencies {
+ debugImplementation(libs.compose.ui.tooling)
+ }
+}
+
+compose.desktop {
+ application {
+ mainClass = "MainKt"
+
+ nativeDistributions {
+ targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
+ packageName = "com.spr.jetpack_loading"
+ packageVersion = "1.0.0"
+ }
+ }
+}
+
+compose.experimental {
+ web.application {}
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/composeApp/src/androidMain/AndroidManifest.xml
similarity index 60%
rename from app/src/main/AndroidManifest.xml
rename to composeApp/src/androidMain/AndroidManifest.xml
index 1d13b71..c5db0b1 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/composeApp/src/androidMain/AndroidManifest.xml
@@ -1,22 +1,17 @@
-
+
+ android:theme="@android:style/Theme.Material.Light.NoActionBar">
+ android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode"
+ android:name=".MainActivity">
diff --git a/composeApp/src/androidMain/kotlin/Platform.android.kt b/composeApp/src/androidMain/kotlin/Platform.android.kt
new file mode 100644
index 0000000..4f3ea05
--- /dev/null
+++ b/composeApp/src/androidMain/kotlin/Platform.android.kt
@@ -0,0 +1,7 @@
+import android.os.Build
+
+class AndroidPlatform : Platform {
+ override val name: String = "Android ${Build.VERSION.SDK_INT}"
+}
+
+actual fun getPlatform(): Platform = AndroidPlatform()
\ No newline at end of file
diff --git a/composeApp/src/androidMain/kotlin/com/spr/jetpack_loading/MainActivity.kt b/composeApp/src/androidMain/kotlin/com/spr/jetpack_loading/MainActivity.kt
new file mode 100644
index 0000000..bbc6dd0
--- /dev/null
+++ b/composeApp/src/androidMain/kotlin/com/spr/jetpack_loading/MainActivity.kt
@@ -0,0 +1,24 @@
+package com.spr.jetpack_loading
+
+import App
+import android.os.Bundle
+import androidx.activity.ComponentActivity
+import androidx.activity.compose.setContent
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.tooling.preview.Preview
+
+class MainActivity : ComponentActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ setContent {
+ App()
+ }
+ }
+}
+
+@Preview
+@Composable
+fun AppAndroidPreview() {
+ App()
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/composeApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml
similarity index 100%
rename from app/src/main/res/drawable-v24/ic_launcher_foreground.xml
rename to composeApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/composeApp/src/androidMain/res/drawable/ic_launcher_background.xml
similarity index 99%
rename from app/src/main/res/drawable/ic_launcher_background.xml
rename to composeApp/src/androidMain/res/drawable/ic_launcher_background.xml
index 07d5da9..e93e11a 100644
--- a/app/src/main/res/drawable/ic_launcher_background.xml
+++ b/composeApp/src/androidMain/res/drawable/ic_launcher_background.xml
@@ -167,4 +167,4 @@
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
-
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml
similarity index 79%
rename from app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
rename to composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml
index 6f3b755..eca70cf 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -2,5 +2,4 @@
-
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml
similarity index 79%
rename from app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
rename to composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml
index 6f3b755..eca70cf 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ b/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -2,5 +2,4 @@
-
\ No newline at end of file
diff --git a/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png b/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..a571e60
Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png b/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..61da551
Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png b/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c41dd28
Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png b/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..db5080a
Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png b/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..6dba46d
Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png b/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..da31a87
Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png b/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..15ac681
Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png b/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..b216f2d
Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png b/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..f25a419
Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png b/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..e96783c
Binary files /dev/null and b/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/composeApp/src/androidMain/res/values/strings.xml b/composeApp/src/androidMain/res/values/strings.xml
new file mode 100644
index 0000000..a59a35f
--- /dev/null
+++ b/composeApp/src/androidMain/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ jetpack-loading
+
\ No newline at end of file
diff --git a/composeApp/src/commonMain/composeResources/drawable/compose-multiplatform.xml b/composeApp/src/commonMain/composeResources/drawable/compose-multiplatform.xml
new file mode 100644
index 0000000..c0bcfb2
--- /dev/null
+++ b/composeApp/src/commonMain/composeResources/drawable/compose-multiplatform.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/composeApp/src/commonMain/kotlin/App.kt b/composeApp/src/commonMain/kotlin/App.kt
new file mode 100644
index 0000000..06c9178
--- /dev/null
+++ b/composeApp/src/commonMain/kotlin/App.kt
@@ -0,0 +1,177 @@
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.BoxWithConstraints
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Surface
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.ExperimentalComposeUiApi
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.platform.LocalWindowInfo
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+import com.spr.jetpack_loading.enums.PunchType
+import com.spr.jetpack_loading.components.indicators.lineScaleIndicator.LineScaleIndicator
+import com.spr.jetpack_loading.components.indicators.BallClipRotateMultipleIndicator
+import com.spr.jetpack_loading.components.indicators.BallClipRotatePulseIndicator
+import com.spr.jetpack_loading.components.indicators.BallPulseRiseIndicator
+import com.spr.jetpack_loading.components.indicators.BallPulseSyncIndicator
+import com.spr.jetpack_loading.components.indicators.BallRotateIndicator
+import com.spr.jetpack_loading.components.indicators.BallScaleIndicator
+import com.spr.jetpack_loading.components.indicators.BallScaleMultipleIndicator
+import com.spr.jetpack_loading.components.indicators.BallScaleRippleIndicator
+import com.spr.jetpack_loading.components.indicators.BallScaleRippleMultipleIndicator
+import com.spr.jetpack_loading.components.indicators.BallSpinFadeLoaderIndicator
+import com.spr.jetpack_loading.components.indicators.BallTrianglePathIndicator
+import com.spr.jetpack_loading.components.indicators.BallZigZagDeflectIndicator
+import com.spr.jetpack_loading.components.indicators.BallZigZagIndicator
+import com.spr.jetpack_loading.components.indicators.CircularPulsatingIndicator
+import com.spr.jetpack_loading.components.indicators.CubeTransitionIndicator
+import com.spr.jetpack_loading.components.indicators.LineSpinFadeLoaderIndicator
+import com.spr.jetpack_loading.components.indicators.PacmanIndicator
+import com.spr.jetpack_loading.components.indicators.PulsatingDot
+import com.spr.jetpack_loading.components.indicators.SemiCircleSpinIndicator
+import com.spr.jetpack_loading.components.indicators.SquareSpinIndicator
+import com.spr.jetpack_loading.components.indicators.TriangleSpinIndicator
+import com.spr.jetpack_loading.components.indicators.BallBeatIndicator
+import com.spr.jetpack_loading.components.indicators.gridIndicator.GridIndicator
+import com.spr.jetpack_loading.enums.GridAnimationType
+
+@OptIn(ExperimentalComposeUiApi::class)
+@Composable
+fun App() = Surface {
+ val rowHeight: Dp = 50.dp
+
+ LazyColumn(
+ modifier = Modifier
+ .fillMaxSize()
+ .background(Color.Blue),
+ verticalArrangement = Arrangement.SpaceEvenly
+ ) {
+ item {
+ // ------------------ Row #1 ----------------------
+ Row(
+ modifier = Modifier
+ .height(rowHeight)
+ .fillMaxWidth(),
+ horizontalArrangement = Arrangement.SpaceEvenly,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ PulsatingDot()
+ GridIndicator(animationType = GridAnimationType.PULSATING)
+ CircularPulsatingIndicator()
+ BallClipRotatePulseIndicator()
+ }
+ }
+
+ item {
+ // ------------------ Row #2 ----------------------
+ Row(
+ modifier = Modifier
+ .height(rowHeight)
+ .fillMaxWidth(),
+ horizontalArrangement = Arrangement.SpaceEvenly,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ SquareSpinIndicator()
+ BallClipRotateMultipleIndicator()
+ BallPulseRiseIndicator()
+ BallRotateIndicator()
+ }
+ }
+
+
+ item {
+ // ------------------ Row #3 ----------------------
+ Row(
+ modifier = Modifier
+ .height(rowHeight)
+ .fillMaxWidth(),
+ horizontalArrangement = Arrangement.SpaceEvenly,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ CubeTransitionIndicator()
+ BallZigZagIndicator()
+ BallZigZagDeflectIndicator()
+ BallTrianglePathIndicator()
+ }
+ }
+
+ item {
+ // ------------------ Row #4 ----------------------
+ Row(
+ modifier = Modifier
+ .height(rowHeight)
+ .fillMaxWidth(),
+ horizontalArrangement = Arrangement.SpaceEvenly,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ BallScaleIndicator()
+ LineScaleIndicator(punchType = PunchType.ACCORDION_PUNCH)
+ LineScaleIndicator(punchType = PunchType.RANDOM_PUNCH)
+ BallScaleMultipleIndicator()
+ }
+ }
+
+
+ item {
+ // ------------------ Row #5 ----------------------
+ Row(
+ modifier = Modifier
+ .height(rowHeight)
+ .fillMaxWidth(),
+ horizontalArrangement = Arrangement.SpaceEvenly,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ BallPulseSyncIndicator()
+ BallBeatIndicator()
+ LineScaleIndicator(punchType = PunchType.SYMMETRIC_PUNCH)
+ LineScaleIndicator(punchType = PunchType.PULSE_OUT_PUNCH)
+ }
+ }
+
+
+ item {
+ // ------------------ Row #6 ----------------------
+ Row(
+ modifier = Modifier
+ .height(rowHeight)
+ .fillMaxWidth(),
+ horizontalArrangement = Arrangement.SpaceEvenly,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ BallScaleRippleIndicator()
+ BallScaleRippleMultipleIndicator()
+ BallSpinFadeLoaderIndicator()
+ LineSpinFadeLoaderIndicator()
+ }
+ }
+
+
+ item {
+ // ------------------ Row #7 ----------------------
+ Row(
+ modifier = Modifier
+ .height(rowHeight)
+ .fillMaxWidth(),
+ horizontalArrangement = Arrangement.SpaceEvenly,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ TriangleSpinIndicator()
+ PacmanIndicator()
+ GridIndicator(animationType = GridAnimationType.BEATING)
+
+
+ // https://github.com/JetBrains/compose-multiplatform/discussions/3225
+ SemiCircleSpinIndicator(canvasSize = (LocalWindowInfo.current.containerSize.width.toDouble() / 9.toDouble()).dp)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/composeApp/src/commonMain/kotlin/Greeting.kt b/composeApp/src/commonMain/kotlin/Greeting.kt
new file mode 100644
index 0000000..887d835
--- /dev/null
+++ b/composeApp/src/commonMain/kotlin/Greeting.kt
@@ -0,0 +1,7 @@
+class Greeting {
+ private val platform = getPlatform()
+
+ fun greet(): String {
+ return "Hello, ${platform.name}!"
+ }
+}
\ No newline at end of file
diff --git a/composeApp/src/commonMain/kotlin/Platform.kt b/composeApp/src/commonMain/kotlin/Platform.kt
new file mode 100644
index 0000000..87ca3ff
--- /dev/null
+++ b/composeApp/src/commonMain/kotlin/Platform.kt
@@ -0,0 +1,5 @@
+interface Platform {
+ val name: String
+}
+
+expect fun getPlatform(): Platform
\ No newline at end of file
diff --git a/composeApp/src/desktopMain/kotlin/Platform.jvm.kt b/composeApp/src/desktopMain/kotlin/Platform.jvm.kt
new file mode 100644
index 0000000..f5e7e49
--- /dev/null
+++ b/composeApp/src/desktopMain/kotlin/Platform.jvm.kt
@@ -0,0 +1,5 @@
+class JVMPlatform: Platform {
+ override val name: String = "Java ${System.getProperty("java.version")}"
+}
+
+actual fun getPlatform(): Platform = JVMPlatform()
\ No newline at end of file
diff --git a/composeApp/src/desktopMain/kotlin/main.kt b/composeApp/src/desktopMain/kotlin/main.kt
new file mode 100644
index 0000000..fd53abd
--- /dev/null
+++ b/composeApp/src/desktopMain/kotlin/main.kt
@@ -0,0 +1,11 @@
+import androidx.compose.ui.window.Window
+import androidx.compose.ui.window.application
+
+fun main() = application {
+ Window(
+ onCloseRequest = ::exitApplication,
+ title = "jetpack-loading",
+ ) {
+ App()
+ }
+}
\ No newline at end of file
diff --git a/composeApp/src/iosMain/kotlin/MainViewController.kt b/composeApp/src/iosMain/kotlin/MainViewController.kt
new file mode 100644
index 0000000..fa143d4
--- /dev/null
+++ b/composeApp/src/iosMain/kotlin/MainViewController.kt
@@ -0,0 +1,3 @@
+import androidx.compose.ui.window.ComposeUIViewController
+
+fun MainViewController() = ComposeUIViewController { App() }
\ No newline at end of file
diff --git a/composeApp/src/iosMain/kotlin/Platform.ios.kt b/composeApp/src/iosMain/kotlin/Platform.ios.kt
new file mode 100644
index 0000000..5cef987
--- /dev/null
+++ b/composeApp/src/iosMain/kotlin/Platform.ios.kt
@@ -0,0 +1,7 @@
+import platform.UIKit.UIDevice
+
+class IOSPlatform: Platform {
+ override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
+}
+
+actual fun getPlatform(): Platform = IOSPlatform()
\ No newline at end of file
diff --git a/composeApp/src/wasmJsMain/kotlin/Platform.wasmJs.kt b/composeApp/src/wasmJsMain/kotlin/Platform.wasmJs.kt
new file mode 100644
index 0000000..57b2e11
--- /dev/null
+++ b/composeApp/src/wasmJsMain/kotlin/Platform.wasmJs.kt
@@ -0,0 +1,5 @@
+class WasmPlatform: Platform {
+ override val name: String = "Web with Kotlin/Wasm"
+}
+
+actual fun getPlatform(): Platform = WasmPlatform()
\ No newline at end of file
diff --git a/composeApp/src/wasmJsMain/kotlin/main.kt b/composeApp/src/wasmJsMain/kotlin/main.kt
new file mode 100644
index 0000000..b9c0f64
--- /dev/null
+++ b/composeApp/src/wasmJsMain/kotlin/main.kt
@@ -0,0 +1,7 @@
+import androidx.compose.ui.ExperimentalComposeUiApi
+import androidx.compose.ui.window.CanvasBasedWindow
+
+@OptIn(ExperimentalComposeUiApi::class)
+fun main() {
+ CanvasBasedWindow(canvasElementId = "ComposeTarget") { App() }
+}
\ No newline at end of file
diff --git a/composeApp/src/wasmJsMain/resources/index.html b/composeApp/src/wasmJsMain/resources/index.html
new file mode 100644
index 0000000..4622749
--- /dev/null
+++ b/composeApp/src/wasmJsMain/resources/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+ jetpack-loading
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jetpack-loading/consumer-rules.pro b/consumer-rules.pro
similarity index 100%
rename from jetpack-loading/consumer-rules.pro
rename to consumer-rules.pro
diff --git a/gradle.properties b/gradle.properties
index 3c5031e..ae705bc 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,23 +1,16 @@
-# Project-wide Gradle settings.
-# IDE (e.g. Android Studio) users:
-# Gradle settings configured through the IDE *will override*
-# any settings specified in this file.
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
-# AndroidX package structure to make it clearer which packages are bundled with the
-# Android operating system, and which are packaged with your app's APK
-# https://developer.android.com/topic/libraries/support-library/androidx-rn
-android.useAndroidX=true
-# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
-# Enables namespacing of each library's R class so that its R class includes only the
-# resources declared in the library itself and none from the library's dependencies,
-# thereby reducing the size of the R class for that library
-android.nonTransitiveRClass=true
\ No newline at end of file
+
+#Gradle
+org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M"
+
+#Android
+android.nonTransitiveRClass=true
+android.useAndroidX=true
+
+#Compose
+org.jetbrains.compose.experimental.wasm.enabled=true
+org.jetbrains.compose.experimental.jscanvas.enabled=true
+
+#MPP
+kotlin.mpp.androidSourceSetLayoutVersion=2
+kotlin.mpp.enableCInteropCommonization=true
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
new file mode 100644
index 0000000..4db653e
--- /dev/null
+++ b/gradle/libs.versions.toml
@@ -0,0 +1,36 @@
+[versions]
+agp = "8.2.0"
+android-compileSdk = "34"
+android-minSdk = "24"
+android-targetSdk = "34"
+androidx-activityCompose = "1.9.0"
+androidx-appcompat = "1.6.1"
+androidx-constraintlayout = "2.1.4"
+androidx-core-ktx = "1.13.0"
+androidx-espresso-core = "3.5.1"
+androidx-material = "1.11.0"
+androidx-test-junit = "1.1.5"
+compose = "1.6.6"
+compose-plugin = "1.6.2"
+junit = "4.13.2"
+kotlin = "1.9.23"
+
+[libraries]
+kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
+kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
+junit = { group = "junit", name = "junit", version.ref = "junit" }
+androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" }
+androidx-test-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-junit" }
+androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidx-espresso-core" }
+androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" }
+androidx-material = { group = "com.google.android.material", name = "material", version.ref = "androidx-material" }
+androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidx-constraintlayout" }
+androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
+compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
+compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
+
+[plugins]
+androidApplication = { id = "com.android.application", version.ref = "agp" }
+androidLibrary = { id = "com.android.library", version.ref = "agp" }
+jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
+kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index e708b1c..7f93135 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index dc1fb98..b82aa23 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
-#Sun Sep 24 17:53:06 GMT+03:30 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 4f906e0..1aa94a4 100644
--- a/gradlew
+++ b/gradlew
@@ -1,7 +1,7 @@
-#!/usr/bin/env sh
+#!/bin/sh
#
-# Copyright 2015 the original author or authors.
+# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,67 +17,99 @@
#
##############################################################################
-##
-## Gradle start up script for UN*X
-##
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
##############################################################################
# Attempt to set APP_HOME
+
# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
+MAX_FD=maximum
warn () {
echo "$*"
-}
+} >&2
die () {
echo
echo "$*"
echo
exit 1
-}
+} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -87,9 +119,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
+ JAVACMD=$JAVA_HOME/jre/sh/java
else
- JAVACMD="$JAVA_HOME/bin/java"
+ JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -98,88 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
+ fi
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
fi
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
-if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
fi
- i=`expr $i + 1`
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
done
- case $i in
- 0) set -- ;;
- 1) set -- "$args0" ;;
- 2) set -- "$args0" "$args1" ;;
- 3) set -- "$args0" "$args1" "$args2" ;;
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
fi
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=`save "$@"`
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index 107acd3..93e3f59 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
-@if "%DEBUG%" == "" @echo off
+@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto execute
+if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end
@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
+if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
diff --git a/iosApp/Configuration/Config.xcconfig b/iosApp/Configuration/Config.xcconfig
new file mode 100644
index 0000000..9c94c7b
--- /dev/null
+++ b/iosApp/Configuration/Config.xcconfig
@@ -0,0 +1,3 @@
+TEAM_ID=
+BUNDLE_ID=com.spr.jetpack_loading.jetpack-loading
+APP_NAME=jetpack-loading
\ No newline at end of file
diff --git a/iosApp/iosApp.xcodeproj/project.pbxproj b/iosApp/iosApp.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..340cada
--- /dev/null
+++ b/iosApp/iosApp.xcodeproj/project.pbxproj
@@ -0,0 +1,398 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 54;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; };
+ 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; };
+ 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; };
+ 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
+ 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; };
+ 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; };
+ 7555FF7B242A565900829871 /* jetpack-loading.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = jetpack-loading.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; };
+ 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ B92378962B6B1156000C7307 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 058557D7273AAEEB004C7B11 /* Preview Content */ = {
+ isa = PBXGroup;
+ children = (
+ 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */,
+ );
+ path = "Preview Content";
+ sourceTree = "";
+ };
+ 42799AB246E5F90AF97AA0EF /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
+ 7555FF72242A565900829871 = {
+ isa = PBXGroup;
+ children = (
+ AB1DB47929225F7C00F7AF9C /* Configuration */,
+ 7555FF7D242A565900829871 /* iosApp */,
+ 7555FF7C242A565900829871 /* Products */,
+ 42799AB246E5F90AF97AA0EF /* Frameworks */,
+ );
+ sourceTree = "";
+ };
+ 7555FF7C242A565900829871 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 7555FF7B242A565900829871 /* jetpack-loading.app */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 7555FF7D242A565900829871 /* iosApp */ = {
+ isa = PBXGroup;
+ children = (
+ 058557BA273AAA24004C7B11 /* Assets.xcassets */,
+ 7555FF82242A565900829871 /* ContentView.swift */,
+ 7555FF8C242A565B00829871 /* Info.plist */,
+ 2152FB032600AC8F00CF470E /* iOSApp.swift */,
+ 058557D7273AAEEB004C7B11 /* Preview Content */,
+ );
+ path = iosApp;
+ sourceTree = "";
+ };
+ AB1DB47929225F7C00F7AF9C /* Configuration */ = {
+ isa = PBXGroup;
+ children = (
+ AB3632DC29227652001CCB65 /* Config.xcconfig */,
+ );
+ path = Configuration;
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 7555FF7A242A565900829871 /* iosApp */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */;
+ buildPhases = (
+ F36B1CEB2AD83DDC00CB74D5 /* Compile Kotlin Framework */,
+ 7555FF77242A565900829871 /* Sources */,
+ B92378962B6B1156000C7307 /* Frameworks */,
+ 7555FF79242A565900829871 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = iosApp;
+ packageProductDependencies = (
+ );
+ productName = iosApp;
+ productReference = 7555FF7B242A565900829871 /* jetpack-loading.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 7555FF73242A565900829871 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastSwiftUpdateCheck = 1130;
+ LastUpgradeCheck = 1130;
+ ORGANIZATIONNAME = orgName;
+ TargetAttributes = {
+ 7555FF7A242A565900829871 = {
+ CreatedOnToolsVersion = 11.3.1;
+ };
+ };
+ };
+ buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */;
+ compatibilityVersion = "Xcode 12.0";
+ developmentRegion = en;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 7555FF72242A565900829871;
+ packageReferences = (
+ );
+ productRefGroup = 7555FF7C242A565900829871 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 7555FF7A242A565900829871 /* iosApp */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 7555FF79242A565900829871 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */,
+ 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ F36B1CEB2AD83DDC00CB74D5 /* Compile Kotlin Framework */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ );
+ name = "Compile Kotlin Framework";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/..\"\n./gradlew :composeApp:embedAndSignAppleFrameworkForXcode\n";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 7555FF77242A565900829871 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */,
+ 7555FF83242A565900829871 /* ContentView.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 7555FFA3242A565B00829871 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu11;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 15.3;
+ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
+ MTL_FAST_MATH = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ };
+ name = Debug;
+ };
+ 7555FFA4242A565B00829871 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu11;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 15.3;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ MTL_FAST_MATH = YES;
+ SDKROOT = iphoneos;
+ SWIFT_COMPILATION_MODE = wholemodule;
+ SWIFT_OPTIMIZATION_LEVEL = "-O";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 7555FFA6242A565B00829871 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_IDENTITY = "Apple Development";
+ CODE_SIGN_STYLE = Automatic;
+ DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
+ DEVELOPMENT_TEAM = "${TEAM_ID}";
+ ENABLE_PREVIEWS = YES;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
+ );
+ INFOPLIST_FILE = iosApp/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 15.3;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ OTHER_LDFLAGS = (
+ "$(inherited)",
+ "-framework",
+ composeApp,
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}";
+ PRODUCT_NAME = "${APP_NAME}";
+ PROVISIONING_PROFILE_SPECIFIER = "";
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 7555FFA7242A565B00829871 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_IDENTITY = "Apple Development";
+ CODE_SIGN_STYLE = Automatic;
+ DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
+ DEVELOPMENT_TEAM = "${TEAM_ID}";
+ ENABLE_PREVIEWS = YES;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
+ );
+ INFOPLIST_FILE = iosApp/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 15.3;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ OTHER_LDFLAGS = (
+ "$(inherited)",
+ "-framework",
+ composeApp,
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}";
+ PRODUCT_NAME = "${APP_NAME}";
+ PROVISIONING_PROFILE_SPECIFIER = "";
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7555FFA3242A565B00829871 /* Debug */,
+ 7555FFA4242A565B00829871 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7555FFA6242A565B00829871 /* Debug */,
+ 7555FFA7242A565B00829871 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 7555FF73242A565900829871 /* Project object */;
+}
\ No newline at end of file
diff --git a/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json b/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json
new file mode 100644
index 0000000..ee7e3ca
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json
@@ -0,0 +1,11 @@
+{
+ "colors" : [
+ {
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
\ No newline at end of file
diff --git a/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..8edf56e
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,14 @@
+{
+ "images" : [
+ {
+ "filename" : "app-icon-1024.png",
+ "idiom" : "universal",
+ "platform" : "ios",
+ "size" : "1024x1024"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png b/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png
new file mode 100644
index 0000000..53fc536
Binary files /dev/null and b/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png differ
diff --git a/iosApp/iosApp/Assets.xcassets/Contents.json b/iosApp/iosApp/Assets.xcassets/Contents.json
new file mode 100644
index 0000000..4aa7c53
--- /dev/null
+++ b/iosApp/iosApp/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
\ No newline at end of file
diff --git a/iosApp/iosApp/ContentView.swift b/iosApp/iosApp/ContentView.swift
new file mode 100644
index 0000000..3cd5c32
--- /dev/null
+++ b/iosApp/iosApp/ContentView.swift
@@ -0,0 +1,21 @@
+import UIKit
+import SwiftUI
+import ComposeApp
+
+struct ComposeView: UIViewControllerRepresentable {
+ func makeUIViewController(context: Context) -> UIViewController {
+ MainViewControllerKt.MainViewController()
+ }
+
+ func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
+}
+
+struct ContentView: View {
+ var body: some View {
+ ComposeView()
+ .ignoresSafeArea(.keyboard) // Compose has own keyboard handler
+ }
+}
+
+
+
diff --git a/iosApp/iosApp/Info.plist b/iosApp/iosApp/Info.plist
new file mode 100644
index 0000000..412e378
--- /dev/null
+++ b/iosApp/iosApp/Info.plist
@@ -0,0 +1,50 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundlePackageType
+ $(PRODUCT_BUNDLE_PACKAGE_TYPE)
+ CFBundleShortVersionString
+ 1.0
+ CFBundleVersion
+ 1
+ LSRequiresIPhoneOS
+
+ CADisableMinimumFrameDurationOnPhone
+
+ UIApplicationSceneManifest
+
+ UIApplicationSupportsMultipleScenes
+
+
+ UILaunchScreen
+
+ UIRequiredDeviceCapabilities
+
+ armv7
+
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+
+
diff --git a/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json b/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json
new file mode 100644
index 0000000..4aa7c53
--- /dev/null
+++ b/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
\ No newline at end of file
diff --git a/iosApp/iosApp/iOSApp.swift b/iosApp/iosApp/iOSApp.swift
new file mode 100644
index 0000000..0648e86
--- /dev/null
+++ b/iosApp/iosApp/iOSApp.swift
@@ -0,0 +1,10 @@
+import SwiftUI
+
+@main
+struct iOSApp: App {
+ var body: some Scene {
+ WindowGroup {
+ ContentView()
+ }
+ }
+}
\ No newline at end of file
diff --git a/jetpack-loading/.gitignore b/jetpack-loading/.gitignore
deleted file mode 100644
index 42afabf..0000000
--- a/jetpack-loading/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
\ No newline at end of file
diff --git a/jetpack-loading/build.gradle.kts b/jetpack-loading/build.gradle.kts
index 2584c64..0dec50b 100644
--- a/jetpack-loading/build.gradle.kts
+++ b/jetpack-loading/build.gradle.kts
@@ -1,63 +1,138 @@
-import io.grpc.internal.SharedResourceHolder.release
-import org.jetbrains.kotlin.config.JvmAnalysisFlags.useIR
+import org.jetbrains.compose.desktop.application.dsl.TargetFormat
+import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
+import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
+import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
plugins {
- id("com.android.library")
- id("org.jetbrains.kotlin.android")
+ alias(libs.plugins.kotlinMultiplatform)
+ alias(libs.plugins.androidLibrary)
+ alias(libs.plugins.jetbrainsCompose)
+
id("maven-publish")
+ id("signing")
}
-android {
- namespace = "com.example.jetpack_loading"
- compileSdk = 33
-
- defaultConfig {
- minSdk = 24
+kotlin {
+ val webConfig : KotlinJsTargetDsl.() -> Unit = {
+ moduleName = "jetpack-loading"
+ browser {
+ commonWebpackConfig {
+ outputFileName = "jetpack-loading.js"
+ }
+ }
- testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
- consumerProguardFiles("consumer-rules.pro")
+ nodejs()
+ binaries.executable()
}
- buildTypes {
- release {
- isMinifyEnabled = false
- proguardFiles(
- getDefaultProguardFile("proguard-android-optimize.txt"),
- "proguard-rules.pro"
- )
+ @OptIn(ExperimentalWasmDsl::class)
+ wasmJs(webConfig)
+
+ js(IR,webConfig)
+
+ jvm("desktop")
+
+ androidTarget {
+ publishLibraryVariants("release", "debug")
+
+ compilations.all {
+ kotlinOptions {
+ jvmTarget = "1.8"
+ }
}
}
- compileOptions {
- sourceCompatibility = JavaVersion.VERSION_17
- targetCompatibility = JavaVersion.VERSION_17
+
+ listOf(
+ iosX64(),
+ iosArm64(),
+ iosSimulatorArm64()
+ ).forEach {
+ it.binaries.framework {
+ baseName = "jetpack-loading"
+ isStatic = true
+ }
}
- kotlinOptions {
- jvmTarget = "17"
+
+ sourceSets {
+ commonMain.dependencies {
+ implementation(compose.runtime)
+ implementation(compose.foundation)
+ implementation(compose.material3)
+ implementation(compose.ui)
+ }
}
- composeOptions {
- kotlinCompilerExtensionVersion = "1.5.3"
+}
+
+android {
+ namespace = "com.spr.jetpack_loading"
+ compileSdk = 34
+ defaultConfig {
+ minSdk = 26
}
- buildFeatures {
- compose = true
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
}
}
-dependencies {
- implementation("androidx.appcompat:appcompat:1.6.1")
- implementation(platform("androidx.compose:compose-bom:2022.10.00"))
- implementation("androidx.compose.material3:material3")
-}
-afterEvaluate {
- publishing {
- publications {
- register("release") {
- from(components["release"])
+// Based on https://medium.com/kodein-koders/publish-a-kotlin-multiplatform-library-on-maven-central-6e8a394b7030
+publishing {
+ publications {
+ repositories {
+ maven {
+ name="oss"
+
+ val repositoryId = System.getenv("SONATYPE_REPOSITORY_ID")
+ val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deployByRepositoryId/$repositoryId/")
+ val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
+
+ url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
+
+ credentials {
+ username = System.getenv("SONATYPE_USERNAME")
+ password = System.getenv("SONATYPE_PASSWORD")
+ }
+ }
+
+ mavenLocal()
+ }
+ withType {
+ pom {
groupId = "com.github.MahboubehSeyedpour"
- artifactId = "jetpack-loading"
- version = "0.1.0"
+ version = "0.1.1.2-SNAPSHORT"
+
+ name.set("jetpack-loading")
+ description.set("Elegant Android loading indicator using Jetpack Compose")
+
+ licenses {
+ name.set("Apache License Version 2.0")
+ }
+
+ url.set("https://github.com/MahboubehSeyedpour/jetpack-loading")
+
+ issueManagement {
+ system.set("Github")
+ url.set("https://github.com/MahboubehSeyedpour/jetpack-loading/issues")
+ }
+
+ scm {
+ connection.set("https://github.com/MahboubehSeyedpour/jetpack-loading.git")
+ url.set("https://github.com/MahboubehSeyedpour/jetpack-loading")
+ }
}
}
}
-}
\ No newline at end of file
+}
+
+// TODO : Enable this again when publishing to mavenCentral
+/*
+signing {
+ useInMemoryPgpKeys(
+ System.getenv("GPG_PRIVATE_KEY"),
+ System.getenv("GPG_PRIVATE_PASSWORD")
+ )
+
+ sign(publishing.publications)
+}*/
\ No newline at end of file
diff --git a/jetpack-loading/proguard-rules.pro b/jetpack-loading/proguard-rules.pro
deleted file mode 100644
index 481bb43..0000000
--- a/jetpack-loading/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/jetpack-loading/src/androidTest/java/com/spr/jetpack_loading/ExampleInstrumentedTest.kt b/jetpack-loading/src/androidTest/java/com/spr/jetpack_loading/ExampleInstrumentedTest.kt
deleted file mode 100644
index 42045bf..0000000
--- a/jetpack-loading/src/androidTest/java/com/spr/jetpack_loading/ExampleInstrumentedTest.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.spr.jetpack_loading
-
-import androidx.test.platform.app.InstrumentationRegistry
-import androidx.test.ext.junit.runners.AndroidJUnit4
-
-import org.junit.Test
-import org.junit.runner.RunWith
-
-import org.junit.Assert.*
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * See [testing documentation](http://d.android.com/tools/testing).
- */
-@RunWith(AndroidJUnit4::class)
-class ExampleInstrumentedTest {
- @Test
- fun useAppContext() {
- // Context of the app under test.
- val appContext = InstrumentationRegistry.getInstrumentation().targetContext
- assertEquals("com.example.jetpack_loading.test", appContext.packageName)
- }
-}
\ No newline at end of file
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallBeatIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallBeatIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallBeatIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallBeatIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallClipRotateMultipleIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallClipRotateMultipleIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallClipRotateMultipleIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallClipRotateMultipleIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallClipRotatePulseIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallClipRotatePulseIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallClipRotatePulseIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallClipRotatePulseIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallPulseRiseIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallPulseRiseIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallPulseRiseIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallPulseRiseIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallPulseSyncIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallPulseSyncIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallPulseSyncIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallPulseSyncIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallRespectivelyExitInicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallRespectivelyExitInicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallRespectivelyExitInicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallRespectivelyExitInicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallRotateIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallRotateIndicator.kt
similarity index 90%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallRotateIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallRotateIndicator.kt
index aa82660..c4fa8f7 100644
--- a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallRotateIndicator.kt
+++ b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallRotateIndicator.kt
@@ -15,6 +15,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
+import com.spr.jetpack_loading.extension.toRadians
import kotlin.math.cos
import kotlin.math.sin
@@ -78,8 +79,8 @@ fun BallRotateIndicator(
color = color,
radius = diameter / 2 * scale,
center = Offset(
- x = center.x + ((spacing) * cos(Math.toRadians((angle) + rotation.toDouble())).toFloat()),
- y = center.y + ((spacing) * sin(Math.toRadians((angle) + rotation.toDouble())).toFloat()),
+ x = center.x + ((spacing) * cos((angle) + rotation.toDouble()).toRadians().toFloat()),
+ y = center.y + ((spacing) * sin((angle) + rotation.toDouble()).toRadians().toFloat()),
)
)
}
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallScaleIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallScaleIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallScaleIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallScaleIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallScaleMultipleIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallScaleMultipleIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallScaleMultipleIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallScaleMultipleIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallScaleRippleIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallScaleRippleIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallScaleRippleIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallScaleRippleIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallScaleRippleMultipleIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallScaleRippleMultipleIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallScaleRippleMultipleIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallScaleRippleMultipleIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallSpinFadeLoaderIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallSpinFadeLoaderIndicator.kt
similarity index 93%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallSpinFadeLoaderIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallSpinFadeLoaderIndicator.kt
index d7c6101..eae2ed3 100644
--- a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallSpinFadeLoaderIndicator.kt
+++ b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallSpinFadeLoaderIndicator.kt
@@ -15,6 +15,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import com.spr.jetpack_loading.enums.LinearAnimationType
+import com.spr.jetpack_loading.extension.toRadians
import kotlinx.coroutines.delay
import kotlin.math.cos
import kotlin.math.sin
@@ -75,8 +76,9 @@ fun BallSpinFadeLoaderIndicator(
val center = Offset(size.width / 2, size.height / 2)
for (index in 0 until ballCount) {
val angle = index * angleStep
- val x = center.x + radius * cos(Math.toRadians(angle.toDouble())).toFloat()
- val y = center.y + radius * sin(Math.toRadians(angle.toDouble())).toFloat()
+ val x = center.x + radius * cos(angle.toDouble().toRadians().toFloat())
+ val y = center.y + radius * sin(angle.toDouble().toRadians().toFloat())
+
drawCircle(
color = color,
radius = ballRadius * animationValues[index], // Apply the scale
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallTrianglePathIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallTrianglePathIndicator.kt
similarity index 87%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallTrianglePathIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallTrianglePathIndicator.kt
index 854774b..f2a996f 100644
--- a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallTrianglePathIndicator.kt
+++ b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallTrianglePathIndicator.kt
@@ -13,6 +13,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.Stroke
+import com.spr.jetpack_loading.extension.toRadians
import kotlin.math.cos
import kotlin.math.sin
@@ -59,8 +60,8 @@ fun BallTrianglePathIndicator(
radius = diameter / 2,
style = Stroke(width = 6f),
center = Offset(
- x = center.x + ((spacingAnimation) * cos(Math.toRadians((angle) + rotation.toDouble())).toFloat()),
- y = center.y + ((spacingAnimation) * sin(Math.toRadians((angle) + rotation.toDouble())).toFloat()),
+ x = center.x + ((spacingAnimation) * cos((angle) + rotation.toDouble()).toRadians().toFloat()),
+ y = center.y + ((spacingAnimation) * sin((angle) + rotation.toDouble()).toRadians().toFloat()),
)
)
}
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallZigZagDeflectIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallZigZagDeflectIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallZigZagDeflectIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallZigZagDeflectIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallZigZagIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallZigZagIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/BallZigZagIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/BallZigZagIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/CircularPulsatingIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/CircularPulsatingIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/CircularPulsatingIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/CircularPulsatingIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/CubeTransitionIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/CubeTransitionIndicator.kt
similarity index 88%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/CubeTransitionIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/CubeTransitionIndicator.kt
index 83833d3..734ddcc 100644
--- a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/CubeTransitionIndicator.kt
+++ b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/CubeTransitionIndicator.kt
@@ -13,6 +13,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
+import com.spr.jetpack_loading.extension.toRadians
import kotlin.math.cos
import kotlin.math.sin
@@ -58,8 +59,8 @@ fun CubeTransitionIndicator(
color = color,
size = Size(width = diameter * scale, height = diameter * scale),
topLeft = Offset(
- x = center.x + ((spacing) * cos(Math.toRadians((angle) + rotation.toDouble())).toFloat()),
- y = center.y + ((spacing) * sin(Math.toRadians((angle) + rotation.toDouble())).toFloat()),
+ x = center.x + ((spacing) * cos((angle) + rotation.toDouble()).toRadians().toFloat()),
+ y = center.y + ((spacing) * sin((angle) + rotation.toDouble()).toRadians().toFloat()),
)
)
}
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/LineSpinFadeLoaderIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/LineSpinFadeLoaderIndicator.kt
similarity index 89%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/LineSpinFadeLoaderIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/LineSpinFadeLoaderIndicator.kt
index 82e7f7e..33c0f5f 100644
--- a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/LineSpinFadeLoaderIndicator.kt
+++ b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/LineSpinFadeLoaderIndicator.kt
@@ -16,6 +16,7 @@ import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.StrokeCap
import com.spr.jetpack_loading.enums.LinearAnimationType
+import com.spr.jetpack_loading.extension.toRadians
import kotlinx.coroutines.delay
import kotlin.math.cos
import kotlin.math.sin
@@ -85,12 +86,12 @@ fun LineSpinFadeLoaderIndicator(
val angle = index * angleStep
val startX =
- center.x + innerRadius * cos(Math.toRadians(angle.toDouble())).toFloat()
+ center.x + innerRadius * cos(angle.toDouble().toRadians()).toFloat()
val startY =
- center.y + innerRadius * sin(Math.toRadians(angle.toDouble())).toFloat()
+ center.y + innerRadius * sin(angle.toDouble().toRadians()).toFloat()
- val endX = center.x + outerRadius * cos(Math.toRadians(angle.toDouble())).toFloat()
- val endY = center.y + outerRadius * sin(Math.toRadians(angle.toDouble())).toFloat()
+ val endX = center.x + outerRadius * cos(angle.toDouble().toRadians()).toFloat()
+ val endY = center.y + outerRadius * sin(angle.toDouble().toRadians()).toFloat()
drawLine(
color = color,
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/PacmanIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/PacmanIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/PacmanIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/PacmanIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/PulsatingDot.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/PulsatingDot.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/PulsatingDot.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/PulsatingDot.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/SemiCircleSpinIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/SemiCircleSpinIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/SemiCircleSpinIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/SemiCircleSpinIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/SquareSpinIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/SquareSpinIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/SquareSpinIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/SquareSpinIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/TriangleSpinIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/TriangleSpinIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/TriangleSpinIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/TriangleSpinIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/gridIndicator/BallGridBeatIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/gridIndicator/BallGridBeatIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/gridIndicator/BallGridBeatIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/gridIndicator/BallGridBeatIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/gridIndicator/GridFadeAntiDiagonal.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/gridIndicator/GridFadeAntiDiagonal.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/gridIndicator/GridFadeAntiDiagonal.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/gridIndicator/GridFadeAntiDiagonal.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/gridIndicator/GridFadeDiagonal.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/gridIndicator/GridFadeDiagonal.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/gridIndicator/GridFadeDiagonal.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/gridIndicator/GridFadeDiagonal.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/gridIndicator/GridIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/gridIndicator/GridIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/gridIndicator/GridIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/gridIndicator/GridIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/gridIndicator/GridPulsatingDot.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/gridIndicator/GridPulsatingDot.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/gridIndicator/GridPulsatingDot.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/gridIndicator/GridPulsatingDot.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScaleIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScaleIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScaleIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScaleIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScalePartyIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScalePartyIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScalePartyIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScalePartyIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScalePulseOutIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScalePulseOutIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScalePulseOutIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScalePulseOutIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScalePulseOutRapidIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScalePulseOutRapidIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScalePulseOutRapidIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/LineScalePulseOutRapidIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/SimpleLineScaleIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/SimpleLineScaleIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/SimpleLineScaleIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/lineScaleIndicator/SimpleLineScaleIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/shape_unveil_indicator/CircleShapeIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/shape_unveil_indicator/CircleShapeIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/shape_unveil_indicator/CircleShapeIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/shape_unveil_indicator/CircleShapeIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/shape_unveil_indicator/ShapeUnveilIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/shape_unveil_indicator/ShapeUnveilIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/shape_unveil_indicator/ShapeUnveilIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/shape_unveil_indicator/ShapeUnveilIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/shape_unveil_indicator/TriangleShapeIndicator.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/shape_unveil_indicator/TriangleShapeIndicator.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/components/indicators/shape_unveil_indicator/TriangleShapeIndicator.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/components/indicators/shape_unveil_indicator/TriangleShapeIndicator.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/DrawStyleType.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/DrawStyleType.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/DrawStyleType.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/DrawStyleType.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/GridAnimationType.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/GridAnimationType.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/GridAnimationType.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/GridAnimationType.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/LinearAnimationType.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/LinearAnimationType.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/LinearAnimationType.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/LinearAnimationType.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/PunchType.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/PunchType.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/PunchType.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/PunchType.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/RotationAxis.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/RotationAxis.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/RotationAxis.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/RotationAxis.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/ShapeType.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/ShapeType.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/ShapeType.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/ShapeType.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/SquareCardFace.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/SquareCardFace.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/SquareCardFace.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/SquareCardFace.kt
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/TriangleCardFace.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/TriangleCardFace.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/enums/TriangleCardFace.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/enums/TriangleCardFace.kt
diff --git a/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/extension/IntExt.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/extension/IntExt.kt
new file mode 100644
index 0000000..ea2df5b
--- /dev/null
+++ b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/extension/IntExt.kt
@@ -0,0 +1,11 @@
+package com.spr.jetpack_loading.extension
+
+import kotlin.math.PI
+
+internal fun Int.isEven() = this == 0 || this/2 == 0
+internal fun Int.isOdd() = !this.isEven()
+
+
+// From - https://stackoverflow.com/a/77516088/20243803
+internal fun Double.toRadians(): Double = this / 180.0 * PI
+
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/extension/ListExt.kt b/jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/extension/ListExt.kt
similarity index 100%
rename from jetpack-loading/src/main/java/com/spr/jetpack_loading/extension/ListExt.kt
rename to jetpack-loading/src/commonMain/kotlin/com/spr/jetpack_loading/jetpack_loading/extension/ListExt.kt
diff --git a/jetpack-loading/src/main/AndroidManifest.xml b/jetpack-loading/src/main/AndroidManifest.xml
deleted file mode 100644
index a5918e6..0000000
--- a/jetpack-loading/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/jetpack-loading/src/main/java/com/spr/jetpack_loading/extension/IntExt.kt b/jetpack-loading/src/main/java/com/spr/jetpack_loading/extension/IntExt.kt
deleted file mode 100644
index e80cdd4..0000000
--- a/jetpack-loading/src/main/java/com/spr/jetpack_loading/extension/IntExt.kt
+++ /dev/null
@@ -1,4 +0,0 @@
-package com.spr.jetpack_loading.extension
-
-fun Int.isEven() = this == 0 || this/2 == 0
-fun Int.isOdd() = !this.isEven()
\ No newline at end of file
diff --git a/jetpack-loading/src/test/java/com/spr/jetpack_loading/ExampleUnitTest.kt b/jetpack-loading/src/test/java/com/spr/jetpack_loading/ExampleUnitTest.kt
deleted file mode 100644
index b5fd145..0000000
--- a/jetpack-loading/src/test/java/com/spr/jetpack_loading/ExampleUnitTest.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.spr.jetpack_loading
-
-import org.junit.Test
-
-import org.junit.Assert.*
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * See [testing documentation](http://d.android.com/tools/testing).
- */
-class ExampleUnitTest {
- @Test
- fun addition_isCorrect() {
- assertEquals(4, 2 + 2)
- }
-}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/proguard-rules.pro
similarity index 100%
rename from app/proguard-rules.pro
rename to proguard-rules.pro
diff --git a/settings.gradle b/settings.gradle
deleted file mode 100644
index f7f2f54..0000000
--- a/settings.gradle
+++ /dev/null
@@ -1,19 +0,0 @@
-pluginManagement {
- repositories {
- google()
- mavenCentral()
- gradlePluginPortal()
- mavenLocal()
- }
-}
-dependencyResolutionManagement {
- repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
- repositories {
- google()
- mavenCentral()
- mavenLocal()
- }
-}
-rootProject.name = "JetpackLoading"
-include ':app'
-include ':jetpack-loading'
\ No newline at end of file
diff --git a/settings.gradle.kts b/settings.gradle.kts
new file mode 100644
index 0000000..3a78852
--- /dev/null
+++ b/settings.gradle.kts
@@ -0,0 +1,33 @@
+rootProject.name = "jetpack-loading-kmp"
+enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
+
+pluginManagement {
+ repositories {
+ google {
+ mavenContent {
+ includeGroupAndSubgroups("androidx")
+ includeGroupAndSubgroups("com.android")
+ includeGroupAndSubgroups("com.google")
+ }
+ }
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+
+dependencyResolutionManagement {
+ repositories {
+ google {
+ mavenContent {
+ includeGroupAndSubgroups("androidx")
+ includeGroupAndSubgroups("com.android")
+ includeGroupAndSubgroups("com.google")
+ }
+ }
+ mavenCentral()
+ mavenLocal()
+ }
+}
+
+include(":composeApp")
+include(":jetpack-loading")