public void checkDelay() { int pos = mPlayerEngineImpl.getCurPosition(); boolean ret = mCheckDelayTimer.isDelay(pos); if (ret) { mUIManager.showLoadView(true); } else { mUIManager.showLoadView(false); } mCheckDelayTimer.setPos(pos); }
public void initData() { mPlayPosTimer = new SingleSecondTimer(this); mHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case REFRESH_CURPOS: refreshCurPos(); break; case EXIT_ACTIVITY: finish(); break; case REFRESH_SPEED: refreshSpeed(); break; case CHECK_DELAY: checkDelay(); break; case LOAD_DRAWABLE_COMPLETE: Object object = msg.obj; Drawable drawable = null; if (object != null) { drawable = (Drawable) object; } onLoadDrawableComplete(drawable); break; } } }; mPlayPosTimer.setHandler(mHandler, REFRESH_CURPOS); mNetWorkTimer = new SingleSecondTimer(this); mNetWorkTimer.setHandler(mHandler, REFRESH_SPEED); mCheckDelayTimer = new CheckDelayTimer(this); mCheckDelayTimer.setHandler(mHandler, CHECK_DELAY); mPlayerEngineImpl = new MusicPlayEngineImpl(this); mPlayerEngineImpl.setOnBuffUpdateListener(this); mPlayerEngineImpl.setOnSeekCompleteListener(this); mPlayerEngineImpl.setDataCaptureListener(mUIManager); mPlayEngineListener = new MusicPlayEngineListener(); mPlayerEngineImpl.setPlayerListener(mPlayEngineListener); mMediaControlBorcastFactory = new MediaControlBrocastFactory(mContext); mMediaControlBorcastFactory.register(this); mNetWorkTimer.startTimer(); mCheckDelayTimer.startTimer(); }
@Override protected void onDestroy() { log.e("onDestroy"); isDestroy = true; mUIManager.unInit(); mCheckDelayTimer.stopTimer(); mNetWorkTimer.stopTimer(); mMediaControlBorcastFactory.unregister(); mPlayPosTimer.stopTimer(); mPlayerEngineImpl.exit(); super.onDestroy(); }