Merge "Import translations. DO NOT MERGE" into ub-launcher3-master
diff --git a/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java b/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java
index 73b824b..c71307d 100644
--- a/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java
+++ b/src/com/android/launcher3/accessibility/WorkspaceAccessibilityHelper.java
@@ -17,6 +17,8 @@
 package com.android.launcher3.accessibility;
 
 import android.content.Context;
+import android.graphics.Rect;
+import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
 import android.text.TextUtils;
 import android.view.View;
 
@@ -24,15 +26,20 @@
 import com.android.launcher3.CellLayout;
 import com.android.launcher3.FolderInfo;
 import com.android.launcher3.ItemInfo;
+import com.android.launcher3.Launcher;
 import com.android.launcher3.accessibility.LauncherAccessibilityDelegate.DragType;
 import com.android.launcher3.R;
 import com.android.launcher3.ShortcutInfo;
+import com.android.launcher3.dragndrop.DragLayer;
 
 /**
  * Implementation of {@link DragAndDropAccessibilityDelegate} to support DnD on workspace.
  */
 public class WorkspaceAccessibilityHelper extends DragAndDropAccessibilityDelegate {
 
+    private final Rect mTempRect = new Rect();
+    private final int[] mTempCords = new int[2];
+
     public WorkspaceAccessibilityHelper(CellLayout layout) {
         super(layout);
     }
@@ -128,6 +135,25 @@
     }
 
     @Override
+    protected void onPopulateNodeForVirtualView(int id, AccessibilityNodeInfoCompat node) {
+        super.onPopulateNodeForVirtualView(id, node);
+
+
+        // ExploreByTouchHelper does not currently handle view scale.
+        // Update BoundsInScreen to appropriate value.
+        DragLayer dragLayer = Launcher.getLauncher(mView.getContext()).getDragLayer();
+        mTempCords[0] = mTempCords[1] = 0;
+        float scale = dragLayer.getDescendantCoordRelativeToSelf(mView, mTempCords);
+
+        node.getBoundsInParent(mTempRect);
+        mTempRect.left = mTempCords[0] + (int) (mTempRect.left * scale);
+        mTempRect.right = mTempCords[0] + (int) (mTempRect.right * scale);
+        mTempRect.top = mTempCords[1] + (int) (mTempRect.top * scale);
+        mTempRect.bottom = mTempCords[1] + (int) (mTempRect.bottom * scale);
+        node.setBoundsInScreen(mTempRect);
+    }
+
+    @Override
     protected String getLocationDescriptionForIconDrop(int id) {
         int x = id % mView.getCountX();
         int y = id / mView.getCountX();
diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
index 5479453..d9e34a6 100644
--- a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
+++ b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
@@ -10,6 +10,7 @@
 import android.os.Build;
 import android.os.Handler;
 import android.os.Looper;
+import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.view.MotionEvent;
 import android.view.View;
@@ -113,7 +114,11 @@
                     final ShortcutInfoCompat shortcut = shortcuts.get(i);
                     final ShortcutInfo launcherShortcutInfo = ShortcutInfo
                             .fromDeepShortcutInfo(shortcut, mLauncher);
-                    uiHandler.post(new UpdateShortcutChild(i, launcherShortcutInfo));
+                    CharSequence label = shortcut.getLongLabel();
+                    if (TextUtils.isEmpty(label)) {
+                        label = shortcut.getShortLabel();
+                    }
+                    uiHandler.post(new UpdateShortcutChild(i, launcherShortcutInfo, label));
                 }
             }
         });
@@ -123,10 +128,13 @@
     private class UpdateShortcutChild implements Runnable {
         private int mShortcutChildIndex;
         private ShortcutInfo mShortcutChildInfo;
+        private CharSequence mLabel;
 
-        public UpdateShortcutChild(int shortcutChildIndex, ShortcutInfo shortcutChildInfo) {
+        public UpdateShortcutChild(int shortcutChildIndex, ShortcutInfo shortcutChildInfo,
+                CharSequence label) {
             mShortcutChildIndex = shortcutChildIndex;
             mShortcutChildInfo = shortcutChildInfo;
+            mLabel = label;
         }
 
         @Override
@@ -134,6 +142,7 @@
             DeepShortcutView shortcutView = (DeepShortcutView) getChildAt(mShortcutChildIndex);
             shortcutView.applyFromShortcutInfo(mShortcutChildInfo,
                     LauncherAppState.getInstance().getIconCache());
+            shortcutView.setText(mLabel);
             shortcutView.setOnClickListener(mLauncher);
             shortcutView.setOnLongClickListener(DeepShortcutsContainer.this);
             shortcutView.setOnTouchListener(DeepShortcutsContainer.this);