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

[faet] 단체 입장 검색 뷰 구현 #67

Merged
merged 13 commits into from
Jan 9, 2024

Conversation

DoReMinWoo
Copy link
Member

@DoReMinWoo DoReMinWoo commented Jan 9, 2024

Related issue 🛠

Work Description ✏️

  • 검색창
    • 검색 아이콘 클릭, 엔터 클릭 시 검색
    • 더미 데이터 확인

Screenshot 📸

Uncompleted Tasks 😅

  • 버튼 활성화/비활성
  • 검색 시 단체를 직접 추가해주세요 텍스트가 사라짐 이슈..

To Reviewers 📢

버튼 활성화 비활성화 로직이 안됩니다 ㅠㅠ 살려주세요
그리고 리사이클러뷰 단일 선택할 때 (선택 - 선택취소 - 재선택) 시 재선택이 불가능합니다!!

Copy link
Collaborator

@jihyunniiii jihyunniiii 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 37 to 44
binding.etJoinGroupSearch.setOnKeyListener(
View.OnKeyListener { _, keyCode, event ->
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
checkListExist()
hideKeyboard(binding.etJoinGroupSearch)
return@OnKeyListener true
}
true
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
Member Author

Choose a reason for hiding this comment

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

EditText 키보드드 엔터 클릭 리스너인데 생각해보니 리스너 2개가 필요하지 않을 것 같아서 수정하겠습니다~

val isJoinBtn get() = _isJoinBtn

val mockJoinGroupSearchData: List<JoinGroupSearchEntity>
private var oldPosition = -1
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 25 to 46
when {
oldPosition == -1 -> {
setIsSelected(true, newPosition)
}

oldPosition != newPosition -> {
setIsSelected(false, oldPosition)
setIsSelected(true, newPosition)
}

oldPosition == newPosition -> {
setIsSelected(false, oldPosition)
oldPosition = -1
}

else -> {
setIsSelected(false, oldPosition)
setIsSelected(true, newPosition)
}
}
oldPosition = newPosition
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

아까 말한대로 인버스 값을 사용하는 로직으로 수정해주세요

tvJoinGroupSearchEmpty.visibility = View.VISIBLE
} else {
rvJoinGroupSearch.visibility = View.VISIBLE
tvJoinGroupSearchCreate.visibility = View.INVISIBLE
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 30 to 33
oldPosition != newPosition -> {
setIsSelected(false, oldPosition)
setIsSelected(true, newPosition)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

이걸 else라고 해도 되지 않나요?
추가로 when(oldPosition)으로 적는 게 더 효율적일 것 같습니다.

android:textColor="@color/g_01"
app:layout_constraintBottom_toBottomOf="@id/tv_join_group_search_create"
app:layout_constraintEnd_toStartOf="@id/tv_join_group_search_create"
app:layout_constraintHorizontal_chainStyle="packed"
Copy link
Collaborator

Choose a reason for hiding this comment

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

야무지네욤

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/spacing18">
Copy link
Collaborator

Choose a reason for hiding this comment

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

이거보다 가이드 라인 주는 게 좋아보입니다
(마진 주면 마진 부분은 클릭 리스너 작동 안 할 듯요?)

android:id="@+id/tv_join_group_search_tag"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginVertical="38dp"
Copy link
Collaborator

Choose a reason for hiding this comment

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

35,,?

Comment on lines 44 to 46
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/tv_join_group_search_tag"
app:layout_constraintTop_toTopOf="parent"
Copy link
Collaborator

Choose a reason for hiding this comment

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

단체 키워드 칩에 중앙 정렬

android:id="@+id/imv_plan_location_check"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing10"
Copy link
Collaborator

Choose a reason for hiding this comment

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

얘도 단체 키워드 칩에 중앙 정렬 해주세요

@jihyunniiii
Copy link
Collaborator

버튼 활성화 로직 다음과 같은 방식으로 구현하면 될 것 같습니다.

  1. 단체를 선택하면 선택된 값을 어차피 서버 통신으로 넘겨야 하니 선택된 값을 저장할 변수(이걸 A라고 할게요)를 ViewModel 에 선언해줍니다.
  2. isSelected 값이 True로 바뀔 때 이 값을 A에 저장해 줍니다. False 로 바뀔 때는 null로 바꿔주세요
  3. A의 값이 null인지 아닌지의 값에 따라 버튼 활성화를 해줍니다

Comment on lines 39 to 40
_joinGroupSearchData.value[oldPosition].isSelected.set(false)
_joinGroupSearchData.value[newPosition].isSelected.set(true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

이건 왜 setIsSelected 함수 사용 안 하나요?

Copy link
Member Author

Choose a reason for hiding this comment

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

아 그러네요 고정되어야 된다고 생각했는데 그냥 둘다 반대로 주면되는거네요 ㅋㅎㅋㅋ

Copy link
Collaborator

@Dan2dani Dan2dani left a comment

Choose a reason for hiding this comment

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

코리완~

private fun checkListExist() {
with(binding) {
if (viewModel.checkJoinGroupSearchIsEmpty()) {
rvJoinGroupSearch.visibility = View.INVISIBLE
Copy link
Collaborator

Choose a reason for hiding this comment

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

리싸이클러뷰는 비지블 처리 필요없음

private fun checkListExist() {
with(binding) {
if (viewModel.checkJoinGroupSearchIsEmpty()) {
rvJoinGroupSearch.visibility = View.INVISIBLE
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
rvJoinGroupSearch.visibility = View.INVISIBLE
rvJoinGroupSearch.isVisible= viewModel.checkJoinGroupSearchIsEmpty

Copy link
Collaborator

Choose a reason for hiding this comment

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

아래 코리에 따라 이렇게 하지말고, joinGroupSearchData를 옵저빙해서 옵저빙한 값의 리스트가 엠티리스트인지 아닌지에 따라 isVisible처리해주세욤

_joinGroupSearchBtn.value = _joinGroupSearchData.value[newPosition].isSelected.get()
}

fun checkJoinGroupSearchIsEmpty() = _joinGroupSearchData.value.isEmpty()
Copy link
Collaborator

Choose a reason for hiding this comment

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

이거 굳이 함수로 만들필요 없을 거 같습니당

) : RecyclerView.ViewHolder(binding.root) {
fun onBind(item: JoinGroupSearchEntity) {
binding.joinGroupSearch = item
binding.root.setOnClickListener {
Copy link
Collaborator

Choose a reason for hiding this comment

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

클릭 리스너 관련 부분 init {} 으로 뺴기 ~

Comment on lines 20 to 21
private val _joinGroupSearchEditText = MutableLiveData<String>()
val joinGroupSearchEditText get() = _joinGroupSearchEditText
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
private val _joinGroupSearchEditText = MutableLiveData<String>()
val joinGroupSearchEditText get() = _joinGroupSearchEditText
val joinGroupSearchEditText = MutableLiveData("")

Copy link
Member Author

@DoReMinWoo DoReMinWoo left a comment

Choose a reason for hiding this comment

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

코드리뷰 반영해서 푸시했습니다!

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
Copy link
Member Author

Choose a reason for hiding this comment

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

헉 그러네용
처음에 제약을 잘못줘서 사용했던 것 같아요

Comment on lines 39 to 40
_joinGroupSearchData.value[oldPosition].isSelected.set(false)
_joinGroupSearchData.value[newPosition].isSelected.set(true)
Copy link
Member Author

Choose a reason for hiding this comment

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

아 그러네요 고정되어야 된다고 생각했는데 그냥 둘다 반대로 주면되는거네요 ㅋㅎㅋㅋ

Comment on lines 37 to 44
binding.etJoinGroupSearch.setOnKeyListener(
View.OnKeyListener { _, keyCode, event ->
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
checkListExist()
hideKeyboard(binding.etJoinGroupSearch)
return@OnKeyListener true
}
true
Copy link
Member Author

Choose a reason for hiding this comment

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

EditText 키보드드 엔터 클릭 리스너인데 생각해보니 리스너 2개가 필요하지 않을 것 같아서 수정하겠습니다~

# Conflicts:
#	app/src/main/java/org/sopt/pingle/presentation/ui/joingroup/JoinViewModel.kt
# Conflicts:
#	app/src/main/res/values/strings.xml
Copy link
Collaborator

@jihyunniiii jihyunniiii left a comment

Choose a reason for hiding this comment

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

검색창 마진만 수정하고 머지하세요

@DoReMinWoo DoReMinWoo merged commit c0f1407 into develop Jan 9, 2024
1 check passed
@DoReMinWoo DoReMinWoo deleted the faet-join-group-search-view branch January 9, 2024 15:56
import kotlinx.serialization.SerialName
import org.sopt.pingle.domain.model.JoinGroupSearchEntity

data class ResponseJoinGroupSearchDto(
Copy link
Collaborator

Choose a reason for hiding this comment

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

다 code라서 먼가했네 휴!! 임시Dto였던 거지??

import org.sopt.pingle.R
import org.sopt.pingle.databinding.ActivityJoinGroupSearchBinding
import org.sopt.pingle.util.base.BindingActivity
import org.sopt.pingle.util.context.hideKeyboard
Copy link
Collaborator

Choose a reason for hiding this comment

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

오마이갓 이것두 넣어야되는데ㅜ!!!!!!!!!!!!!1 다시 리팩토링 필요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[faet] 기존 단체 입장하기 뷰 구현
4 participants