| | |
| | | package com.sinata.xqmuse.dialog |
| | | |
| | | import android.util.Log |
| | | import android.view.Gravity |
| | | import android.widget.SeekBar |
| | | import cn.sinata.xldutils.utils.SPUtils |
| | | import com.sinata.xqmuse.R |
| | | import com.sinata.xqmuse.utils.Const |
| | | import com.sinata.xqmuse.utils.event.EmptyEvent |
| | | import kotlinx.android.synthetic.main.dialog_set_volume.* |
| | | import org.greenrobot.eventbus.EventBus |
| | | |
| | | class VolumeDialog: BaseDialogFragment() { |
| | | override fun setContentView() = R.layout.dialog_set_volume |
| | |
| | | override fun setGravity() = Gravity.BOTTOM |
| | | |
| | | override fun initView() { |
| | | val int = SPUtils.instance().getInt(Const.User.VOLUME_THINK, 50) |
| | | sb_voice.progress = int |
| | | |
| | | sb_voice.setOnSeekBarChangeListener(object :SeekBar.OnSeekBarChangeListener{ |
| | | override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { |
| | | Log.e("MMP","音量调整:${progress}") |
| | | } |
| | | |
| | | override fun onStartTrackingTouch(seekBar: SeekBar?) { |
| | | } |
| | | |
| | | override fun onStopTrackingTouch(seekBar: SeekBar?) { |
| | | SPUtils.instance().put(Const.User.VOLUME_THINK, seekBar?.progress?:50).apply() |
| | | EventBus.getDefault().post(EmptyEvent(Const.EventCode.CHANGE_THINK_VOLUME)) |
| | | } |
| | | }) |
| | | } |
| | | } |