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 com.android.mms.R; 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 java.util.Map; 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 setVideoVisibility(boolean visible) { 107 // TODO Auto-generated method stub 108 109 } 110 111 public void stopAudio() { 112 // TODO Auto-generated method stub 113 114 } 115 116 public void stopVideo() { 117 // TODO Auto-generated method stub 118 119 } 120 121 public void reset() { 122 mImageView.setImageDrawable(null); 123 } 124 125 public void setVisibility(boolean visible) { 126 setVisibility(visible ? View.VISIBLE : View.GONE); 127 } 128 129 public void pauseAudio() { 130 // TODO Auto-generated method stub 131 132 } 133 134 public void pauseVideo() { 135 // TODO Auto-generated method stub 136 137 } 138 139 public void seekAudio(int seekTo) { 140 // TODO Auto-generated method stub 141 142 } 143 144 public void seekVideo(int seekTo) { 145 // TODO Auto-generated method stub 146 147 } 148 } 149