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

kuring-98 학과 편집 화면 2.0 디자인 구현 #91

Merged
merged 36 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b6c80c4
kuring-98 [추가] 투명 IconButton 추가
mwy3055 Jan 20, 2024
ff70357
kuring-98 [추가] 더 큰 상단바인 LargeTopAppBar 추가
mwy3055 Jan 20, 2024
bb8d94f
kuring-98 [추가] 확인/취소를 선택할 수 있는 KuringAlertDialog 추가
mwy3055 Jan 20, 2024
f6bbcf4
kuring-98 [추가] 학과 구독 화면 모듈 추가
mwy3055 Jan 23, 2024
84addfa
kuring-98 [추가] EditDepartmentsActivity 추가
mwy3055 Jan 24, 2024
167d8cf
kuring-98 [추가] 학과 component 3개 추가
mwy3055 Jan 24, 2024
92df329
kuring-98 [추가] 검색창 component 추가
mwy3055 Jan 24, 2024
b1fd661
kuring-98 [추가] 학과 편집 화면 제목, 검색창까지 구현
mwy3055 Jan 24, 2024
bfa50e6
kuring-98 [추가] 학과 편집 화면에서 보여줄 학과 리스트를 wrap하는 DepartmentsUiModel 추가
mwy3055 Jan 30, 2024
53ed00e
kuring-98 [추가] 학과 편집 화면에서 보여줄 팝업 데이터를 wrap하는 PopupUiModel 추가
mwy3055 Jan 30, 2024
b30bfe4
kuring-98 [추가] 학과 편집 화면의 비즈니스 로직 추가
mwy3055 Jan 30, 2024
aeccfc0
kuring-98 [추가] 학과 편집 화면의 학과 리스트 구현
mwy3055 Jan 31, 2024
0c13cd1
kuring-98 [수정] 학과 편집 화면에서 ViewModel을 inject할 수 없던 문제 해결
mwy3055 Jan 31, 2024
c4ff8c3
kuring-98 [추가] 학과 편집 Activity와 Composable을 연결
mwy3055 Jan 31, 2024
5b4f232
kuring-98 [수정] KuringNavigator와 학과 편집 Activity를 연결
mwy3055 Jan 31, 2024
a25a161
kuring-98 [수정] 학과 편집 화면에서 다른 화면의 App Bar 텍스트가 보이던 문제 해결
mwy3055 Jan 31, 2024
06f809f
kuring-98 [수정] PopupUiModel에 학과 이름(영문 풀네임) 추가
mwy3055 Jan 31, 2024
091f2e0
kuring-98 [수정] 학과 추가 및 삭제 작업이 UI에 반영되지 않던 문제 해결
mwy3055 Jan 31, 2024
22861db
kuring-98 [추가] 학과 추가/삭제 팝업 구현
mwy3055 Jan 31, 2024
8e1e0c2
kuring-98 [추가] LargeTopAppBar에 action 매개변수 추가 (optional)
mwy3055 Jan 31, 2024
10cfb03
kuring-98 [추가] 학과 Dao와 Repository에 구독한 모든 학과를 구독 해제하는 함수 추가
mwy3055 Jan 31, 2024
2d64754
kuring-98 [추가] 학과 편집 화면의 상단 바에 모든 학과 삭제 버튼을 추가
mwy3055 Jan 31, 2024
8023198
kuring-98 [수정] build.gradle 파일의 오타 수정
mwy3055 Jan 31, 2024
e14133d
kuring-98 [수정] 학과 편집 화면의 배경색을 surface로 수정
mwy3055 Jan 31, 2024
87b4c49
Merge branch '2.0/base' into 2.0/edit_departments
mwy3055 Jan 31, 2024
179efd0
kuring-98 [수정] 사용하지 않는 코드 제거
mwy3055 Jan 31, 2024
6e3ae92
kuring-98 [수정] 팝업에서 '삭제' 텍스트는 주홍색으로 보여주도록 수정
mwy3055 Feb 1, 2024
761e440
kuring-98 [수정] 팝업 버튼의 텍스트를 디자인에 맞게 수정
mwy3055 Feb 1, 2024
8735d0d
kuring-98 [수정] 팝업 텍스트를 PopupUiModel로부터 바로 얻도록 수정
mwy3055 Feb 1, 2024
bb9dda0
kuring-9 [수정] 팝업 텍스트를 해요체로 수정
mwy3055 Feb 1, 2024
2f0d7f3
kuring-98 [수정] 팝업 텍스트를 해요체로 수정
mwy3055 Feb 1, 2024
dc43269
Merge remote-tracking branch 'origin/2.0/edit_departments' into 2.0/e…
mwy3055 Feb 1, 2024
492c5cc
kuring-98 [수정] 파일 이름에서 잘못 사용된 대문자를 소문자로 수정
mwy3055 Feb 2, 2024
7b762d3
kuring-98 [수정] 학과 편집 화면의 최상위 composable에 Screen을 postfix로 추가
mwy3055 Feb 4, 2024
ed73406
kuring-98 [수정] LargeTopAppBar의 navigationIconId와 onClick 콜백을 필수 매개변수로 변경
mwy3055 Feb 5, 2024
f5961ea
kuring-98 [삭제] 사용하지 않는 TransparentIconButton 제거
mwy3055 Feb 5, 2024
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
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ dependencies {
implementation project(":common:thirdparty")
implementation project(":data:domain")
implementation project(":feature:edit_subscription")
implementation project(":feature:edit_departments")
implementation project(":feature:feedback")
implementation project(":feature:my_notification")
implementation project(":feature:notice_storage")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ package com.ku_stacks.ku_ring.navigator
import android.app.Activity
import android.content.Context
import android.content.Intent
import androidx.fragment.app.FragmentActivity
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
import com.ku_stacks.ku_ring.R
import com.ku_stacks.ku_ring.domain.Notice
import com.ku_stacks.ku_ring.domain.WebViewNotice
import com.ku_stacks.ku_ring.domain.mapper.toWebViewNotice
import com.ku_stacks.ku_ring.edit_departments.EditDepartmentsActivity
import com.ku_stacks.ku_ring.edit_subscription.EditSubscriptionActivity
import com.ku_stacks.ku_ring.feedback.feedback.FeedbackActivity
import com.ku_stacks.ku_ring.main.MainActivity
import com.ku_stacks.ku_ring.main.notice.department.fragment_subscribe.DepartmentSubscribeBottomSheet
import com.ku_stacks.ku_ring.my_notification.NotificationActivity
import com.ku_stacks.ku_ring.notice_detail.NoticeWebActivity
import com.ku_stacks.ku_ring.notice_storage.NoticeStorageActivity
Expand All @@ -34,12 +33,8 @@ class KuringNavigatorImpl @Inject constructor() : KuringNavigator {
EditSubscriptionActivity.start(activity, isFirstRun)
}

override fun navigateToEditSubscribedDepartment(fragmentActivity: FragmentActivity) {
DepartmentSubscribeBottomSheet.newInstance()
.show(
fragmentActivity.supportFragmentManager,
DepartmentSubscribeBottomSheet::class.java.name
)
override fun navigateToEditSubscribedDepartment(activity: Activity) {
EditDepartmentsActivity.start(activity)
}

override fun navigateToFeedback(activity: Activity) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
package com.ku_stacks.ku_ring.designsystem.components

import androidx.compose.foundation.background
import androidx.compose.foundation.border
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.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.contentColorFor
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.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.ku_stacks.ku_ring.designsystem.R
import com.ku_stacks.ku_ring.designsystem.theme.KuringTheme
import com.ku_stacks.ku_ring.designsystem.theme.Pretendard
import com.ku_stacks.ku_ring.domain.Department

@Composable
fun DepartmentWithDeleteIcon(
department: Department,
onDeleteDepartment: (Department) -> Unit,
modifier: Modifier = Modifier,
) {
Department(
department = department,
modifier = modifier,
) {
if (department.isSelected) {
SelectedDepartmentMark()
}
Spacer(modifier = Modifier.weight(1f))
DeleteIconButton(onClick = { onDeleteDepartment(department) })
}
}

@Composable
fun DepartmentWithAddIcon(
department: Department,
onAddDepartment: (Department) -> Unit,
modifier: Modifier = Modifier,
) {
Department(
department = department,
modifier = modifier,
) {
Spacer(modifier = Modifier.weight(1f))
AddIconButton(onClick = { onAddDepartment(department) })
}
}

@Composable
fun DepartmentWithCheckIcon(
department: Department,
onClickDepartment: (Department) -> Unit,
modifier: Modifier = Modifier,
) {
Department(
department = department,
modifier = modifier,
) {
Spacer(modifier = Modifier.weight(1f))
CheckIconButton(onClick = { onClickDepartment(department) })
}
}

@Composable
private fun SelectedDepartmentMark(
modifier: Modifier = Modifier,
) {
val shape = RoundedCornerShape(50)
Box(
modifier = modifier
.clip(shape)
.background(MaterialTheme.colors.surface, shape)
.border(0.5.dp, MaterialTheme.colors.primary, shape)
.padding(horizontal = 8.dp),
) {
Text(
text = stringResource(id = R.string.selected_department),
style = TextStyle(
fontSize = 11.sp,
lineHeight = 17.93.sp,
fontFamily = Pretendard,
fontWeight = FontWeight(600),
color = MaterialTheme.colors.primary,
),
)
}
}

@Composable
private fun DeleteIconButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
contentDescription: String? = null,
) {
IconButton(
onClick = onClick,
modifier = modifier,
) {
Icon(
painter = painterResource(id = R.drawable.ic_trashcan),
contentDescription = contentDescription,
tint = contentColorFor(backgroundColor = MaterialTheme.colors.surface),
)
}
}

@Composable
private fun AddIconButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
contentDescription: String? = null,
) {
IconButton(
onClick = onClick,
modifier = modifier,
) {
Icon(
painter = painterResource(id = R.drawable.ic_add),
contentDescription = contentDescription,
tint = contentColorFor(backgroundColor = MaterialTheme.colors.surface),
)
}
}

@Composable
private fun CheckIconButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
contentDescription: String? = null,
) {
IconButton(
onClick = onClick,
modifier = modifier,
) {
Icon(
painter = painterResource(id = R.drawable.ic_check_checked),
contentDescription = contentDescription,
tint = MaterialTheme.colors.primary,
)
}
}

@Composable
private fun Department(
department: Department,
modifier: Modifier = Modifier,
contents: @Composable RowScope.() -> Unit = {},
) {
val backgroundColor = MaterialTheme.colors.surface
Row(
modifier = modifier
.background(backgroundColor)
.padding(start = 24.dp, end = 12.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
DepartmentTitle(
departmentName = department.koreanName,
textColor = contentColorFor(backgroundColor),
)
contents()
}
}

@Composable
private fun DepartmentTitle(
departmentName: String,
modifier: Modifier = Modifier,
textColor: Color = Color.Unspecified,
) {
Text(
text = departmentName,
style = TextStyle(
fontSize = 16.sp,
lineHeight = 24.sp,
fontFamily = Pretendard,
fontWeight = FontWeight(500),
color = textColor,
),
modifier = modifier,
)
}

private val previewDepartment = Department(
name = "smart_ict",
shortName = "sicte",
koreanName = "스마트ICT융합공학과",
isSubscribed = true,
isSelected = true,
isNotificationEnabled = false,
)

@LightAndDarkPreview
@Composable
private fun DepartmentItemsPreview() {
KuringTheme {
Column(
modifier = Modifier
.background(Color.Gray)
.fillMaxWidth(),
) {
DepartmentWithDeleteIcon(
department = previewDepartment,
onDeleteDepartment = {},
modifier = Modifier.fillMaxWidth(),
)
DepartmentWithAddIcon(
department = previewDepartment,
onAddDepartment = {},
modifier = Modifier.fillMaxWidth(),
)
DepartmentWithCheckIcon(
department = previewDepartment,
onClickDepartment = {},
modifier = Modifier.fillMaxWidth(),
)
}
}
}
Loading
Loading