-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from everymeals/feature/select_screen
[feature/select_screen] 학교 선택화면 뷰 구현
- Loading branch information
Showing
17 changed files
with
349 additions
and
17 deletions.
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
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
55 changes: 55 additions & 0 deletions
55
presentation/src/main/java/com/everymeal/presentation/components/EveryMealButton.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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.everymeal.presentation.components | ||
|
||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.everymeal.presentation.R | ||
import com.everymeal.presentation.ui.theme.Gray200 | ||
import com.everymeal.presentation.ui.theme.Main100 | ||
|
||
@Composable | ||
fun EveryMealMainButton( | ||
text: String, | ||
enabled: Boolean = true, | ||
onClick: () -> Unit, | ||
) { | ||
Button( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(vertical = 16.dp), | ||
shape = RoundedCornerShape(12.dp), | ||
colors = ButtonDefaults.buttonColors(containerColor = if(enabled) Main100 else Gray200), | ||
enabled = enabled, | ||
onClick = onClick, | ||
) { | ||
Text( | ||
text = text, | ||
style = TextStyle( | ||
color = Color.White, | ||
fontWeight = FontWeight.Medium, | ||
), | ||
fontSize = 16.sp, | ||
modifier = Modifier.padding(vertical = 8.dp) | ||
) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun PreviewDisableButton() { | ||
EveryMealMainButton( | ||
text = stringResource(R.string.select), | ||
) { } | ||
} |
38 changes: 38 additions & 0 deletions
38
presentation/src/main/java/com/everymeal/presentation/ui/signup/UnivSelectActivity.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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.everymeal.presentation.ui.signup | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import com.everymeal.presentation.MainActivity | ||
import com.everymeal.presentation.ui.theme.EveryMeal_AndroidTheme | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
|
||
@AndroidEntryPoint | ||
class UnivSelectActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
setUnivSelectScreen() | ||
} | ||
|
||
private fun setUnivSelectScreen() { | ||
setContent { | ||
EveryMeal_AndroidTheme { | ||
UnivSelectScreen{ | ||
MainActivity.startActivity(this) | ||
finish() | ||
} | ||
} | ||
} | ||
} | ||
|
||
companion object { | ||
fun startActivity(context: Context) { | ||
val intent = Intent(context, UnivSelectActivity::class.java) | ||
context.startActivity(intent) | ||
} | ||
} | ||
} |
168 changes: 168 additions & 0 deletions
168
presentation/src/main/java/com/everymeal/presentation/ui/signup/UnivSelectScreen.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 |
---|---|---|
@@ -0,0 +1,168 @@ | ||
package com.everymeal.presentation.ui.signup | ||
|
||
import androidx.compose.foundation.Image | ||
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.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.lazy.grid.GridCells | ||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.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.graphics.Color | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.res.vectorResource | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.everymeal.presentation.R | ||
import com.everymeal.presentation.components.EveryMealMainButton | ||
import com.everymeal.presentation.ui.theme.EveryMeal_AndroidTheme | ||
import com.everymeal.presentation.ui.theme.Gray100 | ||
import com.everymeal.presentation.ui.theme.Gray300 | ||
import com.everymeal.presentation.ui.theme.Gray500 | ||
import com.everymeal.presentation.ui.theme.Gray800 | ||
|
||
data class Item( | ||
val Image: Int, | ||
val name: String, | ||
) | ||
|
||
@Composable | ||
fun UnivSelectScreen( | ||
onSelectClick : () -> Unit | ||
) { | ||
val items = listOf( | ||
Item(Image = R.drawable.image_myongji, name = "명지대"), | ||
Item(Image = R.drawable.image_sungsin, name = "성신여대"), | ||
Item(Image = R.drawable.image_seoulwoman, name = "서울여대"), | ||
Item(Image = R.drawable.image_konkuk, name = "건국대"), | ||
) | ||
|
||
Box( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.background(Color.White) | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.padding(horizontal = 24.dp) | ||
) { | ||
Spacer(modifier = Modifier.padding(58.dp)) | ||
Text( | ||
text = stringResource(R.string.univ_select_title), | ||
style = TextStyle( | ||
fontSize = 24.sp, | ||
fontWeight = FontWeight.Bold | ||
), | ||
) | ||
Spacer(modifier = Modifier.padding(10.dp)) | ||
LazyVerticalGrid( | ||
columns = GridCells.Fixed(3), | ||
modifier = Modifier.weight(1f), | ||
) { | ||
items(items.size) { index -> | ||
UnivSelectItem(item = items[index]) | ||
} | ||
} | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.background(Gray300, RoundedCornerShape(100.dp)) | ||
.padding(horizontal = 24.dp, vertical = 14.dp), | ||
verticalAlignment = Alignment.CenterVertically, | ||
) { | ||
Icon( | ||
imageVector = ImageVector.vectorResource(id = R.drawable.icon_chat), | ||
contentDescription = stringResource(id = R.string.icon_chat_description), | ||
tint = Gray500 | ||
) | ||
Spacer(modifier = Modifier.padding(14.dp)) | ||
Column { | ||
Text( | ||
text = stringResource(id = R.string.univ_select_not_univ), | ||
fontSize = 15.sp, | ||
color = Gray800 | ||
) | ||
Text( | ||
text = stringResource(id = R.string.univ_select_apply), | ||
fontSize = 14.sp, | ||
color = Gray500 | ||
) | ||
} | ||
Spacer(modifier = Modifier.weight(1f)) | ||
Icon( | ||
imageVector = ImageVector.vectorResource(id = R.drawable.icon_arrow_right), | ||
contentDescription = stringResource(id = R.string.icon_arrow_right), | ||
tint = Gray500 | ||
) | ||
} | ||
EveryMealMainButton( | ||
text = stringResource(R.string.select), | ||
enabled = false, | ||
) { | ||
onSelectClick() | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun UnivSelectItem(item: Item) { | ||
Column( | ||
modifier = Modifier | ||
.padding(8.dp) | ||
.clip(RoundedCornerShape(8.dp)) | ||
.background(Gray100) | ||
.fillMaxSize(), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.Center | ||
) { | ||
Spacer(modifier = Modifier.padding(bottom = 10.dp)) | ||
Image( | ||
painter = painterResource(item.Image), | ||
contentDescription = item.name, | ||
Modifier.size(36.dp) | ||
) | ||
Text( | ||
text = item.name, | ||
fontSize = 14.sp, | ||
modifier = Modifier.padding(10.dp) | ||
) | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun UnivSelectScreenPreview() { | ||
EveryMeal_AndroidTheme { | ||
UnivSelectScreen{ } | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun UnivSelectScreenItemPreview() { | ||
EveryMeal_AndroidTheme { | ||
UnivSelectItem(item = Item( | ||
Image = R.drawable.image_myongji, | ||
name = "명지대학교" | ||
)) | ||
} | ||
} |
24 changes: 13 additions & 11 deletions
24
...eal/presentation/splash/SplashActivity.kt → .../presentation/ui/splash/SplashActivity.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
Oops, something went wrong.