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

시간표 블록 그리기 Jetpack Compose로 마이그레이션 + 신규 로직 적용 #346

Merged
merged 14 commits into from
Oct 13, 2024

Conversation

JuTaK97
Copy link
Collaborator

@JuTaK97 JuTaK97 commented Aug 27, 2024

커밋 별로 안 보면 정신나갈거임

변경사항

  • 강의 셀 그리는 부분 nativeCanvas -> Box + Text 로 변경 df0c52d
  • 시간표 grid 그리는 부분 nativeCanvas -> Box + Text 로 변경 901ffa6
  • 이젠 필요 없는 Paint 객체들 제거 46b31bc
  • 신규 로직 구현 e5aa6fd << 요게 핵심
  • 폰트 따로 분리해서 선언 78003fc
  • 강의 셀 그리는 부분에 신규 로직 적용 9233cac

토글 스위치나 이런 부분은 현도가 이미 다 했으니 다음 작업에서 복붙해와서 반영하고, 우선 신규 로직이 잘 돌아가는지만 체크하기
title, place 만 enabled이고 강의번호랑 교수이름은 disable이라 기존이랑 똑같이 렌더링 하는 상태임

@JuTaK97 JuTaK97 self-assigned this Aug 27, 2024
@JuTaK97 JuTaK97 requested a review from a team as a code owner August 27, 2024 16:39
@JuTaK97 JuTaK97 force-pushed the jutak/lecture-info-custom-compose branch from 65b78ab to 9233cac Compare August 27, 2024 16:45
Comment on lines -265 to 286
Canvas(modifier = Modifier.fillMaxSize()) {
BoxWithConstraints(modifier = Modifier.fillMaxSize()) {
val unitWidth =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

근데 여기서 Box를 안쓰고 BoxWithConstraints를 쓴건 어떤 의미를 갖는거야?
찾아보니까 예전에 컬러피커? 뭐 이런거 띄울 때 400이랑 80%중 선택한다 이런거 있었는데
그런데에 쓸 수도 있겠다

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constraint 를 알아야 돼서 그래

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

바로 밑에 있는 maxWidth 요게 BoxWithConstraints의 BoxWithConstraintsScope 에서 제공해 주는 값

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Canvas에도 같은 방식으로 제공해 주는 게 size 요거야

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아아 그런거였군

Comment on lines +174 to +178
color = if (isDarkMode()) {
Color(119, 119, 119, 180)
} else {
Color(0, 0, 0, 180)
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기는 어째서 이런 끔찍한 일이 일어난거지
이거 따로 정의된게 없어서 이렇게 되어버린건가..?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

뭐 어딘가 있을수도 있겠지만
그냥 원래 Paint 로 돼있던거 수치 가져옴

Copy link
Collaborator

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)

바꿔주세용ㅎㅎ

Comment on lines +2 to +7

import androidx.compose.ui.text.TextMeasurer
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.unit.Constraints

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헐 이거 다 라이브러리 제공이군....

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅘ우....

@JuTaK97 JuTaK97 force-pushed the jutak/lecture-info-custom-compose branch from 9233cac to 707f9e6 Compare September 5, 2024 15:05
Copy link
Collaborator

@eastshine2741 eastshine2741 left a 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,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런게있구나

Comment on lines +11 to +16
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)
}
Copy link
Collaborator

@eastshine2741 eastshine2741 Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기 생성자 인자마다 개행 어떠신가요

Comment on lines 143 to 144
val gridColor = SNUTTColors.TableGrid
val gridColor2 = SNUTTColors.TableGrid2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

원래 그랬던거긴한데 네이밍 lightGridColor, darkGridColor로 바꾸는거 어때
1 2보단 나을거같아서...!

Comment on lines +174 to +178
color = if (isDarkMode()) {
Color(119, 119, 119, 180)
} else {
Color(0, 0, 0, 180)
},
Copy link
Collaborator

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)

바꿔주세용ㅎㅎ

}
}

// 각 정보보다 하위 정보를 모두 한 줄로만 렌더링 했을 때 그릴 수 있는 최대 줄 수를 하나씩 계산한다.
Copy link
Collaborator

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가 최대 줄 수로 그려진다고 생각했는데, 시간표 셀을 벗어나지 않는 건가...??

@JuTaK97 JuTaK97 enabled auto-merge (squash) October 13, 2024 09:34
Copy link
Collaborator

@eastshine2741 eastshine2741 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM~~

@JuTaK97 JuTaK97 merged commit c1acf53 into develop Oct 13, 2024
3 checks passed
@JuTaK97 JuTaK97 deleted the jutak/lecture-info-custom-compose branch October 13, 2024 09:45
@JuTaK97 JuTaK97 mentioned this pull request Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants