Methods Summary |
---|
public void | handleEvent(org.w3c.dom.events.Event evt)
final Event event = evt;
mHandler.post(new Runnable() {
public void run() {
String type = event.getType();
if(type.equals(SmilDocumentImpl.SMIL_DOCUMENT_END_EVENT)) {
finish();
}
}
});
|
private void | initMediaController()
mMediaController = new MediaController(SlideshowActivity.this, false);
mMediaController.setMediaPlayer(new SmilPlayerController(mSmilPlayer));
mMediaController.setAnchorView(findViewById(R.id.slide_view));
|
public void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
mHandler = new Handler();
// 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);
} catch (MmsException e) {
Log.e(TAG, "Cannot present the slide show.", e);
finish();
return;
}
SlideView view = (SlideView) findViewById(R.id.slide_view);
PresenterFactory.getPresenter("SlideshowPresenter", this, view, model);
mHandler.post(new Runnable() {
private boolean isRotating() {
return mSmilPlayer.isPausedState()
|| mSmilPlayer.isPlayingState()
|| mSmilPlayer.isPlayedState();
}
public void run() {
mSmilPlayer = SmilPlayer.getPlayer();
initMediaController();
// Use SmilHelper.getDocument() to ensure rebuilding the
// entire SMIL document.
mSmilDoc = SmilHelper.getDocument(model);
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 {
mSmilPlayer.play();
}
}
});
|
public boolean | onKeyDown(int keyCode, android.view.KeyEvent event)
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_VOLUME_UP:
case KeyEvent.KEYCODE_BACK:
case KeyEvent.KEYCODE_MENU:
case KeyEvent.KEYCODE_DPAD_UP:
case KeyEvent.KEYCODE_DPAD_DOWN:
case KeyEvent.KEYCODE_DPAD_LEFT:
case KeyEvent.KEYCODE_DPAD_RIGHT:
break;
default:
if ((mSmilPlayer != null) && (mMediaController != null)) {
mMediaController.show();
}
}
return super.onKeyDown(keyCode, event);
|
protected void | onPause()
super.onPause();
if (mSmilDoc != null) {
((EventTarget) mSmilDoc).removeEventListener(
SmilDocumentImpl.SMIL_DOCUMENT_END_EVENT, this, false);
}
|
protected void | onStop()
super.onStop();
if ((null != mSmilPlayer)) {
if (isFinishing()) {
mSmilPlayer.stop();
} else {
mSmilPlayer.stopWhenReload();
}
}
|
public boolean | onTouchEvent(android.view.MotionEvent ev)
if ((mSmilPlayer != null) && (mMediaController != null)) {
mMediaController.show();
}
return false;
|