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.util.Map; 21 22 import android.content.Context; 23 import android.graphics.Bitmap; 24 import android.graphics.BitmapFactory; 25 import android.net.Uri; 26 import android.util.AttributeSet; 27 import android.util.Log; 28 import android.view.View; 29 import android.widget.ImageView; 30 import android.widget.LinearLayout; 31 32 import com.android.mms.R; 33 34 /** 35 * This class provides an embedded editor/viewer of picture attachment. 36 */ 37 public class ImageAttachmentView extends LinearLayout implements SlideViewInterface { 38 private ImageView mImageView; 39 private static final String TAG = "ImageAttachmentView"; 40 41 public ImageAttachmentView(Context context) { 42 super(context); 43 } 44 45 public ImageAttachmentView(Context context, AttributeSet attrs) { 46 super(context, attrs); 47 } 48 49 @Override 50 protected void onFinishInflate() { 51 mImageView = (ImageView) findViewById(R.id.image_content); 52 } 53 54 public void startAudio() { 55 // TODO Auto-generated method stub 56 57 } 58 59 public void startVideo() { 60 // TODO Auto-generated method stub 61 62 } 63 64 public void setAudio(Uri audio, String name, Map<String, ?> extras) { 65 // TODO Auto-generated method stub 66 67 } 68 69 public void setImage(String name, Bitmap bitmap) { 70 try { 71 if (null == bitmap) { 72 bitmap = BitmapFactory.decodeResource(getResources(), 73 R.drawable.ic_missing_thumbnail_picture); 74 } 75 mImageView.setImageBitmap(bitmap); 76 } catch (java.lang.OutOfMemoryError e) { 77 Log.e(TAG, "setImage: out of memory: ", e); 78 } 79 } 80 81 public void setImageRegionFit(String fit) { 82 // TODO Auto-generated method stub 83 84 } 85 86 public void setImageVisibility(boolean visible) { 87 // TODO Auto-generated method stub 88 89 } 90 91 public void setText(String name, String text) { 92 // TODO Auto-generated method stub 93 94 } 95 96 public void setTextVisibility(boolean visible) { 97 // TODO Auto-generated method stub 98 99 } 100 101 public void setVideo(String name, Uri video) { 102 // TODO Auto-generated method stub 103 104 } 105 106 public void setVideoThumbnail(String name, Bitmap bitmap) { 107 } 108 109 public void setVideoVisibility(boolean visible) { 110 // TODO Auto-generated method stub 111 112 } 113 114 public void stopAudio() { 115 // TODO Auto-generated method stub 116 117 } 118 119 public void stopVideo() { 120 // TODO Auto-generated method stub 121 122 } 123 124 public void reset() { 125 mImageView.setImageDrawable(null); 126 } 127 128 public void setVisibility(boolean visible) { 129 setVisibility(visible ? View.VISIBLE : View.GONE); 130 } 131 132 public void pauseAudio() { 133 // TODO Auto-generated method stub 134 135 } 136 137 public void pauseVideo() { 138 // TODO Auto-generated method stub 139 140 } 141 142 public void seekAudio(int seekTo) { 143 // TODO Auto-generated method stub 144 145 } 146 147 public void seekVideo(int seekTo) { 148 // TODO Auto-generated method stub 149 150 } 151 } 152