Skip to content

Commit

Permalink
[MERGE] #267 -> develop
Browse files Browse the repository at this point in the history
[FIX/#267] ํƒ์ƒ‰ ๋ทฐ / 2์ฐจ QA ๋ฐ˜์˜
  • Loading branch information
leeeyubin authored Sep 27, 2024
2 parents 436c3d2 + da06b7e commit f6f7dc7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -38,18 +40,16 @@ fun InternTitle(
.background(
color = TerningSub3,
shape = RoundedCornerShape(size = 5.dp)
),
)
.width(70.dp)
.height(25.dp),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = dDay,
style = TerningTheme.typography.title3,
color = TerningMain,
modifier = Modifier.padding(
horizontal = 19.5.dp,
vertical = 1.5.dp
)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,34 @@ fun ImageSlider(
images: List<Int>,
onAdvertisementClick: () -> Unit,
) {
val pagerState = rememberPagerState(pageCount = { images.size })
val infiniteImages = remember { images + images + images }
val pagerState = rememberPagerState(
initialPage = images.size,
initialPageOffsetFraction = 0f,
pageCount = { infiniteImages.size }
)
val autoScroll = remember { mutableStateOf(true) }

LaunchedEffect(autoScroll.value) {
if (autoScroll.value) {
while (true) {
delay(2000)
if (!pagerState.isScrollInProgress) {
val nextPage = (pagerState.currentPage + 1) % pagerState.pageCount
val nextPage = pagerState.currentPage + 1
pagerState.animateScrollToPage(nextPage)
}
}
}
}

LaunchedEffect(pagerState.currentPage) {
if (pagerState.currentPage < images.size) {
pagerState.scrollToPage(pagerState.currentPage + images.size)
} else if (pagerState.currentPage >= 2 * images.size) {
pagerState.scrollToPage(pagerState.currentPage - images.size)
}
}

Column(
modifier
.fillMaxWidth()
Expand All @@ -54,10 +67,11 @@ fun ImageSlider(
) {
HorizontalPager(
state = pagerState,
modifier = modifier
modifier = modifier,
beyondViewportPageCount = infiniteImages.size
) { currentPage ->
Image(
painter = painterResource(id = images[currentPage]),
painter = painterResource(id = infiniteImages[currentPage % images.size]),
contentDescription = null,
modifier = modifier
.fillMaxWidth()
Expand All @@ -68,8 +82,8 @@ fun ImageSlider(
}
DotsIndicator(
pageCount = images.size,
currentPage = pagerState.currentPage
currentPage = pagerState.currentPage % images.size
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fun SearchIntern(
.crossfade(true)
.build(),
contentDescription = stringResource(id = R.string.search_image),
contentScale = ContentScale.Crop,
contentScale = ContentScale.FillWidth,
modifier = Modifier
.height(76.dp)
.wrapContentSize()
Expand Down
2 changes: 1 addition & 1 deletion feature/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<!--Intern-->
<string name="intern_share_icon">๊ณต์œ  ์•„์ด์ฝ˜</string>
<string name="intern_move_to_site">์ง€์› ์‚ฌ์ดํŠธ๋กœ ์ด๋™ํ•˜๊ธฐ</string>
<string name="intern_top_app_bar_title">๊ณต๊ณ  ์ •๋ณด</string>
<string name="intern_top_app_bar_title">๊ณต๊ณ  ์ƒ์„ธ ์ •๋ณด</string>
<string name="intern_view_count_detail">%sํšŒ</string>
<string name="intern_info_d_day">์„œ๋ฅ˜ ๋งˆ๊ฐ</string>
<string name="intern_info_working">๊ทผ๋ฌด ๊ธฐ๊ฐ„</string>
Expand Down

0 comments on commit f6f7dc7

Please sign in to comment.