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 | GIF 1 | GIF 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 @@ - - - -