migrate to using rememberImagePainter

This commit is contained in:
John O'Reilly 2021-07-15 14:43:44 +01:00
parent 8261e1afc1
commit b0353d56d0
3 changed files with 6 additions and 10 deletions

View file

@ -9,7 +9,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.google.accompanist.coil.rememberCoilPainter
import coil.compose.rememberImagePainter
import org.koin.androidx.compose.getViewModel
@Composable
@ -42,7 +42,7 @@ fun PersonDetailsScreen(personName: String, popBack: () -> Unit) {
val imageUrl = person.personImageUrl ?: ""
if (imageUrl.isNotEmpty()) {
Image(
painter = rememberCoilPainter(imageUrl),
painter = rememberImagePainter(imageUrl),
modifier = Modifier.size(240.dp), contentDescription = person.name
)
}

View file

@ -17,7 +17,7 @@ import androidx.compose.ui.platform.testTag
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.google.accompanist.coil.rememberCoilPainter
import coil.compose.rememberImagePainter
import com.surrus.common.remote.Assignment
import org.koin.androidx.compose.getViewModel
@ -55,7 +55,7 @@ fun PersonView(person: Assignment, personSelected: (person: Assignment) -> Unit)
val personImageUrl = person.personImageUrl ?: ""
if (personImageUrl.isNotEmpty()) {
Image(
painter = rememberCoilPainter(personImageUrl),
painter = rememberImagePainter(personImageUrl),
modifier = Modifier.size(60.dp), contentDescription = person.name
)
} else {

View file

@ -17,14 +17,10 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.wear.compose.material.MaterialTheme
import androidx.wear.compose.material.Text
import co.touchlab.kermit.Kermit
import com.google.accompanist.coil.rememberCoilPainter
import com.surrus.common.di.initKoin
import coil.compose.rememberImagePainter
import com.surrus.common.remote.Assignment
import com.surrus.common.remote.PeopleInSpaceApi
import com.surrus.common.repository.PeopleInSpaceRepository
import org.koin.android.ext.android.inject
import org.koin.core.component.inject
class MainActivity : ComponentActivity() {
@ -78,7 +74,7 @@ fun PersonView(person: Assignment, personSelected: (person: Assignment) -> Unit)
val personImageUrl = person.personImageUrl ?: ""
if (personImageUrl.isNotEmpty()) {
Image(
painter = rememberCoilPainter(personImageUrl),
painter = rememberImagePainter(personImageUrl),
modifier = Modifier.size(50.dp), contentDescription = person.name
)
} else {