From e4af04179d0bef9b027f502b7d5c796700e56e34 Mon Sep 17 00:00:00 2001 From: skydoves Date: Sun, 4 Sep 2022 00:37:06 +0900 Subject: [PATCH] Update gradle set up and refactor entire code formats --- androidveil/build.gradle | 31 +++++-- androidveil/src/main/AndroidManifest.xml | 16 ++++ .../skydoves/androidveil/ResourceExtension.kt | 2 +- .../com/skydoves/androidveil/VeilLayout.kt | 91 ++++++++++++------- .../com/skydoves/androidveil/VeilParams.kt | 2 +- .../androidveil/VeilRecyclerFrameView.kt | 83 ++++++++++------- .../com/skydoves/androidveil/VeiledAdapter.kt | 13 ++- .../androidveil/VeiledItemOnClickListener.kt | 6 +- .../com/skydoves/androidveil/ViewExtension.kt | 2 +- ...tem_veiled_layout_androidveil_skydoves.xml | 5 - .../src/main/res/layout/veil_item_layout.xml | 20 ++++ .../src/main/res/values/attrs_veil.xml | 15 +++ app/build.gradle | 1 - app/src/main/AndroidManifest.xml | 15 +++ .../androidveildemo/DetailActivity.kt | 2 +- .../com/skydoves/androidveildemo/Extension.kt | 2 +- .../skydoves/androidveildemo/MainActivity.kt | 2 +- .../androidveildemo/SecondActivity.kt | 2 +- .../skydoves/androidveildemo/ShimmerUtils.kt | 2 +- .../androidveildemo/profile/ListItemUtils.kt | 26 ++++-- .../androidveildemo/profile/Profile.kt | 2 +- .../androidveildemo/profile/ProfileAdapter.kt | 2 +- .../drawable-v24/ic_launcher_foreground.xml | 16 ++++ .../res/drawable/ic_launcher_background.xml | 15 +++ app/src/main/res/layout/activity_detail.xml | 15 +++ app/src/main/res/layout/activity_main.xml | 15 +++ app/src/main/res/layout/activity_second.xml | 15 +++ app/src/main/res/layout/item_preview.xml | 15 +++ app/src/main/res/layout/item_profile.xml | 15 +++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 15 +++ .../mipmap-anydpi-v26/ic_launcher_round.xml | 15 +++ app/src/main/res/values-v21/styles.xml | 16 ++++ app/src/main/res/values/colors.xml | 15 +++ app/src/main/res/values/strings.xml | 16 ++++ app/src/main/res/values/styles.xml | 16 ++++ build.gradle | 4 + dependencies.gradle | 14 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- spotless.gradle | 11 --- spotless/spotless.gradle | 18 ++++ .../spotless.license.kt | 2 +- spotless/spotless.license.xml | 16 ++++ 42 files changed, 476 insertions(+), 132 deletions(-) delete mode 100644 androidveil/src/main/res/layout/item_veiled_layout_androidveil_skydoves.xml create mode 100644 androidveil/src/main/res/layout/veil_item_layout.xml delete mode 100644 spotless.gradle create mode 100644 spotless/spotless.gradle rename spotless.license.kt => spotless/spotless.license.kt (90%) create mode 100644 spotless/spotless.license.xml diff --git a/androidveil/build.gradle b/androidveil/build.gradle index a75d906..742e611 100644 --- a/androidveil/build.gradle +++ b/androidveil/build.gradle @@ -12,19 +12,35 @@ android { versionCode versions.versionCode versionName versions.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", - ] + ignoredPackages += ["com/skydoves/androidveil/databinding"] + nonPublicMarkers += ["kotlin.PublishedApi"] +} + +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions.freeCompilerArgs += ["-Xexplicit-api=strict"] } dependencies { @@ -33,5 +49,4 @@ dependencies { api "com.facebook.shimmer:shimmer:$versions.shimmer" } -apply plugin: "com.vanniktech.maven.publish" -apply from: '../spotless.gradle' \ No newline at end of file +apply plugin: "com.vanniktech.maven.publish" \ No newline at end of file diff --git a/androidveil/src/main/AndroidManifest.xml b/androidveil/src/main/AndroidManifest.xml index 5a50619..ecce34f 100644 --- a/androidveil/src/main/AndroidManifest.xml +++ b/androidveil/src/main/AndroidManifest.xml @@ -1 +1,17 @@ + + diff --git a/androidveil/src/main/java/com/skydoves/androidveil/ResourceExtension.kt b/androidveil/src/main/java/com/skydoves/androidveil/ResourceExtension.kt index 25abb6d..ac25515 100644 --- a/androidveil/src/main/java/com/skydoves/androidveil/ResourceExtension.kt +++ b/androidveil/src/main/java/com/skydoves/androidveil/ResourceExtension.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. diff --git a/androidveil/src/main/java/com/skydoves/androidveil/VeilLayout.kt b/androidveil/src/main/java/com/skydoves/androidveil/VeilLayout.kt index 762d981..1b89a58 100644 --- a/androidveil/src/main/java/com/skydoves/androidveil/VeilLayout.kt +++ b/androidveil/src/main/java/com/skydoves/androidveil/VeilLayout.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. @@ -38,17 +38,17 @@ import com.facebook.shimmer.ShimmerFrameLayout /** create a [Shimmer] by [Shimmer.AlphaHighlightBuilder] using dsl. */ @JvmSynthetic -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 -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. */ @Suppress("HasPlatformType", "MemberVisibilityCanBePrivate") -class VeilLayout : FrameLayout { +public class VeilLayout : FrameLayout { @ColorInt private var baseColor = Color.LTGRAY @@ -66,27 +66,28 @@ class VeilLayout : FrameLayout { private var dropOff = 0.5f @Px - var radius = 8f.dp2px(this) - var drawable: Drawable? = null + public var radius: Float = 8f.dp2px(this) + public var drawable: Drawable? = null @LayoutRes - var layout = -1 + public var layout: Int = -1 set(value) { field = value invalidateLayout(value) } - var isVeiled = false + public var isVeiled: Boolean = false private set - val shimmerContainer = ShimmerFrameLayout(context) - val nonShimmer = Shimmer.AlphaHighlightBuilder().setBaseAlpha(1.0f).setDropoff(1.0f).build() - var shimmer = Shimmer.AlphaHighlightBuilder().build() + public val shimmerContainer: ShimmerFrameLayout = ShimmerFrameLayout(context) + public val nonShimmer: Shimmer = + Shimmer.AlphaHighlightBuilder().setBaseAlpha(1.0f).setDropoff(1.0f).build() + public var shimmer: Shimmer = Shimmer.AlphaHighlightBuilder().build() set(value) { field = value shimmerContainer.setShimmer(value) } - var shimmerEnable: Boolean = true + public var shimmerEnable: Boolean = true set(value) { field = value when (value) { @@ -94,19 +95,20 @@ class VeilLayout : FrameLayout { false -> shimmerContainer.setShimmer(nonShimmer) } } - var defaultChildVisible = false + public var defaultChildVisible: Boolean = false - constructor(context: Context) : super(context) { + public constructor(context: Context) : super(context) { onCreate() } - constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { + public constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { getAttrs(attrs) onCreate() } - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( - context, attrs, + public constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( + context, + attrs, defStyleAttr ) { getAttrs(attrs) @@ -114,8 +116,16 @@ class VeilLayout : FrameLayout { } @TargetApi(Build.VERSION_CODES.LOLLIPOP) - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super( - context, attrs, defStyleAttr, defStyleRes + public constructor( + context: Context, + attrs: AttributeSet?, + defStyleAttr: Int, + defStyleRes: Int + ) : super( + context, + attrs, + defStyleAttr, + defStyleRes ) { getAttrs(attrs) onCreate() @@ -124,31 +134,42 @@ class VeilLayout : FrameLayout { private fun getAttrs(attrs: AttributeSet?) { val a = context.obtainStyledAttributes(attrs, R.styleable.VeilLayout) try { - if (a.hasValue(R.styleable.VeilLayout_veilLayout_veiled)) + if (a.hasValue(R.styleable.VeilLayout_veilLayout_veiled)) { isVeiled = a.getBoolean(R.styleable.VeilLayout_veilLayout_veiled, isVeiled) - if (a.hasValue(R.styleable.VeilLayout_veilLayout_layout)) + } + if (a.hasValue(R.styleable.VeilLayout_veilLayout_layout)) { layout = a.getResourceId(R.styleable.VeilLayout_veilLayout_layout, -1) - if (a.hasValue(R.styleable.VeilLayout_veilLayout_drawable)) + } + if (a.hasValue(R.styleable.VeilLayout_veilLayout_drawable)) { drawable = a.getDrawable(R.styleable.VeilLayout_veilLayout_drawable) - if (a.hasValue(R.styleable.VeilLayout_veilLayout_radius)) + } + if (a.hasValue(R.styleable.VeilLayout_veilLayout_radius)) { radius = a.getDimension(R.styleable.VeilLayout_veilLayout_radius, radius) - if (a.hasValue(R.styleable.VeilLayout_veilLayout_shimmerEnable)) + } + if (a.hasValue(R.styleable.VeilLayout_veilLayout_shimmerEnable)) { shimmerEnable = a.getBoolean(R.styleable.VeilLayout_veilLayout_shimmerEnable, shimmerEnable) - if (a.hasValue(R.styleable.VeilLayout_veilLayout_baseColor)) + } + if (a.hasValue(R.styleable.VeilLayout_veilLayout_baseColor)) { baseColor = a.getColor(R.styleable.VeilLayout_veilLayout_baseColor, baseColor) - if (a.hasValue(R.styleable.VeilLayout_veilLayout_highlightColor)) + } + if (a.hasValue(R.styleable.VeilLayout_veilLayout_highlightColor)) { highlightColor = a.getColor(R.styleable.VeilLayout_veilLayout_highlightColor, highlightColor) - if (a.hasValue(R.styleable.VeilLayout_veilLayout_baseAlpha)) + } + if (a.hasValue(R.styleable.VeilLayout_veilLayout_baseAlpha)) { baseAlpha = a.getFloat(R.styleable.VeilLayout_veilLayout_baseAlpha, baseAlpha) - if (a.hasValue(R.styleable.VeilLayout_veilLayout_highlightAlpha)) + } + if (a.hasValue(R.styleable.VeilLayout_veilLayout_highlightAlpha)) { highlightAlpha = a.getFloat(R.styleable.VeilLayout_veilLayout_highlightAlpha, highlightAlpha) - if (a.hasValue(R.styleable.VeilLayout_veilLayout_dropOff)) + } + if (a.hasValue(R.styleable.VeilLayout_veilLayout_dropOff)) { dropOff = a.getFloat(R.styleable.VeilLayout_veilLayout_dropOff, dropOff) - if (a.hasValue(R.styleable.VeilLayout_veilLayout_defaultChildVisible)) + } + if (a.hasValue(R.styleable.VeilLayout_veilLayout_defaultChildVisible)) { defaultChildVisible = a.getBoolean(R.styleable.VeilLayout_veilLayout_defaultChildVisible, defaultChildVisible) + } } finally { a.recycle() } @@ -170,7 +191,7 @@ class VeilLayout : FrameLayout { } /** Remove previous views and inflate a new layout using an inflated view. */ - fun setLayout(layout: View) { + public fun setLayout(layout: View) { removeAllViews() addView(layout) shimmerContainer.removeAllViews() @@ -242,7 +263,7 @@ class VeilLayout : FrameLayout { } /** Make appear the mask. */ - fun veil() { + public fun veil() { if (!this.isVeiled) { this.isVeiled = true startShimmer() @@ -251,7 +272,7 @@ class VeilLayout : FrameLayout { } /** Make disappear the mask. */ - fun unVeil() { + public fun unVeil() { if (this.isVeiled) { this.isVeiled = false stopShimmer() @@ -260,7 +281,7 @@ class VeilLayout : FrameLayout { } /** Starts the shimmer animation. */ - fun startShimmer() { + public fun startShimmer() { this.shimmerContainer.visible() if (this.shimmerEnable) { this.shimmerContainer.startShimmer() @@ -271,7 +292,7 @@ class VeilLayout : FrameLayout { } /** Stops the shimmer animation. */ - fun stopShimmer() { + public fun stopShimmer() { this.shimmerContainer.invisible() this.shimmerContainer.stopShimmer() if (!this.defaultChildVisible) { diff --git a/androidveil/src/main/java/com/skydoves/androidveil/VeilParams.kt b/androidveil/src/main/java/com/skydoves/androidveil/VeilParams.kt index 58b2da5..2c85865 100644 --- a/androidveil/src/main/java/com/skydoves/androidveil/VeilParams.kt +++ b/androidveil/src/main/java/com/skydoves/androidveil/VeilParams.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. diff --git a/androidveil/src/main/java/com/skydoves/androidveil/VeilRecyclerFrameView.kt b/androidveil/src/main/java/com/skydoves/androidveil/VeilRecyclerFrameView.kt index 10bd0ff..ae2c151 100644 --- a/androidveil/src/main/java/com/skydoves/androidveil/VeilRecyclerFrameView.kt +++ b/androidveil/src/main/java/com/skydoves/androidveil/VeilRecyclerFrameView.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. @@ -35,7 +35,7 @@ import com.facebook.shimmer.Shimmer /** VeilRecyclerFrameView implements skeleton veiling for user [RecyclerView] with shimmering effect. */ @Suppress("unused", "MemberVisibilityCanBePrivate") -class VeilRecyclerFrameView : RelativeLayout { +public class VeilRecyclerFrameView : RelativeLayout { private val userRecyclerView: RecyclerView = RecyclerView(context) private val veiledRecyclerView: RecyclerView = RecyclerView(context) @@ -64,24 +64,25 @@ class VeilRecyclerFrameView : RelativeLayout { private var radius = 8f.dp2px(this) private var drawable: Drawable? = null - var shimmer: Shimmer? = null - var shimmerEnable: Boolean = true - var defaultChildVisible = false + public var shimmer: Shimmer? = null + public var shimmerEnable: Boolean = true + public var defaultChildVisible: Boolean = false private var isItemWrapContentWidth = false private var isItemWrapContentHeight = true private val threshold = 10 - constructor(context: Context) : super(context) { + public constructor(context: Context) : super(context) { onCreate() } - constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { + public constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { getAttrs(attrs) onCreate() } - constructor(context: Context, attrs: AttributeSet?, defStyle: Int) : super( - context, attrs, + public constructor(context: Context, attrs: AttributeSet?, defStyle: Int) : super( + context, + attrs, defStyle ) { getAttrs(attrs) @@ -91,47 +92,58 @@ class VeilRecyclerFrameView : RelativeLayout { private fun getAttrs(attrs: AttributeSet?) { val a = context.obtainStyledAttributes(attrs, R.styleable.VeilRecyclerFrameView) try { - if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_veiled)) + if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_veiled)) { isVeiled = a.getBoolean(R.styleable.VeilRecyclerFrameView_veilFrame_veiled, isVeiled) - if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_layout)) + } + if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_layout)) { layout = a.getResourceId(R.styleable.VeilRecyclerFrameView_veilFrame_layout, -1) - if (a.hasValue(R.styleable.VeilLayout_veilLayout_drawable)) + } + if (a.hasValue(R.styleable.VeilLayout_veilLayout_drawable)) { drawable = a.getDrawable(R.styleable.VeilRecyclerFrameView_veilFrame_drawable) - if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_radius)) + } + if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_radius)) { radius = a.getDimension(R.styleable.VeilRecyclerFrameView_veilFrame_radius, radius) - if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_shimmerEnable)) + } + if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_shimmerEnable)) { shimmerEnable = a.getBoolean( R.styleable.VeilRecyclerFrameView_veilFrame_shimmerEnable, shimmerEnable ) - if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_baseColor)) + } + if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_baseColor)) { baseColor = a.getColor(R.styleable.VeilRecyclerFrameView_veilFrame_baseColor, baseColor) - if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_highlightColor)) + } + if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_highlightColor)) { highlightColor = a.getColor( R.styleable.VeilRecyclerFrameView_veilFrame_highlightColor, highlightColor ) - if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_baseAlpha)) + } + if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_baseAlpha)) { baseAlpha = a.getFloat(R.styleable.VeilRecyclerFrameView_veilFrame_baseAlpha, baseAlpha) - if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_highlightAlpha)) + } + if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_highlightAlpha)) { highlightAlpha = a.getFloat( R.styleable.VeilRecyclerFrameView_veilFrame_highlightAlpha, highlightAlpha ) - if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_dropOff)) + } + if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_dropOff)) { dropOff = a.getFloat(R.styleable.VeilRecyclerFrameView_veilFrame_dropOff, dropOff) - if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_defaultChildVisible)) + } + if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_defaultChildVisible)) { defaultChildVisible = a.getBoolean( R.styleable.VeilRecyclerFrameView_veilFrame_defaultChildVisible, defaultChildVisible ) + } if (a.hasValue(R.styleable.VeilRecyclerFrameView_veilFrame_isItemWrapContentWidth)) { isItemWrapContentWidth = a.getBoolean( R.styleable.VeilRecyclerFrameView_veilFrame_isItemWrapContentWidth, @@ -165,19 +177,19 @@ class VeilRecyclerFrameView : RelativeLayout { } /** Sets mask layout. */ - fun setVeilLayout(@LayoutRes layout: Int) { + public fun setVeilLayout(@LayoutRes layout: Int) { this.veiledAdapter = VeiledAdapter( userLayout = layout, isListItemWrapContentWidth = isItemWrapContentWidth, - isListItemWrapContentHeight = isItemWrapContentHeight, + isListItemWrapContentHeight = isItemWrapContentHeight ) this.veiledRecyclerView.adapter = this.veiledAdapter requestLayout() } /** Sets mask layout and VeiledItemOnClickListener. */ - fun setVeilLayout( + public fun setVeilLayout( @LayoutRes layout: Int, onItemClickListener: VeiledItemOnClickListener ) { @@ -186,20 +198,20 @@ class VeilRecyclerFrameView : RelativeLayout { userLayout = layout, onItemClickListener = onItemClickListener, isListItemWrapContentWidth = isItemWrapContentWidth, - isListItemWrapContentHeight = isItemWrapContentHeight, + isListItemWrapContentHeight = isItemWrapContentHeight ) this.veiledRecyclerView.adapter = this.veiledAdapter } /** Sets mask layout and adds masked items. */ - fun setVeilLayout(@LayoutRes layout: Int, size: Int) { + public fun setVeilLayout(@LayoutRes layout: Int, size: Int) { this.setVeilLayout(layout) this.addVeiledItems(size) requestLayout() } /** Sets mask layout and VeiledItemOnClickListener and adds masked items. */ - fun setVeilLayout( + public fun setVeilLayout( @LayoutRes layout: Int, onItemClickListener: VeiledItemOnClickListener, size: Int @@ -209,7 +221,7 @@ class VeilRecyclerFrameView : RelativeLayout { } /** Adds masked items. */ - fun addVeiledItems(size: Int) { + public fun addVeiledItems(size: Int) { val paramList = ArrayList() for (i in 0 until size) { paramList.add( @@ -231,19 +243,22 @@ class VeilRecyclerFrameView : RelativeLayout { } /** Sets userRecyclerView's adapter. */ - fun setAdapter(adapter: RecyclerView.Adapter<*>?) { + public fun setAdapter(adapter: RecyclerView.Adapter<*>?) { this.userRecyclerView.adapter = adapter this.invalidate() } /** Sets userRecyclerView's adapter and RecyclerViews LayoutManager. */ - fun setAdapter(adapter: RecyclerView.Adapter<*>?, layoutManager: RecyclerView.LayoutManager) { + public fun setAdapter( + adapter: RecyclerView.Adapter<*>?, + layoutManager: RecyclerView.LayoutManager + ) { this.setAdapter(adapter) this.setLayoutManager(layoutManager) } /** Sets RecyclerViews LayoutManager. */ - fun setLayoutManager(layoutManager: RecyclerView.LayoutManager) { + public fun setLayoutManager(layoutManager: RecyclerView.LayoutManager) { this.userRecyclerView.layoutManager = layoutManager when (layoutManager) { is GridLayoutManager -> @@ -264,7 +279,7 @@ class VeilRecyclerFrameView : RelativeLayout { } /** Make appear the mask. */ - fun veil() { + public fun veil() { this.veiledAdapter?.let { if (!this.isVeiled) { this.isVeiled = true @@ -274,7 +289,7 @@ class VeilRecyclerFrameView : RelativeLayout { } /** Make disappear the mask. */ - fun unVeil() { + public fun unVeil() { if (this.isVeiled) { this.isVeiled = false visibleUserRecyclerView() @@ -282,12 +297,12 @@ class VeilRecyclerFrameView : RelativeLayout { } /** Returns a veiled recyclerView. */ - fun getVeiledRecyclerView(): RecyclerView { + public fun getVeiledRecyclerView(): RecyclerView { return this.veiledRecyclerView } /** Returns a user recyclerView. */ - fun getRecyclerView(): RecyclerView { + public fun getRecyclerView(): RecyclerView { return this.userRecyclerView } diff --git a/androidveil/src/main/java/com/skydoves/androidveil/VeiledAdapter.kt b/androidveil/src/main/java/com/skydoves/androidveil/VeiledAdapter.kt index a68a273..4b91d23 100644 --- a/androidveil/src/main/java/com/skydoves/androidveil/VeiledAdapter.kt +++ b/androidveil/src/main/java/com/skydoves/androidveil/VeiledAdapter.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. @@ -20,19 +20,19 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.annotation.LayoutRes import androidx.recyclerview.widget.RecyclerView -import com.skydoves.androidveil.databinding.ItemVeiledLayoutAndroidveilSkydovesBinding +import com.skydoves.androidveil.databinding.VeilItemLayoutBinding internal class VeiledAdapter( @LayoutRes private val userLayout: Int, 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() override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VeiledViewHolder { - val binding = ItemVeiledLayoutAndroidveilSkydovesBinding.inflate( + val binding = VeilItemLayoutBinding.inflate( LayoutInflater.from(parent.context), parent, false @@ -51,7 +51,7 @@ internal class VeiledAdapter( with(holder.binding.itemVeilLayoutMain) { layoutParams = ViewGroup.LayoutParams( getLayoutParams(isListItemWrapContentWidth), - getLayoutParams(isListItemWrapContentHeight), + getLayoutParams(isListItemWrapContentHeight) ) if (layout == -1) { layout = userLayout @@ -95,6 +95,5 @@ internal class VeiledAdapter( override fun getItemCount() = veilParamList.size - class VeiledViewHolder(val binding: ItemVeiledLayoutAndroidveilSkydovesBinding) : - RecyclerView.ViewHolder(binding.root) + class VeiledViewHolder(val binding: VeilItemLayoutBinding) : RecyclerView.ViewHolder(binding.root) } diff --git a/androidveil/src/main/java/com/skydoves/androidveil/VeiledItemOnClickListener.kt b/androidveil/src/main/java/com/skydoves/androidveil/VeiledItemOnClickListener.kt index 19009f7..f05457d 100644 --- a/androidveil/src/main/java/com/skydoves/androidveil/VeiledItemOnClickListener.kt +++ b/androidveil/src/main/java/com/skydoves/androidveil/VeiledItemOnClickListener.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. @@ -17,8 +17,8 @@ package com.skydoves.androidveil /** VeiledItemOnClickListener is a delegation of veil item click. */ -fun interface VeiledItemOnClickListener { +public fun interface VeiledItemOnClickListener { /** will be invoked when the item on the [VeilRecyclerFrameView] clicked. */ - fun onItemClicked(pos: Int) + public fun onItemClicked(pos: Int) } diff --git a/androidveil/src/main/java/com/skydoves/androidveil/ViewExtension.kt b/androidveil/src/main/java/com/skydoves/androidveil/ViewExtension.kt index 8ef9841..99c0932 100644 --- a/androidveil/src/main/java/com/skydoves/androidveil/ViewExtension.kt +++ b/androidveil/src/main/java/com/skydoves/androidveil/ViewExtension.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. diff --git a/androidveil/src/main/res/layout/item_veiled_layout_androidveil_skydoves.xml b/androidveil/src/main/res/layout/item_veiled_layout_androidveil_skydoves.xml deleted file mode 100644 index 843028a..0000000 --- a/androidveil/src/main/res/layout/item_veiled_layout_androidveil_skydoves.xml +++ /dev/null @@ -1,5 +0,0 @@ - - \ No newline at end of file diff --git a/androidveil/src/main/res/layout/veil_item_layout.xml b/androidveil/src/main/res/layout/veil_item_layout.xml new file mode 100644 index 0000000..b86d9df --- /dev/null +++ b/androidveil/src/main/res/layout/veil_item_layout.xml @@ -0,0 +1,20 @@ + + + \ No newline at end of file diff --git a/androidveil/src/main/res/values/attrs_veil.xml b/androidveil/src/main/res/values/attrs_veil.xml index 8bdbead..2843207 100644 --- a/androidveil/src/main/res/values/attrs_veil.xml +++ b/androidveil/src/main/res/values/attrs_veil.xml @@ -1,4 +1,19 @@ + diff --git a/app/build.gradle b/app/build.gradle index 907a0c4..7a0adeb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,4 +27,3 @@ dependencies { implementation project(":androidveil") } -apply from: "$rootDir/spotless.gradle" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9fd3a7d..50ae0a5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,4 +1,19 @@ + diff --git a/app/src/main/java/com/skydoves/androidveildemo/DetailActivity.kt b/app/src/main/java/com/skydoves/androidveildemo/DetailActivity.kt index c2f0fb9..fbd0c26 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/DetailActivity.kt +++ b/app/src/main/java/com/skydoves/androidveildemo/DetailActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. diff --git a/app/src/main/java/com/skydoves/androidveildemo/Extension.kt b/app/src/main/java/com/skydoves/androidveildemo/Extension.kt index 8c051f1..107eb4d 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/Extension.kt +++ b/app/src/main/java/com/skydoves/androidveildemo/Extension.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. diff --git a/app/src/main/java/com/skydoves/androidveildemo/MainActivity.kt b/app/src/main/java/com/skydoves/androidveildemo/MainActivity.kt index 5fa7139..b282ea9 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/MainActivity.kt +++ b/app/src/main/java/com/skydoves/androidveildemo/MainActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. diff --git a/app/src/main/java/com/skydoves/androidveildemo/SecondActivity.kt b/app/src/main/java/com/skydoves/androidveildemo/SecondActivity.kt index 87a5474..8f0dcc7 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/SecondActivity.kt +++ b/app/src/main/java/com/skydoves/androidveildemo/SecondActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. diff --git a/app/src/main/java/com/skydoves/androidveildemo/ShimmerUtils.kt b/app/src/main/java/com/skydoves/androidveildemo/ShimmerUtils.kt index c48d663..2ab3269 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/ShimmerUtils.kt +++ b/app/src/main/java/com/skydoves/androidveildemo/ShimmerUtils.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. diff --git a/app/src/main/java/com/skydoves/androidveildemo/profile/ListItemUtils.kt b/app/src/main/java/com/skydoves/androidveildemo/profile/ListItemUtils.kt index add828d..2570fb8 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/profile/ListItemUtils.kt +++ b/app/src/main/java/com/skydoves/androidveildemo/profile/ListItemUtils.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. @@ -30,49 +30,57 @@ object ListItemUtils { val list = ArrayList() list.add( Profile( - ContextCompat.getDrawable(context, R.drawable.person0), "The Little Prince", + 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." ) ) list.add( Profile( - ContextCompat.getDrawable(context, R.drawable.person1), "Mia Vance", + ContextCompat.getDrawable(context, R.drawable.person1), + "Mia Vance", "All grown-ups were once children... but only few of them remember it." ) ) list.add( Profile( - ContextCompat.getDrawable(context, R.drawable.person2), "Ryker Beil", + ContextCompat.getDrawable(context, R.drawable.person2), + "Ryker Beil", "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", + ContextCompat.getDrawable(context, R.drawable.person3), + "Kayden Bautista", "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", + 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." ) ) list.add( Profile( - ContextCompat.getDrawable(context, R.drawable.person5), "Autumn Villegas", + ContextCompat.getDrawable(context, R.drawable.person5), + "Autumn Villegas", "It is such a mysterious place, the land of tears." ) ) list.add( Profile( - ContextCompat.getDrawable(context, R.drawable.person6), "Wyatt Sherman", + 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." ) ) list.add( Profile( - ContextCompat.getDrawable(context, R.drawable.person7), "Rachel Alvarado", + ContextCompat.getDrawable(context, R.drawable.person7), + "Rachel Alvarado", "You see, one loves the sunset when one is so sad." ) ) diff --git a/app/src/main/java/com/skydoves/androidveildemo/profile/Profile.kt b/app/src/main/java/com/skydoves/androidveildemo/profile/Profile.kt index d141fb2..f5cc820 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/profile/Profile.kt +++ b/app/src/main/java/com/skydoves/androidveildemo/profile/Profile.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. diff --git a/app/src/main/java/com/skydoves/androidveildemo/profile/ProfileAdapter.kt b/app/src/main/java/com/skydoves/androidveildemo/profile/ProfileAdapter.kt index 961f6ed..b1c113a 100644 --- a/app/src/main/java/com/skydoves/androidveildemo/profile/ProfileAdapter.kt +++ b/app/src/main/java/com/skydoves/androidveildemo/profile/ProfileAdapter.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 skydoves + * Designed and developed by 2018 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. diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml index 1f6bb29..96f8c70 100644 --- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -1,3 +1,19 @@ + + + + + + + + + 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 eca70cf..70c3db5 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 @@ -1,4 +1,19 @@ + diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml index 734c081..2a5e200 100644 --- a/app/src/main/res/values-v21/styles.xml +++ b/app/src/main/res/values-v21/styles.xml @@ -1,3 +1,19 @@ + +