Skip to content

Commit

Permalink
feat : 불필요한 코드 제거 및 databinding 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
2taezeat committed Dec 7, 2023
1 parent 687d4fd commit 0ebd68b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
16 changes: 0 additions & 16 deletions android/app/src/main/java/com/ohdodok/catchytape/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import androidx.navigation.ui.setupWithNavController
import com.ohdodok.catchytape.databinding.ActivityMainBinding
import com.ohdodok.catchytape.feature.player.PlayerListener
import com.ohdodok.catchytape.feature.player.PlayerViewModel
import com.ohdodok.catchytape.feature.player.changeMoveBtnState
import com.ohdodok.catchytape.feature.player.changePlayBtnState
import com.ohdodok.catchytape.feature.player.getMediasWithMetaData
import com.ohdodok.catchytape.feature.player.millisecondsPerSecond
import com.ohdodok.catchytape.feature.player.moveNextMedia
Expand Down Expand Up @@ -144,11 +142,6 @@ class MainActivity : AppCompatActivity() {

private fun showPlayerController() {
binding.pcvController.visibility = View.VISIBLE
player.changePlayBtnState(binding.pcvController.playImageView)
player.changeMoveBtnState(
binding.pcvController.moveNextImageView,
binding.pcvController.movePreviousImageView
)
}

private fun setupPlayer() {
Expand Down Expand Up @@ -191,26 +184,17 @@ class MainActivity : AppCompatActivity() {
if (playViewModel.uiState.value.isPlaying) player.pause()
else player.play()
}
player.changePlayBtnState(binding.pcvController.playImageView)
}

private fun setupPreviousButton() {
binding.pcvController.setOnPreviousButtonClick {
player.movePreviousMedia()
player.changeMoveBtnState(
binding.pcvController.moveNextImageView,
binding.pcvController.movePreviousImageView
)
}
}

private fun setupNextButton() {
binding.pcvController.setOnNextButtonClick {
player.moveNextMedia()
player.changeMoveBtnState(
binding.pcvController.moveNextImageView,
binding.pcvController.movePreviousImageView
)
}
}
}
3 changes: 3 additions & 0 deletions android/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:music="@{viewModel.uiState.currentMusic}"
app:nextEnabled="@{viewModel.uiState.nextEnable}"
app:playEnabled="@{viewModel.uiState.playEnable}"
app:playing="@{viewModel.uiState.isPlaying}"
app:previousEnabled="@{viewModel.uiState.previousEnable}"
app:progress="@{viewModel.uiState.currentPositionSecond}" />

<com.google.android.material.bottomnavigation.BottomNavigationView
Expand Down

0 comments on commit 0ebd68b

Please sign in to comment.