@Override public void handleMessage(Message msg) { switch (msg.what) { case CMD_REFRESH_SEEKBAR: if (mPlayer == null || mDuration == 0) break; int position = mPlayer.getCurrentPosition(); int ps = (position * sBar.getMax()) / mDuration; mTvCurtm.setText(MediaUtil.formatTime(position)); sBar.setProgress(ps); break; } };
@Override public void onPrepared(MediaPlayer mPlayer) { Logger.LOGD(TAG, "onPrepared called"); if (mRunMode != Configer.RunMode.MODE_DIRECT) { int pos = mHListView.getClickPos() == -1 ? 0 : mHListView.getClickPos(); mMvTitle.setText(mData.get(pos).getName()); } mDuration = mPlayer.getDuration(); if (mDuration == 0) mDuration = 1200; mTvDur.setText(MediaUtil.formatTime(mDuration)); mBtnPlay.setBackgroundResource(R.drawable.mv_btn_pause); mPlayer.start(); mLoading.cancel(); }