• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.R;
36 
37 /**
38  * This class provides an embedded editor/viewer of slide-show attachment.
39  */
40 public class SlideshowAttachmentView extends LinearLayout implements
41         SlideViewInterface {
42     private static final String TAG = "SlideshowAttachmentView";
43 
44     private ImageView mImageView;
45     private TextView mTextView;
46 
SlideshowAttachmentView(Context context)47     public SlideshowAttachmentView(Context context) {
48         super(context);
49     }
50 
SlideshowAttachmentView(Context context, AttributeSet attrs)51     public SlideshowAttachmentView(Context context, AttributeSet attrs) {
52         super(context, attrs);
53     }
54 
55     @Override
onFinishInflate()56     protected void onFinishInflate() {
57         mImageView = (ImageView) findViewById(R.id.slideshow_image);
58         mTextView = (TextView) findViewById(R.id.slideshow_text);
59     }
60 
startAudio()61     public void startAudio() {
62         // TODO Auto-generated method stub
63     }
64 
startVideo()65     public void startVideo() {
66         // TODO Auto-generated method stub
67     }
68 
setAudio(Uri audio, String name, Map<String, ?> extras)69     public void setAudio(Uri audio, String name, Map<String, ?> extras) {
70         // TODO Auto-generated method stub
71     }
72 
setImage(String name, Bitmap bitmap)73     public void setImage(String name, Bitmap bitmap) {
74         if (null == bitmap) {
75             try {
76                 bitmap = BitmapFactory.decodeResource(getResources(),
77                         R.drawable.ic_missing_thumbnail_picture);
78             } catch (java.lang.OutOfMemoryError e) {
79                 // We don't even have enough memory to load the "missing thumbnail" image
80             }
81         }
82         if (bitmap != null) {
83             mImageView.setImageBitmap(bitmap);      // implementation doesn't appear to be null-safe
84         }
85     }
86 
setImageRegionFit(String fit)87     public void setImageRegionFit(String fit) {
88         // TODO Auto-generated method stub
89     }
90 
setImageVisibility(boolean visible)91     public void setImageVisibility(boolean visible) {
92         mImageView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
93     }
94 
setText(String name, String text)95     public void setText(String name, String text) {
96         mTextView.setText(text);
97     }
98 
setTextVisibility(boolean visible)99     public void setTextVisibility(boolean visible) {
100         mTextView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
101     }
102 
setVideo(String name, Uri video)103     public void setVideo(String name, Uri video) {
104         MediaPlayer mp = new MediaPlayer();
105         try {
106             mp.setDataSource(mContext, video);
107             mImageView.setImageBitmap(mp.getFrameAt(1000));
108         } catch (IOException e) {
109             Log.e(TAG, "Unexpected IOException.", e);
110         } finally {
111             mp.release();
112         }
113     }
114 
setVideoVisibility(boolean visible)115     public void setVideoVisibility(boolean visible) {
116         // TODO Auto-generated method stub
117     }
118 
stopAudio()119     public void stopAudio() {
120         // TODO Auto-generated method stub
121     }
122 
stopVideo()123     public void stopVideo() {
124         // TODO Auto-generated method stub
125     }
126 
reset()127     public void reset() {
128         mImageView.setImageBitmap(null);
129         mTextView.setText("");
130     }
131 
setVisibility(boolean visible)132     public void setVisibility(boolean visible) {
133         // TODO Auto-generated method stub
134     }
135 
pauseAudio()136     public void pauseAudio() {
137         // TODO Auto-generated method stub
138 
139     }
140 
pauseVideo()141     public void pauseVideo() {
142         // TODO Auto-generated method stub
143 
144     }
145 
seekAudio(int seekTo)146     public void seekAudio(int seekTo) {
147         // TODO Auto-generated method stub
148 
149     }
150 
seekVideo(int seekTo)151     public void seekVideo(int seekTo) {
152         // TODO Auto-generated method stub
153 
154     }
155 
setVideoThumbnail(String name, Bitmap bitmap)156     public void setVideoThumbnail(String name, Bitmap bitmap) {
157     }
158 }
159