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

[MOD/#298] 배너 이미지 변경 #299

Merged
merged 7 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.terning.domain.entity.search

data class SearchBanner(
Copy link
Member

Choose a reason for hiding this comment

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

오호~~~~ data class 추가한거 좋네요!!

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 Down Expand Up @@ -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"
Comment on lines +5 to +6
Copy link
Member

Choose a reason for hiding this comment

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

업데이트 감사합니다~

kotlinCompilerExtensionVersion = "1.5.0"
jvmTarget = "1.8"

Expand Down
Loading