Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce shimmer modifier #117

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ UI Components includes several custom views for Android platform to make develop
* [TimelineView](libraries/timeline-view): **TimelineView** for creating a timeline and show actions on it.
* [TimelineViewCompose](libraries/timeline-view-compose): **TimelineView** for creating a timeline for compose and show actions on it.
* [FitOptionMessage](libraries/fit-option-message-view): **FitOptionMessageView** for displaying text views with clipped imageviews.

* [Shimmer](libraries/shimmer-compose): **Shimmer** for displaying shimmer for loading state.
License
--------
Copyright 2022 Trendyol.com
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ object Dependencies {
const val composeBom = "androidx.compose:compose-bom:2023.05.01"
const val composeActivity = "androidx.activity:activity-compose:1.3.0-alpha07"
const val composeMaterial = "androidx.compose.material:material"
const val composeUiUtil = "androidx.compose.ui:ui-util"
const val composeUiTooling = "androidx.compose.ui:ui-tooling"
const val composeRuntime = "androidx.compose.runtime:runtime"
const val composeCoil = "io.coil-kt:coil-compose:2.2.1"
Expand Down
1 change: 1 addition & 0 deletions libraries/shimmer-compose/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
63 changes: 63 additions & 0 deletions libraries/shimmer-compose/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
shimmerComposeVersion = **shimmer-compose-1.0.0** [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

# Shimmer Modifier

The `shimmer` modifier allows you to display a shimmer with a custom shape for loading state.

# Parameters

The `Shimmer` modifier accepts the following parameters:


| Parameter Name | Type | Description |
|-------------------------|-------------|--------------------------------|
| isVisible | Boolean | It determines if the shimmer isVisible or not |
| isWipeOffAnimationEnabled | Boolean | It enables or disables wipe-off animation of the shimmer |
| shape | Shape | It determines the shimmer's shape |

# Usage

```kotlin
val title by mutableStateOf("")

Text(
text = title,
modifier = Modifier
.fillMaxWidth()
.shimmer(title == "")
)
```

# Installation

- To implement **Shimmer** to your Android project via Gradle, you need to add JitPack repository to your root build.gradle.

```groovy
allprojects {
repositories {
// ...

maven { url 'https://jitpack.io' }
}
}
```

Open your module-level `build.gradle` file and add the `Shimmer` dependency:

```groovy
dependencies {
implementation "com.github.Trendyol.android-ui-components:shimmer-compose:$shimmerComposeVersion"
}
```

# Contributors

This library is maintained mainly by Trendyol Android Team members but also other Android lovers contributes.

# License

```
Copyright 2023 Trendyol.com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 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.
```
47 changes: 47 additions & 0 deletions libraries/shimmer-compose/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
plugins {
id(Plugins.androidLibrary)
id(Plugins.kotlinAndroid)
id(Plugins.mavenPublish)
}

android {
namespace = "com.trendyol.shimmercompose"
compileSdk = Configs.compileSdkVersion

defaultConfig {
minSdk = Configs.minSdkVersion
targetSdk = Configs.targetSdkVersion

vectorDrawables.useSupportLibrary = true
}

buildTypes {
getByName<com.android.build.gradle.internal.dsl.BuildType>("release") {
isMinifyEnabled = false
setProguardFiles(
mutableListOf(
getDefaultProguardFile("proguard-android.txt"),
"proguard-rules.pro"
)
)
}
}
buildFeatures {
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = Dependencies.kotlinCompilerExtensionVersion
}
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
implementation(platform(Dependencies.composeBom))
implementation(Dependencies.composeMaterial)
implementation(Dependencies.composeUiUtil)
implementation(Dependencies.composeUiTooling)
implementation(Dependencies.composeRuntime)
}
Loading