Skip to content

Commit

Permalink
#11 / [ADD] Progress Bar 로티로 교체
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchbreeze committed Jun 9, 2023
1 parent cb43dc2 commit 0c912ba
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ class LoadingDialogFragment :
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

initDialogCancelable()
}

private fun initDialogCancelable() {
dialog?.setCancelable(false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ class FollowerFragment : BindingFragment<FragmentFollowerBinding>(R.layout.fragm
private val followerList = mutableListOf<FollowerResponseDTO.User>()
private val followerAdapter = FollowerAdapter()

private var _loadingDialog: LoadingDialogFragment? = null
val loadingDialog get() = requireNotNull(_loadingDialog!!) { "${this::class.java.simpleName}에서 에러가 발생했습니다." }
private lateinit var loadingDialogFragment: LoadingDialogFragment

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

binding.rvFollower.adapter = followerAdapter
_loadingDialog = LoadingDialogFragment()

loadingDialogFragment = LoadingDialogFragment()
parentFragmentManager.beginTransaction().add(R.id.fcv_main, loadingDialogFragment).commit()

// 뷰모델 observer 설정
viewModel.followerResult.observe(viewLifecycleOwner) { followerResult ->
Expand All @@ -37,7 +38,7 @@ class FollowerFragment : BindingFragment<FragmentFollowerBinding>(R.layout.fragm

// 두 페이지의 12명이 모두 들어올 때까지 보이도록 설정
if (followerList.size == 12) {
binding.progressBarFollower.visibility = View.GONE
loadingDialogFragment.dismiss()
}
}
viewModel.errorResult.observe(viewLifecycleOwner) { errorResult ->
Expand Down
22 changes: 0 additions & 22 deletions app/src/main/res/layout/fragment_follower.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/progress_bar_follower"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:elevation="1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<ProgressBar
android:layout_width="0dp"
android:layout_height="80dp"
android:background="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_follower"
android:layout_width="match_parent"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/fragment_loading_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_loading"
android:background="@color/half_transparent"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lav_loading"
android:layout_width="160dp"
android:layout_width="200dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@
<color name="teal_A700">#00bfa5</color>

<color name="transparent">#00FFFFFF</color>
<color name="half_transparent">#80FFFFFF</color>
</resources>

0 comments on commit 0c912ba

Please sign in to comment.