Fields Summary |
---|
private static final String | TAG |
public static final int | EMPTY |
public static final int | TEXT_ONLY |
public static final int | IMAGE_ATTACHMENT |
public static final int | VIDEO_ATTACHMENT |
public static final int | AUDIO_ATTACHMENT |
public static final int | SLIDESHOW_ATTACHMENT |
static final int | MSG_EDIT_SLIDESHOW |
static final int | MSG_SEND_SLIDESHOW |
static final int | MSG_PLAY_SLIDESHOW |
static final int | MSG_REPLACE_IMAGE |
static final int | MSG_REPLACE_VIDEO |
static final int | MSG_REPLACE_AUDIO |
static final int | MSG_PLAY_VIDEO |
static final int | MSG_PLAY_AUDIO |
static final int | MSG_VIEW_IMAGE |
private final android.content.Context | mContext |
private final android.os.Handler | mHandler |
private final android.view.View | mRoot |
private SlideViewInterface | mView |
private com.android.mms.model.SlideshowModel | mSlideshow |
private Presenter | mPresenter |
private int | mAttachmentType |
private OnAttachmentChangedListener | mAttachmentChangedListener |
private boolean | mCanSend |
private android.widget.Button | mSendButton |
Methods Summary |
---|
public void | changeAudio(android.net.Uri uri)
AudioModel audio = new AudioModel(mContext, uri);
SlideModel slide = mSlideshow.get(0);
slide.removeImage();
slide.removeVideo();
slide.add(audio);
slide.updateDuration(audio.getDuration());
|
public void | changeImage(android.net.Uri uri)
ImageModel image = new ImageModel(mContext, uri,
mSlideshow.getLayout().getImageRegion());
SlideModel slide = mSlideshow.get(0);
slide.removeVideo();
slide.removeAudio();
slide.add(image);
|
public void | changeVideo(android.net.Uri uri)
VideoModel video = new VideoModel(mContext, uri,
mSlideshow.getLayout().getImageRegion());
SlideModel slide = mSlideshow.get(0);
slide.removeImage();
slide.removeAudio();
slide.add(video);
slide.updateDuration(video.getDuration());
|
private SlideViewInterface | createMediaView(int stub_view_id, int real_view_id, int view_button_id, int replace_button_id, int remove_button_id, int view_message, int replace_message)
LinearLayout view = (LinearLayout)getStubView(stub_view_id, real_view_id);
view.setVisibility(View.VISIBLE);
Button viewButton = (Button) view.findViewById(view_button_id);
Button replaceButton = (Button) view.findViewById(replace_button_id);
Button removeButton = (Button) view.findViewById(remove_button_id);
viewButton.setOnClickListener(new MessageOnClick(view_message));
replaceButton.setOnClickListener(new MessageOnClick(replace_message));
removeButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
removeAttachment();
((View) mView).setVisibility(View.GONE);
int oldAttachmentType = mAttachmentType;
mAttachmentType = TEXT_ONLY;
if (mAttachmentChangedListener != null) {
mAttachmentChangedListener.onAttachmentChanged(
mAttachmentType, oldAttachmentType);
}
}
});
return (SlideViewInterface) view;
|
private SlideViewInterface | createSlideshowView()
LinearLayout view =(LinearLayout) getStubView(
R.id.slideshow_attachment_view_stub, R.id.slideshow_attachment_view);
view.setVisibility(View.VISIBLE);
Button editBtn = (Button) view.findViewById(R.id.edit_slideshow_button);
mSendButton = (Button) view.findViewById(R.id.send_slideshow_button);
updateSendButton();
final ImageButton playBtn = (ImageButton) view.findViewById(
R.id.play_slideshow_button);
editBtn.setOnClickListener(new MessageOnClick(MSG_EDIT_SLIDESHOW));
mSendButton.setOnClickListener(new MessageOnClick(MSG_SEND_SLIDESHOW));
playBtn.setOnClickListener(new MessageOnClick(MSG_PLAY_SLIDESHOW));
return (SlideViewInterface) view;
|
private SlideViewInterface | createView()
switch(mAttachmentType) {
case IMAGE_ATTACHMENT:
return createMediaView(
R.id.image_attachment_view_stub, R.id.image_attachment_view,
R.id.view_image_button, R.id.replace_image_button, R.id.remove_image_button,
MSG_VIEW_IMAGE, MSG_REPLACE_IMAGE);
case VIDEO_ATTACHMENT:
return createMediaView(
R.id.video_attachment_view_stub, R.id.video_attachment_view,
R.id.view_video_button, R.id.replace_video_button, R.id.remove_video_button,
MSG_PLAY_VIDEO, MSG_REPLACE_VIDEO);
case AUDIO_ATTACHMENT:
return createMediaView(
R.id.audio_attachment_view_stub, R.id.audio_attachment_view,
R.id.play_audio_button, R.id.replace_audio_button, R.id.remove_audio_button,
MSG_PLAY_AUDIO, MSG_REPLACE_AUDIO);
case SLIDESHOW_ATTACHMENT:
return createSlideshowView();
default:
throw new IllegalArgumentException();
}
|
public int | getAttachmentType()
return mAttachmentType;
|
private android.view.View | getStubView(int stubId, int viewId)
View view = mRoot.findViewById(viewId);
if (view == null) {
ViewStub stub = (ViewStub) mRoot.findViewById(stubId);
view = stub.inflate();
}
return view;
|
public void | hideView()
if (mView != null) {
((View)mView).setVisibility(View.GONE);
}
|
public void | removeAttachment()
SlideModel slide = mSlideshow.get(0);
slide.removeImage();
slide.removeVideo();
slide.removeAudio();
|
public void | setAttachment(com.android.mms.model.SlideshowModel slideshow, int attachmentType)
if (attachmentType == EMPTY) {
throw new IllegalArgumentException(
"Type of the attachment may not be EMPTY.");
}
mSlideshow = slideshow;
int oldAttachmentType = mAttachmentType;
mAttachmentType = attachmentType;
if (mView != null) {
((View) mView).setVisibility(View.GONE);
mView = null;
}
if (attachmentType != TEXT_ONLY) {
mView = createView();
if ((mPresenter == null) || !mSlideshow.equals(mPresenter.getModel())) {
mPresenter = PresenterFactory.getPresenter(
"MmsThumbnailPresenter", mContext, mView, mSlideshow);
} else {
mPresenter.setView(mView);
}
mPresenter.present();
}
if ((mAttachmentChangedListener != null) && (mAttachmentType != oldAttachmentType)) {
mAttachmentChangedListener.onAttachmentChanged(mAttachmentType, oldAttachmentType);
}
|
public void | setCanSend(boolean enable)
if (mCanSend != enable) {
mCanSend = enable;
updateSendButton();
}
|
public void | setOnAttachmentChangedListener(com.android.mms.ui.AttachmentEditor$OnAttachmentChangedListener l)
mAttachmentChangedListener = l;
|
private void | updateSendButton()
if (null != mSendButton) {
mSendButton.setEnabled(mCanSend);
mSendButton.setFocusable(mCanSend);
}
|