am 4913cfe2: am de53f6ed: am cac30827: Import translations. DO NOT MERGE

* commit '4913cfe2a356d439a7ba055096c2f2cb0c8ad18c':
  Import translations. DO NOT MERGE
diff --git a/src/com/android/mms/model/LayoutModel.java b/src/com/android/mms/model/LayoutModel.java
index 97b1637..0280534 100644
--- a/src/com/android/mms/model/LayoutModel.java
+++ b/src/com/android/mms/model/LayoutModel.java
@@ -110,6 +110,11 @@
         if (mTextRegion == null) {
             createDefaultTextRegion();
         }
+        // LayoutModel will re-construct when orientation changes, so we need to
+        // initialize mLayoutType here. Otherwise, the mLayoutType is alway default
+        // value (LAYOUT_BOTTOM_TEXT) after LayoutModel re-construct.
+        mLayoutType =
+                (mImageRegion.getTop() == 0) ? LAYOUT_BOTTOM_TEXT : LAYOUT_TOP_TEXT;
     }
 
     public RegionModel getRootLayout() {
diff --git a/src/com/android/mms/model/VideoModel.java b/src/com/android/mms/model/VideoModel.java
index a426b42..a71e455 100644
--- a/src/com/android/mms/model/VideoModel.java
+++ b/src/com/android/mms/model/VideoModel.java
@@ -70,7 +70,8 @@
     }
 
     private void initFromFile(Uri uri) {
-        mSrc = uri.getPath();
+        String path = uri.getPath();
+        mSrc = path.substring(path.lastIndexOf('/') + 1);
         MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
         String extension = MimeTypeMap.getFileExtensionFromUrl(mSrc);
         if (TextUtils.isEmpty(extension)) {
diff --git a/src/com/android/mms/transaction/TransactionBundle.java b/src/com/android/mms/transaction/TransactionBundle.java
index 5962b90..ea3edc0 100644
--- a/src/com/android/mms/transaction/TransactionBundle.java
+++ b/src/com/android/mms/transaction/TransactionBundle.java
@@ -19,7 +19,7 @@
 
 import android.os.Bundle;
 
-import com.android.internal.telephony.IccUtils;
+import com.android.internal.telephony.uicc.IccUtils;
 
 /**
  * A wrapper around the Bundle instances used to start the TransactionService.
diff --git a/src/com/android/mms/ui/IconListAdapter.java b/src/com/android/mms/ui/IconListAdapter.java
index e52a0d2..288be7e 100644
--- a/src/com/android/mms/ui/IconListAdapter.java
+++ b/src/com/android/mms/ui/IconListAdapter.java
@@ -35,7 +35,33 @@
 public class IconListAdapter extends ArrayAdapter<IconListAdapter.IconListItem> {
     protected LayoutInflater mInflater;
     private static final int mResource = R.layout.icon_list_item;
+    private ViewHolder mViewHolder;
 
+    static class ViewHolder {
+        private View mView;
+        private TextView mTextView;
+        private ImageView mImageView;
+
+        public ViewHolder(View view) {
+            mView = view;
+        }
+
+        public TextView getTextView() {
+            if (mTextView == null) {
+                mTextView = (TextView) mView.findViewById(R.id.text1);
+            }
+
+            return mTextView;
+        }
+
+        public ImageView getImageView() {
+            if (mImageView == null) {
+                mImageView = (ImageView) mView.findViewById(R.id.icon);
+            }
+
+            return mImageView;
+        }
+    }
     public IconListAdapter(Context context,
             List<IconListItem> items) {
         super(context, mResource, items);
@@ -44,22 +70,22 @@
 
     @Override
     public View getView(int position, View convertView, ViewGroup parent) {
-        TextView text;
-        ImageView image;
-
         View view;
         if (convertView == null) {
             view = mInflater.inflate(mResource, parent, false);
+            mViewHolder = new ViewHolder(view);
+            view.setTag(mViewHolder);
         } else {
             view = convertView;
+            mViewHolder = (ViewHolder) view.getTag();
         }
 
         // Set text field
-        text = (TextView) view.findViewById(R.id.text1);
+        TextView text = mViewHolder.getTextView();
         text.setText(getItem(position).getTitle());
 
         // Set resource icon
-        image = (ImageView) view.findViewById(R.id.icon);
+        ImageView image = mViewHolder.getImageView();
         image.setImageResource(getItem(position).getResource());
 
         return view;
diff --git a/src/com/android/mms/ui/MessageListItem.java b/src/com/android/mms/ui/MessageListItem.java
index 880b7b6..ffe06fb 100644
--- a/src/com/android/mms/ui/MessageListItem.java
+++ b/src/com/android/mms/ui/MessageListItem.java
@@ -212,6 +212,7 @@
         mDateView.setText(buildTimestampLine(msgSizeText + " " + mMessageItem.mTimestamp));
 
         switch (mMessageItem.getMmsDownloadStatus()) {
+            case DownloadManager.STATE_PRE_DOWNLOADING:
             case DownloadManager.STATE_DOWNLOADING:
                 showDownloadingAttachment();
                 break;
@@ -246,6 +247,9 @@
                         intent.putExtra(TransactionBundle.TRANSACTION_TYPE,
                                 Transaction.RETRIEVE_TRANSACTION);
                         mContext.startService(intent);
+
+                        DownloadManager.getInstance().markState(
+                                    mMessageItem.mMessageUri, DownloadManager.STATE_PRE_DOWNLOADING);
                     }
                 });
                 break;
diff --git a/src/com/android/mms/ui/MessageUtils.java b/src/com/android/mms/ui/MessageUtils.java
index 57075f8..502bfde 100644
--- a/src/com/android/mms/ui/MessageUtils.java
+++ b/src/com/android/mms/ui/MessageUtils.java
@@ -904,6 +904,7 @@
         // Launch the slideshow activity to play/view.
         Intent intent = new Intent(context, SlideshowActivity.class);
         intent.setData(msgUri);
+        intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
         if (requestCode > 0 && context instanceof Activity) {
             ((Activity)context).startActivityForResult(intent, requestCode);
         } else {
diff --git a/src/com/android/mms/ui/SlideshowAttachmentView.java b/src/com/android/mms/ui/SlideshowAttachmentView.java
index 22dccef..03d50e5 100644
--- a/src/com/android/mms/ui/SlideshowAttachmentView.java
+++ b/src/com/android/mms/ui/SlideshowAttachmentView.java
@@ -125,7 +125,7 @@
     }
 
     public void reset() {
-        mImageView.setImageURI(null);
+        mImageView.setImageBitmap(null);
         mTextView.setText("");
     }
 
diff --git a/src/com/android/mms/ui/SlideshowPresenter.java b/src/com/android/mms/ui/SlideshowPresenter.java
index 64af07b..acb7a01 100644
--- a/src/com/android/mms/ui/SlideshowPresenter.java
+++ b/src/com/android/mms/ui/SlideshowPresenter.java
@@ -200,7 +200,7 @@
         }
 
         if (dataChanged) {
-            view.setImage(image.getSrc(), image.getBitmap(r.getWidth(), r.getHeight()));
+            view.setImage(image.getSrc(), image.getBitmap(transformedWidth, transformedHeight));
         }
 
         if (view instanceof AdaptableSlideViewInterface) {
diff --git a/src/com/android/mms/util/DownloadManager.java b/src/com/android/mms/util/DownloadManager.java
index 5210597..3e061e3 100644
--- a/src/com/android/mms/util/DownloadManager.java
+++ b/src/com/android/mms/util/DownloadManager.java
@@ -57,6 +57,7 @@
     public static final int STATE_DOWNLOADING       = 0x81;
     public static final int STATE_TRANSIENT_FAILURE = 0x82;
     public static final int STATE_PERMANENT_FAILURE = 0x87;
+    public static final int STATE_PRE_DOWNLOADING   = 0x88;
 
     private final Context mContext;
     private final Handler mHandler;
diff --git a/src/com/android/mms/widget/MmsWidgetProvider.java b/src/com/android/mms/widget/MmsWidgetProvider.java
index a050f68..99b7903 100644
--- a/src/com/android/mms/widget/MmsWidgetProvider.java
+++ b/src/com/android/mms/widget/MmsWidgetProvider.java
@@ -67,10 +67,8 @@
                     MmsWidgetProvider.class));
 
             // We need to update all Mms appwidgets on the home screen.
-            for (int appWidgetId : appWidgetIds) {
-                appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId,
-                        R.id.conversation_list);
-            }
+            appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds,
+                    R.id.conversation_list);
         } else {
             super.onReceive(context, intent);
         }
diff --git a/src/com/android/mms/widget/MmsWidgetService.java b/src/com/android/mms/widget/MmsWidgetService.java
index 4497e67..a0644a8 100644
--- a/src/com/android/mms/widget/MmsWidgetService.java
+++ b/src/com/android/mms/widget/MmsWidgetService.java
@@ -16,6 +16,7 @@
 
 package com.android.mms.widget;
 
+import android.app.PendingIntent;
 import android.appwidget.AppWidgetManager;
 import android.content.Context;
 import android.content.Intent;
@@ -183,9 +184,8 @@
             if (Log.isLoggable(LogTag.WIDGET, Log.VERBOSE)) {
                 Log.v(TAG, "getConversationCount");
             }
-            synchronized (sWidgetLock) {
-                return Math.min(mConversationCursor.getCount(), MAX_CONVERSATIONS_COUNT);
-            }
+
+            return Math.min(mConversationCursor.getCount(), MAX_CONVERSATIONS_COUNT);
         }
 
         /*
@@ -301,8 +301,11 @@
             RemoteViews view = new RemoteViews(mContext.getPackageName(), R.layout.widget_loading);
             view.setTextViewText(
                     R.id.loading_text, mContext.getText(R.string.view_more_conversations));
-            view.setOnClickFillInIntent(R.id.widget_loading,
-                   new Intent(mContext, ConversationList.class));
+            PendingIntent pendingIntent =
+                    PendingIntent.getActivity(mContext, 0, new Intent(mContext,
+                            ConversationList.class),
+                            PendingIntent.FLAG_UPDATE_CURRENT);
+            view.setOnClickPendingIntent(R.id.widget_loading, pendingIntent);
             return view;
         }