use of com.moez.QKSMS.model.RegionModel in project qksms by moezbhatti.
the class SlideshowActivity method onCreate.
@Override
public void onCreate(Bundle icicle) {
// Play slide-show in full-screen mode.
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(icicle);
mHandler = new Handler();
getWindow().setFormat(PixelFormat.TRANSLUCENT);
setContentView(R.layout.view_slideshow);
Intent intent = getIntent();
Uri msg = intent.getData();
final SlideshowModel model;
try {
model = SlideshowModel.createFromMessageUri(this, msg);
mSlideCount = model.size();
} catch (MmsException e) {
Log.e(TAG, "Cannot present the slide show.", e);
finish();
return;
}
mSlideView = (SlideView) findViewById(R.id.slide_view);
new SlideshowPresenter(this, mSlideView, model);
mHandler.post(new Runnable() {
private boolean isRotating() {
return mSmilPlayer.isPausedState() || mSmilPlayer.isPlayingState() || mSmilPlayer.isPlayedState();
}
public void run() {
mSmilPlayer = SmilPlayer.getPlayer();
if (mSlideCount > 1) {
// Only show the slideshow controller if we have more than a single slide.
// Otherwise, when we play a sound on a single slide, it appears like
// the slide controller should control the sound (seeking, ff'ing, etc).
initMediaController();
mSlideView.setMediaController(mMediaController);
}
// Use SmilHelper.getDocument() to ensure rebuilding the
// entire SMIL document.
mSmilDoc = SmilHelper.getDocument(model);
if (isMMSConformance(mSmilDoc)) {
int imageLeft = 0;
int imageTop = 0;
int textLeft = 0;
int textTop = 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();
}
}
mSlideView.enableMMSConformanceMode(textLeft, textTop, imageLeft, imageTop);
}
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();
}
}
});
}
Aggregations