-
Notifications
You must be signed in to change notification settings - Fork 0
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
시간표 블록 그리기 Jetpack Compose로 마이그레이션 + 신규 로직 적용 #346
Conversation
65b78ab
to
9233cac
Compare
Canvas(modifier = Modifier.fillMaxSize()) { | ||
BoxWithConstraints(modifier = Modifier.fillMaxSize()) { | ||
val unitWidth = |
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.
근데 여기서 Box를 안쓰고 BoxWithConstraints를 쓴건 어떤 의미를 갖는거야?
찾아보니까 예전에 컬러피커? 뭐 이런거 띄울 때 400이랑 80%중 선택한다 이런거 있었는데
그런데에 쓸 수도 있겠다
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.
constraint 를 알아야 돼서 그래
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.
바로 밑에 있는 maxWidth 요게 BoxWithConstraints의 BoxWithConstraintsScope 에서 제공해 주는 값
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.
Canvas에도 같은 방식으로 제공해 주는 게 size
요거야
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.
아아 그런거였군
color = if (isDarkMode()) { | ||
Color(119, 119, 119, 180) | ||
} else { | ||
Color(0, 0, 0, 180) | ||
}, |
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.
여기는 어째서 이런 끔찍한 일이 일어난거지
이거 따로 정의된게 없어서 이렇게 되어버린건가..?
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.
뭐 어딘가 있을수도 있겠지만
그냥 원래 Paint 로 돼있던거 수치 가져옴
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.
SNUTTColors.DarkGray에 alpha 70%(0x777777b4)
SNUTTColors.Black에 alpha 70%(0x000000b4)
바꿔주세용ㅎㅎ
|
||
import androidx.compose.ui.text.TextMeasurer | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.buildAnnotatedString | ||
import androidx.compose.ui.unit.Constraints | ||
|
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.
헐 이거 다 라이브러리 제공이군....
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.
ㅘ우....
9233cac
to
707f9e6
Compare
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.
수고하셨습니다~~
|
||
fun calculateAdjustedTextLayout( | ||
input: List<LectureCellInfo>, | ||
textMeasurer: TextMeasurer, |
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.
이런게있구나
companion object { | ||
fun titleTextLayout(title: String, enabled: Boolean) = LectureCellInfo(title, enabled, TimetableCanvasObjects.lectureTitleTextStyle, TimetableCanvasObjects.lectureTitleMinifiedTextStyle) | ||
fun placeTextLayout(place: String, enabled: Boolean) = LectureCellInfo(place, enabled, TimetableCanvasObjects.lecturePlaceTextStyle, TimetableCanvasObjects.lecturePlaceMinifiedTextStyle) | ||
fun lectureNumberTextLayout(lectureNumber: String, enabled: Boolean) = LectureCellInfo(lectureNumber, enabled, TimetableCanvasObjects.lectureNumberTextStyle, TimetableCanvasObjects.lectureNumberMinifiedTextStyle) | ||
fun instructorNameTextLayout(name: String, enabled: Boolean) = LectureCellInfo(name, enabled, TimetableCanvasObjects.lectureInstructorTextStyle, TimetableCanvasObjects.lectureInstructorMinifiedTextStyle) | ||
} |
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.
여기 생성자 인자마다 개행 어떠신가요
val gridColor = SNUTTColors.TableGrid | ||
val gridColor2 = SNUTTColors.TableGrid2 |
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.
원래 그랬던거긴한데 네이밍 lightGridColor, darkGridColor로 바꾸는거 어때
1 2보단 나을거같아서...!
color = if (isDarkMode()) { | ||
Color(119, 119, 119, 180) | ||
} else { | ||
Color(0, 0, 0, 180) | ||
}, |
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.
SNUTTColors.DarkGray에 alpha 70%(0x777777b4)
SNUTTColors.Black에 alpha 70%(0x000000b4)
바꿔주세용ㅎㅎ
} | ||
} | ||
|
||
// 각 정보보다 하위 정보를 모두 한 줄로만 렌더링 했을 때 그릴 수 있는 최대 줄 수를 하나씩 계산한다. |
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.
요 마지막 로직이 제일 어렵군
- 상위정보랑 하위정보는 어떤거야? cellInfoList에서 앞에 있는 정보일수록 상위 정보인건가?
- 그럼 이 로직은
- 각 LectureCellInfo에 대해서, 그보다 하위 정보를 모두 한 줄로 그렸을 때 가능한 최대 줄 수를 계산하고
- 마지막에 List으로 map해서 리턴하는건가?
- 그럼 결국 각 LectureCellInfo가 최대 줄 수로 그려진다고 생각했는데, 시간표 셀을 벗어나지 않는 건가...??
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.
LGTM~~
커밋 별로 안 보면 정신나갈거임
변경사항
토글 스위치나 이런 부분은 현도가 이미 다 했으니 다음 작업에서 복붙해와서 반영하고, 우선 신규 로직이 잘 돌아가는지만 체크하기
title, place 만 enabled이고 강의번호랑 교수이름은 disable이라 기존이랑 똑같이 렌더링 하는 상태임