@Override protected void onDestroy() { if (mSlideView != null) { mSlideView.setMediaController(null); } super.onDestroy(); }
@Override protected void onStop() { super.onStop(); /// M: Code analyze 009, fix bug ALPS00335430, should close in lockscreen @{ /** * M: when this activity is invisiable, it should exit. though it has nohistory property, lock * screen is an exception. so we must destory this activity in onStop. */ finish(); /// @} if ((null != mSmilPlayer)) { if (isFinishing()) { mSmilPlayer.stop(); if (mSlideView != null) { mSlideView.clearImageView(); } } else { mSmilPlayer.stopWhenReload(); } if (mMediaController != null) { // Must set the seek bar change listener null, otherwise if we rotate it // while tapping progress bar continuously, window will leak. View seekBar = mMediaController.findViewById(com.android.internal.R.id.mediacontroller_progress); if (seekBar instanceof SeekBar) { ((SeekBar) seekBar).setOnSeekBarChangeListener(null); } // Must do this so we don't leak a window. mMediaController.hide(); } } /// M: Code analyze 003, fix bug ALPS00119632, present slide return /// (mActivityRunning=false) when SlideshowActivity stop @{ if (mPresenter != null) { mPresenter.onStop(); mPresenter = null; } /// @} }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); mHandler = new Handler(); /// M: Code analyze 004, new feature, Slideshow Plugin(unknown) @{ initPlugin(this); /// @} // Play slide-show in full-screen mode. requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFormat(PixelFormat.TRANSLUCENT); setContentView(R.layout.slideshow); Intent intent = getIntent(); Uri msg = intent.getData(); final SlideshowModel model; try { model = SlideshowModel.createFromMessageUri(this, msg); mSlideCount = model.size(); /** M: Confirm that we have at least 1 supported_slide to display @{ */ if (mSlideCount == 0) { Toast.makeText(this, getString(R.string.unsupport_media_type), Toast.LENGTH_SHORT).show(); throw new MmsException(); } /** @} */ } catch (MmsException e) { Log.e(TAG, "Cannot present the slide show.", e); finish(); return; } mSlideView = (SlideView) findViewById(R.id.slide_view); /// M: Code analyze 003, fix bug ALPS00119632, present slide return /// (mActivityRunning=false) when SlideshowActivity stop @{ mPresenter = (SlideshowPresenter) PresenterFactory.getPresenter("SlideshowPresenter", this, mSlideView, model); /// @} mRotate = true; /// M: Code analyze 005, fix bug ALPS00071669, Handel delay problem /// when progress bar update @{ mSmilPlayer = SmilPlayer.getPlayer(); initMediaController(); mSlideView.setMediaController(mMediaController); mSlideView.setActivity(this); mSlideView.setMmsSlideShowPlugin(mMmsSlideShowPlugin); // Use SmilHelper.getDocument() to ensure rebuilding the /// M: entire SMIL document. mSmilDoc = SmilHelper.getDocument(model); /// @} mHandler.post( new Runnable() { private boolean isRotating() { return mSmilPlayer.isPausedState() || mSmilPlayer.isPlayingState() || mSmilPlayer.isPlayedState(); } public void run() { if (isMMSConformance(mSmilDoc)) { int imageLeft = 0; int imageTop = 0; int textLeft = 0; int textTop = 0; /// M: Code analyze 006, fix bug ALPS00300308, Modified Text layout @{ int textWidth = 0; int textHeight = 0; /// @} LayoutModel layout = model.getLayout(); if (layout != null) { RegionModel imageRegion = layout.getImageRegion(); if (imageRegion != null) { imageLeft = imageRegion.getLeft(); imageTop = imageRegion.getTop(); } RegionModel textRegion = layout.getTextRegion(); if (textRegion != null) { textLeft = textRegion.getLeft(); textTop = textRegion.getTop(); } } /// M: Code analyze 006, fix bug ALPS00300308, Modified Text layout @{ mSlideView.enableMMSConformanceMode( textLeft, textTop, textWidth, textHeight, imageLeft, imageTop); /// @} } else { /// M: init page divider view mSlideView.initPageDivider(); } if (DEBUG) { ByteArrayOutputStream ostream = new ByteArrayOutputStream(); SmilXmlSerializer.serialize(mSmilDoc, ostream); if (LOCAL_LOGV) { Log.v(TAG, ostream.toString()); } } // Add event listener. ((EventTarget) mSmilDoc) .addEventListener( SmilDocumentImpl.SMIL_DOCUMENT_END_EVENT, SlideshowActivity.this, false); mSmilPlayer.init(mSmilDoc); if (isRotating()) { mSmilPlayer.reload(); } else { /// M: Code analyze 002, fix bug ALPS00111374, (CMCC feature) pause / not auto play /// but need prepareToPlay when enter the slideshow activity @{ if (mMmsSlideShowPlugin.getInitialPlayState() == IMmsSlideShow.PLAY_AS_PAUSE) { mSmilPlayer.prepareToPlay(); bNeedResume = true; mSmilPlayerController.pause(); } else { mSmilPlayer.play(); bNeedResume = true; } /// @} } } }); }