MessageListItem.java revision f7e8281a223af6228e6399055a6197a1edd9bc3a
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.util.Map; 21import java.util.regex.Matcher; 22import java.util.regex.Pattern; 23 24import android.app.AlertDialog; 25import android.content.Context; 26import android.content.DialogInterface; 27import android.content.Intent; 28import android.graphics.Bitmap; 29import android.graphics.BitmapFactory; 30import android.graphics.Canvas; 31import android.graphics.Paint; 32import android.graphics.Typeface; 33import android.graphics.Paint.FontMetricsInt; 34import android.graphics.drawable.Drawable; 35import android.net.Uri; 36import android.os.Handler; 37import android.os.Message; 38import android.provider.Browser; 39import android.provider.Telephony.Mms; 40import android.provider.Telephony.MmsSms; 41import android.provider.Telephony.Sms; 42import android.telephony.PhoneNumberUtils; 43import android.telephony.TelephonyManager; 44import android.text.Html; 45import android.text.Layout; 46import android.text.Spannable; 47import android.text.SpannableStringBuilder; 48import android.text.TextUtils; 49import android.text.method.HideReturnsTransformationMethod; 50import android.text.style.ForegroundColorSpan; 51import android.text.style.LeadingMarginSpan; 52import android.text.style.LineHeightSpan; 53import android.text.style.StyleSpan; 54import android.text.style.TextAppearanceSpan; 55import android.text.style.URLSpan; 56import android.util.AttributeSet; 57import android.view.View; 58import android.view.ViewGroup; 59import android.view.View.OnClickListener; 60import android.widget.ArrayAdapter; 61import android.widget.Button; 62import android.widget.ImageButton; 63import android.widget.ImageView; 64import android.widget.LinearLayout; 65import android.widget.QuickContactBadge; 66import android.widget.TextView; 67 68import com.android.mms.MmsApp; 69import com.android.mms.R; 70import com.android.mms.data.WorkingMessage; 71import com.android.mms.transaction.Transaction; 72import com.android.mms.transaction.TransactionBundle; 73import com.android.mms.transaction.TransactionService; 74import com.android.mms.util.DownloadManager; 75import com.android.mms.util.SmileyParser; 76import com.google.android.mms.ContentType; 77import com.google.android.mms.pdu.PduHeaders; 78 79/** 80 * This class provides view of a message in the messages list. 81 */ 82public class MessageListItem extends LinearLayout implements 83 SlideViewInterface, OnClickListener { 84 public static final String EXTRA_URLS = "com.android.mms.ExtraUrls"; 85 86 private static final String TAG = "MessageListItem"; 87 private static final StyleSpan STYLE_BOLD = new StyleSpan(Typeface.BOLD); 88 89 static final int MSG_LIST_EDIT_MMS = 1; 90 static final int MSG_LIST_EDIT_SMS = 2; 91 92 private View mMsgListItem; 93 private View mMmsView; 94 private ImageView mImageView; 95 private ImageView mLockedIndicator; 96 private ImageView mDeliveredIndicator; 97 private ImageView mDetailsIndicator; 98 private ImageButton mSlideShowButton; 99 private TextView mBodyTextView; 100 private Button mDownloadButton; 101 private TextView mDownloadingLabel; 102 private QuickContactBadge mAvatar; 103 private Handler mHandler; 104 private MessageItem mMessageItem; 105 106 public MessageListItem(Context context) { 107 super(context); 108 } 109 110 public MessageListItem(Context context, AttributeSet attrs) { 111 super(context, attrs); 112 113 int color = mContext.getResources().getColor(R.color.timestamp_color); 114 mColorSpan = new ForegroundColorSpan(color); 115 } 116 117 @Override 118 protected void onFinishInflate() { 119 super.onFinishInflate(); 120 121 mMsgListItem = findViewById(R.id.msg_list_item); 122 mBodyTextView = (TextView) findViewById(R.id.text_view); 123 mLockedIndicator = (ImageView) findViewById(R.id.locked_indicator); 124 mDeliveredIndicator = (ImageView) findViewById(R.id.delivered_indicator); 125 mDetailsIndicator = (ImageView) findViewById(R.id.details_indicator); 126 mAvatar = (QuickContactBadge) findViewById(R.id.avatar); 127 128 ViewGroup.MarginLayoutParams badgeParams = (MarginLayoutParams)mAvatar.getLayoutParams(); 129 final int badgeWidth = badgeParams.width + badgeParams.rightMargin + badgeParams.leftMargin; 130 131 int lineHeight = mBodyTextView.getLineHeight(); 132 int effectiveBadgeHeight = badgeParams.height + badgeParams.topMargin - mBodyTextView.getPaddingTop(); 133 final int indentLineCount = (int) ((effectiveBadgeHeight-1) / lineHeight) + 1; 134 135 mLeadingMarginSpan = new LeadingMarginSpan.LeadingMarginSpan2() { 136 public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, 137 int top, int baseline, int bottom, CharSequence text, 138 int start, int end, boolean first, Layout layout) { 139 // no op 140 } 141 142 public int getLeadingMargin(boolean first) { 143 return first ? badgeWidth : 0; 144 } 145 146 public int getLeadingMarginLineCount() { 147 return indentLineCount; 148 } 149 }; 150 151 } 152 153 public void bind(MessageListAdapter.AvatarCache avatarCache, MessageItem msgItem) { 154 mMessageItem = msgItem; 155 156 setLongClickable(false); 157 158 switch (msgItem.mMessageType) { 159 case PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND: 160 bindNotifInd(msgItem); 161 break; 162 default: 163 bindCommonMessage(avatarCache, msgItem); 164 break; 165 } 166 } 167 168 public MessageItem getMessageItem() { 169 return mMessageItem; 170 } 171 172 public void setMsgListItemHandler(Handler handler) { 173 mHandler = handler; 174 } 175 176 private void bindNotifInd(final MessageItem msgItem) { 177 hideMmsViewIfNeeded(); 178 179 String msgSizeText = mContext.getString(R.string.message_size_label) 180 + String.valueOf((msgItem.mMessageSize + 1023) / 1024) 181 + mContext.getString(R.string.kilobyte); 182 183 mBodyTextView.setText(formatMessage(msgItem, msgItem.mContact, null, msgItem.mSubject, 184 msgSizeText + "\n" + msgItem.mTimestamp, 185 msgItem.mHighlight, msgItem.mTextContentType)); 186 187 int state = DownloadManager.getInstance().getState(msgItem.mMessageUri); 188 switch (state) { 189 case DownloadManager.STATE_DOWNLOADING: 190 inflateDownloadControls(); 191 mDownloadingLabel.setVisibility(View.VISIBLE); 192 mDownloadButton.setVisibility(View.GONE); 193 break; 194 case DownloadManager.STATE_UNSTARTED: 195 case DownloadManager.STATE_TRANSIENT_FAILURE: 196 case DownloadManager.STATE_PERMANENT_FAILURE: 197 default: 198 setLongClickable(true); 199 inflateDownloadControls(); 200 mDownloadingLabel.setVisibility(View.GONE); 201 mDownloadButton.setVisibility(View.VISIBLE); 202 mDownloadButton.setOnClickListener(new OnClickListener() { 203 public void onClick(View v) { 204 mDownloadingLabel.setVisibility(View.VISIBLE); 205 mDownloadButton.setVisibility(View.GONE); 206 Intent intent = new Intent(mContext, TransactionService.class); 207 intent.putExtra(TransactionBundle.URI, msgItem.mMessageUri.toString()); 208 intent.putExtra(TransactionBundle.TRANSACTION_TYPE, 209 Transaction.RETRIEVE_TRANSACTION); 210 mContext.startService(intent); 211 } 212 }); 213 break; 214 } 215 216 // Hide the indicators. 217 mLockedIndicator.setVisibility(View.GONE); 218 mDeliveredIndicator.setVisibility(View.GONE); 219 mDetailsIndicator.setVisibility(View.GONE); 220 221 drawLeftStatusIndicator(msgItem.mBoxId); 222 } 223 224 private void bindCommonMessage(final MessageListAdapter.AvatarCache avatarCache, final MessageItem msgItem) { 225 if (mDownloadButton != null) { 226 mDownloadButton.setVisibility(View.GONE); 227 mDownloadingLabel.setVisibility(View.GONE); 228 } 229 // Since the message text should be concatenated with the sender's 230 // address(or name), I have to display it here instead of 231 // displaying it by the Presenter. 232 mBodyTextView.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); 233 234 String addr = null; 235 if (!Sms.isOutgoingFolder(msgItem.mBoxId)) { 236 addr = msgItem.mAddress; 237 } else { 238 addr = MmsApp.getApplication().getTelephonyManager().getLine1Number(); 239 } 240 if (!TextUtils.isEmpty(addr)) { 241 MessageListAdapter.AvatarCache.ContactData contactData = avatarCache.get(addr); 242 mAvatar.setImageDrawable(contactData.getAvatar()); 243 Uri contactUri = contactData.getContactUri(); 244 // Since we load the contact info in the background, on the first screenfull of 245 // messages, it's likely we haven't loaded the contact URI info yet. In that case, 246 // fall back and use the phone number. 247 if (contactUri != null) { 248 mAvatar.assignContactUri(contactUri); 249 } else { 250 mAvatar.assignContactFromPhone(addr, true); 251 } 252 } else { 253 mAvatar.setImageDrawable(null); 254 mAvatar.assignContactUri(null); 255 } 256 257 // Get and/or lazily set the formatted message from/on the 258 // MessageItem. Because the MessageItem instances come from a 259 // cache (currently of size ~50), the hit rate on avoiding the 260 // expensive formatMessage() call is very high. 261 CharSequence formattedMessage = msgItem.getCachedFormattedMessage(); 262 if (formattedMessage == null) { 263 formattedMessage = formatMessage(msgItem, msgItem.mContact, msgItem.mBody, 264 msgItem.mSubject, msgItem.mTimestamp, 265 msgItem.mHighlight, msgItem.mTextContentType); 266 } 267 mBodyTextView.setText(formattedMessage); 268 269 if (msgItem.isSms()) { 270 hideMmsViewIfNeeded(); 271 } else { 272 Presenter presenter = PresenterFactory.getPresenter( 273 "MmsThumbnailPresenter", mContext, 274 this, msgItem.mSlideshow); 275 presenter.present(); 276 277 if (msgItem.mAttachmentType != WorkingMessage.TEXT) { 278 inflateMmsView(); 279 mMmsView.setVisibility(View.VISIBLE); 280 setOnClickListener(msgItem); 281 drawPlaybackButton(msgItem); 282 } else { 283 hideMmsViewIfNeeded(); 284 } 285 } 286 287 drawLeftStatusIndicator(msgItem.mBoxId); 288 drawRightStatusIndicator(msgItem); 289 } 290 291 private void hideMmsViewIfNeeded() { 292 if (mMmsView != null) { 293 mMmsView.setVisibility(View.GONE); 294 } 295 } 296 297 public void startAudio() { 298 // TODO Auto-generated method stub 299 } 300 301 public void startVideo() { 302 // TODO Auto-generated method stub 303 } 304 305 public void setAudio(Uri audio, String name, Map<String, ?> extras) { 306 // TODO Auto-generated method stub 307 } 308 309 public void setImage(String name, Bitmap bitmap) { 310 inflateMmsView(); 311 312 if (null == bitmap) { 313 bitmap = BitmapFactory.decodeResource(getResources(), 314 R.drawable.ic_missing_thumbnail_picture); 315 } 316 mImageView.setImageBitmap(bitmap); 317 mImageView.setVisibility(VISIBLE); 318 } 319 320 private void inflateMmsView() { 321 if (mMmsView == null) { 322 //inflate the surrounding view_stub 323 findViewById(R.id.mms_layout_view_stub).setVisibility(VISIBLE); 324 325 mMmsView = findViewById(R.id.mms_view); 326 mImageView = (ImageView) findViewById(R.id.image_view); 327 mSlideShowButton = (ImageButton) findViewById(R.id.play_slideshow_button); 328 } 329 } 330 331 private void inflateDownloadControls() { 332 if (mDownloadButton == null) { 333 //inflate the download controls 334 findViewById(R.id.mms_downloading_view_stub).setVisibility(VISIBLE); 335 mDownloadButton = (Button) findViewById(R.id.btn_download_msg); 336 mDownloadingLabel = (TextView) findViewById(R.id.label_downloading); 337 } 338 } 339 340 private LeadingMarginSpan mLeadingMarginSpan; 341 342 private LineHeightSpan mSpan = new LineHeightSpan() { 343 public void chooseHeight(CharSequence text, int start, 344 int end, int spanstartv, int v, FontMetricsInt fm) { 345 fm.ascent -= 10; 346 } 347 }; 348 349 TextAppearanceSpan mTextSmallSpan = 350 new TextAppearanceSpan(mContext, android.R.style.TextAppearance_Small); 351 352 ForegroundColorSpan mColorSpan = null; // set in ctor 353 354 private CharSequence formatMessage(MessageItem msgItem, String contact, String body, 355 String subject, String timestamp, Pattern highlight, 356 String contentType) { 357 CharSequence template = mContext.getResources().getText(R.string.name_colon); 358 SpannableStringBuilder buf = 359 new SpannableStringBuilder(TextUtils.replace(template, 360 new String[] { "%s" }, 361 new CharSequence[] { contact })); 362 363 boolean hasSubject = !TextUtils.isEmpty(subject); 364 if (hasSubject) { 365 buf.append(mContext.getResources().getString(R.string.inline_subject, subject)); 366 } 367 368 if (!TextUtils.isEmpty(body)) { 369 // Converts html to spannable if ContentType is "text/html". 370 if (contentType != null && ContentType.TEXT_HTML.equals(contentType)) { 371 buf.append("\n"); 372 buf.append(Html.fromHtml(body)); 373 } else { 374 if (hasSubject) { 375 buf.append(" - "); 376 } 377 SmileyParser parser = SmileyParser.getInstance(); 378 buf.append(parser.addSmileySpans(body)); 379 } 380 } 381 // If we're in the process of sending a message (i.e. pending), then we show a "Sending..." 382 // string in place of the timestamp. 383 if (msgItem.isSending()) { 384 timestamp = mContext.getResources().getString(R.string.sending_message); 385 } 386 if (!TextUtils.isEmpty(timestamp)) { 387 buf.append("\n"); 388 int startOffset = buf.length(); 389 390 startOffset = buf.length(); 391 buf.append(timestamp); 392 393 buf.setSpan(mTextSmallSpan, startOffset, buf.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 394 buf.setSpan(mSpan, startOffset+1, buf.length(), 0); 395 396 // Make the timestamp text not as dark 397 buf.setSpan(mColorSpan, startOffset, buf.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 398 } 399 if (highlight != null) { 400 Matcher m = highlight.matcher(buf.toString()); 401 while (m.find()) { 402 buf.setSpan(new StyleSpan(Typeface.BOLD), m.start(), m.end(), 0); 403 } 404 } 405 buf.setSpan(mLeadingMarginSpan, 0, buf.length(), 0); 406 return buf; 407 } 408 409 private void drawPlaybackButton(MessageItem msgItem) { 410 switch (msgItem.mAttachmentType) { 411 case WorkingMessage.SLIDESHOW: 412 case WorkingMessage.AUDIO: 413 case WorkingMessage.VIDEO: 414 // Show the 'Play' button and bind message info on it. 415 mSlideShowButton.setTag(msgItem); 416 // Set call-back for the 'Play' button. 417 mSlideShowButton.setOnClickListener(this); 418 mSlideShowButton.setVisibility(View.VISIBLE); 419 setLongClickable(true); 420 421 // When we show the mSlideShowButton, this list item's onItemClickListener doesn't 422 // get called. (It gets set in ComposeMessageActivity: 423 // mMsgListView.setOnItemClickListener) Here we explicitly set the item's 424 // onClickListener. It allows the item to respond to embedded html links and at the 425 // same time, allows the slide show play button to work. 426 setOnClickListener(new OnClickListener() { 427 public void onClick(View v) { 428 onMessageListItemClick(); 429 } 430 }); 431 break; 432 default: 433 mSlideShowButton.setVisibility(View.GONE); 434 break; 435 } 436 } 437 438 // OnClick Listener for the playback button 439 public void onClick(View v) { 440 MessageItem mi = (MessageItem) v.getTag(); 441 switch (mi.mAttachmentType) { 442 case WorkingMessage.VIDEO: 443 case WorkingMessage.AUDIO: 444 case WorkingMessage.SLIDESHOW: 445 MessageUtils.viewMmsMessageAttachment(mContext, mi.mMessageUri, mi.mSlideshow); 446 break; 447 } 448 } 449 450 public void onMessageListItemClick() { 451 URLSpan[] spans = mBodyTextView.getUrls(); 452 453 if (spans.length == 0) { 454 // Do nothing. 455 } else if (spans.length == 1) { 456 Uri uri = Uri.parse(spans[0].getURL()); 457 Intent intent = new Intent(Intent.ACTION_VIEW, uri); 458 intent.putExtra(Browser.EXTRA_APPLICATION_ID, mContext.getPackageName()); 459 intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); 460 mContext.startActivity(intent); 461 } else { 462 final java.util.ArrayList<String> urls = MessageUtils.extractUris(spans); 463 464 ArrayAdapter<String> adapter = 465 new ArrayAdapter<String>(mContext, android.R.layout.select_dialog_item, urls) { 466 public View getView(int position, View convertView, ViewGroup parent) { 467 View v = super.getView(position, convertView, parent); 468 try { 469 String url = getItem(position).toString(); 470 TextView tv = (TextView) v; 471 Drawable d = mContext.getPackageManager().getActivityIcon(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); 472 if (d != null) { 473 d.setBounds(0, 0, d.getIntrinsicHeight(), d.getIntrinsicHeight()); 474 tv.setCompoundDrawablePadding(10); 475 tv.setCompoundDrawables(d, null, null, null); 476 } 477 final String telPrefix = "tel:"; 478 if (url.startsWith(telPrefix)) { 479 url = PhoneNumberUtils.formatNumber(url.substring(telPrefix.length())); 480 } 481 tv.setText(url); 482 } catch (android.content.pm.PackageManager.NameNotFoundException ex) { 483 ; 484 } 485 return v; 486 } 487 }; 488 489 AlertDialog.Builder b = new AlertDialog.Builder(mContext); 490 491 DialogInterface.OnClickListener click = new DialogInterface.OnClickListener() { 492 public final void onClick(DialogInterface dialog, int which) { 493 if (which >= 0) { 494 Uri uri = Uri.parse(urls.get(which)); 495 Intent intent = new Intent(Intent.ACTION_VIEW, uri); 496 intent.putExtra(Browser.EXTRA_APPLICATION_ID, mContext.getPackageName()); 497 intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); 498 mContext.startActivity(intent); 499 } 500 } 501 }; 502 503 b.setTitle(R.string.select_link_title); 504 b.setCancelable(true); 505 b.setAdapter(adapter, click); 506 507 b.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { 508 public final void onClick(DialogInterface dialog, int which) { 509 dialog.dismiss(); 510 } 511 }); 512 513 b.show(); 514 } 515 } 516 517 518 private void setOnClickListener(final MessageItem msgItem) { 519 switch(msgItem.mAttachmentType) { 520 case WorkingMessage.IMAGE: 521 case WorkingMessage.VIDEO: 522 mImageView.setOnClickListener(new OnClickListener() { 523 public void onClick(View v) { 524 MessageUtils.viewMmsMessageAttachment(mContext, null, msgItem.mSlideshow); 525 } 526 }); 527 mImageView.setOnLongClickListener(new OnLongClickListener() { 528 public boolean onLongClick(View v) { 529 return v.showContextMenu(); 530 } 531 }); 532 break; 533 534 default: 535 mImageView.setOnClickListener(null); 536 break; 537 } 538 } 539 540 private void drawLeftStatusIndicator(int msgBoxId) { 541 switch (msgBoxId) { 542 case Mms.MESSAGE_BOX_INBOX: 543 mMsgListItem.setBackgroundResource(R.drawable.listitem_background_lightblue); 544 break; 545 546 case Mms.MESSAGE_BOX_DRAFTS: 547 case Sms.MESSAGE_TYPE_FAILED: 548 case Sms.MESSAGE_TYPE_QUEUED: 549 case Mms.MESSAGE_BOX_OUTBOX: 550 mMsgListItem.setBackgroundResource(R.drawable.listitem_background); 551 break; 552 553 default: 554 mMsgListItem.setBackgroundResource(R.drawable.listitem_background); 555 break; 556 } 557 } 558 559 private void setErrorIndicatorClickListener(final MessageItem msgItem) { 560 String type = msgItem.mType; 561 final int what; 562 if (type.equals("sms")) { 563 what = MSG_LIST_EDIT_SMS; 564 } else { 565 what = MSG_LIST_EDIT_MMS; 566 } 567 mDeliveredIndicator.setOnClickListener(new OnClickListener() { 568 public void onClick(View v) { 569 if (null != mHandler) { 570 Message msg = Message.obtain(mHandler, what); 571 msg.obj = new Long(msgItem.mMsgId); 572 msg.sendToTarget(); 573 } 574 } 575 }); 576 } 577 578 private void drawRightStatusIndicator(MessageItem msgItem) { 579 // Locked icon 580 if (msgItem.mLocked) { 581 mLockedIndicator.setImageResource(R.drawable.ic_lock_message_sms); 582 mLockedIndicator.setVisibility(View.VISIBLE); 583 } else { 584 mLockedIndicator.setVisibility(View.GONE); 585 } 586 587 // Delivery icon 588 if (msgItem.isOutgoingMessage()) { 589 if (msgItem.isFailedMessage()) { 590 mDeliveredIndicator.setImageResource(R.drawable.ic_sms_mms_not_delivered); 591 setErrorIndicatorClickListener(msgItem); 592 mDeliveredIndicator.setVisibility(View.VISIBLE); 593 } 594 } else if (msgItem.mDeliveryStatus == MessageItem.DeliveryStatus.FAILED) { 595 mDeliveredIndicator.setImageResource(R.drawable.ic_sms_mms_not_delivered); 596 mDeliveredIndicator.setVisibility(View.VISIBLE); 597 } else if (msgItem.mDeliveryStatus == MessageItem.DeliveryStatus.RECEIVED) { 598 mDeliveredIndicator.setImageResource(R.drawable.ic_sms_mms_delivered); 599 mDeliveredIndicator.setVisibility(View.VISIBLE); 600 } else { 601 mDeliveredIndicator.setVisibility(View.GONE); 602 } 603 604 // Message details icon 605 if (msgItem.mDeliveryStatus == MessageItem.DeliveryStatus.INFO || msgItem.mReadReport) { 606 mDetailsIndicator.setImageResource(R.drawable.ic_sms_mms_details); 607 mDetailsIndicator.setVisibility(View.VISIBLE); 608 } else { 609 mDetailsIndicator.setVisibility(View.GONE); 610 } 611 } 612 613 public void setImageRegionFit(String fit) { 614 // TODO Auto-generated method stub 615 } 616 617 public void setImageVisibility(boolean visible) { 618 // TODO Auto-generated method stub 619 } 620 621 public void setText(String name, String text) { 622 // TODO Auto-generated method stub 623 } 624 625 public void setTextVisibility(boolean visible) { 626 // TODO Auto-generated method stub 627 } 628 629 public void setVideo(String name, Uri video) { 630 inflateMmsView(); 631 Bitmap bitmap = VideoAttachmentView.createVideoThumbnail(mContext, video); 632 if (null == bitmap) { 633 bitmap = BitmapFactory.decodeResource(getResources(), 634 R.drawable.ic_missing_thumbnail_video); 635 } 636 mImageView.setImageBitmap(bitmap); 637 mImageView.setVisibility(VISIBLE); 638 } 639 640 public void setVideoVisibility(boolean visible) { 641 // TODO Auto-generated method stub 642 } 643 644 public void stopAudio() { 645 // TODO Auto-generated method stub 646 } 647 648 public void stopVideo() { 649 // TODO Auto-generated method stub 650 } 651 652 public void reset() { 653 if (mImageView != null) { 654 mImageView.setVisibility(GONE); 655 } 656 } 657 658 public void setVisibility(boolean visible) { 659 // TODO Auto-generated method stub 660 } 661 662 public void pauseAudio() { 663 // TODO Auto-generated method stub 664 665 } 666 667 public void pauseVideo() { 668 // TODO Auto-generated method stub 669 670 } 671 672 public void seekAudio(int seekTo) { 673 // TODO Auto-generated method stub 674 675 } 676 677 public void seekVideo(int seekTo) { 678 // TODO Auto-generated method stub 679 680 } 681} 682