Skip to content

Commit

Permalink
#47 Feat : Glide -> Coil 라이브러리 교체
Browse files Browse the repository at this point in the history
  • Loading branch information
DongChyeon committed Feb 12, 2024
1 parent 4fe4853 commit 963bf54
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 90 deletions.
1 change: 0 additions & 1 deletion buildSrc/src/main/java/Dependency.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,5 @@ object Dependency {
const val TEST_ESPRESSO_CORE =
"androidx.test.espresso:espresso-core:${Versions.TEST_ESPRESSO_CORE}"
const val JUNIT = "junit:junit:4.13.2"
const val COMPOSE_GLIDE = "com.github.bumptech.glide:compose:${Versions.COMPOSE_GLIDE}"
const val COMPOSE_UI_UTIL = "androidx.compose.ui:ui-util:$${Versions.COMPOSE}"
}
1 change: 0 additions & 1 deletion buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ object Versions {
const val TEST_EXT_JUNIT = "1.1.5"
const val TEST_ESPRESSO_CORE = "3.5.1"
const val JUNIT = "4.13.2"
const val COMPOSE_GLIDE = "1.0.0-beta01"
const val GOOGLE_SERVICES = "4.4.0"
const val PLAY_SERVICES_AUTH = "20.7.0"
const val PLAY_SERVICES_LOCATION = "21.1.0"
Expand Down
8 changes: 3 additions & 5 deletions core/design/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,16 @@ android {

dependencies {
with(Dependency) {
implementation(COMPOSE_GLIDE)
implementation(ANDROID_CORE_KTX)
implementation(ACTIVITY_COMPOSE)
implementation(LIFECYCLE_RUNTIME_VIEWMODEL_COMPOSE)
implementation(COMPOSE_COIL)
implementation(COMPOSE_MATERIAL3)
implementation(COMPOSE_MATERIAL)
implementation(COMPOSE_UI)
implementation(COMPOSE_UI_TOOLING)
implementation(COMPOSE_UI_TEST_MANIFEST)
implementation(COMPOSE_UI_PREVIEW)
implementation(platform(KOTLIN_BOM))
}

implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,39 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.Icon
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.FilterQuality
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.content.ContextCompat
import androidx.lifecycle.viewmodel.compose.viewModel
import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi
import com.bumptech.glide.integration.compose.GlideImage
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.teamwiney.core.design.R
import com.teamwiney.ui.components.TopBar
import com.teamwiney.ui.components.WButton
Expand Down Expand Up @@ -180,7 +192,6 @@ internal fun PickerContent(
}
}

@OptIn(ExperimentalGlideComposeApi::class)
@Composable
internal fun ImageItem(
image: ImageInfo,
Expand All @@ -189,6 +200,8 @@ internal fun ImageItem(
removeImage: (ImageInfo) -> Unit,
maxImgCount: Int
) {
val context = LocalContext.current

val selected = selectedImages.any { it.id == image.id }

Box(
Expand All @@ -207,9 +220,12 @@ internal fun ImageItem(
),
contentAlignment = Alignment.TopEnd
) {
GlideImage(
model = image.contentUri,
AsyncImage(
model = ImageRequest.Builder(context)
.data(image.contentUri)
.build(),
contentDescription = "IMG_URL",
filterQuality = FilterQuality.Low,
contentScale = ContentScale.Crop,
modifier = Modifier
.aspectRatio(1.0F)
Expand All @@ -225,7 +241,6 @@ internal fun ImageItem(
}
}


@Composable
internal fun ImageIndicator(
imgCount: Int
Expand Down
2 changes: 1 addition & 1 deletion feature/map/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ dependencies {
implementation(PLAY_SERVICES_MAPS)
implementation(NAVER_MAP_COMPOSE)
implementation(NAVER_MAP_LOCATION)
implementation(COMPOSE_GLIDE)
implementation(ANDROID_CORE_KTX)
implementation(COMPOSE_COIL)
implementation(COMPOSE_MATERIAL)
implementation(COMPOSE_MATERIAL3)
implementation(COMPOSE_UI)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:OptIn(ExperimentalGlideComposeApi::class)

package com.teamwiney.map.components

import androidx.compose.foundation.background
Expand All @@ -18,7 +16,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi
import com.naver.maps.geometry.LatLng
import com.teamwiney.data.network.model.response.WineShop
import com.teamwiney.map.model.ShopCategory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:OptIn(ExperimentalGlideComposeApi::class, ExperimentalFoundationApi::class)

package com.teamwiney.map.components

import androidx.compose.foundation.BorderStroke
Expand Down Expand Up @@ -29,23 +27,26 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi
import com.bumptech.glide.integration.compose.GlideImage
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.teamwiney.core.design.R
import com.teamwiney.data.network.model.response.WineShop
import com.teamwiney.ui.components.HeightSpacer
import com.teamwiney.ui.components.HeightSpacerWithLine
import com.teamwiney.ui.theme.WineyTheme


@OptIn(ExperimentalFoundationApi::class)
@Composable
fun LazyItemScope.WineShopItem(
wineShop: WineShop,
postBookmark: (WineShop) -> Unit,
setSelectedMarker: (WineShop) -> Unit
) {
val context = LocalContext.current

Row(
modifier = Modifier
.padding(24.dp)
Expand All @@ -56,17 +57,18 @@ fun LazyItemScope.WineShopItem(
}
.animateItemPlacement()
) {
GlideImage(
model = wineShop.imgUrl,
AsyncImage(
model = ImageRequest.Builder(context)
.placeholder(R.drawable.img_dummy_wine)
.error(R.drawable.img_dummy_wine)
.data(wineShop.imgUrl)
.build(),
contentDescription = "IMG_WINE",
modifier = Modifier
.clip(RoundedCornerShape(10.dp))
.size(110.dp, 100.dp)
.background(WineyTheme.colors.gray_900),
contentScale = ContentScale.Crop,
requestBuilderTransform = { requestBuilder ->
requestBuilder.apply(options)
},
contentScale = ContentScale.Crop
)
Spacer(modifier = Modifier.width(17.dp))
Column(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,51 +1,12 @@
@file:OptIn(ExperimentalGlideComposeApi::class)

package com.teamwiney.map.components

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Icon
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi
import com.bumptech.glide.integration.compose.GlideImage
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.request.RequestOptions
import com.teamwiney.core.design.R
import com.teamwiney.data.network.model.response.WineShop
import com.teamwiney.ui.components.HeightSpacer
import com.teamwiney.ui.components.HeightSpacerWithLine
import com.teamwiney.ui.theme.WineyTheme

val options = RequestOptions()
.centerCrop()
.error(R.drawable.img_dummy_wine)
.diskCacheStrategy(DiskCacheStrategy.ALL)

@Composable
fun ColumnScope.WineShopList(
Expand Down
2 changes: 1 addition & 1 deletion feature/mypage/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ dependencies {
with(Dependency) {
kapt(HILT_ANDROID_COMPILER)
implementation(BROWSER)
implementation(COMPOSE_GLIDE)
implementation(ANDROID_CORE_KTX)
implementation(COMPOSE_COIL)
implementation(COMPOSE_MATERIAL3)
implementation(COMPOSE_MATERIAL)
implementation(COMPOSE_UI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi
import com.bumptech.glide.integration.compose.GlideImage
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.teamwiney.core.common.WineyAppState
import com.teamwiney.core.common.WineyBottomSheetState
import com.teamwiney.data.network.model.response.WineBadge
Expand Down Expand Up @@ -250,12 +251,13 @@ private fun MyPageActivityBadge(
}
}

@OptIn(ExperimentalGlideComposeApi::class)
@Composable
private fun WineBadgeItem(
modifier: Modifier = Modifier,
wineBadge: WineBadge
) {
val context = LocalContext.current

Column(
modifier = modifier.height(IntrinsicSize.Max)
) {
Expand Down Expand Up @@ -290,8 +292,10 @@ private fun WineBadgeItem(
shape = RoundedCornerShape(5.dp)
)
) {
GlideImage(
model = wineBadge.badgeImage,
AsyncImage(
model = ImageRequest.Builder(context)
.data(wineBadge.badgeImage)
.build(),
contentDescription = "BADGE_IMAGE",
modifier = Modifier
.fillMaxWidth()
Expand Down
2 changes: 1 addition & 1 deletion feature/note/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ dependencies {
with(Dependency) {
kapt(HILT_ANDROID_COMPILER)
implementation(ACCOMPANIST_SYSTEMUI)
implementation(COMPOSE_GLIDE)
implementation(ANDROID_CORE_KTX)
implementation(COMPOSE_COIL)
implementation(COMPOSE_MATERIAL3)
implementation(COMPOSE_MATERIAL)
implementation(COMPOSE_UI)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:OptIn(ExperimentalGlideComposeApi::class)

package com.teamwiney.notedetail.component

import androidx.compose.foundation.BorderStroke
Expand All @@ -22,17 +20,19 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi
import com.bumptech.glide.integration.compose.GlideImage
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.teamwiney.data.network.model.response.TastingNoteDetail
import com.teamwiney.ui.components.HeightSpacer
import com.teamwiney.ui.theme.WineyTheme


@Composable
fun WineMemo(noteDetail: TastingNoteDetail) {

val context = LocalContext.current

Column {
Text(
text = "Feature",
Expand All @@ -53,8 +53,10 @@ fun WineMemo(noteDetail: TastingNoteDetail) {
Spacer(modifier = Modifier.width(14.dp))
}
items(noteDetail.tastingNoteImage.map { it.imgUrl }) {
GlideImage(
model = it,
AsyncImage(
model = ImageRequest.Builder(context)
.data(it)
.build(),
contentDescription = "IMG_URL",
modifier = Modifier
.size(120.dp)
Expand Down
Loading

0 comments on commit 963bf54

Please sign in to comment.