2019-04-20 05:29:45 +00:00
|
|
|
package code.name.monkey.retromusic.fragments.base
|
2018-11-30 01:06:16 +00:00
|
|
|
|
|
|
|
import android.os.Bundle
|
|
|
|
import android.view.View
|
|
|
|
import android.view.animation.AccelerateInterpolator
|
|
|
|
import android.view.animation.DecelerateInterpolator
|
2020-07-30 14:11:19 +00:00
|
|
|
import androidx.annotation.LayoutRes
|
2019-04-04 06:07:55 +00:00
|
|
|
import code.name.monkey.retromusic.R
|
2019-04-20 05:29:45 +00:00
|
|
|
import code.name.monkey.retromusic.fragments.VolumeFragment
|
2019-10-04 10:58:28 +00:00
|
|
|
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
2020-05-23 09:27:55 +00:00
|
|
|
|
2020-06-06 18:57:28 +00:00
|
|
|
import code.name.monkey.retromusic.util.PreferenceUtil
|
2020-05-18 07:22:18 +00:00
|
|
|
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
2019-04-04 06:07:55 +00:00
|
|
|
|
2018-11-30 01:06:16 +00:00
|
|
|
/**
|
|
|
|
* Created by hemanths on 24/09/17.
|
|
|
|
*/
|
|
|
|
|
2020-07-30 14:11:19 +00:00
|
|
|
abstract class AbsPlayerControlsFragment(@LayoutRes layout: Int) : AbsMusicServiceFragment(layout),
|
2020-02-26 16:49:24 +00:00
|
|
|
MusicProgressViewUpdateHelper.Callback {
|
2018-11-30 01:06:16 +00:00
|
|
|
|
|
|
|
protected abstract fun show()
|
|
|
|
|
|
|
|
protected abstract fun hide()
|
|
|
|
|
|
|
|
protected abstract fun updateShuffleState()
|
|
|
|
|
|
|
|
protected abstract fun updateRepeatState()
|
|
|
|
|
|
|
|
protected abstract fun setUpProgressSlider()
|
|
|
|
|
2020-05-18 07:22:18 +00:00
|
|
|
abstract fun setColor(color: MediaNotificationProcessor)
|
2018-11-30 01:06:16 +00:00
|
|
|
|
2018-12-05 12:13:50 +00:00
|
|
|
fun showBonceAnimation(view: View) {
|
|
|
|
view.apply {
|
|
|
|
clearAnimation()
|
|
|
|
scaleX = 0.9f
|
|
|
|
scaleY = 0.9f
|
|
|
|
visibility = View.VISIBLE
|
|
|
|
pivotX = (view.width / 2).toFloat()
|
|
|
|
pivotY = (view.height / 2).toFloat()
|
|
|
|
|
|
|
|
animate().setDuration(200)
|
2020-01-06 03:12:32 +00:00
|
|
|
.setInterpolator(DecelerateInterpolator())
|
|
|
|
.scaleX(1.1f)
|
|
|
|
.scaleY(1.1f)
|
|
|
|
.withEndAction {
|
|
|
|
animate().setDuration(200)
|
|
|
|
.setInterpolator(AccelerateInterpolator())
|
|
|
|
.scaleX(1f)
|
|
|
|
.scaleY(1f)
|
|
|
|
.alpha(1f)
|
|
|
|
.start()
|
|
|
|
}
|
|
|
|
.start()
|
2018-12-05 12:13:50 +00:00
|
|
|
}
|
2018-11-30 01:06:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
|
super.onViewCreated(view, savedInstanceState)
|
2018-12-05 12:13:50 +00:00
|
|
|
hideVolumeIfAvailable()
|
|
|
|
}
|
2018-12-05 04:29:55 +00:00
|
|
|
|
2019-04-04 06:07:55 +00:00
|
|
|
protected var volumeFragment: VolumeFragment? = null
|
|
|
|
|
2018-12-05 12:13:50 +00:00
|
|
|
private fun hideVolumeIfAvailable() {
|
2020-06-06 18:57:28 +00:00
|
|
|
if (PreferenceUtil.isVolumeVisibilityMode) {
|
2020-05-23 13:53:10 +00:00
|
|
|
childFragmentManager.beginTransaction()
|
|
|
|
.replace(R.id.volumeFragmentContainer, VolumeFragment()).commit()
|
2019-10-04 10:58:28 +00:00
|
|
|
childFragmentManager.executePendingTransactions()
|
2020-05-23 13:53:10 +00:00
|
|
|
volumeFragment =
|
|
|
|
childFragmentManager.findFragmentById(R.id.volumeFragmentContainer) as VolumeFragment?
|
2019-04-04 06:07:55 +00:00
|
|
|
}
|
2019-02-23 17:39:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
const val SLIDER_ANIMATION_TIME: Long = 400
|
2018-11-30 01:06:16 +00:00
|
|
|
}
|
|
|
|
}
|