[6.3.0]
[包车音乐播放]
@@ -41,6 +41,7 @@ import kotlinx.android.synthetic.main.charter_p_main_fragment.biz_selectline
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.biz_softcontrol
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.biz_video
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.mapBizView
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.mcv_play_music
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.omvOverMap
|
||||
//import kotlinx.android.synthetic.main.charter_p_main_fragment.viewBusPM1MsgBoxBubble
|
||||
//import kotlinx.android.synthetic.main.charter_p_main_fragment.viewBusPM1MsgBoxButton
|
||||
@@ -140,6 +141,7 @@ class MainFragment : MvpFragment<MainFragment?, BusPassengerPresenter?>(), IMogo
|
||||
BottomBar.SelectView.SETTING -> showBizView(softControl = true)
|
||||
BottomBar.SelectView.LINE -> showBizView(selectLine = true)
|
||||
BottomBar.SelectView.VIDEO -> showBizView(showVideo = true)
|
||||
BottomBar.SelectView.MUSIC -> showBizView(showMusic = true)
|
||||
else -> {
|
||||
showBizView()
|
||||
statusBarView?.setBackgroudColor(R.color.charter_p_80ffffff)
|
||||
@@ -178,7 +180,8 @@ class MainFragment : MvpFragment<MainFragment?, BusPassengerPresenter?>(), IMogo
|
||||
orderinfo: Boolean = false,
|
||||
softControl: Boolean = false,
|
||||
selectLine: Boolean = false,
|
||||
showVideo: Boolean = false
|
||||
showVideo: Boolean = false,
|
||||
showMusic: Boolean = false
|
||||
) {
|
||||
if (orderinfo) {
|
||||
biz_orderinfo.visibility = View.VISIBLE
|
||||
@@ -204,6 +207,12 @@ class MainFragment : MvpFragment<MainFragment?, BusPassengerPresenter?>(), IMogo
|
||||
} else {
|
||||
biz_video.visibility = View.GONE
|
||||
}
|
||||
if(showMusic) {
|
||||
mcv_play_music.visibility = View.VISIBLE
|
||||
statusBarView?.setBackgroudColor(R.color.charter_p_40ffffff)
|
||||
}else{
|
||||
mcv_play_music.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
fun setCarModel(rawInfo: Int) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.mogo.och.charter.passenger.R
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.aciv_center_image
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.actv_close_door
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.actv_line
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.actv_music
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.actv_open_door
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.actv_setting
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.actv_stop_site
|
||||
@@ -40,6 +41,10 @@ class BottomBar @JvmOverloads constructor(
|
||||
actv_line.onClick {
|
||||
setCheckIndex(SelectView.LINE)
|
||||
}
|
||||
actv_music.onClick {
|
||||
|
||||
setCheckIndex(SelectView.MUSIC)
|
||||
}
|
||||
}
|
||||
fun setCheckChangeListener(overMapViewApply:ApplyClickLintener){
|
||||
this.overMapViewApply = overMapViewApply
|
||||
@@ -79,11 +84,16 @@ class BottomBar @JvmOverloads constructor(
|
||||
}else{
|
||||
actv_line.setCheckItem(false)
|
||||
}
|
||||
if(checkIndex == SelectView.MUSIC){
|
||||
actv_music.setCheckItem(true)
|
||||
}else{
|
||||
actv_music.setCheckItem(false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enum class SelectView{
|
||||
NONE,ORDERINFO,SETTING,LINE,VIDEO
|
||||
NONE,ORDERINFO,SETTING,LINE,VIDEO,MUSIC
|
||||
}
|
||||
|
||||
interface ApplyClickLintener{
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.mogo.och.charter.passenger.ui.music
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.charter.passenger.ui.music.list.MusicListView
|
||||
import com.mogo.och.common.module.manager.auditionmanager.MusicData
|
||||
import kotlinx.android.synthetic.main.charter_p_music.view.mlv_list
|
||||
import kotlinx.android.synthetic.main.charter_p_music.view.mpv_music_info
|
||||
|
||||
|
||||
class MusicControlView : ConstraintLayout, MusicControlViewModel.MusicCallback {
|
||||
|
||||
private val TAG = "MusicControlView"
|
||||
|
||||
private var viewModel: MusicControlViewModel? = null
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context, attributeSet, defStyleAttr
|
||||
)
|
||||
|
||||
constructor(
|
||||
context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int
|
||||
) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.charter_p_music, this, true)
|
||||
|
||||
mlv_list.setCheckItemListener(object : MusicListView.CheckListener{
|
||||
override fun checkItem(musicData: MusicData) {
|
||||
mpv_music_info.setData(musicData)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(MusicControlViewModel::class.java)
|
||||
}
|
||||
viewModel?.setViewCallback(this)
|
||||
}
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.mogo.och.charter.passenger.ui.music
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils
|
||||
import com.mogo.och.common.module.manager.devicemanage.callback.LightAirconditionDoorCallback
|
||||
import com.mogo.och.common.module.manager.devicemanage.LightAirconditionDoorStatusManager
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.AirconditionStatus
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.HeaterStatue
|
||||
import com.mogo.och.common.module.manager.devicemanage.data.LightStatus
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
class MusicControlViewModel : ViewModel() {
|
||||
|
||||
private val TAG = MusicControlViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: MusicCallback? = null
|
||||
|
||||
|
||||
init {
|
||||
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
}
|
||||
|
||||
fun setViewCallback(viewCallback: MusicCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
}
|
||||
|
||||
|
||||
interface MusicCallback {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.mogo.och.charter.passenger.ui.music.list
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Build
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.common.module.manager.auditionmanager.MusicData
|
||||
import com.mogo.och.common.module.manager.auditionmanager.PlayState
|
||||
|
||||
/**
|
||||
* Created by adityagohad on 06/06/17.
|
||||
*/
|
||||
class MusicListItemAdapter(
|
||||
private val context: Context,
|
||||
private val dataList: MutableList<MusicData>,
|
||||
private val clickListener: ClickListener
|
||||
) : RecyclerView.Adapter<MusicListItemAdapter.TextVH>() {
|
||||
|
||||
val gradientDrawable = GradientDrawable().also {
|
||||
it.shape = GradientDrawable.RECTANGLE
|
||||
val firstColor = ContextCompat.getColor(context, android.R.color.transparent)
|
||||
val setondColor = ContextCompat.getColor(context, R.color.charter_p_4DFFFFFF)
|
||||
val thirdColor = ContextCompat.getColor(context, R.color.charter_p_4DFFFFFF)
|
||||
val fourceColor = ContextCompat.getColor(context, R.color.charter_p_4DFFFFFF)
|
||||
val fifthColor = ContextCompat.getColor(context, android.R.color.transparent)
|
||||
|
||||
it.orientation = GradientDrawable.Orientation.LEFT_RIGHT
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
it.setColors(intArrayOf(firstColor, setondColor, thirdColor, fourceColor,fifthColor),
|
||||
floatArrayOf(0.0f,0.3f,0.6f,0.9f,1f)
|
||||
)
|
||||
}else{
|
||||
it.colors = intArrayOf(firstColor, setondColor, thirdColor, fourceColor)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TextVH {
|
||||
val view: View
|
||||
val inflater = LayoutInflater.from(context)
|
||||
view = inflater.inflate(R.layout.charter_p_music_list_item, parent, false)
|
||||
return TextVH(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: TextVH, position: Int) {
|
||||
val musicData = dataList[holder.bindingAdapterPosition]
|
||||
|
||||
holder.musicName.text = musicData.songName
|
||||
holder.itemView.setOnClickListener {
|
||||
clickListener.clickItem(musicData)
|
||||
}
|
||||
|
||||
if (musicData.state==PlayState.Playing||musicData.state==PlayState.Pause) {
|
||||
holder.musicPlayState.visibility = View.VISIBLE
|
||||
holder.itemView.background = gradientDrawable
|
||||
}else{
|
||||
holder.itemView.background = null
|
||||
holder.musicPlayState.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return dataList.size
|
||||
}
|
||||
|
||||
fun setNewData(data: MutableList<MusicData>) {
|
||||
dataList.clear()
|
||||
dataList.addAll(data)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun addOneData(musicData: MusicData){
|
||||
dataList.add(musicData)
|
||||
notifyItemInserted(dataList.size)
|
||||
}
|
||||
|
||||
fun upDateMusicData(oldData: MusicData?,musicData: MusicData) {
|
||||
dataList.forEachIndexed { index, musicDataIn ->
|
||||
if (musicDataIn.id==musicData.id) {
|
||||
musicDataIn.state = musicData.state
|
||||
notifyItemChanged(index,0)
|
||||
}
|
||||
if(oldData?.id==musicDataIn.id){
|
||||
notifyItemChanged(index,0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inner class TextVH(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
var musicName: TextView
|
||||
var musicPlayState: ImageView
|
||||
|
||||
init {
|
||||
musicName = itemView.findViewById(R.id.tv_song_name)
|
||||
musicPlayState = itemView.findViewById(R.id.iv_music_playing)
|
||||
}
|
||||
}
|
||||
|
||||
interface ClickListener {
|
||||
fun clickItem(musicData: MusicData)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.mogo.och.charter.passenger.ui.music.list
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.common.module.manager.auditionmanager.MusicData
|
||||
import kotlinx.android.synthetic.main.charter_p_music_list.view.rv_music_list
|
||||
|
||||
class MusicListView : ConstraintLayout, MusicListViewModel.IMusicListViewCaLillback,
|
||||
MusicListItemAdapter.ClickListener {
|
||||
|
||||
private val TAG = "MusicListView"
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
private val dataList = mutableListOf<MusicData>()
|
||||
private lateinit var lineAdapter: MusicListItemAdapter
|
||||
private var checkListener: CheckListener?=null
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.charter_p_music_list, this, true)
|
||||
rv_music_list.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
lineAdapter = MusicListItemAdapter(context,dataList,this)
|
||||
rv_music_list.adapter = lineAdapter
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
val viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(MusicListViewModel::class.java)
|
||||
}
|
||||
|
||||
viewModel?.setDistanceCallback(this)
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun addAllData(data: MutableList<MusicData>) {
|
||||
lineAdapter.setNewData(data)
|
||||
}
|
||||
|
||||
override fun addOneData(it: MusicData) {
|
||||
lineAdapter.addOneData(it)
|
||||
}
|
||||
|
||||
override fun updateMusicData(oldData: MusicData?,musicData: MusicData) {
|
||||
lineAdapter.upDateMusicData(oldData,musicData)
|
||||
CallerLogger.d(TAG,"${Thread.currentThread().name}----更新数据${oldData}-----${musicData}")
|
||||
}
|
||||
|
||||
override fun clickItem(musicData: MusicData) {
|
||||
// 通知主页面去显示详情
|
||||
this.checkListener?.checkItem(musicData)
|
||||
}
|
||||
|
||||
fun setCheckItemListener(checkListener: CheckListener) {
|
||||
this.checkListener = checkListener
|
||||
}
|
||||
|
||||
interface CheckListener {
|
||||
fun checkItem(musicData: MusicData)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.mogo.och.charter.passenger.ui.music.list
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.manager.auditionmanager.AuditionManager
|
||||
import com.mogo.och.common.module.manager.auditionmanager.MusicData
|
||||
|
||||
class MusicListViewModel : ViewModel(),
|
||||
AuditionManager.MusicDataChangeListener {
|
||||
|
||||
private val TAG = MusicListViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: IMusicListViewCaLillback? = null
|
||||
|
||||
init {
|
||||
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback: IMusicListViewCaLillback) {
|
||||
this.viewCallback = viewCallback
|
||||
viewCallback.addAllData(AuditionManager.musicList)
|
||||
CallerLogger.d(TAG,"初始化音乐${AuditionManager.musicList.size}")
|
||||
AuditionManager.addDataChangeListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
}
|
||||
|
||||
interface IMusicListViewCaLillback {
|
||||
fun addAllData(data:MutableList<MusicData>)
|
||||
fun addOneData(it: MusicData)
|
||||
fun updateMusicData(oldData: MusicData?,musicData: MusicData)
|
||||
}
|
||||
|
||||
override fun addOneData(it: MusicData) {
|
||||
CallerLogger.d(TAG,"添加音乐:${it.songName}--${it.path}")
|
||||
UiThreadHandler.post({
|
||||
this.viewCallback?.addOneData(it)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun updateState(oldData: MusicData?,musicData: MusicData) {
|
||||
UiThreadHandler.post({
|
||||
viewCallback?.updateMusicData(oldData, musicData)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun onMusicCompletion(musicData: MusicData) {
|
||||
super.onMusicCompletion(musicData)
|
||||
UiThreadHandler.post({
|
||||
viewCallback?.updateMusicData(musicData, musicData)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package com.mogo.och.charter.passenger.ui.music.playing
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.SeekBar
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.TimeTransformUtils
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.common.module.manager.auditionmanager.MusicData
|
||||
import com.mogo.och.common.module.manager.auditionmanager.PlayState
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.iv_music_cover
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.iv_music_cover_bg
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.iv_show_next
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.iv_show_pre
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.iv_toggle
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.sb_musuc_progess
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.tv_music_name
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.tv_playing_during
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.tv_playing_time
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.tv_tag
|
||||
|
||||
|
||||
class MusicPlayingView : ConstraintLayout, MusicPlayingViewModel.IMusicPlayingViewCallback {
|
||||
|
||||
private val TAG = "ItineraryView"
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
private var viewModel: MusicPlayingViewModel?=null
|
||||
|
||||
private var animator:ObjectAnimator?=null
|
||||
|
||||
private var isSeekBarTouch = false
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.charter_p_music_playing, this, true)
|
||||
|
||||
|
||||
iv_toggle.setOnClickListener {
|
||||
viewModel?.toggle()
|
||||
}
|
||||
iv_show_pre.setOnClickListener {
|
||||
viewModel?.showPreMusic()
|
||||
}
|
||||
iv_show_next.setOnClickListener {
|
||||
viewModel?.showNextMusic()
|
||||
}
|
||||
sb_musuc_progess.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
|
||||
var seekToProgress = 0
|
||||
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||
if(isSeekBarTouch) {
|
||||
CallerLogger.d(TAG, "progress:${progress}----fromUser:${fromUser}")
|
||||
seekToProgress = progress
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
||||
isSeekBarTouch = true
|
||||
}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
||||
isSeekBarTouch = false
|
||||
viewModel?.seekTo(seekToProgress)
|
||||
seekToProgress = 0
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(MusicPlayingViewModel::class.java)
|
||||
}
|
||||
|
||||
viewModel?.setDistanceCallback(this)
|
||||
}
|
||||
|
||||
override fun onVisibilityAggregated(isVisible: Boolean) {
|
||||
super.onVisibilityAggregated(isVisible)
|
||||
if(isVisible){
|
||||
viewModel?.showData()
|
||||
}
|
||||
}
|
||||
|
||||
fun setData(musicData: MusicData) {
|
||||
viewModel?.setMusicData(musicData)
|
||||
}
|
||||
|
||||
override fun setViewData(musicData: MusicData){
|
||||
tv_music_name.text = musicData.songName
|
||||
tv_tag.text = musicData.tag.first()
|
||||
tv_playing_time.text = DateTimeUtil.second2Time(0)
|
||||
tv_playing_during.text = TimeTransformUtils.stringForTime(musicData.duration.toInt())
|
||||
if(musicData.state==PlayState.Playing){
|
||||
iv_toggle.setImageResource(R.drawable.charter_p_music_pause)
|
||||
startAnimal()
|
||||
}else{
|
||||
iv_toggle.setImageResource(R.drawable.charter_p_music_play)
|
||||
endAnimal()
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
sb_musuc_progess.setProgress(0,true)
|
||||
}else{
|
||||
sb_musuc_progess.progress=0.toInt()
|
||||
}
|
||||
|
||||
Glide.with(context)
|
||||
.load(musicData.coverHeadImageUrl)
|
||||
.apply(RequestOptions().placeholder(R.drawable.charter_p_music_bg_relax_head))
|
||||
.into(iv_music_cover)
|
||||
Glide.with(context)
|
||||
.load(musicData.coverBottomImageUrl)
|
||||
.apply(RequestOptions().placeholder(R.drawable.charter_p_music_bg_relax_bottom))
|
||||
.into(iv_music_cover_bg)
|
||||
}
|
||||
|
||||
private fun startAnimal(){
|
||||
if(animator!=null){
|
||||
animator?.cancel()
|
||||
animator = null
|
||||
}
|
||||
animator = ObjectAnimator.ofFloat(iv_music_cover, "rotation", 0f, 360f)
|
||||
iv_music_cover.pivotX = (iv_music_cover.getWidth() / 2).toFloat()
|
||||
iv_music_cover.pivotY = iv_music_cover.height*174.5f/390f
|
||||
animator?.duration = 4000
|
||||
animator?.repeatCount = -1
|
||||
animator?.repeatMode = ValueAnimator.RESTART
|
||||
animator?.interpolator = LinearInterpolator()
|
||||
animator?.start()
|
||||
}
|
||||
private fun endAnimal(){
|
||||
if(animator!=null){
|
||||
animator?.cancel()
|
||||
animator = null
|
||||
}
|
||||
}
|
||||
|
||||
override fun setPlayOrpause(it: MusicData) {
|
||||
if(it.state==PlayState.Playing){
|
||||
iv_toggle.setImageResource(R.drawable.charter_p_music_pause)
|
||||
startAnimal()
|
||||
}else{
|
||||
iv_toggle.setImageResource(R.drawable.charter_p_music_play)
|
||||
endAnimal()
|
||||
}
|
||||
}
|
||||
|
||||
override fun setProgress(currentPlay: Long, duration: Long) {
|
||||
if(isSeekBarTouch){
|
||||
|
||||
}else{
|
||||
sb_musuc_progess.max = duration.toInt()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
sb_musuc_progess.setProgress(currentPlay.toInt(),true)
|
||||
}else{
|
||||
sb_musuc_progess.progress=currentPlay.toInt()
|
||||
}
|
||||
}
|
||||
|
||||
tv_playing_time.text = TimeTransformUtils.stringForTime(currentPlay.toInt())
|
||||
tv_playing_during.text = TimeTransformUtils.stringForTime(duration.toInt())
|
||||
}
|
||||
|
||||
fun listenerPlaying(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.mogo.och.charter.passenger.ui.music.playing
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.elegant.utils.UiThreadHandler
|
||||
import com.mogo.och.common.module.manager.auditionmanager.AuditionManager
|
||||
import com.mogo.och.common.module.manager.auditionmanager.MusicData
|
||||
|
||||
class MusicPlayingViewModel : ViewModel(), AuditionManager.MusicDataChangeListener {
|
||||
|
||||
private val TAG = MusicPlayingViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: IMusicPlayingViewCallback? = null
|
||||
|
||||
private var checkMusicData:MusicData?=null
|
||||
|
||||
init {
|
||||
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback: IMusicPlayingViewCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
AuditionManager.addDataChangeListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
}
|
||||
|
||||
fun setMusicData(musicData: MusicData) {
|
||||
this.checkMusicData = musicData
|
||||
this.viewCallback?.setViewData(musicData)
|
||||
}
|
||||
|
||||
fun showData() {
|
||||
if(checkMusicData!=null){
|
||||
setMusicData(this.checkMusicData!!)
|
||||
}else{
|
||||
val musicList = AuditionManager.musicList
|
||||
if(musicList.size>0){
|
||||
val first = musicList.first()
|
||||
setMusicData(first)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun toggle() {
|
||||
checkMusicData?.let {
|
||||
AuditionManager.toggle(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun showPreMusic() {
|
||||
checkMusicData?.let {
|
||||
val nextMusicData = AuditionManager.getPreMusicData(it)
|
||||
setMusicData(nextMusicData)
|
||||
}
|
||||
}
|
||||
|
||||
fun showNextMusic() {
|
||||
checkMusicData?.let {
|
||||
val nextMusicData = AuditionManager.getNextMusicData(it)
|
||||
setMusicData(nextMusicData)
|
||||
}
|
||||
}
|
||||
|
||||
interface IMusicPlayingViewCallback {
|
||||
fun setViewData(musicData: MusicData)
|
||||
fun setPlayOrpause(it: MusicData)
|
||||
fun setProgress(currentPlay: Long, duration: Long)
|
||||
}
|
||||
|
||||
override fun updateState(oldData:MusicData?,musicData: MusicData) {
|
||||
checkMusicData?.let {
|
||||
if(it.id==musicData.id){
|
||||
it.state = musicData.state
|
||||
UiThreadHandler.post {
|
||||
viewCallback?.setPlayOrpause(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun updatePlayCurrent(currentPlay: Long, duration: Long, musicData: MusicData){
|
||||
checkMusicData?.let {
|
||||
if(it.id==musicData.id){
|
||||
UiThreadHandler.post {
|
||||
viewCallback?.setProgress(currentPlay, duration)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMusicCompletion(musicData: MusicData) {
|
||||
super.onMusicCompletion(musicData)
|
||||
checkMusicData?.let {
|
||||
if(it.id==musicData.id){
|
||||
it.state = musicData.state
|
||||
UiThreadHandler.post {
|
||||
viewCallback?.setPlayOrpause(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
showNextMusic()
|
||||
toggle()
|
||||
}
|
||||
|
||||
fun seekTo(progress: Int) {
|
||||
AuditionManager.seekTo(progress)
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 341 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 140 KiB |
|
After Width: | Height: | Size: 872 B |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
BIN
OCH/charter/passenger/src/main/res/drawable/charter_p_music_bg_relax_head.png
Executable file
|
After Width: | Height: | Size: 140 KiB |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient android:startColor="@color/charter_p_4D6A83A5" android:centerColor="@color/charter_p_6A83A5" android:endColor="@color/charter_p_4D6A83A5" android:angle="-45"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/dp_16_5"/>
|
||||
<stroke android:width="@dimen/dp_1" android:color="@color/charter_p_425877"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="5dp"/>
|
||||
<solid android:color="@color/charter_p_488ED0" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@android:id/secondaryProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="5dp"/>
|
||||
<solid android:color="@color/charter_p_488ED0" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
<item android:id="@android:id/progress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="5dp"/>
|
||||
<solid android:color="@color/charter_p_598CFF" />
|
||||
</shape>
|
||||
</scale>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -13,7 +13,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_width="@dimen/dp_489"
|
||||
android:layout_width="@dimen/dp_430"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
@@ -22,7 +22,7 @@
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/actv_stop_site"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_stop_site"
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/actv_close_door"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
@@ -45,7 +45,7 @@
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/actv_close_door"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_close_door"
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.bottom.impl.CloseDoorView
|
||||
@@ -58,7 +58,7 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/actv_open_door"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
@@ -67,7 +67,7 @@
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/actv_open_door"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_open_door"
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.bottom.impl.OpenDoorView
|
||||
@@ -80,8 +80,12 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/actv_close_door"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<View
|
||||
app:layout_constraintStart_toEndOf="@+id/actv_open_door"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
@@ -90,18 +94,38 @@
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/cl_order_time"
|
||||
app:layout_constraintEnd_toEndOf="@+id/cl_order_time"
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.bottom.BottomOrderInfoView
|
||||
android:id="@+id/cl_order_time"
|
||||
app:charterPBackageViewId="@+id/cl_order_time_press"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/actv_music"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="@dimen/dp_170"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/actv_music_press"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/actv_music"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_music"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.bottom.BottomCheckView
|
||||
android:id="@+id/actv_music"
|
||||
app:charterPBackageViewId="@+id/actv_music_press"
|
||||
app:charterPselectedDrawable="@drawable/charter_p_bottom_music_press"
|
||||
app:charterPnormalDrawable="@drawable/charter_p_bottom_music_normal"
|
||||
app:charterPBottomTitle="音乐"
|
||||
app:charterPBottomClick="false"
|
||||
app:layout_constraintEnd_toStartOf="@+id/actv_setting"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="@dimen/dp_175"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
@@ -110,7 +134,7 @@
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/actv_setting"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_setting"
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.bottom.BottomCheckView
|
||||
@@ -120,11 +144,10 @@
|
||||
app:charterPnormalDrawable="@drawable/charter_p_bottom_softsettiing_normal"
|
||||
app:charterPBottomTitle="设置"
|
||||
app:charterPBottomClick="false"
|
||||
app:layout_constraintStart_toEndOf="@+id/cl_order_time"
|
||||
app:layout_constraintEnd_toStartOf="@+id/actv_line"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
@@ -133,7 +156,7 @@
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/actv_line"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_line"
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.bottom.BottomCheckView
|
||||
@@ -143,11 +166,10 @@
|
||||
app:charterPnormalDrawable="@drawable/charter_p_bottom_line_normal"
|
||||
app:charterPBottomTitle="线路"
|
||||
app:charterPBottomClick="false"
|
||||
app:layout_constraintStart_toEndOf="@+id/actv_setting"
|
||||
app:layout_constraintEnd_toStartOf="@+id/aciv_center_image"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</merge>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/dp_489"
|
||||
android:layout_width="@dimen/dp_430"
|
||||
android:layout_height="@dimen/dp_107"
|
||||
android:background="@drawable/charter_p_bottom_center_normal"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
||||
@@ -121,6 +121,13 @@
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.music.MusicControlView
|
||||
android:id="@+id/mcv_play_music"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<!--底部导航栏-->
|
||||
<com.mogo.och.charter.passenger.ui.bottom.BottomBar
|
||||
android:id="@+id/bb_boorombar"
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@drawable/charter_p_function_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/dp_870"
|
||||
android:layout_height="@dimen/dp_509"
|
||||
android:clickable="true"
|
||||
android:layout_marginBottom="@dimen/dp_110"
|
||||
android:paddingStart="@dimen/dp_35"
|
||||
android:paddingEnd="@dimen/dp_35"
|
||||
android:paddingTop="@dimen/dp_30"
|
||||
android:paddingBottom="@dimen/dp_40"
|
||||
android:background="@drawable/charter_p_music_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.music.list.MusicListView
|
||||
android:id="@+id/mlv_list"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_width="@dimen/dp_339"
|
||||
android:layout_height="@dimen/dp_440"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.music.playing.MusicPlayingView
|
||||
android:id="@+id/mpv_music_info"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="@dimen/dp_460"
|
||||
android:layout_height="@dimen/dp_440"/>
|
||||
|
||||
<View
|
||||
app:layout_constraintStart_toEndOf="@+id/mlv_list"
|
||||
android:background="@drawable/charter_p_music_center_split"
|
||||
android:layout_width="@dimen/dp_1"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/dp_339"
|
||||
android:layout_height="@dimen/dp_440"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_music_title"
|
||||
android:text="音乐列表"
|
||||
android:textColor="@color/charter_p_253A5A"
|
||||
android:textSize="@dimen/dp_18"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_45"
|
||||
android:layout_marginTop="@dimen/dp_35"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_music_list"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_89"
|
||||
android:layout_width="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
</merge>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_51"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_song_name"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textColor="@color/charter_p_303C52"
|
||||
android:layout_marginStart="@dimen/dp_45"
|
||||
android:text="音乐名称"
|
||||
android:textSize="@dimen/dp_18"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_music_playing"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_song_name"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_song_name"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_song_name"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:src="@drawable/charter_p_music_list_playing"
|
||||
android:visibility="gone"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_16"/>
|
||||
|
||||
<TextView
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textColor="@color/charter_p_425877"
|
||||
android:textSize="@dimen/dp_11"
|
||||
android:background="@drawable/charter_p_music_list_tag_bg"
|
||||
android:paddingStart="@dimen/dp_4"
|
||||
android:paddingEnd="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_43"
|
||||
android:text="轻柔"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,146 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/dp_460"
|
||||
android:layout_height="@dimen/dp_440"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_music_cover_bg"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:src="@drawable/charter_p_music_bg_relax_bottom"
|
||||
android:layout_width="@dimen/dp_358"
|
||||
android:layout_height="@dimen/dp_440"/>
|
||||
|
||||
<ImageView
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_45"
|
||||
android:src="@drawable/charter_p_music_bg_middle"
|
||||
android:layout_width="@dimen/dp_187"
|
||||
android:layout_height="@dimen/dp_187"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_music_cover"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_45"
|
||||
android:src="@drawable/charter_p_music_bg_relax_head"
|
||||
android:layout_width="@dimen/dp_187"
|
||||
android:layout_height="@dimen/dp_187"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_music_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_music_cover"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_m_17"
|
||||
android:textSize="@dimen/dp_21"
|
||||
tools:text="Current"
|
||||
android:textColor="@color/charter_p_303C52"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_author"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_tag"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_music_name"
|
||||
android:textSize="@dimen/dp_17"
|
||||
android:textColor="@color/charter_p_576887"
|
||||
tools:text="Kokia"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_tag"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_author"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:textSize="@dimen/dp_16"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/tv_author"
|
||||
android:textColor="@color/charter_p_576887"
|
||||
tools:text="轻柔"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<SeekBar
|
||||
android:max="100"
|
||||
android:progress="50"
|
||||
android:paddingStart="@dimen/dp_0"
|
||||
android:paddingEnd="@dimen/dp_0"
|
||||
android:id="@+id/sb_musuc_progess"
|
||||
android:thumb="@null"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_author"
|
||||
android:layout_marginTop="@dimen/dp_28"
|
||||
android:progressDrawable="@drawable/taxt_p_music_seekbar_style"
|
||||
android:paddingTop="3dp"
|
||||
android:paddingBottom="@dimen/dp_3"
|
||||
android:layout_width="@dimen/dp_270"
|
||||
android:layout_height="@dimen/dp_10"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_playing_time"
|
||||
android:textSize="@dimen/dp_15"
|
||||
android:includeFontPadding="false"
|
||||
app:layout_constraintTop_toTopOf="@+id/sb_musuc_progess"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/sb_musuc_progess"
|
||||
app:layout_constraintEnd_toStartOf="@+id/sb_musuc_progess"
|
||||
android:textColor="@color/charter_p_576887"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
tools:text="02:34"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_playing_during"
|
||||
android:textSize="@dimen/dp_15"
|
||||
android:includeFontPadding="false"
|
||||
app:layout_constraintTop_toTopOf="@+id/sb_musuc_progess"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/sb_musuc_progess"
|
||||
app:layout_constraintStart_toEndOf="@+id/sb_musuc_progess"
|
||||
android:textColor="@color/charter_p_576887"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
tools:text="05:56"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_toggle"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_29"
|
||||
android:src="@drawable/charter_p_music_play"
|
||||
android:layout_width="@dimen/dp_78"
|
||||
android:layout_height="@dimen/dp_78"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_show_pre"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_toggle"
|
||||
android:layout_marginTop="@dimen/dp_19"
|
||||
app:layout_constraintEnd_toStartOf="@+id/iv_toggle"
|
||||
android:src="@drawable/charter_p_music_pre"
|
||||
android:layout_marginEnd="@dimen/dp_33"
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_show_next"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_toggle"
|
||||
android:layout_marginTop="@dimen/dp_19"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_toggle"
|
||||
android:src="@drawable/charter_p_music_next"
|
||||
android:layout_marginStart="@dimen/dp_33"
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"/>
|
||||
</merge>
|
||||
@@ -54,4 +54,14 @@
|
||||
<color name="charter_p_f0e0efff">#F0E0EFFF </color>
|
||||
<color name="charter_p_66000000">#66000000</color>
|
||||
<color name="charter_p_ff6d2c">#FF6D2C</color>
|
||||
<color name="charter_p_4DFFFFFF">#4DFFFFFF</color>
|
||||
<color name="charter_p_253A5A">#253A5A</color>
|
||||
<color name="charter_p_303C52">#303C52</color>
|
||||
<color name="charter_p_425877">#425877</color>
|
||||
<color name="charter_p_576887">#576887</color>
|
||||
<color name="charter_p_488ED0">#488ED0</color>
|
||||
<color name="charter_p_598CFF">#598CFF</color>
|
||||
<color name="charter_p_4D6A83A5">#4D6A83A5</color>
|
||||
<color name="charter_p_6A83A5">#6A83A5</color>
|
||||
|
||||
</resources>
|
||||
@@ -126,14 +126,14 @@ class MusicPlayingView : ConstraintLayout, MusicPlayingViewModel.IMusicPlayingVi
|
||||
sb_musuc_progess.progress=0.toInt()
|
||||
}
|
||||
|
||||
Glide.with(context)
|
||||
.load(musicData.coverHeadImageUrl)
|
||||
.apply(RequestOptions().placeholder(R.drawable.taxt_p_music_bg_relax_head))
|
||||
.into(iv_music_cover)
|
||||
Glide.with(context)
|
||||
.load(musicData.coverBottomImageUrl)
|
||||
.apply(RequestOptions().placeholder(R.drawable.taxt_p_music_bg_relax_bottom))
|
||||
.into(iv_music_cover_bg)
|
||||
// Glide.with(context)
|
||||
// .load(musicData.coverHeadImageUrl)
|
||||
// .apply(RequestOptions().placeholder(R.drawable.taxt_p_music_bg_relax_head))
|
||||
// .into(iv_music_cover)
|
||||
// Glide.with(context)
|
||||
// .load(musicData.coverBottomImageUrl)
|
||||
// .apply(RequestOptions().placeholder(R.drawable.taxt_p_music_bg_relax_bottom))
|
||||
// .into(iv_music_cover_bg)
|
||||
}
|
||||
|
||||
private fun startAnimal(){
|
||||
@@ -143,7 +143,7 @@ class MusicPlayingView : ConstraintLayout, MusicPlayingViewModel.IMusicPlayingVi
|
||||
}
|
||||
animator = ObjectAnimator.ofFloat(iv_music_cover, "rotation", 0f, 360f)
|
||||
iv_music_cover.pivotX = (iv_music_cover.getWidth() / 2).toFloat()
|
||||
iv_music_cover.pivotY = 166f
|
||||
iv_music_cover.pivotY = 174.5f
|
||||
animator?.duration = 4000
|
||||
animator?.repeatCount = -1
|
||||
animator?.repeatMode = ValueAnimator.RESTART
|
||||
|
||||