Skip to content

Commit

Permalink
Merge pull request #44 from skydoves/agp/8.1.2
Browse files Browse the repository at this point in the history
Update AGP, Kotlin, Gradle, and dependencies
  • Loading branch information
skydoves authored Oct 3, 2023
2 parents 0f9dd6e + 9466e02 commit 477ccce
Show file tree
Hide file tree
Showing 25 changed files with 258 additions and 90 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11
java-version: 17
- name: spotless
run: ./gradlew spotlessCheck

Expand All @@ -31,7 +31,7 @@ jobs:
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11
java-version: 17
- name: API check
run: ./gradlew apiCheck

Expand All @@ -44,7 +44,7 @@ jobs:
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11
java-version: 17

- name: Cache Gradle and wrapper
uses: actions/cache@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
steps:
- name: Check out code
uses: actions/[email protected]
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11
java-version: 17
- name: Release build
run: ./gradlew assemble --scan
- name: Source jar and dokka
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11
java-version: 17
- name: Release build
run: ./gradlew assemble --scan
- name: Source jar and dokka
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ plugins {
}

android {
namespace = "com.skydoves.transformationlayoutdemo"
compileSdk = Configuration.compileSdk
defaultConfig {
applicationId = "com.skydoves.transformationlayoutdemo"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class DetailActivity : TransformationAppCompatActivity() {
fun startActivity(
context: Context,
transformationLayout: TransformationLayout,
poster: Poster
poster: Poster,
) {
val intent = Intent(context, DetailActivity::class.java)
intent.putExtra(posterExtraName, poster)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class HomeFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
savedInstanceState: Bundle?,
): View {
_binding = FragmentHomeBinding.inflate(inflater, container, false)
return binding.root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class LibraryFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
savedInstanceState: Bundle?,
): View {
_binding = FragmentLibraryBinding.inflate(inflater, container, false)
return binding.root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ class MainActivity : AppCompatActivity() {
override fun onPageScrolled(
position: Int,
positionOffset: Float,
positionOffsetPixels: Int
positionOffsetPixels: Int,
) = Unit

override fun onPageSelected(position: Int) {
binding.mainBottomNavigation.menu.getItem(position).isChecked = true
}
}
},
)
}

Expand Down
193 changes: 168 additions & 25 deletions app/src/main/kotlin/com/skydoves/transformationlayoutdemo/MockUtil.kt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class RadioFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
savedInstanceState: Bundle?,
): View {
_binding = FragmentRadioBinding.inflate(inflater, container, false)
return binding.root
Expand All @@ -42,13 +42,15 @@ class RadioFragment : Fragment() {
super.onViewCreated(view, savedInstanceState)

with(binding) {
recyclerView.adapter = PosterCircleAdapter().apply { addPosterList(MockUtil.getMockPosters()) }
recyclerView.adapter = PosterCircleAdapter().apply {
addPosterList(MockUtil.getMockPosters())
}

fab.setOnClickListener {
DetailActivity.startActivity(
requireContext(),
transformationLayoutFab,
MockUtil.getMockPoster()
MockUtil.getMockPoster(),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ data class Poster(
val release: String,
val playtime: String,
val description: String,
val poster: String
val poster: String,
val gif: String?,
) : Parcelable
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ class PosterCircleAdapter : RecyclerView.Adapter<PosterCircleAdapter.PosterViewH
private var previousTime = SystemClock.elapsedRealtime()

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PosterViewHolder {
val binding = ItemPosterCircleBinding.inflate(LayoutInflater.from(parent.context), parent, false)
val binding = ItemPosterCircleBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false,
)
return PosterViewHolder(binding)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import com.skydoves.transformationlayoutdemo.databinding.ItemPosterBinding

class PosterSingleAdapter
constructor(
private val delegate: PosterDelegate
private val delegate: PosterDelegate,
) : RecyclerView.Adapter<PosterSingleAdapter.PosterViewHolder>() {

private val items = mutableListOf<Poster>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MainSingleDetailFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
savedInstanceState: Bundle?,
): View {
_binding = ActivityDetailBinding.inflate(inflater, container, false)
return binding.root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MainSingleFragment : Fragment(), PosterSingleAdapter.PosterDelegate {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
savedInstanceState: Bundle?,
): View {
_binding = FragmentHomeBinding.inflate(inflater, container, false)
return binding.root
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ subprojects {
kotlin {
target("**/*.kt")
targetExclude("$buildDir/**/*.kt")
ktlint().setUseExperimental(true).editorConfigOverride(
ktlint().editorConfigOverride(
mapOf(
"indent_size" to "2",
"continuation_indent_size" to "2"
Expand Down
17 changes: 8 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
[versions]
agp = "7.4.0"
dokka = "1.7.20"
agp = "8.1.2"
dokka = "1.9.0"
nexusPlugin = "1.1.0"
kotlin = "1.8.10"
kotlinBinaryCompatibility = "0.12.1"
javaRelease = "8"
kotlin = "1.9.10"
kotlinBinaryCompatibility = "0.13.2"
jvmTarget = "11"
androidxMaterial = "1.8.0"
constraintLayout = "2.0.4"
glide = "4.15.0"
spotless = "6.7.2"
androidxMaterial = "1.9.0"
constraintLayout = "2.1.4"
glide = "4.16.0"
spotless = "6.21.0"

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 8 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
5 changes: 3 additions & 2 deletions transformationlayout/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ rootProject.extra.apply {
apply(from ="${rootDir}/scripts/publish-module.gradle")

android {
namespace = "com.skydoves.transformationlayout"
compileSdk = Configuration.compileSdk
defaultConfig {
minSdk = Configuration.minSdk
Expand All @@ -45,8 +46,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public object TransformationCompat {
@JvmStatic
public fun startActivity(
transformationLayout: TransformationLayout,
intent: Intent
intent: Intent,
) {
transformationLayout.startActivityWithBundleOptions(intent) { workedIntent, bundle ->
ActivityCompat.startActivity(transformationLayout.context, workedIntent, bundle)
Expand All @@ -51,7 +51,7 @@ public object TransformationCompat {
public fun startActivityForResult(
transformationLayout: TransformationLayout,
intent: Intent,
requestCode: Int
requestCode: Int,
) {
val activity = transformationLayout.context.getActivity()
if (activity != null) {
Expand All @@ -68,7 +68,7 @@ public object TransformationCompat {
@JvmStatic
public fun onTransformationEndContainerApplyParams(activity: Activity) {
activity.onTransformationEndContainer(
activity.intent.getParcelableExtra(activityTransitionName)
activity.intent.getParcelableExtra(activityTransitionName),
)
}

Expand All @@ -80,7 +80,10 @@ public object TransformationCompat {

/** sets an enter shared element callback to activity for implementing shared element transition. */
@JvmStatic
public fun onTransformationEndContainer(activity: Activity, params: TransformationLayout.Params?) {
public fun onTransformationEndContainer(
activity: Activity,
params: TransformationLayout.Params?,
) {
activity.onTransformationEndContainer(params)
}

Expand All @@ -92,7 +95,10 @@ public object TransformationCompat {

/** sets an enter shared element callback to fragment for implementing shared element transition. */
@JvmStatic
public fun onTransformationEndContainer(fragment: Fragment, params: TransformationLayout.Params?) {
public fun onTransformationEndContainer(
fragment: Fragment,
params: TransformationLayout.Params?,
) {
fragment.onTransformationEndContainer(params)
}

Expand All @@ -101,14 +107,14 @@ public object TransformationCompat {
public fun addTransformation(
fragmentTransaction: FragmentTransaction,
transformationLayout: TransformationLayout,
transitionName: String? = null
transitionName: String? = null,
) {
fragmentTransaction.addTransformation(transformationLayout, transitionName)
}

private inline fun TransformationLayout.startActivityWithBundleOptions(
intent: Intent,
block: (Intent, Bundle) -> Unit
block: (Intent, Bundle) -> Unit,
) {
val now = SystemClock.elapsedRealtime()
if (now - throttledTime > duration) {
Expand Down
Loading

0 comments on commit 477ccce

Please sign in to comment.