Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump dependencies; migrate from Picasso to Coil #48

Merged
merged 1 commit into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ buildscript {
ext.versions = [
'compile_sdk' : 29,
'min_sdk' : 21,
'android_gradle_plugin' : '3.5.3',
'kotlin' : '1.3.61',
'maven_publish_plugin' : '0.8.0',
'coroutines' : '1.3.3',
'android_gradle_plugin' : '4.0.0',
'kotlin' : '1.3.72',
'maven_publish_plugin' : '0.11.1',
'coroutines' : '1.3.7',
'appcompat' : '1.1.0',
'androidx_core' : '1.1.0',
'drawerlayout' : '1.0.0',
'material' : '1.1.0-rc01',
'lifecycle' : '2.1.0',
'leakcanary' : '2.1',
'moshi' : '1.9.2',
'okhttp' : '4.3.0',
'retrofit' : '2.7.1',
'picasso' : '2.71828',
'androidx_core' : '1.3.0',
'drawerlayout' : '1.1.0',
'material' : '1.1.0',
'lifecycle' : '2.2.0',
'leakcanary' : '2.4',
'moshi' : '1.9.3',
'okhttp' : '4.7.2',
'retrofit' : '2.9.0',
'coil' : '0.11.0',
'process_phoenix' : '2.0.0',
'timber' : '4.7.1'
]
Expand Down
4 changes: 4 additions & 0 deletions debugdrawer-leakcanary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

libraryVariants.all {
it.generateBuildConfig.enabled = false
}
Expand Down
4 changes: 4 additions & 0 deletions debugdrawer-okhttp-logger/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

libraryVariants.all {
it.generateBuildConfig.enabled = false
}
Expand Down
4 changes: 4 additions & 0 deletions debugdrawer-retrofit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

libraryVariants.all {
it.generateBuildConfig.enabled = false
}
Expand Down
4 changes: 4 additions & 0 deletions debugdrawer-timber/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

libraryVariants.all {
it.generateBuildConfig.enabled = false
}
Expand Down
4 changes: 4 additions & 0 deletions debugdrawer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

libraryVariants.all {
it.generateBuildConfig.enabled = false
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Sep 12 14:59:55 AEST 2019
#Sat Jun 27 11:13:32 AEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
6 changes: 5 additions & 1 deletion sample-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}

dependencies {
Expand All @@ -53,6 +57,6 @@ dependencies {
implementation "com.squareup.retrofit2:retrofit:${versions.retrofit}"
implementation "com.squareup.retrofit2:converter-moshi:${versions.retrofit}"
debugImplementation "com.squareup.retrofit2:retrofit-mock:${versions.retrofit}"
implementation "com.squareup.picasso:picasso:${versions.picasso}"
implementation "io.coil-kt:coil:${versions.coil}"
implementation "com.jakewharton.timber:timber:${versions.timber}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import au.com.gridstone.debugdrawer.sampleapp.GamesAdapter.ViewHolder
import com.squareup.picasso.Picasso
import coil.api.load

class GamesAdapter : RecyclerView.Adapter<ViewHolder>() {
private var games: List<Game> = emptyList()
Expand Down Expand Up @@ -36,13 +36,11 @@ class GamesAdapter : RecyclerView.Adapter<ViewHolder>() {
fun bindTo(game: Game) {
nameView.text = game.name

Picasso.get()
.load(game.image.small_url)
.fit()
.centerCrop()
.placeholder(R.drawable.gfx_controller)
.error(R.drawable.gfx_dead_link_small)
.into(imageView)
imageView.load(game.image.small_url) {
placeholder(R.drawable.gfx_controller)
error(R.drawable.gfx_dead_link_small)
crossfade(true)
Comment on lines +39 to +42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What coroutine context is this bound to 🤔 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one, I believe

}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.core.view.GravityCompat
import androidx.drawerlayout.widget.DrawerLayout
import androidx.lifecycle.ViewModelProviders
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.get
import androidx.lifecycle.observe
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import au.com.gridstone.debugdrawer.sampleapp.AppConfiguration.getRootViewContainerFor
import au.com.gridstone.debugdrawer.sampleapp.GamesViewModel.State
import com.squareup.picasso.Picasso
import coil.api.load

class MainActivity : AppCompatActivity() {

Expand Down Expand Up @@ -56,7 +56,7 @@ class MainActivity : AppCompatActivity() {
recycler.updatePaddingWithInsets(left = true, right = true, bottom = true)

val viewAnimator: ViewAnimator = findViewById(R.id.games_viewAnimator)
val viewModel: GamesViewModel = ViewModelProviders.of(this).get()
val viewModel: GamesViewModel = ViewModelProvider(this).get()

// Observe ViewModel state and change UI accordingly.
viewModel.states.observe(this) { state ->
Expand All @@ -66,7 +66,7 @@ class MainActivity : AppCompatActivity() {
State.Error -> {
viewAnimator.displayedChild = 1
val errorImageView: ImageView = findViewById(R.id.games_error_image)
Picasso.get().load(R.drawable.gfx_dead_link_small).into(errorImageView)
errorImageView.load(R.drawable.gfx_dead_link_small)
}

is State.Success -> {
Expand All @@ -87,7 +87,7 @@ class MainActivity : AppCompatActivity() {
override fun onStart() {
super.onStart()

val viewModel: GamesViewModel = ViewModelProviders.of(this).get()
val viewModel: GamesViewModel = ViewModelProvider(this).get()
viewModel.refreshIfNecessary()
}
}
1 change: 1 addition & 0 deletions sample-app/src/main/res/layout/list_item_game.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
android:id="@+id/game_image"
android:layout_width="72dp"
android:layout_height="72dp"
android:scaleType="centerCrop"
tools:ignore="ContentDescription"
/>

Expand Down
4 changes: 4 additions & 0 deletions simple-sample-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}

dependencies {
Expand Down