diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index bd6dd9a..502f511 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -9,63 +9,48 @@ on: jobs: lint: name: Spotless check - runs-on: macos-latest + runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v4.1.1 + uses: actions/checkout@v4.1.7 - name: Set up JDK - uses: actions/setup-java@v4.0.0 + uses: actions/setup-java@v4.2.1 with: - distribution: 'zulu' + distribution: zulu java-version: 17 + - uses: gradle/gradle-build-action@v3.4.2 - name: spotless run: ./gradlew spotlessCheck api_check: name: API check - runs-on: macos-latest + runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v4.1.1 + uses: actions/checkout@v4.1.7 - name: Set up JDK - uses: actions/setup-java@v4.0.0 + uses: actions/setup-java@v4.2.1 with: - distribution: 'zulu' + distribution: zulu java-version: 17 + - uses: gradle/gradle-build-action@v3.4.2 - name: API check run: ./gradlew apiCheck build: - name: Build and Tests - runs-on: macos-latest + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.1 - + - uses: actions/checkout@v4.1.7 - name: set up JDK - uses: actions/setup-java@v4.0.0 + uses: actions/setup-java@v4.2.1 with: - distribution: 'zulu' + distribution: zulu java-version: 17 - - name: Cache Gradle and wrapper - uses: actions/cache@v4 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: | - ${{ runner.os }}-gradle- - + - uses: gradle/gradle-build-action@v3.4.2 - name: Make Gradle executable run: chmod +x ./gradlew - name: Build with Gradle run: | - ./gradlew --scan --stacktrace \ - assemble - - - name: Run unit tests - run: | - ./gradlew --scan --stacktrace \ - testDebugUnitTest \ No newline at end of file + ./gradlew --scan --stacktrace \ No newline at end of file diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml deleted file mode 100644 index 75d6b46..0000000 --- a/.github/workflows/publish-snapshot.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Publish Snapshot builds - -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - publish: - name: Snapshot build and publish - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - distribution: adopt - java-version: 11 - - name: Release build - run: ./gradlew assemble --scan - - name: Source jar and dokka - run: ./gradlew androidSourcesJar javadocJar --scan - - name: Publish to MavenCentral - run: ./gradlew publishReleasePublicationToSonatypeRepository --scan - env: - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} - SNAPSHOT: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3ad591c..5b5ab89 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,31 +2,35 @@ name: Publish on: release: - types: [released] + types: [ released ] workflow_dispatch: jobs: publish: - name: Release build and publish + name: Snapshot build and publish runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/checkout@v4.1.7 + + - name: Set up JDK 17 + uses: actions/setup-java@v4.2.1 with: - distribution: adopt - java-version: 11 + distribution: 'zulu' + java-version: 17 + + - name: Grant Permission to Execute Gradle + run: chmod +x gradlew + - name: Release build - run: ./gradlew assemble --scan - - name: Source jar and dokka - run: ./gradlew androidSourcesJar javadocJar --scan + run: ./gradlew assemble + - name: Publish to MavenCentral - run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository --scan + run: | + ./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache env: - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} \ No newline at end of file diff --git a/README.md b/README.md index 9672fbf..d6790e8 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ An easy, flexible way to implement veil skeletons and shimmering effect for Andr
-
+
@@ -26,20 +26,11 @@ An easy, flexible way to implement veil skeletons and shimmering effect for Andr
[![Maven Central](https://img.shields.io/maven-central/v/com.github.skydoves/androidveil.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.skydoves%22%20AND%20a:%22androidveil%22)
### Gradle
-Add the codes below to your **root** `build.gradle` file (not your module build.gradle file):
-```gradle
-allprojects {
- repositories {
- mavenCentral()
- }
-}
-```
-
-And add the dependency below to your **module**'s `build.gradle` file:
+Add the dependency below to your **module**'s `build.gradle` file:
```gradle
dependencies {
- implementation "com.github.skydoves:androidveil:1.1.3"
+ implementation("com.github.skydoves:androidveil:1.1.4")
}
```
diff --git a/androidveil/build.gradle b/androidveil/build.gradle
deleted file mode 100644
index da5c552..0000000
--- a/androidveil/build.gradle
+++ /dev/null
@@ -1,60 +0,0 @@
-import com.skydoves.androidveil.Configuration
-import com.skydoves.androidveil.Dependencies
-
-apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-apply plugin: 'org.jetbrains.dokka'
-apply plugin: 'binary-compatibility-validator'
-
-ext {
- PUBLISH_GROUP_ID = Configuration.artifactGroup
- PUBLISH_ARTIFACT_ID = 'androidveil'
- PUBLISH_VERSION = rootVersionName
-}
-
-apply from: "${rootDir}/scripts/publish-module.gradle"
-
-android {
- compileSdkVersion Configuration.compileSdk
- defaultConfig {
- minSdkVersion Configuration.minSdk
- targetSdkVersion Configuration.compileSdk
- versionCode Configuration.versionCode
- versionName Configuration.versionName
- }
-
- resourcePrefix "veil"
-
- buildFeatures {
- buildConfig false
- viewBinding true
- }
-
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-
- kotlinOptions {
- jvmTarget = "1.8"
- }
-
- lintOptions {
- abortOnError false
- }
-}
-
-apiValidation {
- ignoredPackages += ["com/skydoves/androidveil/databinding"]
- nonPublicMarkers += ["kotlin.PublishedApi"]
-}
-
-tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
- kotlinOptions.freeCompilerArgs += ["-Xexplicit-api=strict"]
-}
-
-dependencies {
- implementation Dependencies.appcompat
- implementation Dependencies.recyclerview
- api Dependencies.shimmer
-}
diff --git a/androidveil/build.gradle.kts b/androidveil/build.gradle.kts
new file mode 100644
index 0000000..173d5ed
--- /dev/null
+++ b/androidveil/build.gradle.kts
@@ -0,0 +1,85 @@
+// Designed and developed by 2019 skydoves (Jaewoong Eum)
+//
+// 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.
+
+import com.skydoves.androidveil.Configuration
+
+@Suppress("DSL_SCOPE_VIOLATION")
+plugins {
+ id(libs.plugins.android.library.get().pluginId)
+ id(libs.plugins.kotlin.android.get().pluginId)
+ id(libs.plugins.nexus.plugin.get().pluginId)
+}
+
+apply(from = "${rootDir}/scripts/publish-module.gradle.kts")
+
+mavenPublishing {
+ val artifactId = "androidveil"
+ coordinates(
+ Configuration.artifactGroup,
+ artifactId,
+ rootProject.extra.get("libVersion").toString()
+ )
+
+ pom {
+ name.set(artifactId)
+ description.set("An easy, flexible way to implement veil skeletons and shimmering effect for Android.")
+ }
+}
+
+android {
+ compileSdk = Configuration.compileSdk
+ namespace = "com.skydoves.androidveil"
+
+ defaultConfig {
+ minSdk = Configuration.minSdk
+ }
+
+ resourcePrefix = "veil"
+
+ buildFeatures {
+ viewBinding = true
+ }
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_11
+ targetCompatibility = JavaVersion.VERSION_11
+ }
+
+ kotlinOptions {
+ jvmTarget = libs.versions.jvmTarget.get()
+ }
+
+ lint {
+ abortOnError = false
+ }
+}
+
+kotlin {
+ compilerOptions {
+ freeCompilerArgs.addAll(
+ "-Xexplicit-api=strict",
+ )
+ }
+}
+
+tasks.withType(JavaCompile::class.java).configureEach {
+ this.targetCompatibility = libs.versions.jvmTarget.get()
+ this.sourceCompatibility = libs.versions.jvmTarget.get()
+}
+
+dependencies {
+ implementation(libs.androidx.appcompat)
+ implementation(libs.androidx.recyclerview)
+ api(libs.shimmer)
+}
diff --git a/androidveil/src/main/java/com/skydoves/androidveil/ResourceExtension.kt b/androidveil/src/main/kotlin/com/skydoves/androidveil/ResourceExtension.kt
similarity index 100%
rename from androidveil/src/main/java/com/skydoves/androidveil/ResourceExtension.kt
rename to androidveil/src/main/kotlin/com/skydoves/androidveil/ResourceExtension.kt
diff --git a/androidveil/src/main/java/com/skydoves/androidveil/VeilLayout.kt b/androidveil/src/main/kotlin/com/skydoves/androidveil/VeilLayout.kt
similarity index 97%
rename from androidveil/src/main/java/com/skydoves/androidveil/VeilLayout.kt
rename to androidveil/src/main/kotlin/com/skydoves/androidveil/VeilLayout.kt
index a54630d..16a1f87 100644
--- a/androidveil/src/main/java/com/skydoves/androidveil/VeilLayout.kt
+++ b/androidveil/src/main/kotlin/com/skydoves/androidveil/VeilLayout.kt
@@ -38,12 +38,16 @@ import com.facebook.shimmer.ShimmerFrameLayout
/** create a [Shimmer] by [Shimmer.AlphaHighlightBuilder] using dsl. */
@JvmSynthetic
-public inline fun alphaShimmer(crossinline block: Shimmer.AlphaHighlightBuilder.() -> Unit): Shimmer =
+public inline fun alphaShimmer(
+ crossinline block: Shimmer.AlphaHighlightBuilder.() -> Unit,
+): Shimmer =
Shimmer.AlphaHighlightBuilder().apply(block).build()
/** create a [Shimmer] by [Shimmer.ColorHighlightBuilder] using dsl. */
@JvmSynthetic
-public inline fun colorShimmer(crossinline block: Shimmer.ColorHighlightBuilder.() -> Unit): Shimmer =
+public inline fun colorShimmer(
+ crossinline block: Shimmer.ColorHighlightBuilder.() -> Unit,
+): Shimmer =
Shimmer.ColorHighlightBuilder().apply(block).build()
/** VeilLayout creates skeletons about the complex child views with shimmering effect. */
@@ -126,7 +130,7 @@ public class VeilLayout : FrameLayout {
public constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
- defStyleAttr
+ defStyleAttr,
) {
getAttrs(attrs)
onCreate()
@@ -137,12 +141,12 @@ public class VeilLayout : FrameLayout {
context: Context,
attrs: AttributeSet?,
defStyleAttr: Int,
- defStyleRes: Int
+ defStyleRes: Int,
) : super(
context,
attrs,
defStyleAttr,
- defStyleRes
+ defStyleRes,
) {
getAttrs(attrs)
onCreate()
@@ -266,7 +270,7 @@ public class VeilLayout : FrameLayout {
child: View,
marginX: Float,
parent: ViewGroup,
- marginY: Float
+ marginY: Float,
): View {
return View(context).apply {
layoutParams = LayoutParams(child.width, child.height)
diff --git a/androidveil/src/main/java/com/skydoves/androidveil/VeilParams.kt b/androidveil/src/main/kotlin/com/skydoves/androidveil/VeilParams.kt
similarity index 97%
rename from androidveil/src/main/java/com/skydoves/androidveil/VeilParams.kt
rename to androidveil/src/main/kotlin/com/skydoves/androidveil/VeilParams.kt
index 2c85865..8d5a2d3 100644
--- a/androidveil/src/main/java/com/skydoves/androidveil/VeilParams.kt
+++ b/androidveil/src/main/kotlin/com/skydoves/androidveil/VeilParams.kt
@@ -32,5 +32,5 @@ internal data class VeilParams(
var dropOff: Float,
var shimmerEnable: Boolean,
var shimmer: Shimmer?,
- var defaultChildVisible: Boolean
+ var defaultChildVisible: Boolean,
)
diff --git a/androidveil/src/main/java/com/skydoves/androidveil/VeilRecyclerFrameView.kt b/androidveil/src/main/kotlin/com/skydoves/androidveil/VeilRecyclerFrameView.kt
similarity index 91%
rename from androidveil/src/main/java/com/skydoves/androidveil/VeilRecyclerFrameView.kt
rename to androidveil/src/main/kotlin/com/skydoves/androidveil/VeilRecyclerFrameView.kt
index edcc213..895fbc4 100644
--- a/androidveil/src/main/java/com/skydoves/androidveil/VeilRecyclerFrameView.kt
+++ b/androidveil/src/main/kotlin/com/skydoves/androidveil/VeilRecyclerFrameView.kt
@@ -86,7 +86,7 @@ public class VeilRecyclerFrameView : RelativeLayout {
public constructor(context: Context, attrs: AttributeSet?, defStyle: Int) : super(
context,
attrs,
- defStyle
+ defStyle,
) {
getAttrs(attrs)
onCreate()
@@ -112,7 +112,7 @@ public class VeilRecyclerFrameView : RelativeLayout {
shimmerEnable =
a.getBoolean(
R.styleable.VeilRecyclerFrameView_veilFrame_shimmerEnable,
- shimmerEnable
+ shimmerEnable,
)
}
if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_baseColor)) {
@@ -123,7 +123,7 @@ public class VeilRecyclerFrameView : RelativeLayout {
highlightColor =
a.getColor(
R.styleable.VeilRecyclerFrameView_veilFrame_highlightColor,
- highlightColor
+ highlightColor,
)
}
if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_baseAlpha)) {
@@ -134,7 +134,7 @@ public class VeilRecyclerFrameView : RelativeLayout {
highlightAlpha =
a.getFloat(
R.styleable.VeilRecyclerFrameView_veilFrame_highlightAlpha,
- highlightAlpha
+ highlightAlpha,
)
}
if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_dropOff)) {
@@ -144,7 +144,7 @@ public class VeilRecyclerFrameView : RelativeLayout {
defaultChildVisible =
a.getBoolean(
R.styleable.VeilRecyclerFrameView_veilFrame_defaultChildVisible,
- defaultChildVisible
+ defaultChildVisible,
)
}
if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_isPrepared)) {
@@ -154,13 +154,13 @@ public class VeilRecyclerFrameView : RelativeLayout {
if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_isItemWrapContentWidth)) {
isItemWrapContentWidth = a.getBoolean(
R.styleable.VeilRecyclerFrameView_veilFrame_isItemWrapContentWidth,
- isItemWrapContentWidth
+ isItemWrapContentWidth,
)
}
if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_isItemWrapContentHeight)) {
isItemWrapContentHeight = a.getBoolean(
R.styleable.VeilRecyclerFrameView_veilFrame_isItemWrapContentHeight,
- isItemWrapContentHeight
+ isItemWrapContentHeight,
)
}
} finally {
@@ -169,9 +169,11 @@ public class VeilRecyclerFrameView : RelativeLayout {
}
private fun onCreate() {
- addView(this.userRecyclerView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
- addView(this.veiledRecyclerView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
- this.veiledRecyclerView.setHasFixedSize(true)
+ addView(userRecyclerView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
+ addView(veiledRecyclerView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
+ userRecyclerView.clipToPadding = this@VeilRecyclerFrameView.clipToPadding
+ veiledRecyclerView.clipToPadding = this@VeilRecyclerFrameView.clipToPadding
+ veiledRecyclerView.setHasFixedSize(true)
applyOverScrollMode()
when (this.isVeiled) {
true -> visibleVeilRecyclerView()
@@ -187,7 +189,7 @@ public class VeilRecyclerFrameView : RelativeLayout {
public fun setVeilLayout(
@LayoutRes layout: Int,
isPrepared: Boolean = false,
- onItemClickListener: VeiledItemOnClickListener? = null
+ onItemClickListener: VeiledItemOnClickListener? = null,
) {
this.veiledAdapter =
VeiledAdapter(
@@ -195,7 +197,7 @@ public class VeilRecyclerFrameView : RelativeLayout {
isPrepared = isPrepared,
onItemClickListener = onItemClickListener,
isListItemWrapContentWidth = isItemWrapContentWidth,
- isListItemWrapContentHeight = isItemWrapContentHeight
+ isListItemWrapContentHeight = isItemWrapContentHeight,
)
this.veiledRecyclerView.adapter = this.veiledAdapter
requestLayout()
@@ -206,12 +208,12 @@ public class VeilRecyclerFrameView : RelativeLayout {
@LayoutRes layout: Int,
@IntRange(from = 1) size: Int,
isPrepared: Boolean = false,
- onItemClickListener: VeiledItemOnClickListener? = null
+ onItemClickListener: VeiledItemOnClickListener? = null,
) {
this.setVeilLayout(
layout = layout,
isPrepared = isPrepared,
- onItemClickListener = onItemClickListener
+ onItemClickListener = onItemClickListener,
)
this.addVeiledItems(size)
requestLayout()
@@ -232,8 +234,8 @@ public class VeilRecyclerFrameView : RelativeLayout {
dropOff = dropOff,
shimmerEnable = shimmerEnable,
shimmer = shimmer,
- defaultChildVisible = defaultChildVisible
- )
+ defaultChildVisible = defaultChildVisible,
+ ),
)
}
this.veiledAdapter?.updateParams(paramList)
@@ -248,7 +250,7 @@ public class VeilRecyclerFrameView : RelativeLayout {
/** Sets userRecyclerView's adapter and RecyclerViews LayoutManager. */
public fun setAdapter(
adapter: RecyclerView.Adapter<*>?,
- layoutManager: RecyclerView.LayoutManager
+ layoutManager: RecyclerView.LayoutManager,
) {
this.setAdapter(adapter)
this.setLayoutManager(layoutManager)
@@ -271,7 +273,7 @@ public class VeilRecyclerFrameView : RelativeLayout {
LinearLayoutManager(
context,
layoutManager.orientation,
- layoutManager.reverseLayout
+ layoutManager.reverseLayout,
)
else -> this.veiledRecyclerView.layoutManager
diff --git a/androidveil/src/main/java/com/skydoves/androidveil/VeiledAdapter.kt b/androidveil/src/main/kotlin/com/skydoves/androidveil/VeiledAdapter.kt
similarity index 96%
rename from androidveil/src/main/java/com/skydoves/androidveil/VeiledAdapter.kt
rename to androidveil/src/main/kotlin/com/skydoves/androidveil/VeiledAdapter.kt
index eae7b18..12e5bd6 100644
--- a/androidveil/src/main/java/com/skydoves/androidveil/VeiledAdapter.kt
+++ b/androidveil/src/main/kotlin/com/skydoves/androidveil/VeiledAdapter.kt
@@ -27,7 +27,7 @@ internal class VeiledAdapter(
private val isPrepared: Boolean = false,
private val onItemClickListener: VeiledItemOnClickListener? = null,
private val isListItemWrapContentWidth: Boolean = false,
- private val isListItemWrapContentHeight: Boolean = true
+ private val isListItemWrapContentHeight: Boolean = true,
) : RecyclerView.Adapter