-
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
[mod] 상세페이지 홈페이지, 인스타, 전화번호 없는 경우에 대한 분기처리, 상세페이지, 검색뷰, 필터뷰 이슈 해결 #229
Changes from 6 commits
c5438bd
e78cb12
1823575
e8760e6
ab9b67a
ff5a888
606d220
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,13 +8,14 @@ import com.google.android.material.chip.ChipGroup | |
import com.sopt.geonppang.R | ||
import com.sopt.geonppang.databinding.ItemBakeryBinding | ||
import com.sopt.geonppang.domain.model.BakeryInformation | ||
import com.sopt.geonppang.presentation.type.BreadFilterType | ||
import com.sopt.geonppang.util.ItemDiffCallback | ||
import com.sopt.geonppang.util.extension.loadingImage | ||
import com.sopt.geonppang.util.extension.setOnSingleClickListener | ||
|
||
class BakeryAdapter( | ||
private val moveToDetail: (Int) -> Unit, | ||
private val initBreadTypeChips: (ChipGroup, Int) -> Unit, | ||
private val initBreadTypeChips: (ChipGroup, List<BreadFilterType>) -> Unit, | ||
) : ListAdapter<BakeryInformation, BakeryAdapter.BakeryViewHolder>( | ||
ItemDiffCallback<BakeryInformation>( | ||
onItemsTheSame = { old, new -> old.bakeryId == new.bakeryId }, | ||
|
@@ -28,16 +29,15 @@ class BakeryAdapter( | |
fun onBind( | ||
bakery: BakeryInformation, | ||
moveToDetail: (Int) -> Unit, | ||
initBreadTypeChips: (ChipGroup, Int) -> Unit, | ||
position: Int | ||
initBreadTypeChips: (ChipGroup, List<BreadFilterType>) -> Unit | ||
) { | ||
binding.bakery = bakery | ||
binding.executePendingBindings() | ||
|
||
// TODO: dana 다른 방식이 있는지 고민, 매 바인딩마다 removeAllViews 해야하는가 ? | ||
with(binding.cgBakeryBreadTypes) { | ||
this.removeAllViews() | ||
initBreadTypeChips(this, position) | ||
initBreadTypeChips(this, bakery.breadTypeList) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오옹 이 방식으로 햇어야 했네여 |
||
} | ||
|
||
binding.root.setOnSingleClickListener { | ||
|
@@ -59,6 +59,6 @@ class BakeryAdapter( | |
} | ||
|
||
override fun onBindViewHolder(holder: BakeryViewHolder, position: Int) { | ||
holder.onBind(getItem(position), moveToDetail, initBreadTypeChips, position) | ||
holder.onBind(getItem(position), moveToDetail, initBreadTypeChips) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ import com.sopt.geonppang.presentation.common.BakeryAdapter | |
import com.sopt.geonppang.presentation.detail.DetailActivity | ||
import com.sopt.geonppang.presentation.detail.DetailActivity.Companion.SOURCE | ||
import com.sopt.geonppang.presentation.detail.DetailActivity.Companion.VIEW_DETAIL_PAGE_AT | ||
import com.sopt.geonppang.presentation.type.BreadFilterType | ||
import com.sopt.geonppang.util.AmplitudeUtils | ||
import com.sopt.geonppang.util.CustomItemDecoration | ||
import com.sopt.geonppang.util.UiState | ||
|
@@ -85,17 +86,16 @@ class MyBookMarksActivity : | |
startActivity(intent) | ||
} | ||
|
||
private fun initBreadTypeChips(chipGroup: ChipGroup, position: Int) { | ||
if (myBookMarkBakeryList.isNotEmpty()) { | ||
myBookMarkBakeryList.get(position).breadTypeList.let { breadTypeList -> | ||
chipGroup.breadTypeListToChips( | ||
breadTypeList = breadTypeList, | ||
toChip = { | ||
this.toBreadTypePointM2Chip(layoutInflater) | ||
} | ||
) | ||
private fun initBreadTypeChips( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 흠 그러게요 chip 관련이라 같이 따로 확장함수로 빼도 괜찮을 것 같긴 합니당 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이게 제가 모든 로직 확장함수로 빼려다가 일부만 뺀게, 리스트로 넘어오는 타입(BreadFilterType, ReviewData 등,, ) 이 다 다른데 거기서 breadType을 generic으로 받아서 접근할 수 가 없음여,,, 가능하면 빼면 좋을 거 같긴 하네염 근데 이게 경우의 수가 겁나 많아서 좀 고민이 필요함! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 마자요 ㅜ 저도 그래서 빼려다가 안 뺐는데 ㅜ 이따가 같이 고민해보면 좋을 것 같습니다 ~~ |
||
chipGroup: ChipGroup, | ||
breadTypeList: List<BreadFilterType> | ||
) { | ||
chipGroup.breadTypeListToChips( | ||
breadTypeList = breadTypeList, | ||
toChip = { | ||
this.toBreadTypePointM2Chip(layoutInflater) | ||
} | ||
} | ||
) | ||
} | ||
|
||
companion object { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,11 @@ import androidx.recyclerview.widget.ConcatAdapter | |
import com.google.android.material.chip.ChipGroup | ||
import com.sopt.geonppang.R | ||
import com.sopt.geonppang.databinding.ActivitySearchBinding | ||
import com.sopt.geonppang.domain.model.BakeryInformation | ||
import com.sopt.geonppang.presentation.common.BakeryAdapter | ||
import com.sopt.geonppang.presentation.detail.DetailActivity | ||
import com.sopt.geonppang.presentation.detail.DetailActivity.Companion.SOURCE | ||
import com.sopt.geonppang.presentation.detail.DetailActivity.Companion.VIEW_DETAIL_PAGE_AT | ||
import com.sopt.geonppang.presentation.type.BreadFilterType | ||
import com.sopt.geonppang.util.AmplitudeUtils | ||
import com.sopt.geonppang.util.CustomItemDecoration | ||
import com.sopt.geonppang.util.UiState | ||
|
@@ -34,8 +34,6 @@ class SearchActivity : BindingActivity<ActivitySearchBinding>(R.layout.activity_ | |
private lateinit var bakeryAdapter: BakeryAdapter | ||
private lateinit var searchCountAdapter: SearchCountAdapter | ||
|
||
private var bakeryInformationList = listOf<BakeryInformation>() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding.viewModel = viewModel | ||
|
@@ -86,8 +84,6 @@ class SearchActivity : BindingActivity<ActivitySearchBinding>(R.layout.activity_ | |
completeFilteringInParticularView() | ||
viewModel.searchBakeryList() | ||
searchCountAdapter.setSearchData(it.data) | ||
|
||
bakeryInformationList = it.data.bakeryList | ||
bakeryAdapter.submitList(it.data.bakeryList) | ||
} | ||
|
||
|
@@ -129,17 +125,16 @@ class SearchActivity : BindingActivity<ActivitySearchBinding>(R.layout.activity_ | |
return super.dispatchTouchEvent(ev) | ||
} | ||
|
||
private fun initBreadTypeChips(chipGroup: ChipGroup, position: Int) { | ||
if (bakeryInformationList.isNotEmpty()) { | ||
bakeryInformationList.get(position).breadTypeList.let { breadTypeIdList -> | ||
chipGroup.breadTypeListToChips( | ||
breadTypeList = breadTypeIdList, | ||
toChip = { | ||
this.toBreadTypePointM2Chip(layoutInflater) | ||
} | ||
) | ||
private fun initBreadTypeChips( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 음하하 ㅋ.ㅋ |
||
chipGroup: ChipGroup, | ||
breadTypeList: List<BreadFilterType> | ||
) { | ||
chipGroup.breadTypeListToChips( | ||
breadTypeList = breadTypeList, | ||
toChip = { | ||
this.toBreadTypePointM2Chip(layoutInflater) | ||
} | ||
} | ||
) | ||
} | ||
|
||
companion object { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,7 +108,7 @@ | |
app:chipSpacingHorizontal="4dp" | ||
app:layout_constraintEnd_toEndOf="@+id/tv_item_detail_bakery_info_bakery_name" | ||
app:layout_constraintStart_toStartOf="@+id/tv_item_detail_bakery_info_bakery_name" | ||
app:layout_constraintTop_toBottomOf="@id/tv_item_detail_bakery_info_bakery_name"/> | ||
app:layout_constraintTop_toBottomOf="@id/tv_item_detail_bakery_info_bakery_name" /> | ||
|
||
<ImageView | ||
android:id="@+id/iv_item_detail_bakery_info_bookmark" | ||
|
@@ -228,7 +228,7 @@ | |
|
||
<TextView | ||
android:id="@+id/tv_item_detail_bakery_info_homepage" | ||
visibility="@{!bakeryInfo.homepageUrl.isEmpty()}" | ||
visibility="@{!bakeryInfo.homepageUrl.trim().isEmpty()}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. trim()을 적용해야 하는 이유가 있나염?! There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 아항 ㅜㅜ |
||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="4dp" | ||
|
@@ -244,7 +244,7 @@ | |
|
||
<TextView | ||
android:id="@+id/tv_item_detail_bakery_info_instagram" | ||
visibility="@{!bakeryInfo.instagramUrl.isEmpty()}" | ||
visibility="@{!bakeryInfo.instagramUrl.trim().isEmpty()}" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="4dp" | ||
|
@@ -338,39 +338,27 @@ | |
app:layout_constraintTop_toBottomOf="@+id/tv_item_detail_bakery_info_time_holiday" | ||
tools:text="수-금 12:00 ~ 19:00 / 토-일 13:00 ~ 19:00 " /> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:id="@+id/layout_item_detail_bakery_info_call" | ||
visibility="@{!bakeryInfo.phoneNumber.isEmpty()}" | ||
android:layout_width="0dp" | ||
<ImageView | ||
android:id="@+id/iv_item_detail_bakery_info_call" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:paddingTop="@dimen/spacing16" | ||
app:layout_constraintEnd_toStartOf="@+id/gl_end" | ||
android:layout_marginTop="@dimen/spacing16" | ||
android:src="@drawable/ic_call" | ||
app:layout_constraintStart_toStartOf="@+id/gl_start" | ||
app:layout_constraintTop_toBottomOf="@+id/tv_item_detail_bakery_info_time"> | ||
app:layout_constraintTop_toBottomOf="@+id/tv_item_detail_bakery_info_time" /> | ||
|
||
<ImageView | ||
android:id="@+id/iv_item_detail_bakery_info_call" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/ic_call" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_item_detail_bakery_info_call" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="12dp" | ||
android:text="@{bakeryInfo.phoneNumber}" | ||
android:textAppearance="@style/TextAppearance.Subhead" | ||
android:textColor="@color/gray_400" | ||
app:layout_constraintBottom_toBottomOf="@+id/iv_item_detail_bakery_info_call" | ||
app:layout_constraintStart_toEndOf="@+id/iv_item_detail_bakery_info_call" | ||
app:layout_constraintTop_toTopOf="@+id/iv_item_detail_bakery_info_call" | ||
tools:text="02-033-3333" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
<TextView | ||
android:id="@+id/tv_item_detail_bakery_info_call" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="12dp" | ||
android:text="@{bakeryInfo.phoneNumber}" | ||
android:textAppearance="@style/TextAppearance.Subhead" | ||
android:textColor="@color/gray_400" | ||
app:layout_constraintBottom_toBottomOf="@+id/iv_item_detail_bakery_info_call" | ||
app:layout_constraintStart_toEndOf="@+id/iv_item_detail_bakery_info_call" | ||
app:layout_constraintTop_toTopOf="@+id/iv_item_detail_bakery_info_call" | ||
tools:text="02-033-3333" /> | ||
|
||
<View | ||
android:id="@+id/view_item_detail_bakery_info_second_line" | ||
|
@@ -380,7 +368,7 @@ | |
android:background="@color/gray_200" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/layout_item_detail_bakery_info_call" /> | ||
app:layout_constraintTop_toBottomOf="@id/iv_item_detail_bakery_info_call" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_item_detail_bakery_info_menu" | ||
|
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.
ㅋㅋㅋㅋㅋ 오 감사합니다