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
18package com.android.mms.ui;
19
20import java.io.IOException;
21import java.util.Map;
22
23import android.content.Context;
24import android.graphics.Bitmap;
25import android.graphics.BitmapFactory;
26import android.media.MediaPlayer;
27import android.net.Uri;
28import android.util.AttributeSet;
29import android.util.Log;
30import android.view.View;
31import android.widget.ImageView;
32import android.widget.LinearLayout;
33import android.widget.TextView;
34
35import com.android.mms.R;
36
37/**
38 * This class provides an embedded editor/viewer of slide-show attachment.
39 */
40public class SlideshowAttachmentView extends LinearLayout implements
41        SlideViewInterface {
42    private static final String TAG = "SlideshowAttachmentView";
43
44    private ImageView mImageView;
45    private TextView mTextView;
46
47    public SlideshowAttachmentView(Context context) {
48        super(context);
49    }
50
51    public SlideshowAttachmentView(Context context, AttributeSet attrs) {
52        super(context, attrs);
53    }
54
55    @Override
56    protected void onFinishInflate() {
57        mImageView = (ImageView) findViewById(R.id.slideshow_image);
58        mTextView = (TextView) findViewById(R.id.slideshow_text);
59    }
60
61    public void startAudio() {
62        // TODO Auto-generated method stub
63    }
64
65    public void startVideo() {
66        // TODO Auto-generated method stub
67    }
68
69    public void setAudio(Uri audio, String name, Map<String, ?> extras) {
70        // TODO Auto-generated method stub
71    }
72
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
87    public void setImageRegionFit(String fit) {
88        // TODO Auto-generated method stub
89    }
90
91    public void setImageVisibility(boolean visible) {
92        mImageView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
93    }
94
95    public void setText(String name, String text) {
96        mTextView.setText(text);
97    }
98
99    public void setTextVisibility(boolean visible) {
100        mTextView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
101    }
102
103    public void setVideo(String name, Uri video) {
104        // TODO: get a thumbnail from the video
105        mImageView.setImageBitmap(null);
106    }
107
108    public void setVideoVisibility(boolean visible) {
109        // TODO Auto-generated method stub
110    }
111
112    public void stopAudio() {
113        // TODO Auto-generated method stub
114    }
115
116    public void stopVideo() {
117        // TODO Auto-generated method stub
118    }
119
120    public void reset() {
121        mImageView.setImageBitmap(null);
122        mTextView.setText("");
123    }
124
125    public void setVisibility(boolean visible) {
126        // TODO Auto-generated method stub
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    public void setVideoThumbnail(String name, Bitmap bitmap) {
150    }
151}
152