-
Notifications
You must be signed in to change notification settings - Fork 1
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
[init] 폰트, 색상 세팅 + 상단바 구현 #13
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b910b4f
[init] #12 기존 색상 삭제, 중복 폰트 속성 삭제
t1nm1ksun d1882fc
[init] #11 탑 앱바 제작 및 화면 전환 구현
t1nm1ksun 6c51a91
[delete] 미사용 import문 삭제
t1nm1ksun d10b147
[init] #11 indicator 커스텀
t1nm1ksun 3ace800
[init] #11 divider 속성값으로 지정
t1nm1ksun 689e687
[chore] #11 주석 제거
t1nm1ksun 05e1325
[chore] #11 string.xml 사용처 명시
t1nm1ksun 9d110a2
[chore] #11 주석 제거
t1nm1ksun 908ebed
[chore] #13 불필요 ktlint설정 삭제
t1nm1ksun 2c86f23
[chore] #13 needless blank line 삭제
t1nm1ksun 300c7a3
Update build.gradle.kts
t1nm1ksun a4a88c3
[chore] #13 스트링 추출
t1nm1ksun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
root = true | ||
|
||
[*] | ||
max_line_length = off | ||
max_line_length = off | ||
|
||
[*.{kt,kts}] | ||
ktlint_function_naming_ignore_when_annotated_with=Composable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
204 changes: 197 additions & 7 deletions
204
app/src/main/java/org/sopt/kream/presentation/ui/dummy/View1Screen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,213 @@ | ||
package org.sopt.kream.presentation.ui.dummy | ||
|
||
import androidx.compose.foundation.ExperimentalFoundationApi | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
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.pager.HorizontalPager | ||
import androidx.compose.foundation.pager.PagerState | ||
import androidx.compose.foundation.pager.rememberPagerState | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.foundation.text.BasicTextField | ||
import androidx.compose.material3.HorizontalDivider | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.ScrollableTabRow | ||
import androidx.compose.material3.Tab | ||
import androidx.compose.material3.TabRowDefaults | ||
import androidx.compose.material3.TabRowDefaults.tabIndicatorOffset | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.times | ||
import kotlinx.coroutines.launch | ||
import org.sopt.kream.R | ||
import org.sopt.kream.theme.Black01 | ||
import org.sopt.kream.theme.Black02 | ||
import org.sopt.kream.theme.Black09 | ||
import org.sopt.kream.theme.Gray06 | ||
import org.sopt.kream.theme.body3SemiBold | ||
import org.sopt.kream.theme.body5Regular | ||
import org.sopt.kream.theme.head1Bold | ||
|
||
val pages = listOf("추천", "랭킹", "발매정보", "럭셔리", "남성", "여성", "발견") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 스트링 추출 해주면 좋을 듯 우하하 |
||
|
||
@OptIn(ExperimentalFoundationApi::class) | ||
@Preview | ||
@Composable | ||
fun View1Screen() { | ||
var editText by remember { | ||
mutableStateOf("") | ||
} | ||
val pagerState = | ||
rememberPagerState { | ||
pages.size | ||
} | ||
Scaffold( | ||
topBar = { | ||
Column(modifier = Modifier.fillMaxWidth()) { | ||
Spacer(modifier = Modifier.height(33.dp)) | ||
Row( | ||
modifier = Modifier.fillMaxWidth(), | ||
verticalAlignment = Alignment.CenterVertically, | ||
) { | ||
Spacer(modifier = Modifier.width(14.dp)) | ||
|
||
BasicTextField( | ||
value = editText, | ||
onValueChange = { editText = it }, | ||
singleLine = true, | ||
modifier = | ||
Modifier | ||
.weight(1f) | ||
.size(width = 293.dp, height = 33.dp) | ||
.background(color = Gray06, shape = RoundedCornerShape(9.dp)), | ||
decorationBox = { innerTextField -> | ||
Box( | ||
contentAlignment = Alignment.CenterStart, | ||
modifier = Modifier.padding(start = 7.dp), | ||
) { | ||
innerTextField() | ||
if (editText.isEmpty()) { | ||
Text( | ||
style = body5Regular, | ||
color = Black09, | ||
text = stringResource(id = R.string.bar_search_label), | ||
) | ||
} | ||
} | ||
}, | ||
) | ||
|
||
Spacer(modifier = Modifier.width(14.dp)) | ||
Icon( | ||
painter = painterResource(R.drawable.ic_topappbar_bell_28), | ||
contentDescription = null, | ||
modifier = Modifier.size(28.dp), | ||
) | ||
Spacer(modifier = Modifier.width(11.dp)) | ||
} | ||
CustomTabPager(pagerState, pages) | ||
} | ||
}, | ||
) { innerPadding -> | ||
View1Content(Modifier.padding(innerPadding)) | ||
} | ||
} | ||
|
||
@OptIn(ExperimentalFoundationApi::class) | ||
@Composable | ||
fun CustomTabPager( | ||
pagerState: PagerState, | ||
tabs: List<String>, | ||
) { | ||
val coroutineScope = rememberCoroutineScope() | ||
Column { | ||
ScrollableTabRow( | ||
selectedTabIndex = pagerState.currentPage, | ||
indicator = { tabPositions -> | ||
TabRowDefaults.PrimaryIndicator( | ||
modifier = | ||
Modifier | ||
.tabIndicatorOffset(tabPositions[pagerState.currentPage]), | ||
color = Black02, | ||
width = pages[pagerState.currentPage].length * 12.dp, | ||
) | ||
}, | ||
containerColor = Color.White, | ||
contentColor = Black02, | ||
edgePadding = 0.dp, | ||
modifier = Modifier.padding(0.dp), | ||
divider = { | ||
HorizontalDivider( | ||
modifier = | ||
Modifier | ||
.fillMaxWidth(), | ||
color = Color.LightGray, | ||
thickness = 1.dp, | ||
) | ||
}, | ||
) { | ||
tabs.forEachIndexed { index, title -> | ||
Tab( | ||
text = { Text(title, style = body3SemiBold) }, | ||
selected = pagerState.currentPage == index, | ||
onClick = { | ||
coroutineScope.launch { | ||
pagerState.animateScrollToPage(index) | ||
} | ||
}, | ||
modifier = Modifier.width(0.dp), | ||
) | ||
} | ||
} | ||
|
||
HorizontalPager( | ||
state = pagerState, | ||
) { page -> | ||
Column( | ||
modifier = | ||
Modifier | ||
.fillMaxSize() | ||
.background(Color.White), | ||
verticalArrangement = Arrangement.Center, | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
) { | ||
when (page) { | ||
0 -> View1Content(modifier = Modifier) | ||
2 -> View2Content(modifier = Modifier) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun View1Content(modifier: Modifier) { | ||
Column( | ||
modifier = modifier.fillMaxSize(), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.Center, | ||
) { | ||
Text( | ||
text = "추천", | ||
style = head1Bold, | ||
color = Black01, | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
fun View1Screen(dummyViewModel: DummyViewModel) { | ||
Column (modifier = Modifier.fillMaxSize(), | ||
fun View2Content(modifier: Modifier) { | ||
Column( | ||
modifier = modifier.fillMaxSize(), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.Center | ||
){ | ||
Text(text = "View1 Screen", | ||
verticalArrangement = Arrangement.Center, | ||
) { | ||
Text( | ||
text = "발매정보", | ||
style = head1Bold, | ||
color = Gray06) | ||
color = Black01, | ||
) | ||
} | ||
} | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 쏘굿도링 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 지워줘도 됩니다 ~