| | |
| | | import android.widget.SeekBar |
| | | import cn.sinata.xldutils.gone |
| | | import cn.sinata.xldutils.utils.SPUtils |
| | | import com.sinata.xqmuse.MainActivity |
| | | import com.sinata.xqmuse.R |
| | | import com.sinata.xqmuse.network.HttpManager |
| | | import com.sinata.xqmuse.network.entity.BGMBean |
| | |
| | | import com.sinata.xqmuse.ui.home.adapter.BgmBannerAdapter |
| | | import com.sinata.xqmuse.utils.AudioUtils |
| | | import com.sinata.xqmuse.utils.Const |
| | | import com.sinata.xqmuse.utils.event.EmptyEvent |
| | | import kotlinx.android.synthetic.main.activity_bgm.* |
| | | import org.greenrobot.eventbus.EventBus |
| | | import org.jetbrains.anko.startActivity |
| | | import org.jetbrains.anko.toast |
| | | |
| | | class BGMSettingActivity :TransparentStatusBarActivity(), AudioUtils.OnAudioStatusUpdateListener { |
| | |
| | | }) |
| | | |
| | | tv_action.setOnClickListener { |
| | | SPUtils.instance().put(Const.User.VOLUME,sb_voice.progress).put(Const.User.BGM,list[banner_landscape.currentItem].audioFile).apply() |
| | | //存音量 |
| | | SPUtils.instance().put(Const.User.VOLUME,sb_voice.progress).apply() |
| | | if (list.isNotEmpty()){ //存bgm和bg |
| | | SPUtils.instance().put(Const.User.BG,list[banner_landscape.currentItem].imageUrl) |
| | | .put(Const.User.BGM,list[banner_landscape.currentItem].audioFile).apply() |
| | | EventBus.getDefault().post(EmptyEvent(Const.EventCode.CHANGE_BGM)) |
| | | } |
| | | toast("保存成功") |
| | | player.startPlayMusic(this,list[banner_landscape.currentItem].audioFile) |
| | | startActivity<MainActivity>() |
| | | EventBus.getDefault().post(EmptyEvent(Const.EventCode.FINISH_GUIDE_AUDIO)) |
| | | } |
| | | } |
| | | |
| | |
| | | banner_landscape.setBannerGalleryEffect(110,12,0.85f) |
| | | player.setOnAudioStatusUpdateListener(this) |
| | | sb_voice.progress = SPUtils.instance().getInt(Const.User.VOLUME,50) |
| | | player.setVolume(sb_voice.progress.toFloat()/100) |
| | | getData() |
| | | } |
| | | |
| | |
| | | cardBannerAdapter.playPosition = -1 |
| | | cardBannerAdapter.notifyItemChanged(p) |
| | | } |
| | | |
| | | override fun onGetDuration(duration: Int) { |
| | | } |
| | | |
| | | override fun onPause() { |
| | | super.onPause() |
| | | player.stopPlayMusic() |
| | | } |
| | | } |