@Override public void onClick(View view) { switch (view.getId()) { case R.id.ib_lock: break; case R.id.ib_forward: mPlayerView.seek(10000); break; case R.id.ib_play: if (mPlayerView.isPlaying()) { mPlayerView.pause(); ibPlay.setBackgroundResource(R.drawable.ic_play); } else { mPlayerView.play(); ibPlay.setBackgroundResource(R.drawable.ic_pause); } break; case R.id.ib_backward: mPlayerView.seek(-10000); break; case R.id.ib_size: break; default: break; } }
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser && mPlayerView.canSeekable()) { mPlayerView.setTime(progress); setOverlayProgress(); } SharedPreferences sp = getSharedPreferences("spTest", Context.MODE_PRIVATE); Log.d("===", "sp:" + sp.getBoolean("isAuto", true)); if (!sp.getBoolean("isAuto", true)) { Log.d("===", "正在播放之前"); if (mPlayerView.isPlaying() && isPlay) { Log.d("===", "正在播放"); mPlayerView.pause(); ibPlay.setBackgroundResource(R.drawable.ic_play); isPlay = false; } } }