diff --git a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt index 22c87fe..eadc36b 100644 --- a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt +++ b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt @@ -16,8 +16,11 @@ savedInstanceState: Bundle? ): View? { binding = FragmentPlayBinding.inflate(inflater) - binding.playSwitch.setOnCheckedChangeListener { _, isOn -> - Rhythm.on = isOn + binding.playButton.setOnClickListener { + Rhythm.on = !Rhythm.on + binding.playButton.setImageResource( + if (Rhythm.on) android.R.drawable.ic_media_pause else android.R.drawable.ic_media_play + ) } return binding.root } diff --git a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt index 22c87fe..eadc36b 100644 --- a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt +++ b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt @@ -16,8 +16,11 @@ savedInstanceState: Bundle? ): View? { binding = FragmentPlayBinding.inflate(inflater) - binding.playSwitch.setOnCheckedChangeListener { _, isOn -> - Rhythm.on = isOn + binding.playButton.setOnClickListener { + Rhythm.on = !Rhythm.on + binding.playButton.setImageResource( + if (Rhythm.on) android.R.drawable.ic_media_pause else android.R.drawable.ic_media_play + ) } return binding.root } diff --git a/app/src/main/res/layout/fragment_play.xml b/app/src/main/res/layout/fragment_play.xml index e960c03..e66caea 100644 --- a/app/src/main/res/layout/fragment_play.xml +++ b/app/src/main/res/layout/fragment_play.xml @@ -10,16 +10,17 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - + app:layout_constraintTop_toTopOf="parent" /> \ No newline at end of file