use of com.android.mms.model.TextModel in project android-aosp-mms by slvn.
the class SlideshowEditor method addNewSlide.
/**
* Add a new slide at the specified position in the message.
*
* @return true if success, false if reach the max slide number.
* @throws IndexOutOfBoundsException - if position is out of range
* (position < 0 || position > size()).
*/
public boolean addNewSlide(int position) {
int size = mModel.size();
if (size < MAX_SLIDE_NUM) {
SlideModel slide = new SlideModel(mModel);
TextModel text = new TextModel(mContext, ContentType.TEXT_PLAIN, "text_" + size + ".txt", mModel.getLayout().getTextRegion());
slide.add(text);
mModel.add(position, slide);
return true;
} else {
Log.w(TAG, "The limitation of the number of slides is reached.");
return false;
}
}
use of com.android.mms.model.TextModel in project android-aosp-mms by slvn.
the class WorkingMessage method syncTextToSlideshow.
/**
* Moves the message text into the slideshow. Should be called any time
* the message is about to be sent or written to disk.
*/
private void syncTextToSlideshow() {
if (mSlideshow == null || mSlideshow.size() != 1)
return;
SlideModel slide = mSlideshow.get(0);
TextModel text;
if (!slide.hasText()) {
// Add a TextModel to slide 0 if one doesn't already exist
text = new TextModel(mActivity, ContentType.TEXT_PLAIN, "text_0.txt", mSlideshow.getLayout().getTextRegion());
slide.add(text);
} else {
// Otherwise just reuse the existing one.
text = slide.getText();
}
text.setText(mText);
}
use of com.android.mms.model.TextModel in project android-aosp-mms by slvn.
the class SlideshowEditor method changeText.
public void changeText(int position, String newText) {
if (newText != null) {
SlideModel slide = mModel.get(position);
TextModel text = slide.getText();
if (text == null) {
text = new TextModel(mContext, ContentType.TEXT_PLAIN, "text_" + position + ".txt", mModel.getLayout().getTextRegion());
text.setText(newText);
slide.add(text);
} else if (!newText.equals(text.getText())) {
text.setText(newText);
}
}
}
Aggregations