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

License - API + API Build Status Android Weekly Medium @@ -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() { private val veilParamList: MutableList = mutableListOf() @@ -36,7 +36,7 @@ internal class VeiledAdapter( val binding = VeilItemLayoutBinding.inflate( LayoutInflater.from(parent.context), parent, - false + false, ) return VeiledViewHolder(binding).apply { binding.root.setOnClickListener { @@ -52,7 +52,7 @@ internal class VeiledAdapter( with(holder.binding.itemVeilLayoutMain) { layoutParams = ViewGroup.LayoutParams( getLayoutParams(isListItemWrapContentWidth), - getLayoutParams(isListItemWrapContentHeight) + getLayoutParams(isListItemWrapContentHeight), ) if (getLayout() == -1) { setLayout(userLayout, isPrepared) diff --git a/androidveil/src/main/java/com/skydoves/androidveil/VeiledItemOnClickListener.kt b/androidveil/src/main/kotlin/com/skydoves/androidveil/VeiledItemOnClickListener.kt similarity index 100% rename from androidveil/src/main/java/com/skydoves/androidveil/VeiledItemOnClickListener.kt rename to androidveil/src/main/kotlin/com/skydoves/androidveil/VeiledItemOnClickListener.kt diff --git a/androidveil/src/main/java/com/skydoves/androidveil/ViewExtension.kt b/androidveil/src/main/kotlin/com/skydoves/androidveil/ViewExtension.kt similarity index 100% rename from androidveil/src/main/java/com/skydoves/androidveil/ViewExtension.kt rename to androidveil/src/main/kotlin/com/skydoves/androidveil/ViewExtension.kt diff --git a/androidveil/src/main/res/layout/veil_item_layout.xml b/androidveil/src/main/res/layout/veil_item_layout.xml index dec7712..e7f814d 100644 --- a/androidveil/src/main/res/layout/veil_item_layout.xml +++ b/androidveil/src/main/res/layout/veil_item_layout.xml @@ -17,4 +17,4 @@ \ No newline at end of file + android:layout_height="match_parent" /> diff --git a/androidveil/src/main/res/values/attrs_veil.xml b/androidveil/src/main/res/values/attrs_veil.xml index 8322ec2..ed64d2f 100644 --- a/androidveil/src/main/res/values/attrs_veil.xml +++ b/androidveil/src/main/res/values/attrs_veil.xml @@ -45,4 +45,4 @@ - \ No newline at end of file + diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 2711ec1..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -import com.skydoves.androidveil.Configuration -import com.skydoves.androidveil.Dependencies - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' - -android { - compileSdkVersion Configuration.compileSdk - defaultConfig { - applicationId "com.skydoves.androidveildemo" - minSdkVersion Configuration.minSdk - targetSdkVersion Configuration.compileSdk - versionCode Configuration.versionCode - versionName Configuration.versionName - } - lintOptions { - abortOnError false - } - kotlinOptions { - jvmTarget = '1.8' - } - buildFeatures { - viewBinding true - } -} - -dependencies { - implementation Dependencies.material - implementation project(":androidveil") -} - diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..c421ef8 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,43 @@ +import com.skydoves.androidveil.Configuration + +@Suppress("DSL_SCOPE_VIOLATION") +plugins { + id(libs.plugins.android.application.get().pluginId) + id(libs.plugins.kotlin.android.get().pluginId) +} + +android { + compileSdk = Configuration.compileSdk + namespace = "com.skydoves.androidveildemo" + + defaultConfig { + applicationId = "com.skydoves.androidveildemo" + minSdk = Configuration.minSdk + targetSdk = Configuration.targetSdk + versionCode = Configuration.versionCode + versionName = Configuration.versionName + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = "17" + } + + buildFeatures { + viewBinding = true + } + + lint { + abortOnError = false + } +} + +dependencies { + implementation(libs.androidx.material) + implementation(project(":androidveil")) +} + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 60f1afc..5e4573f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,8 +15,7 @@ limitations under the License. --> + xmlns:tools="http://schemas.android.com/tools"> - \ No newline at end of file + diff --git a/app/src/main/java/com/skydoves/androidveildemo/CarouselActivity.kt b/app/src/main/kotlin/com/skydoves/androidveildemo/CarouselActivity.kt similarity index 96% rename from app/src/main/java/com/skydoves/androidveildemo/CarouselActivity.kt rename to app/src/main/kotlin/com/skydoves/androidveildemo/CarouselActivity.kt index 44a51ac..ce4b2ec 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/CarouselActivity.kt +++ b/app/src/main/kotlin/com/skydoves/androidveildemo/CarouselActivity.kt @@ -55,7 +55,7 @@ class CarouselActivity : setVeilLayout( layout = R.layout.item_prepared_shimmer_carousel, isPrepared = true, - onItemClickListener = this@CarouselActivity + onItemClickListener = this@CarouselActivity, ) setAdapter(adapter) setLayoutManager(LinearLayoutManager(this@CarouselActivity, RecyclerView.HORIZONTAL, false)) @@ -66,7 +66,7 @@ class CarouselActivity : setVeilLayout( layout = R.layout.item_prepared_shimmer_carousel, isPrepared = true, - onItemClickListener = this@CarouselActivity + onItemClickListener = this@CarouselActivity, ) setAdapter(adapter) setLayoutManager(LinearLayoutManager(this@CarouselActivity, RecyclerView.HORIZONTAL, false)) @@ -81,13 +81,13 @@ class CarouselActivity : { binding.veilRecyclerView.unVeil() }, - 3000 + 3000, ) Handler(Looper.getMainLooper()).postDelayed( { binding.veilRecyclerView2.unVeil() }, - 5000 + 5000, ) } diff --git a/app/src/main/java/com/skydoves/androidveildemo/DetailActivity.kt b/app/src/main/kotlin/com/skydoves/androidveildemo/DetailActivity.kt similarity index 99% rename from app/src/main/java/com/skydoves/androidveildemo/DetailActivity.kt rename to app/src/main/kotlin/com/skydoves/androidveildemo/DetailActivity.kt index 89d31ed..c1ee39c 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/DetailActivity.kt +++ b/app/src/main/kotlin/com/skydoves/androidveildemo/DetailActivity.kt @@ -44,7 +44,7 @@ class DetailActivity : AppCompatActivity() { binding.detailVeilLayoutHeader.unVeil() binding.detailVeilLayoutBody.unVeil() }, - 3000 + 3000, ) } } diff --git a/app/src/main/java/com/skydoves/androidveildemo/Extension.kt b/app/src/main/kotlin/com/skydoves/androidveildemo/Extension.kt similarity index 100% rename from app/src/main/java/com/skydoves/androidveildemo/Extension.kt rename to app/src/main/kotlin/com/skydoves/androidveildemo/Extension.kt diff --git a/app/src/main/java/com/skydoves/androidveildemo/GridActivity.kt b/app/src/main/kotlin/com/skydoves/androidveildemo/GridActivity.kt similarity index 98% rename from app/src/main/java/com/skydoves/androidveildemo/GridActivity.kt rename to app/src/main/kotlin/com/skydoves/androidveildemo/GridActivity.kt index fb07637..e3e2e5a 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/GridActivity.kt +++ b/app/src/main/kotlin/com/skydoves/androidveildemo/GridActivity.kt @@ -53,7 +53,7 @@ class GridActivity : setVeilLayout( layout = R.layout.item_preview_grid, isPrepared = false, - onItemClickListener = this@GridActivity + onItemClickListener = this@GridActivity, ) setAdapter(adapter) setLayoutManager(GridLayoutManager(this@GridActivity, 2)) diff --git a/app/src/main/java/com/skydoves/androidveildemo/MainActivity.kt b/app/src/main/kotlin/com/skydoves/androidveildemo/MainActivity.kt similarity index 98% rename from app/src/main/java/com/skydoves/androidveildemo/MainActivity.kt rename to app/src/main/kotlin/com/skydoves/androidveildemo/MainActivity.kt index 8990f59..b96e7e0 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/MainActivity.kt +++ b/app/src/main/kotlin/com/skydoves/androidveildemo/MainActivity.kt @@ -53,7 +53,7 @@ class MainActivity : binding.veilRecyclerView.run { setVeilLayout( layout = R.layout.item_profile_list, - onItemClickListener = this@MainActivity + onItemClickListener = this@MainActivity, ) setAdapter(adapter) setLayoutManager(LinearLayoutManager(this@MainActivity)) @@ -68,7 +68,7 @@ class MainActivity : { binding.veilRecyclerView.unVeil() }, - 5000 + 5000, ) } diff --git a/app/src/main/java/com/skydoves/androidveildemo/ShimmerUtils.kt b/app/src/main/kotlin/com/skydoves/androidveildemo/ShimmerUtils.kt similarity index 100% rename from app/src/main/java/com/skydoves/androidveildemo/ShimmerUtils.kt rename to app/src/main/kotlin/com/skydoves/androidveildemo/ShimmerUtils.kt diff --git a/app/src/main/java/com/skydoves/androidveildemo/profile/ListItemUtils.kt b/app/src/main/kotlin/com/skydoves/androidveildemo/profile/ListItemUtils.kt similarity index 81% rename from app/src/main/java/com/skydoves/androidveildemo/profile/ListItemUtils.kt rename to app/src/main/kotlin/com/skydoves/androidveildemo/profile/ListItemUtils.kt index 2570fb8..8752482 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/profile/ListItemUtils.kt +++ b/app/src/main/kotlin/com/skydoves/androidveildemo/profile/ListItemUtils.kt @@ -32,57 +32,61 @@ object ListItemUtils { Profile( ContextCompat.getDrawable(context, R.drawable.person0), "The Little Prince", - "And now here is my secret, a very simple secret: It is only with the heart that one can see rightly; what is essential is invisible to the eye." - ) + "And now here is my secret, a very simple secret: It is only with " + + "the heart that one can see rightly; what is essential is invisible to the eye.", + ), ) list.add( Profile( ContextCompat.getDrawable(context, R.drawable.person1), "Mia Vance", - "All grown-ups were once children... but only few of them remember it." - ) + "All grown-ups were once children... but only few of them remember it.", + ), ) list.add( Profile( ContextCompat.getDrawable(context, R.drawable.person2), "Ryker Beil", - "What makes the desert beautiful,' said the little prince, 'is that somewhere it hides a well..." - ) + "What makes the desert beautiful,' said the little prince, " + + "'is that somewhere it hides a well...", + ), ) list.add( Profile( ContextCompat.getDrawable(context, R.drawable.person3), "Kayden Bautista", - "It is the time you have wasted for your rose that makes your rose so important." - ) + "It is the time you have wasted for your rose that makes your rose so important.", + ), ) list.add( Profile( ContextCompat.getDrawable(context, R.drawable.person4), "Skylar Odom", - "The most beautiful things in the world cannot be seen or touched, they are felt with the heart." - ) + "The most beautiful things in the world cannot be seen or touched," + + " they are felt with the heart.", + ), ) list.add( Profile( ContextCompat.getDrawable(context, R.drawable.person5), "Autumn Villegas", - "It is such a mysterious place, the land of tears." - ) + "It is such a mysterious place, the land of tears.", + ), ) list.add( Profile( ContextCompat.getDrawable(context, R.drawable.person6), "Wyatt Sherman", - "Well, I must endure the presence of a few caterpillars if I wish to become acquainted with the butterflies." - ) + "Well, I must endure the presence of a few caterpillars " + + "if I wish to become acquainted with the butterflies.", + ), ) list.add( Profile( ContextCompat.getDrawable(context, R.drawable.person7), "Rachel Alvarado", - "You see, one loves the sunset when one is so sad." - ) + "You see, one loves the sunset when one is so sad.", + ), ) return list } diff --git a/app/src/main/java/com/skydoves/androidveildemo/profile/Profile.kt b/app/src/main/kotlin/com/skydoves/androidveildemo/profile/Profile.kt similarity index 97% rename from app/src/main/java/com/skydoves/androidveildemo/profile/Profile.kt rename to app/src/main/kotlin/com/skydoves/androidveildemo/profile/Profile.kt index f5cc820..3ceb8c9 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/profile/Profile.kt +++ b/app/src/main/kotlin/com/skydoves/androidveildemo/profile/Profile.kt @@ -26,5 +26,5 @@ import android.graphics.drawable.Drawable data class Profile( val image: Drawable?, val name: String, - val content: String + val content: String, ) diff --git a/app/src/main/java/com/skydoves/androidveildemo/profile/ProfileAdapter.kt b/app/src/main/kotlin/com/skydoves/androidveildemo/profile/ProfileAdapter.kt similarity index 97% rename from app/src/main/java/com/skydoves/androidveildemo/profile/ProfileAdapter.kt rename to app/src/main/kotlin/com/skydoves/androidveildemo/profile/ProfileAdapter.kt index 32097ae..242f5ae 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/profile/ProfileAdapter.kt +++ b/app/src/main/kotlin/com/skydoves/androidveildemo/profile/ProfileAdapter.kt @@ -27,7 +27,7 @@ import com.skydoves.androidveildemo.databinding.ItemProfileListBinding */ class ProfileAdapter( - private val delegate: ProfileViewHolder.Delegate + private val delegate: ProfileViewHolder.Delegate, ) : RecyclerView.Adapter() { private val profileList: MutableList = mutableListOf() diff --git a/app/src/main/java/com/skydoves/androidveildemo/profile/ProfileCarouselAdapter.kt b/app/src/main/kotlin/com/skydoves/androidveildemo/profile/ProfileCarouselAdapter.kt similarity index 91% rename from app/src/main/java/com/skydoves/androidveildemo/profile/ProfileCarouselAdapter.kt rename to app/src/main/kotlin/com/skydoves/androidveildemo/profile/ProfileCarouselAdapter.kt index 4be0bdf..919da99 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/profile/ProfileCarouselAdapter.kt +++ b/app/src/main/kotlin/com/skydoves/androidveildemo/profile/ProfileCarouselAdapter.kt @@ -27,13 +27,17 @@ import com.skydoves.androidveildemo.databinding.ItemProfileCarouselBinding */ class ProfileCarouselAdapter( - private val delegate: ProfileViewHolder.Delegate + private val delegate: ProfileViewHolder.Delegate, ) : RecyclerView.Adapter() { private val profileList: MutableList = mutableListOf() override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ProfileViewHolder { - val binding = ItemProfileCarouselBinding.inflate(LayoutInflater.from(parent.context), parent, false) + val binding = ItemProfileCarouselBinding.inflate( + LayoutInflater.from(parent.context), + parent, + false, + ) return ProfileViewHolder(binding) } diff --git a/app/src/main/res/layout/activity_carousel.xml b/app/src/main/res/layout/activity_carousel.xml index 7e3422a..c4e2ac0 100644 --- a/app/src/main/res/layout/activity_carousel.xml +++ b/app/src/main/res/layout/activity_carousel.xml @@ -70,4 +70,4 @@ app:veilFrame_radius="4dp" app:veilFrame_shimmerEnable="true" app:veilFrame_veiled="true" /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/activity_detail.xml b/app/src/main/res/layout/activity_detail.xml index ca711a6..6b8f434 100644 --- a/app/src/main/res/layout/activity_detail.xml +++ b/app/src/main/res/layout/activity_detail.xml @@ -136,4 +136,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/layout/activity_grid.xml b/app/src/main/res/layout/activity_grid.xml index a8c19ac..9f2076b 100644 --- a/app/src/main/res/layout/activity_grid.xml +++ b/app/src/main/res/layout/activity_grid.xml @@ -39,4 +39,4 @@ app:veilFrame_radius="4dp" app:veilFrame_shimmerEnable="true" app:veilFrame_veiled="true" /> - \ No newline at end of file + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index 0c20dd6..b51a943 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -17,4 +17,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index 0c20dd6..b51a943 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -17,4 +17,4 @@ - \ No newline at end of file + diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 2f562df..0000000 --- a/build.gradle +++ /dev/null @@ -1,33 +0,0 @@ -import com.skydoves.androidveil.Dependencies - -apply plugin: 'io.github.gradle-nexus.publish-plugin' -apply plugin: 'org.jetbrains.dokka' - -buildscript { - repositories { - google() - mavenCentral() - maven { url "https://plugins.gradle.org/m2/" } - } - dependencies { - classpath Dependencies.androidGradlePlugin - classpath Dependencies.kotlinGradlePlugin - classpath Dependencies.spotlessGradlePlugin - classpath Dependencies.gradleNexusPublishPlugin - classpath Dependencies.dokka - classpath Dependencies.kotlinBinaryValidator - } -} - -subprojects { - apply from: "$rootDir/spotless/spotless.gradle" -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -apply from: "${rootDir}/scripts/publish-root.gradle" \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..4dcee42 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,59 @@ +// 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. + +@Suppress("DSL_SCOPE_VIOLATION") +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.baseline.profile) apply false + alias(libs.plugins.nexus.plugin) + alias(libs.plugins.spotless) + alias(libs.plugins.dokka) + alias(libs.plugins.kotlin.binary.compatibility) +} + +apiValidation { + ignoredProjects.addAll(listOf("app")) + ignoredPackages.add("com/skydoves/androidveil/databinding") + nonPublicMarkers.add("kotlin.PublishedApi") +} + +subprojects { + apply(plugin = rootProject.libs.plugins.spotless.get().pluginId) + + configure { + kotlin { + target("**/*.kt") + targetExclude("$buildDir/**/*.kt") + ktlint().editorConfigOverride( + mapOf( + "indent_size" to "2", + "continuation_indent_size" to "2" + ) + ) + licenseHeaderFile(rootProject.file("spotless/spotless.license.kt")) + trimTrailingWhitespace() + endWithNewline() + } + format("xml") { + target("**/*.xml") + targetExclude("**/build/**/*.xml") + // Look for the first XML tag that isn't a comment (