Skip to content

Commit

Permalink
[MERGE] #298 -> develop
Browse files Browse the repository at this point in the history
[MOD/#298] 배너 이미지 변경
  • Loading branch information
boiledEgg-s authored Oct 23, 2024
2 parents bfd99a5 + 25351a6 commit 4022be5
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.terning.domain.entity.search

data class SearchBanner(
val imageRes: Int,
val url: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White
import com.terning.core.extension.noRippleClickable
import com.terning.core.state.UiState
import com.terning.domain.entity.search.SearchBanner
import com.terning.domain.entity.search.SearchPopularAnnouncement
import com.terning.feature.R
import com.terning.feature.search.search.component.ImageSlider
import com.terning.feature.search.search.component.InternListType
import com.terning.feature.search.search.component.SearchInternList
import okhttp3.internal.toImmutableList

const val ADVERTISEMENT_URL =
"https://www.instagram.com/terning_official?igsh=NnNma245bnUzbWNm&utm_source=qr"

@Composable
fun SearchRoute(
modifier: Modifier,
Expand Down Expand Up @@ -84,6 +82,7 @@ fun SearchRoute(

SearchScreen(
modifier = modifier,
bannerList = SearchViewModel.bannerList,
searchViewsList = searchViewsList,
searchScrapsList = searchScrapsList,
navigateToSearchProcess = {
Expand All @@ -94,28 +93,22 @@ fun SearchRoute(
navigateToSearchProcess()
},
navigateToIntern = navigateToIntern,
onAdvertisementClick = {
CustomTabsIntent.Builder().build().launchUrl(context, ADVERTISEMENT_URL.toUri())
onAdvertisementClick = { pageIndex ->
CustomTabsIntent.Builder().build().launchUrl(context, SearchViewModel.bannerList[pageIndex].url.toUri())
}
)
}

@Composable
fun SearchScreen(
modifier: Modifier = Modifier,
bannerList: List<SearchBanner>,
searchViewsList: List<SearchPopularAnnouncement>,
searchScrapsList: List<SearchPopularAnnouncement>,
navigateToSearchProcess: () -> Unit,
navigateToIntern: (Long) -> Unit,
onAdvertisementClick: () -> Unit,
onAdvertisementClick: (Int) -> Unit,
) {

val images = listOf(
R.drawable.img_ad_1,
R.drawable.img_ad_2,
R.drawable.img_ad_3,
)

Column(
modifier = modifier
.fillMaxSize()
Expand Down Expand Up @@ -150,7 +143,7 @@ fun SearchScreen(
LazyColumn {
item {
ImageSlider(
images = images,
images = bannerList,
onAdvertisementClick = onAdvertisementClick,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.terning.feature.search.search
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.terning.core.state.UiState
import com.terning.domain.entity.search.SearchBanner
import com.terning.domain.repository.SearchRepository
import com.terning.feature.R
import com.terning.feature.search.search.model.SearchScrapsListState
Expand Down Expand Up @@ -61,4 +62,21 @@ class SearchViewModel @Inject constructor(
}
}
}

companion object {
val bannerList: List<SearchBanner> = listOf(
SearchBanner(
imageRes = R.drawable.img_ad_1,
url = "https://www.instagram.com/p/DBWCO97TRds/?igsh=bDhjMGxlMGliNDc2"
),
SearchBanner(
imageRes = R.drawable.img_ad_2,
url = "https://www.instagram.com/terning_official/"
),
SearchBanner(
imageRes = R.drawable.img_ad_3,
url = "https://forms.gle/4btEwEbUQ3JSjTKP7"
)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.terning.core.designsystem.theme.Grey200
import com.terning.core.extension.noRippleClickable
import com.terning.domain.entity.search.SearchBanner
import kotlinx.coroutines.delay

@Composable
fun ImageSlider(
modifier: Modifier = Modifier,
images: List<Int>,
onAdvertisementClick: () -> Unit,
images: List<SearchBanner>,
onAdvertisementClick: (Int) -> Unit,
) {
val pagerState = rememberPagerState(
initialPage = 0,
Expand All @@ -36,7 +37,7 @@ fun ImageSlider(
LaunchedEffect(autoScroll.value) {
if (autoScroll.value) {
while (true) {
delay(3000)
delay(2500)
if (!pagerState.isScrollInProgress) {
val nextPage = pagerState.currentPage + 1
pagerState.animateScrollToPage(nextPage)
Expand All @@ -62,12 +63,12 @@ fun ImageSlider(
) { currentPage ->
val pageIndex = currentPage % images.size
Image(
painter = painterResource(id = images[pageIndex]),
painter = painterResource(id = images[pageIndex].imageRes),
contentDescription = null,
modifier = modifier
.fillMaxWidth()
.height(112.dp)
.noRippleClickable(onAdvertisementClick),
.noRippleClickable { onAdvertisementClick(pageIndex) },
contentScale = ContentScale.Crop,
)
}
Expand Down
Binary file modified feature/src/main/res/drawable/img_ad_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified feature/src/main/res/drawable/img_ad_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified feature/src/main/res/drawable/img_ad_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
compileSdk = "34"
minSdk = "28"
targetSdk = "34"
versionName = "1.1.6"
versionCode = "10106"
versionName = "1.1.7"
versionCode = "10107"
kotlinCompilerExtensionVersion = "1.5.0"
jvmTarget = "1.8"

Expand Down

0 comments on commit 4022be5

Please sign in to comment.