-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: 지역 버튼 배경 * feat: SchoolRegionUiState 추가 * feat: RegionBottomSheetDialogFragment 구현 * feat: RegionBottomSheetDialogFragment 연결 * fix: 페이징 loadMore인 경우 구분 * refactor: "지역별" string 리소스 사용 * fix: 축제 loadMore 시 지역 필터링 유지 * fix: 새로고침시 지역 필터링 유지 * feat: 축제 목록 다른 탭 클릭 시 로딩중 임을 보여준다. * chore: ktlint check --------- Co-authored-by: vrexpert <[email protected]>
- Loading branch information
1 parent
483b8d5
commit a5921ae
Showing
20 changed files
with
413 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...n/java/com/festago/festago/presentation/ui/home/festivallist/bottomsheet/RegionAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.festago.festago.presentation.ui.home.festivallist.bottomsheet | ||
|
||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.festago.festago.domain.model.festival.SchoolRegion | ||
import com.festago.festago.presentation.ui.home.festivallist.uistate.SchoolRegionUiState | ||
|
||
class RegionAdapter( | ||
private val items: List<SchoolRegionUiState>, | ||
private val onRegionSelect: (SchoolRegion) -> Unit, | ||
private val onDismiss: () -> Unit, | ||
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { | ||
return RegionItemViewHolder.of(parent, onRegionSelect, onDismiss) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return items.size | ||
} | ||
|
||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { | ||
(holder as RegionItemViewHolder).bind(items[position]) | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
.../festago/presentation/ui/home/festivallist/bottomsheet/RegionBottomSheetDialogFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.festago.festago.presentation.ui.home.festivallist.bottomsheet | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.festago.festago.domain.model.festival.SchoolRegion | ||
import com.festago.festago.presentation.databinding.FragmentRegionBottomSheetBinding | ||
import com.festago.festago.presentation.ui.home.festivallist.uistate.SchoolRegionUiState | ||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class RegionBottomSheetDialogFragment() : BottomSheetDialogFragment() { | ||
|
||
private var _binding: FragmentRegionBottomSheetBinding? = null | ||
private val binding: FragmentRegionBottomSheetBinding get() = _binding!! | ||
|
||
private lateinit var listener: OnRegionSelectListener | ||
private lateinit var items: List<SchoolRegionUiState> | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
_binding = FragmentRegionBottomSheetBinding.inflate(inflater) | ||
binding.lifecycleOwner = viewLifecycleOwner | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
initView() | ||
} | ||
|
||
private fun initView() { | ||
binding.rvRegionList.adapter = RegionAdapter( | ||
items = items, | ||
onRegionSelect = listener::onRegionSelect | ||
) { dismiss() } | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
|
||
interface OnRegionSelectListener { | ||
fun onRegionSelect(region: SchoolRegion) | ||
} | ||
|
||
companion object { | ||
fun newInstance( | ||
items: List<SchoolRegionUiState>, | ||
listener: OnRegionSelectListener, | ||
): RegionBottomSheetDialogFragment = RegionBottomSheetDialogFragment().apply { | ||
this.listener = listener | ||
this.items = items | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...com/festago/festago/presentation/ui/home/festivallist/bottomsheet/RegionItemViewHolder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.festago.festago.presentation.ui.home.festivallist.bottomsheet | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.festago.festago.domain.model.festival.SchoolRegion | ||
import com.festago.festago.presentation.databinding.ItemRegionBinding | ||
import com.festago.festago.presentation.ui.home.festivallist.uistate.SchoolRegionUiState | ||
|
||
class RegionItemViewHolder( | ||
private val binding: ItemRegionBinding, | ||
private val onRegionSelect: (SchoolRegion) -> Unit, | ||
private val onDismiss: () -> Unit | ||
) : RecyclerView.ViewHolder(binding.root) { | ||
fun bind(item: SchoolRegionUiState) { | ||
binding.item = item | ||
with(binding.tvRegion) { | ||
this.isSelected = item.isSelected | ||
setOnClickListener { | ||
onRegionSelect(item.schoolRegion) | ||
onDismiss.invoke() | ||
} | ||
} | ||
} | ||
|
||
companion object { | ||
fun of( | ||
parent: ViewGroup, | ||
onRegionSelect: (SchoolRegion) -> Unit, | ||
onDismiss: () -> Unit | ||
): RegionItemViewHolder { | ||
val binding = ItemRegionBinding.inflate( | ||
LayoutInflater.from(parent.context), | ||
parent, | ||
false, | ||
) | ||
return RegionItemViewHolder(binding, onRegionSelect, onDismiss) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
.../java/com/festago/festago/presentation/ui/home/festivallist/uistate/FestivalTabUiState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
package com.festago.festago.presentation.ui.home.festivallist.uistate | ||
|
||
import com.festago.festago.domain.model.festival.SchoolRegion | ||
|
||
data class FestivalTabUiState( | ||
val selectedFilter: FestivalFilterUiState, | ||
val selectedRegion: SchoolRegion?, | ||
val onFilterSelected: (FestivalFilterUiState) -> Unit, | ||
val onRegionClick: () -> Unit, | ||
) |
8 changes: 8 additions & 0 deletions
8
...java/com/festago/festago/presentation/ui/home/festivallist/uistate/SchoolRegionUiState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.festago.festago.presentation.ui.home.festivallist.uistate | ||
|
||
import com.festago.festago.domain.model.festival.SchoolRegion | ||
|
||
data class SchoolRegionUiState( | ||
val schoolRegion: SchoolRegion, | ||
val isSelected: Boolean, | ||
) |
8 changes: 8 additions & 0 deletions
8
android/festago/presentation/src/main/res/drawable/bg_btn_region_check.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<corners android:radius="16dp" /> | ||
<stroke | ||
android:width="1dp" | ||
android:color="@color/primary_blue_07" /> | ||
<solid android:color="@color/primary_blue_01" /> | ||
</shape> |
Oops, something went wrong.