-
Notifications
You must be signed in to change notification settings - Fork 1
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
[ADD] CommonToolbarLayout(BaseToolbar) 추가 #317
Conversation
* Riffle 미작업 * 팝업 메뉴 추가 필요
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.
오호 친절한 사용 설명서까지~ 수고 많으셨습니다 :) 👍
@Retention(AnnotationRetention.SOURCE) | ||
annotation class Direction | ||
|
||
companion object { |
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는 파일 하단으로 배치해주시면 더 좋을 것 같습니다 :)
import com.runnect.runnect.util.custom.popup.RunnectPopupMenu | ||
import com.runnect.runnect.util.extension.dpToPx | ||
|
||
sealed class ToolbarMenu( |
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.
sealed class로 만드신 의도가 있나요?
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.
@unam98 답변이 늦었네요
처음 구현할 때는 when 구문에서 ToolbarMenu 타입에 따라 뷰를 생성해주고 있었습니다.
BaseToolbarMenu로 추상화하면서 아래와 같이 createMenu 하나로 처리가 가능해져 when 구문은 삭제 되었으나, 굳이 sealed class까지 제거할 필요는 없다고 판단되어 유지 했습니다~!
private fun addMenuView(context: Context?, parent: LinearLayout, toolbarMenu: ToolbarMenu) {
context ?: return
val menuView: View = toolbarMenu.createMenu(context)
parent.addView(menuView)
}
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.
앞으로 툴바 사용할 일 있을 때 적극 이용해봐야겠네요! 새로운 거 많이 배워갑니다! 👍
interface CommonToolbarLayout { | ||
|
||
@IntDef(LEFT, RIGHT) | ||
@Retention(AnnotationRetention.SOURCE) |
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.
@IntDef
, @Retention
어노테이션에 대해 배워갑니다!
private fun getColor(context: Context, @ColorRes colorResId: Int): Int { | ||
return ContextCompat.getColor(context, colorResId) | ||
} | ||
} |
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.
@leeeha
이게 좋은 방법인진 모르겠지만 최대한 코드 정리 해봤습니다..!
유동적인 레이아웃을 공통으로 이용할 수 있는 좋은 방법이 있으면 공유 부탁드려요~!
*/ | ||
fun setToolBarTitleFont(@FontRes fontResId: Int) { | ||
with(toolbarBinding) { | ||
val context = toolbar.context ?: return |
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.
플랫폼 타입에 대한 널처리도 항상 꼼꼼하게 챙기시는 모습이 인상적입니다! 평소에 개발하면서 간과했던 부분인데 덕분에 배워갑니다!
📌 개요
✨ 작업 내용
✨ PR 포인트
📸 스크린샷/동영상