1 /* 2 * Copyright (C) 2008 Esmertec AG. 3 * Copyright (C) 2008 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package com.android.mms.ui; 19 20 import java.io.IOException; 21 import java.util.Map; 22 23 import android.content.Context; 24 import android.graphics.Bitmap; 25 import android.graphics.BitmapFactory; 26 import android.media.MediaPlayer; 27 import android.net.Uri; 28 import android.util.AttributeSet; 29 import android.util.Log; 30 import android.view.View; 31 import android.widget.ImageView; 32 import android.widget.LinearLayout; 33 import android.widget.TextView; 34 35 import com.android.mms.LogTag; 36 import com.android.mms.R; 37 38 /** 39 * This class provides an embedded editor/viewer of slide-show attachment. 40 */ 41 public class SlideshowAttachmentView extends LinearLayout implements 42 SlideViewInterface { 43 private static final String TAG = LogTag.TAG; 44 45 private ImageView mImageView; 46 private TextView mTextView; 47 SlideshowAttachmentView(Context context)48 public SlideshowAttachmentView(Context context) { 49 super(context); 50 } 51 SlideshowAttachmentView(Context context, AttributeSet attrs)52 public SlideshowAttachmentView(Context context, AttributeSet attrs) { 53 super(context, attrs); 54 } 55 56 @Override onFinishInflate()57 protected void onFinishInflate() { 58 mImageView = (ImageView) findViewById(R.id.slideshow_image); 59 mTextView = (TextView) findViewById(R.id.slideshow_text); 60 } 61 startAudio()62 public void startAudio() { 63 // TODO Auto-generated method stub 64 } 65 startVideo()66 public void startVideo() { 67 // TODO Auto-generated method stub 68 } 69 setAudio(Uri audio, String name, Map<String, ?> extras)70 public void setAudio(Uri audio, String name, Map<String, ?> extras) { 71 // TODO Auto-generated method stub 72 } 73 setImage(String name, Bitmap bitmap)74 public void setImage(String name, Bitmap bitmap) { 75 if (null == bitmap) { 76 try { 77 bitmap = BitmapFactory.decodeResource(getResources(), 78 R.drawable.ic_missing_thumbnail_picture); 79 } catch (java.lang.OutOfMemoryError e) { 80 // We don't even have enough memory to load the "missing thumbnail" image 81 } 82 } 83 if (bitmap != null) { 84 mImageView.setImageBitmap(bitmap); // implementation doesn't appear to be null-safe 85 } 86 } 87 setImageRegionFit(String fit)88 public void setImageRegionFit(String fit) { 89 // TODO Auto-generated method stub 90 } 91 setImageVisibility(boolean visible)92 public void setImageVisibility(boolean visible) { 93 mImageView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); 94 } 95 setText(String name, String text)96 public void setText(String name, String text) { 97 mTextView.setText(text); 98 } 99 setTextVisibility(boolean visible)100 public void setTextVisibility(boolean visible) { 101 mTextView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); 102 } 103 setVideo(String name, Uri video)104 public void setVideo(String name, Uri video) { 105 // TODO: get a thumbnail from the video 106 mImageView.setImageBitmap(null); 107 } 108 setVideoVisibility(boolean visible)109 public void setVideoVisibility(boolean visible) { 110 // TODO Auto-generated method stub 111 } 112 stopAudio()113 public void stopAudio() { 114 // TODO Auto-generated method stub 115 } 116 stopVideo()117 public void stopVideo() { 118 // TODO Auto-generated method stub 119 } 120 reset()121 public void reset() { 122 mImageView.setImageBitmap(null); 123 mTextView.setText(""); 124 } 125 setVisibility(boolean visible)126 public void setVisibility(boolean visible) { 127 // TODO Auto-generated method stub 128 } 129 pauseAudio()130 public void pauseAudio() { 131 // TODO Auto-generated method stub 132 133 } 134 pauseVideo()135 public void pauseVideo() { 136 // TODO Auto-generated method stub 137 138 } 139 seekAudio(int seekTo)140 public void seekAudio(int seekTo) { 141 // TODO Auto-generated method stub 142 143 } 144 seekVideo(int seekTo)145 public void seekVideo(int seekTo) { 146 // TODO Auto-generated method stub 147 148 } 149 setVideoThumbnail(String name, Bitmap bitmap)150 public void setVideoThumbnail(String name, Bitmap bitmap) { 151 } 152 } 153