8000 [하티] 뷰 챌린지 미션 1단계 제출합니다. by sujin9 · Pull Request #10 · woowacourse/android-paint · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[하티] 뷰 챌린지 미션 1단계 제출합니다. #10

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

Merged
merged 18 commits into from
Oct 3, 2023

Conversation

sujin9
Copy link
@sujin9 sujin9 commented Sep 28, 2023

안녕하세요 핑구 🐧 🌼 💕
이번 뷰 챌린지 미션동안 만나서 반가워요!!
잘 부탁 드립니당 ~~~

이번 1단계 미션을 진행하며 요구 사항들을 열심히 반영했는데요!

다만, 하단에 색상 변경 굵기 변경 의 경우,
색상 혹은 굵기를 바꿀 때마다 버튼을 누르는 것이 너무 불필요한 작업이라 느껴져서 우선 삭제했습니다.
사실 색상 변경을 누르면 색상 리스트가 보이고, 굵기 변경을 누르면 굵기조절 슬라이드가 보이면서
그림을 그리면 사라지도록 하고 싶었는데,, <- 이 부분을 어떻게 구현해야 할지 감이 잘 안잡혀서 ㅠㅠ 우선 포기했습니다..

연휴 기간 잘 쉬시고 리뷰는 천천히 해주셔도 됩니다!
질문 & DM & 피드백은 언제든 환영이에요 🤗
그럼 즐거운 추석 연휴 보내요 핑구 ~

@sujin9 sujin9 self-assigned this Sep 28, 2023
@sujin9 sujin9 requested a review from pingu244 September 28, 2023 18:11
Copy link
@pingu244 pingu244 left a comment

Choose a reason for hiding this comment

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

하티 안녕하세요~!
리뷰이로 만나게 되어 반가워요🥰✨🐤🐥
너무 늦게 리뷰드리게 되어 죄송합니다..
전체적으로 코드들이 깔끔해서 리뷰하기 좋았어요! 궁금한 점 위주로 코멘트 남겨놓았으니 한 번 확인부탁드려요~😁

Comment on lines 15 to 20
) : RecyclerView.ViewHolder(
LayoutInflater.from(parent.context).inflate(
R.layout.item_color,
parent,
false,
),
Copy link

Choose a reason for hiding this comment

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

뷰 홀더를 만들 때 이렇게 만드는 것은 처음 보는데 어떤 방식으로 작동하는지 설명해주실 수 있을까요?

Copy link
Author
@sujin9 sujin9 Oct 2, 2023

Choose a reason for hiding this comment

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

adapter에서 createViewHolder를 할 때 부모 view를 넘기구, viewHolder에서 itemView를 넘기는 곳에서 바로 inflate를 해주어 itemView 객체를 만들어요!

리사이클러뷰에 들어가는 각각의 아이템 뷰를 관리하는 곳인 ViewHolder 내에서 inflate를 해주는 것이 맞다고 생각해서 이렇게 구현했어요 ;)

@@ -1,9 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<layout xmlns:android="http://schemas.android.com/apk/res/android"
Copy link

Choose a reason for hiding this comment

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

데이터 바인딩을 사용하는 이유가 있을까요? 여기서는 뷰바인딩만 사용해도 괜찮다고 보입니다

Copy link
Author

Choose a reason for hiding this comment

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

data binding을 사용할 가능성을 열어두고 싶기도 했고, 습관적으로 적용해준 이유도 없지않아 있는 것 같네요,, 😅
현재는 코드 수정을 통해 data binding을 활용하고 있답니다! :)

binding.rangeSliderBrushSize.values = listOf(DEFAULT_BRUSH_SIZE)
binding.ctvPaintBoard.apply {
setBrushSize(DEFAULT_BRUSH_SIZE)
setBrushColor(getColor(PaintColor.values().first().colorRes))
Copy link

Choose a reason for hiding this comment

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

getColor(PaintColor.values().first().colorRes) 이 부분이 너무 긴 것 같아요..! PaintColor 클래스에서 정의해놓은 getColorRes() 함수를 사용하시는 것은 어떨까요?

Copy link
Author
@sujin9 sujin9 Oct 2, 2023

Choose a reason for hiding this comment

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

좋은 의견 같아요!! 👍
미리 함수를 만들어두고 안쓰고 있었네요 ㅋㅋ
그리고 현재는 아예 Default color값(첫 번째 색)을 가져올 수 있도록 수정했습니다! :)

private fun setDefaultPaint() {
currentPaint.apply {
strokeCap = Paint.Cap.ROUND
strokeJoin = Paint.Join.ROUND
Copy link

Choose a reason for hiding this comment

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

제 그림판에서는 왜이리 삐쭉빼쭉하지 했는데 여기서 힌트를 얻네요!! 감사합니다 하티😉

currentPaint.apply {
strokeCap = Paint.Cap.ROUND
strokeJoin = Paint.Join.ROUND
isAntiAlias = true
Copy link

Choose a reason for hiding this comment

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

이 친구는 무슨 역할을 해주는 건가요?

Copy link
Author
@sujin9 sujin9 Oct 2, 2023

Choose a reason for hiding this comment

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

설명드릴게요 핑구! 😆 🌼
(열심히 찾아보았답니다 ㅋㅋ)
혹시 틀린 부분이 있거나, 이해가 되지 않는 부분이 있다면 말씀해주세요 ~ 💘


strokeCap

선의 양 끝 선 처리를 해줍니다.

strokeCap = Paint.Cap.ROUND 를 주석처리한 경우에는, 다음과 같이 보여요.

ref.
https://developer.android.com/reference/android/graphics/Paint#setStrokeCap(android.graphics.Paint.Cap)
https://developer.android.com/reference/android/graphics/Paint.Cap

strokeJoin

선의 꼭지점 처리를 해줍니다.

strokeJoin = Paint.Join.ROUND 를 주석처리한 경우에는, 다음과 같이 보여요.

ref.
https://developer.android.com/reference/android/graphics/Paint#setStrokeJoin(android.graphics.Paint.Join)
https://developer.android.com/reference/android/graphics/Paint.Join

isAntiAlias (setAntiAlias)

true로 설정하는 경우, 선 자체에는 영향이 없고, 선의 가장자리를 부드럽게 해줍니다.
주변 배경과 잘 어울리도록 하는 효과가 있다고 해요 ;)

image

ref.
https://developer.android.com/reference/android/graphics/Paint#isAntiAlias()

Copy link

Choose a reason for hiding this comment

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

정성스러운 답변 정말 감사해요..❣️

Comment on lines +36 to +38
MotionEvent.ACTION_DOWN -> startDrawing(event)
MotionEvent.ACTION_MOVE -> moveDrawing(event)
MotionEvent.ACTION_UP -> endDrawing()
Copy link

Choose a reason for hiding this comment

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

함수화를 아주 잘 해주셨군요 굿굿

private fun startDrawing(event: MotionEvent) {
currentPath = Path()
currentPath.moveTo(event.x, event.y)
currentPath.lineTo(event.x, event.y)
Copy link

Choose a reason for hiding this comment

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

moveDrawing()에서 lineTo로 그려주니 시작할 때는 그냥 moveTo만 해줘도 되지 않을까요?

Copy link
Author
@sujin9 sujin9 Oct 2, 2023

Choose a reason for hiding this comment

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

우선 저는 화면 위로 드래그를 하면 선이 그려지고, 그냥 터치만 하는 경우에는 점이 찍히도록 구현하고자 했어요.
시작할 때도 lineTo를 해주지 않으면, 화면을 그냥 터치했을 때 점이 찍히지 않더라구요 :(
그래서 해당 라인을 추가하게 되었습니다..!

혹시 핑구도 이런 문제를 겪으셨나요?
해결하셨다면, 어떤 방법으로 하셨는지 궁금해요! :)

Copy link

Choose a reason for hiding this comment

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

오 그런 부분에 대해서는 생각을 못했네요..! 하티 덕분에 알아가는게 많아지네요 감사합니다 ><

Comment on lines +7 to +11
RED(R.color.red),
ORANGE(R.color.orange),
YELLOW(R.color.yellow),
GREEN(R.color.green),
BLUE(R.color.blue),
Copy link

Choose a reason for hiding this comment

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

저는 그냥 ColorRes값이 없는 enum class로 정의해주고 Custom View에서 색상을 지정해주었는데 이렇게 한 곳에서 관리해주는 것이 더 좋은 것 같아요!👍

Copy link
@pingu244 pingu244 left a comment

Choose a reason for hiding this comment

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

리뷰 답변과 반영 고생하셨습니다~!!
하티의 코드를 리뷰하면서 오히려 제가 많이 얻어가네요😊
마지막까지 꼼꼼하게 코드들 정비해주셔서 더이상 드릴 리뷰가 없는 것 같아요!
코멘트 하나 남겼는데 생각해보시고 다음 미션에서 반영해주세요

바로 머지하겠습니다 ;) 다음 단계도 화이팅👍

import woowacourse.paint.model.DrawablePath
import woowacourse.paint.model.DrawablePathHistory
import woowacourse.paint.model.PaintColor

class PaintBoard constructor(context: Context, attrs: AttributeSet) : View(context, attrs) {
Copy link

Choose a reason for hiding this comment

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

현재는 xml 상에서만 PaintBoard를 사용할 수 있어요! 동적 생성을 하려면 어떻게 해야할까요?

@pingu244 pingu244 merged commit ea4a576 into woowacourse:sujin9 Oct 3, 2023
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.

2 participants
0