Methods Summary |
---|
public boolean | add(MediaModel object)Add a MediaModel to the slide. If the slide has already contained
a media object in the same type, the media object will be replaced by
the new one.
internalAdd(object);
notifyModelChanged(true);
return true;
|
public void | add(int location, MediaModel object)
throw new UnsupportedOperationException("Operation not supported.");
|
public boolean | addAll(java.util.Collection collection)
throw new UnsupportedOperationException("Operation not supported.");
|
public boolean | addAll(int location, java.util.Collection collection)
throw new UnsupportedOperationException("Operation not supported.");
|
public void | clear()
if (mMedia.size() > 0) {
for (MediaModel media : mMedia) {
media.unregisterAllModelChangedObservers();
int decreaseSize = media.getMediaSize();
decreaseSlideSize(decreaseSize);
decreaseMessageSize(decreaseSize);
}
mMedia.clear();
mText = null;
mImage = null;
mAudio = null;
mVideo = null;
mCanAddImage = true;
mCanAddAudio = true;
mCanAddVideo = true;
notifyModelChanged(true);
}
|
public boolean | contains(java.lang.Object object)
return mMedia.contains(object);
|
public boolean | containsAll(java.util.Collection collection)
return mMedia.containsAll(collection);
|
public void | decreaseMessageSize(int decreaseSize)
if ((decreaseSize > 0) && (null != mParent)) {
int size = mParent.getCurrentMessageSize();
size -= decreaseSize;
mParent.setCurrentMessageSize(size);
}
|
public void | decreaseSlideSize(int decreaseSize)
if (decreaseSize > 0) {
mSlideSize -= decreaseSize;
}
|
public MediaModel | get(int location)
return mMedia.get(location);
|
public AudioModel | getAudio()
return (AudioModel) mAudio;
|
public int | getDuration()
return mDuration;
|
public short | getFill()
return mFill;
|
public ImageModel | getImage()
return (ImageModel) mImage;
|
public int | getSlideSize()
return mSlideSize;
|
public TextModel | getText()
return (TextModel) mText;
|
public VideoModel | getVideo()
return (VideoModel) mVideo;
|
public void | handleEvent(org.w3c.dom.events.Event evt)
if (evt.getType().equals(SmilParElementImpl.SMIL_SLIDE_START_EVENT)) {
if (LOCAL_LOGV) {
Log.v(TAG, "Start to play slide: " + this);
}
mVisible = true;
} else if (mFill != ElementTime.FILL_FREEZE) {
if (LOCAL_LOGV) {
Log.v(TAG, "Stop playing slide: " + this);
}
mVisible = false;
}
notifyModelChanged(false);
|
public boolean | hasAudio()
return mAudio != null;
|
public boolean | hasImage()
return mImage != null;
|
public boolean | hasText()
return mText != null;
|
public boolean | hasVideo()
return mVideo != null;
|
public void | increaseMessageSize(int increaseSize)
if ((increaseSize > 0) && (null != mParent)) {
int size = mParent.getCurrentMessageSize();
size += increaseSize;
mParent.setCurrentMessageSize(size);
}
|
public void | increaseSlideSize(int increaseSize)
if (increaseSize > 0) {
mSlideSize += increaseSize;
}
|
public int | indexOf(java.lang.Object object)
return mMedia.indexOf(object);
|
private void | internalAdd(MediaModel media)
if (media == null) {
// Don't add null value into the list.
return;
}
if (media.isText()) {
internalAddOrReplace(mText, media);
mText = media;
} else if (media.isImage()) {
if (mCanAddImage) {
internalAddOrReplace(mImage, media);
mImage = media;
mCanAddVideo = false;
} else {
throw new IllegalStateException();
}
} else if (media.isAudio()) {
if (mCanAddAudio) {
internalAddOrReplace(mAudio, media);
mAudio = media;
mCanAddVideo = false;
} else {
throw new IllegalStateException();
}
} else if (media.isVideo()) {
if (mCanAddVideo) {
internalAddOrReplace(mVideo, media);
mVideo = media;
mCanAddImage = false;
mCanAddAudio = false;
} else {
throw new IllegalStateException();
}
}
|
private void | internalAddOrReplace(MediaModel old, MediaModel media)
int addSize = media.getMediaSize();
int removeSize;
if (old == null) {
if (null != mParent) {
mParent.checkMessageSize(addSize);
}
mMedia.add(media);
increaseSlideSize(addSize);
increaseMessageSize(addSize);
} else {
removeSize = old.getMediaSize();
if (addSize > removeSize) {
if (null != mParent) {
mParent.checkMessageSize(addSize - removeSize);
}
increaseSlideSize(addSize - removeSize);
increaseMessageSize(addSize - removeSize);
} else {
decreaseSlideSize(removeSize - addSize);
decreaseMessageSize(removeSize - addSize);
}
mMedia.set(mMedia.indexOf(old), media);
old.unregisterAllModelChangedObservers();
}
for (IModelChangedObserver observer : mModelChangedObservers) {
media.registerModelChangedObserver(observer);
}
|
private boolean | internalRemove(java.lang.Object object)
if (mMedia.remove(object)) {
if (object instanceof TextModel) {
mText = null;
} else if (object instanceof ImageModel) {
mImage = null;
mCanAddVideo = true;
} else if (object instanceof AudioModel) {
mAudio = null;
mCanAddVideo = true;
} else if (object instanceof VideoModel) {
mVideo = null;
mCanAddImage = true;
mCanAddAudio = true;
}
int decreaseSize = ((MediaModel) object).getMediaSize();
decreaseSlideSize(decreaseSize);
decreaseMessageSize(decreaseSize);
((Model) object).unregisterAllModelChangedObservers();
return true;
}
return false;
|
public boolean | isEmpty()
return mMedia.isEmpty();
|
public boolean | isVisible()
return mVisible;
|
public java.util.Iterator | iterator()
return mMedia.iterator();
|
public int | lastIndexOf(java.lang.Object object)
return mMedia.lastIndexOf(object);
|
public java.util.ListIterator | listIterator()
return mMedia.listIterator();
|
public java.util.ListIterator | listIterator(int location)
return mMedia.listIterator(location);
|
protected void | registerModelChangedObserverInDescendants(IModelChangedObserver observer)
for (MediaModel media : mMedia) {
media.registerModelChangedObserver(observer);
}
|
public boolean | remove(java.lang.Object object)
if ((object != null) && (object instanceof MediaModel)
&& internalRemove(object)) {
notifyModelChanged(true);
return true;
}
return false;
|
public MediaModel | remove(int location)
MediaModel media = mMedia.get(location);
if ((media != null) && internalRemove(media)) {
notifyModelChanged(true);
}
return media;
|
public boolean | removeAll(java.util.Collection collection)
throw new UnsupportedOperationException("Operation not supported.");
|
public boolean | removeAudio()
return remove(mAudio);
|
public boolean | removeImage()
return remove(mImage);
|
public boolean | removeText()
return remove(mText);
|
public boolean | removeVideo()
return remove(mVideo);
|
public boolean | retainAll(java.util.Collection collection)
throw new UnsupportedOperationException("Operation not supported.");
|
public MediaModel | set(int location, MediaModel object)
throw new UnsupportedOperationException("Operation not supported.");
|
public void | setDuration(int duration)
mDuration = duration;
notifyModelChanged(true);
|
public void | setFill(short fill)
mFill = fill;
notifyModelChanged(true);
|
public void | setParent(SlideshowModel parent)
mParent = parent;
|
public void | setVisible(boolean visible)
mVisible = visible;
notifyModelChanged(true);
|
public int | size()
return mMedia.size();
|
public java.util.List | subList(int start, int end)
return mMedia.subList(start, end);
|
public java.lang.Object[] | toArray()
return mMedia.toArray();
|
public T[] | toArray(T[] array)
return mMedia.toArray(array);
|
protected void | unregisterAllModelChangedObserversInDescendants()
for (MediaModel media : mMedia) {
media.unregisterAllModelChangedObservers();
}
|
protected void | unregisterModelChangedObserverInDescendants(IModelChangedObserver observer)
for (MediaModel media : mMedia) {
media.unregisterModelChangedObserver(observer);
}
|
public void | updateDuration(int duration)
if (duration <= 0) {
return;
}
if ((duration > mDuration)
|| (mDuration == DEFAULT_SLIDE_DURATION)) {
mDuration = duration;
}
|