migrate to using rememberImagePainter
This commit is contained in:
parent
8261e1afc1
commit
b0353d56d0
3 changed files with 6 additions and 10 deletions
|
@ -9,7 +9,7 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.google.accompanist.coil.rememberCoilPainter
|
import coil.compose.rememberImagePainter
|
||||||
import org.koin.androidx.compose.getViewModel
|
import org.koin.androidx.compose.getViewModel
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -42,7 +42,7 @@ fun PersonDetailsScreen(personName: String, popBack: () -> Unit) {
|
||||||
val imageUrl = person.personImageUrl ?: ""
|
val imageUrl = person.personImageUrl ?: ""
|
||||||
if (imageUrl.isNotEmpty()) {
|
if (imageUrl.isNotEmpty()) {
|
||||||
Image(
|
Image(
|
||||||
painter = rememberCoilPainter(imageUrl),
|
painter = rememberImagePainter(imageUrl),
|
||||||
modifier = Modifier.size(240.dp), contentDescription = person.name
|
modifier = Modifier.size(240.dp), contentDescription = person.name
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ import androidx.compose.ui.platform.testTag
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.google.accompanist.coil.rememberCoilPainter
|
import coil.compose.rememberImagePainter
|
||||||
import com.surrus.common.remote.Assignment
|
import com.surrus.common.remote.Assignment
|
||||||
import org.koin.androidx.compose.getViewModel
|
import org.koin.androidx.compose.getViewModel
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ fun PersonView(person: Assignment, personSelected: (person: Assignment) -> Unit)
|
||||||
val personImageUrl = person.personImageUrl ?: ""
|
val personImageUrl = person.personImageUrl ?: ""
|
||||||
if (personImageUrl.isNotEmpty()) {
|
if (personImageUrl.isNotEmpty()) {
|
||||||
Image(
|
Image(
|
||||||
painter = rememberCoilPainter(personImageUrl),
|
painter = rememberImagePainter(personImageUrl),
|
||||||
modifier = Modifier.size(60.dp), contentDescription = person.name
|
modifier = Modifier.size(60.dp), contentDescription = person.name
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -17,14 +17,10 @@ import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.wear.compose.material.MaterialTheme
|
import androidx.wear.compose.material.MaterialTheme
|
||||||
import androidx.wear.compose.material.Text
|
import androidx.wear.compose.material.Text
|
||||||
import co.touchlab.kermit.Kermit
|
import coil.compose.rememberImagePainter
|
||||||
import com.google.accompanist.coil.rememberCoilPainter
|
|
||||||
import com.surrus.common.di.initKoin
|
|
||||||
import com.surrus.common.remote.Assignment
|
import com.surrus.common.remote.Assignment
|
||||||
import com.surrus.common.remote.PeopleInSpaceApi
|
|
||||||
import com.surrus.common.repository.PeopleInSpaceRepository
|
import com.surrus.common.repository.PeopleInSpaceRepository
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
import org.koin.core.component.inject
|
|
||||||
|
|
||||||
class MainActivity : ComponentActivity() {
|
class MainActivity : ComponentActivity() {
|
||||||
|
|
||||||
|
@ -78,7 +74,7 @@ fun PersonView(person: Assignment, personSelected: (person: Assignment) -> Unit)
|
||||||
val personImageUrl = person.personImageUrl ?: ""
|
val personImageUrl = person.personImageUrl ?: ""
|
||||||
if (personImageUrl.isNotEmpty()) {
|
if (personImageUrl.isNotEmpty()) {
|
||||||
Image(
|
Image(
|
||||||
painter = rememberCoilPainter(personImageUrl),
|
painter = rememberImagePainter(personImageUrl),
|
||||||
modifier = Modifier.size(50.dp), contentDescription = person.name
|
modifier = Modifier.size(50.dp), contentDescription = person.name
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue