Skip to content

Commit

Permalink
feat : 새 재생목록 추가 버튼 클릭 throttleFist 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
2taezeat committed Dec 13, 2023
1 parent e4f24ea commit 342f5a5
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ import android.view.View
import androidx.core.view.ViewCompat
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavController
import androidx.navigation.fragment.findNavController
import com.ohdodok.catchytape.core.domain.utils.throttleFist
import com.ohdodok.catchytape.core.ui.BaseFragment
import com.ohdodok.catchytape.core.ui.PlaylistAdapter
import com.ohdodok.catchytape.core.ui.RootViewInsetsCallback
import com.ohdodok.catchytape.core.ui.cterror.toMessageId
import com.ohdodok.catchytape.feature.playlist.databinding.FragmentPlaylistsBinding
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach

@AndroidEntryPoint
class PlaylistsFragment : BaseFragment<FragmentPlaylistsBinding>(R.layout.fragment_playlists),
Expand All @@ -28,11 +32,16 @@ class PlaylistsFragment : BaseFragment<FragmentPlaylistsBinding>(R.layout.fragme
viewModel.fetchPlaylists()

observeEvents()
val newPlaylistDialog = NewPlaylistDialog()
setupButton(NewPlaylistDialog())
}

private fun setupButton(newPlaylistDialog: NewPlaylistDialog) {
binding.fabNewPlaylist.setOnClickListener {
newPlaylistDialog.show(childFragmentManager, NewPlaylistDialog.TAG)
clicksFlow(view = it).throttleFist(500)
.onEach {
newPlaylistDialog.show(childFragmentManager, NewPlaylistDialog.TAG)
}.launchIn(viewLifecycleOwner.lifecycleScope)
}

}

private fun observeEvents() {
Expand Down

0 comments on commit 342f5a5

Please sign in to comment.