From d7c519ec9a5de7dde70ab3a5e9bfbaa0d7bb5985 Mon Sep 17 00:00:00 2001 From: Ritesh Date: Sun, 1 Aug 2021 16:00:06 +0530 Subject: [PATCH 1/2] Upgraded agp and kotlin version --- app/src/main/java/io/plaidapp/ui/HomeViewModel.kt | 2 +- build.gradle | 8 ++++++-- .../io/plaidapp/core/dribbble/data/api/ShotWeigher.kt | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- repositories.gradle | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/plaidapp/ui/HomeViewModel.kt b/app/src/main/java/io/plaidapp/ui/HomeViewModel.kt index a832f12e7..9bf71e7c8 100644 --- a/app/src/main/java/io/plaidapp/ui/HomeViewModel.kt +++ b/app/src/main/java/io/plaidapp/ui/HomeViewModel.kt @@ -197,7 +197,7 @@ class HomeViewModel( positions.add(i) } - val scrollToPosition = positions.max() + val scrollToPosition = positions.maxOrNull() return if (scrollToPosition == null) { null } else { diff --git a/build.gradle b/build.gradle index e33f77017..55a54deff 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ buildscript { scriptHandler -> 'gson' : '2.8.5', 'jsoup' : '1.11.3', 'junit' : '4.12', - 'kotlin' : '1.3.50', + 'kotlin' : '1.5.21', 'ktlint' : '0.36.0', 'legacyCoreUtils' : '1.0.0', 'lifecycle' : '2.2.0-alpha03', @@ -60,7 +60,7 @@ buildscript { scriptHandler -> ] dependencies { - classpath 'com.android.tools.build:gradle:3.6.1' + classpath 'com.android.tools.build:gradle:7.0.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" classpath "com.google.gms:google-services:${versions.googleServices}" classpath "io.fabric.tools:gradle:${versions.fabric}" @@ -82,6 +82,10 @@ subprojects { apply from: rootProject.file('repositories.gradle') } + repositories { + mavenCentral() + } + apply plugin: 'com.diffplug.gradle.spotless' spotless { kotlin { diff --git a/core/src/main/java/io/plaidapp/core/dribbble/data/api/ShotWeigher.kt b/core/src/main/java/io/plaidapp/core/dribbble/data/api/ShotWeigher.kt index b38a1cd3c..2ca36ef91 100644 --- a/core/src/main/java/io/plaidapp/core/dribbble/data/api/ShotWeigher.kt +++ b/core/src/main/java/io/plaidapp/core/dribbble/data/api/ShotWeigher.kt @@ -27,7 +27,7 @@ class ShotWeigher : PlaidItemSorting.PlaidItemGroupWeigher { override fun weigh(shots: List) { // We add 1 to the max so that weights don't 'overflow' into the next page range - val maxLikes = (shots.maxBy { it.likesCount }?.likesCount?.toFloat() ?: 0f) + 1f + val maxLikes = (shots.maxByOrNull { it.likesCount }?.likesCount?.toFloat() ?: 0f) + 1f shots.forEach { shot -> val weight = 1f - (shot.likesCount.toFloat() / maxLikes) shot.weight = shot.page + weight diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5028f28f8..69a971507 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/repositories.gradle b/repositories.gradle index 991672618..99ca769c7 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -11,6 +11,7 @@ repositories { includeGroup "com.google.android.material" includeGroup "com.google.gms" includeGroup "zipflinger" + includeGroup "com.google.testing.platform" } } From b7220e143035b5ad16edb79466c3487987a723b0 Mon Sep 17 00:00:00 2001 From: Ritesh Date: Sun, 1 Aug 2021 16:49:16 +0530 Subject: [PATCH 2/2] added constraint layout in designernews and dribble gradle --- designernews/build.gradle | 1 + dribbble/build.gradle | 1 + 2 files changed, 2 insertions(+) diff --git a/designernews/build.gradle b/designernews/build.gradle index 4082f9e50..d281d86b3 100644 --- a/designernews/build.gradle +++ b/designernews/build.gradle @@ -61,6 +61,7 @@ dependencies { implementation "androidx.room:room-ktx:${versions.room}" implementation "com.android.support:customtabs:${versions.supportLibrary}" implementation "com.github.bumptech.glide:glide:${versions.glide}" + implementation "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}" kapt "com.google.dagger:dagger-compiler:${versions.dagger}" } diff --git a/dribbble/build.gradle b/dribbble/build.gradle index f46e56123..6cf74662b 100644 --- a/dribbble/build.gradle +++ b/dribbble/build.gradle @@ -53,6 +53,7 @@ dependencies { implementation "com.android.support:customtabs:${versions.supportLibrary}" implementation "com.android.support:palette-v7:${versions.supportLibrary}" implementation "com.github.bumptech.glide:recyclerview-integration:${versions.glide}" + implementation "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}" kapt "com.google.dagger:dagger-compiler:${versions.dagger}" }