-
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
[feat] 위니 업로드 / 과소비 플로우 추가 #240
Conversation
|
||
private val feedType by lazy { | ||
intent.extras?.getCompatibleSerializable(WineyFeedFragment.KEY_FEED_TYPE) | ||
?: WineyFeedType.SAVE |
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.
SAVE 로 두는 이유가 있나요 ?
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.
nullable 타입에 대한 처리가 애매해서 디폴트 값으로 SAVE를 지정했습니다!
private val amountString by lazy { intent.extras?.getString(KEY_SAVE_AMOUNT, "") } | ||
private val amount by lazy { intent.extras?.getString(KEY_SAVE_AMOUNT, "") } |
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.
👍
@BindingAdapter("switchUploadImageTitle") | ||
fun TextView.switchUploadImageTitle(feedType: WineyFeedType) { | ||
text = when (feedType) { | ||
WineyFeedType.SAVE -> context.getString(R.string.upload_photo_title, "절약을 실천한") | ||
WineyFeedType.CONSUME -> context.getString(R.string.upload_photo_title, "과소비한") | ||
} | ||
} | ||
|
||
@BindingAdapter("switchUploadImageButtonText") | ||
fun TextView.switchUploadImageButtonText(feedType: WineyFeedType) { | ||
text = when (feedType) { | ||
WineyFeedType.SAVE -> context.getString(R.string.upload_plus_text, "절약을") | ||
WineyFeedType.CONSUME -> context.getString(R.string.upload_plus_text, "과소비를") | ||
} | ||
} | ||
|
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.
타입에 따라 바뀌는 6가지 요소를 data class로 묶으면 하나의 bindingAdapter로 관리할 수는 있을 것 같아요 ~! 다만 그러면 뷰의 id에 따라 바인딩 해줘야 해서 ... 결과적으로는 지금 방향이 더 낫지 않을까 생각합니다
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.
오.. 어떤 방식인지 더 구체적으로 알 수 있을까요?! 뷰의 id에 따라 바인딩 한다는 게 어떤 건지 감이 잘 안 와서요!
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.
data class ViewTexts(
val title: String,
val description: ~~~
)
이렇게 만들고
when (id) {
R.id.uploadImageTitle -> text = viewTexts.title
}
이런 바인딩 어댑터 만들면 관리는 가능할 것 같은데, 위에 적은 것처럼 아이디를 직접참조하는 방식은 변동+증가에 따라 일일이 반영해줘야해서 결국 기존 방식이 좋을 것 같다는 말이었습니다 😄
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.
아하 그러네요 id가 바뀌면 일일이 다 바꿔줘야 하니까 번거롭겠네요! 그럼 우선은 지금 방식대로 머지할게요!
…o feature/feat-overcomsumption-upload # Conflicts: # app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt # app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt
📝 Work Description
📣 To Reviewers