blob: 6bf8abf3068df03ff969cf8d9feb957f7a18d9e0 [file] [log] [blame]
Sunny Goyal83a8f042015-05-19 12:52:12 -07001package com.android.launcher3.accessibility;
Sunny Goyal71b5c0b2015-01-08 16:59:04 -08002
3import android.annotation.TargetApi;
Sunny Goyal9ca9c132015-04-29 14:57:22 -07004import android.app.AlertDialog;
5import android.appwidget.AppWidgetProviderInfo;
6import android.content.DialogInterface;
Adam Cohenc9735cf2015-01-23 16:11:55 -08007import android.graphics.Rect;
Sunny Goyal71b5c0b2015-01-08 16:59:04 -08008import android.os.Build;
9import android.os.Bundle;
Sunny Goyal9ae77772015-04-29 16:30:23 -070010import android.os.Handler;
Sunny Goyal1a70cef2015-04-22 11:29:51 -070011import android.text.TextUtils;
Sunny Goyala9116722015-04-29 13:55:58 -070012import android.util.Log;
Sunny Goyal71b5c0b2015-01-08 16:59:04 -080013import android.util.SparseArray;
14import android.view.View;
15import android.view.View.AccessibilityDelegate;
16import android.view.accessibility.AccessibilityNodeInfo;
17import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
18
Sunny Goyal83a8f042015-05-19 12:52:12 -070019import com.android.launcher3.AppInfo;
20import com.android.launcher3.AppWidgetResizeFrame;
21import com.android.launcher3.CellLayout;
22import com.android.launcher3.DeleteDropTarget;
Sunny Goyal45478022015-06-08 16:52:41 -070023import com.android.launcher3.DragSource;
Sunny Goyal26119432016-02-18 22:09:23 +000024import com.android.launcher3.folder.Folder;
Sunny Goyal83a8f042015-05-19 12:52:12 -070025import com.android.launcher3.FolderInfo;
26import com.android.launcher3.InfoDropTarget;
27import com.android.launcher3.ItemInfo;
28import com.android.launcher3.Launcher;
29import com.android.launcher3.LauncherAppWidgetHostView;
30import com.android.launcher3.LauncherAppWidgetInfo;
31import com.android.launcher3.LauncherModel;
32import com.android.launcher3.LauncherSettings;
33import com.android.launcher3.PendingAddItemInfo;
34import com.android.launcher3.R;
35import com.android.launcher3.ShortcutInfo;
36import com.android.launcher3.UninstallDropTarget;
37import com.android.launcher3.Workspace;
Vadim Tryshevfedca432015-08-19 17:55:02 -070038import com.android.launcher3.dragndrop.DragController.DragListener;
Adam Cohen091440a2015-03-18 14:16:05 -070039import com.android.launcher3.util.Thunk;
Sunny Goyal71b5c0b2015-01-08 16:59:04 -080040
41import java.util.ArrayList;
42
43@TargetApi(Build.VERSION_CODES.LOLLIPOP)
Sunny Goyal45478022015-06-08 16:52:41 -070044public class LauncherAccessibilityDelegate extends AccessibilityDelegate implements DragListener {
Sunny Goyal71b5c0b2015-01-08 16:59:04 -080045
Sunny Goyala9116722015-04-29 13:55:58 -070046 private static final String TAG = "LauncherAccessibilityDelegate";
47
48 private static final int REMOVE = R.id.action_remove;
49 private static final int INFO = R.id.action_info;
50 private static final int UNINSTALL = R.id.action_uninstall;
51 private static final int ADD_TO_WORKSPACE = R.id.action_add_to_workspace;
52 private static final int MOVE = R.id.action_move;
Sunny Goyal9ae77772015-04-29 16:30:23 -070053 private static final int MOVE_TO_WORKSPACE = R.id.action_move_to_workspace;
Sunny Goyal9ca9c132015-04-29 14:57:22 -070054 private static final int RESIZE = R.id.action_resize;
Adam Cohenc9735cf2015-01-23 16:11:55 -080055
Sunny Goyale9b651e2015-04-24 11:44:51 -070056 public enum DragType {
Adam Cohenc9735cf2015-01-23 16:11:55 -080057 ICON,
58 FOLDER,
59 WIDGET
60 }
61
62 public static class DragInfo {
Sunny Goyale9b651e2015-04-24 11:44:51 -070063 public DragType dragType;
64 public ItemInfo info;
65 public View item;
Adam Cohenc9735cf2015-01-23 16:11:55 -080066 }
67
Sunny Goyala9116722015-04-29 13:55:58 -070068 private final SparseArray<AccessibilityAction> mActions = new SparseArray<>();
Adam Cohen091440a2015-03-18 14:16:05 -070069 @Thunk final Launcher mLauncher;
Sunny Goyal71b5c0b2015-01-08 16:59:04 -080070
Sunny Goyale9b651e2015-04-24 11:44:51 -070071 private DragInfo mDragInfo = null;
72 private AccessibilityDragSource mDragSource = null;
73
Sunny Goyal71b5c0b2015-01-08 16:59:04 -080074 public LauncherAccessibilityDelegate(Launcher launcher) {
75 mLauncher = launcher;
76
77 mActions.put(REMOVE, new AccessibilityAction(REMOVE,
Tony Wickham9aae47f2015-10-01 13:04:22 -070078 launcher.getText(R.string.remove_drop_target_label)));
Sunny Goyal71b5c0b2015-01-08 16:59:04 -080079 mActions.put(INFO, new AccessibilityAction(INFO,
Tony Wickham9aae47f2015-10-01 13:04:22 -070080 launcher.getText(R.string.app_info_drop_target_label)));
Sunny Goyal71b5c0b2015-01-08 16:59:04 -080081 mActions.put(UNINSTALL, new AccessibilityAction(UNINSTALL,
Tony Wickham9aae47f2015-10-01 13:04:22 -070082 launcher.getText(R.string.uninstall_drop_target_label)));
Sunny Goyal71b5c0b2015-01-08 16:59:04 -080083 mActions.put(ADD_TO_WORKSPACE, new AccessibilityAction(ADD_TO_WORKSPACE,
84 launcher.getText(R.string.action_add_to_workspace)));
Adam Cohenc9735cf2015-01-23 16:11:55 -080085 mActions.put(MOVE, new AccessibilityAction(MOVE,
86 launcher.getText(R.string.action_move)));
Sunny Goyal9ae77772015-04-29 16:30:23 -070087 mActions.put(MOVE_TO_WORKSPACE, new AccessibilityAction(MOVE_TO_WORKSPACE,
88 launcher.getText(R.string.action_move_to_workspace)));
Sunny Goyal9ca9c132015-04-29 14:57:22 -070089 mActions.put(RESIZE, new AccessibilityAction(RESIZE,
90 launcher.getText(R.string.action_resize)));
Sunny Goyal71b5c0b2015-01-08 16:59:04 -080091 }
92
93 @Override
94 public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
95 super.onInitializeAccessibilityNodeInfo(host, info);
96 if (!(host.getTag() instanceof ItemInfo)) return;
97 ItemInfo item = (ItemInfo) host.getTag();
98
Tony Wickham9aae47f2015-10-01 13:04:22 -070099 if (DeleteDropTarget.supportsAccessibleDrop(item)) {
Sunny Goyal1a70cef2015-04-22 11:29:51 -0700100 info.addAction(mActions.get(REMOVE));
101 }
102 if (UninstallDropTarget.supportsDrop(host.getContext(), item)) {
103 info.addAction(mActions.get(UNINSTALL));
104 }
Sunny Goyald5bd67d2016-03-11 01:10:19 -0800105 if (InfoDropTarget.supportsDrop(item)) {
Sunny Goyal1a70cef2015-04-22 11:29:51 -0700106 info.addAction(mActions.get(INFO));
107 }
108
Sunny Goyal71b5c0b2015-01-08 16:59:04 -0800109 if ((item instanceof ShortcutInfo)
110 || (item instanceof LauncherAppWidgetInfo)
111 || (item instanceof FolderInfo)) {
Adam Cohenc9735cf2015-01-23 16:11:55 -0800112 info.addAction(mActions.get(MOVE));
Sunny Goyal9ae77772015-04-29 16:30:23 -0700113
114 if (item.container >= 0) {
115 info.addAction(mActions.get(MOVE_TO_WORKSPACE));
Sunny Goyal9ca9c132015-04-29 14:57:22 -0700116 } else if (item instanceof LauncherAppWidgetInfo) {
117 if (!getSupportedResizeActions(host, (LauncherAppWidgetInfo) item).isEmpty()) {
118 info.addAction(mActions.get(RESIZE));
119 }
Sunny Goyal9ae77772015-04-29 16:30:23 -0700120 }
Adam Cohen6e92f052016-06-07 14:30:10 -0700121 }
122
123 if ((item instanceof AppInfo) || (item instanceof PendingAddItemInfo)) {
Sunny Goyal71b5c0b2015-01-08 16:59:04 -0800124 info.addAction(mActions.get(ADD_TO_WORKSPACE));
125 }
126 }
127
128 @Override
129 public boolean performAccessibilityAction(View host, int action, Bundle args) {
130 if ((host.getTag() instanceof ItemInfo)
131 && performAction(host, (ItemInfo) host.getTag(), action)) {
132 return true;
133 }
134 return super.performAccessibilityAction(host, action, args);
135 }
136
Sunny Goyal9ca9c132015-04-29 14:57:22 -0700137 public boolean performAction(final View host, final ItemInfo item, int action) {
Sunny Goyal71b5c0b2015-01-08 16:59:04 -0800138 if (action == REMOVE) {
Sunny Goyale78e3d72015-09-24 11:23:31 -0700139 DeleteDropTarget.removeWorkspaceOrFolderItem(mLauncher, item, host);
140 return true;
Sunny Goyal71b5c0b2015-01-08 16:59:04 -0800141 } else if (action == INFO) {
Sunny Goyald5bd67d2016-03-11 01:10:19 -0800142 InfoDropTarget.startDetailsActivityForInfo(item, mLauncher, null);
Sunny Goyal71b5c0b2015-01-08 16:59:04 -0800143 return true;
144 } else if (action == UNINSTALL) {
Sunny Goyal1a70cef2015-04-22 11:29:51 -0700145 return UninstallDropTarget.startUninstallActivity(mLauncher, item);
Adam Cohenc9735cf2015-01-23 16:11:55 -0800146 } else if (action == MOVE) {
147 beginAccessibleDrag(host, item);
Sunny Goyal71b5c0b2015-01-08 16:59:04 -0800148 } else if (action == ADD_TO_WORKSPACE) {
Sunny Goyala9116722015-04-29 13:55:58 -0700149 final int[] coordinates = new int[2];
150 final long screenId = findSpaceOnWorkspace(item, coordinates);
151 mLauncher.showWorkspace(true, new Runnable() {
Sunny Goyal71b5c0b2015-01-08 16:59:04 -0800152
153 @Override
Sunny Goyala9116722015-04-29 13:55:58 -0700154 public void run() {
155 if (item instanceof AppInfo) {
156 ShortcutInfo info = ((AppInfo) item).makeShortcut();
157 LauncherModel.addItemToDatabase(mLauncher, info,
158 LauncherSettings.Favorites.CONTAINER_DESKTOP,
159 screenId, coordinates[0], coordinates[1]);
160
161 ArrayList<ItemInfo> itemList = new ArrayList<>();
162 itemList.add(info);
163 mLauncher.bindItems(itemList, 0, itemList.size(), true);
164 } else if (item instanceof PendingAddItemInfo) {
165 PendingAddItemInfo info = (PendingAddItemInfo) item;
166 Workspace workspace = mLauncher.getWorkspace();
167 workspace.snapToPage(workspace.getPageIndexForScreenId(screenId));
168 mLauncher.addPendingItem(info, LauncherSettings.Favorites.CONTAINER_DESKTOP,
169 screenId, coordinates, info.spanX, info.spanY);
Sunny Goyal71b5c0b2015-01-08 16:59:04 -0800170 }
Sunny Goyala9116722015-04-29 13:55:58 -0700171 announceConfirmation(R.string.item_added_to_workspace);
172 }
173 });
174 return true;
Sunny Goyal9ae77772015-04-29 16:30:23 -0700175 } else if (action == MOVE_TO_WORKSPACE) {
176 Folder folder = mLauncher.getWorkspace().getOpenFolder();
Sunny Goyal935fca12015-10-13 10:19:01 -0700177 mLauncher.closeFolder(folder, true);
Sunny Goyal9ae77772015-04-29 16:30:23 -0700178 ShortcutInfo info = (ShortcutInfo) item;
Sunny Goyalc52ba712016-04-05 15:59:05 -0700179 folder.getInfo().remove(info, false);
Sunny Goyal9ae77772015-04-29 16:30:23 -0700180
181 final int[] coordinates = new int[2];
182 final long screenId = findSpaceOnWorkspace(item, coordinates);
183 LauncherModel.moveItemInDatabase(mLauncher, info,
184 LauncherSettings.Favorites.CONTAINER_DESKTOP,
185 screenId, coordinates[0], coordinates[1]);
186
187 // Bind the item in next frame so that if a new workspace page was created,
188 // it will get laid out.
189 new Handler().post(new Runnable() {
190
191 @Override
192 public void run() {
193 ArrayList<ItemInfo> itemList = new ArrayList<>();
194 itemList.add(item);
195 mLauncher.bindItems(itemList, 0, itemList.size(), true);
196 announceConfirmation(R.string.item_moved);
197 }
198 });
Sunny Goyal9ca9c132015-04-29 14:57:22 -0700199 } else if (action == RESIZE) {
200 final LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) item;
201 final ArrayList<Integer> actions = getSupportedResizeActions(host, info);
202 CharSequence[] labels = new CharSequence[actions.size()];
203 for (int i = 0; i < actions.size(); i++) {
204 labels[i] = mLauncher.getText(actions.get(i));
205 }
206
207 new AlertDialog.Builder(mLauncher)
208 .setTitle(R.string.action_resize)
209 .setItems(labels, new DialogInterface.OnClickListener() {
210
211 @Override
212 public void onClick(DialogInterface dialog, int which) {
213 performResizeAction(actions.get(which), host, info);
214 dialog.dismiss();
215 }
216 })
217 .show();
Sunny Goyal71b5c0b2015-01-08 16:59:04 -0800218 }
219 return false;
220 }
Adam Cohenc9735cf2015-01-23 16:11:55 -0800221
Sunny Goyal9ca9c132015-04-29 14:57:22 -0700222 private ArrayList<Integer> getSupportedResizeActions(View host, LauncherAppWidgetInfo info) {
Sunny Goyal9ca9c132015-04-29 14:57:22 -0700223 ArrayList<Integer> actions = new ArrayList<>();
224
Sunny Goyald3d8c952015-06-01 10:09:06 -0700225 AppWidgetProviderInfo providerInfo = ((LauncherAppWidgetHostView) host).getAppWidgetInfo();
226 if (providerInfo == null) {
227 return actions;
228 }
229
Sunny Goyal9ca9c132015-04-29 14:57:22 -0700230 CellLayout layout = (CellLayout) host.getParent().getParent();
231 if ((providerInfo.resizeMode & AppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0) {
232 if (layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY) ||
233 layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY)) {
234 actions.add(R.string.action_increase_width);
235 }
236
237 if (info.spanX > info.minSpanX && info.spanX > 1) {
238 actions.add(R.string.action_decrease_width);
239 }
240 }
241
242 if ((providerInfo.resizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0) {
243 if (layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1) ||
244 layout.isRegionVacant(info.cellX, info.cellY - 1, info.spanX, 1)) {
245 actions.add(R.string.action_increase_height);
246 }
247
248 if (info.spanY > info.minSpanY && info.spanY > 1) {
249 actions.add(R.string.action_decrease_height);
250 }
251 }
252 return actions;
253 }
254
Sunny Goyal316490e2015-06-02 09:38:28 -0700255 @Thunk void performResizeAction(int action, View host, LauncherAppWidgetInfo info) {
Sunny Goyal9ca9c132015-04-29 14:57:22 -0700256 CellLayout.LayoutParams lp = (CellLayout.LayoutParams) host.getLayoutParams();
257 CellLayout layout = (CellLayout) host.getParent().getParent();
258 layout.markCellsAsUnoccupiedForView(host);
259
260 if (action == R.string.action_increase_width) {
261 if (((host.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL)
262 && layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY))
263 || !layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY)) {
264 lp.cellX --;
265 info.cellX --;
266 }
267 lp.cellHSpan ++;
268 info.spanX ++;
269 } else if (action == R.string.action_decrease_width) {
270 lp.cellHSpan --;
271 info.spanX --;
272 } else if (action == R.string.action_increase_height) {
273 if (!layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1)) {
274 lp.cellY --;
275 info.cellY --;
276 }
277 lp.cellVSpan ++;
278 info.spanY ++;
279 } else if (action == R.string.action_decrease_height) {
280 lp.cellVSpan --;
281 info.spanY --;
282 }
283
284 layout.markCellsAsOccupiedForView(host);
285 Rect sizeRange = new Rect();
286 AppWidgetResizeFrame.getWidgetSizeRanges(mLauncher, info.spanX, info.spanY, sizeRange);
287 ((LauncherAppWidgetHostView) host).updateAppWidgetSize(null,
288 sizeRange.left, sizeRange.top, sizeRange.right, sizeRange.bottom);
289 host.requestLayout();
290 LauncherModel.updateItemInDatabase(mLauncher, info);
291 announceConfirmation(mLauncher.getString(R.string.widget_resized, info.spanX, info.spanY));
292 }
293
Adam Cohen091440a2015-03-18 14:16:05 -0700294 @Thunk void announceConfirmation(int resId) {
Adam Cohenc9735cf2015-01-23 16:11:55 -0800295 announceConfirmation(mLauncher.getResources().getString(resId));
296 }
297
Adam Cohen091440a2015-03-18 14:16:05 -0700298 @Thunk void announceConfirmation(String confirmation) {
Adam Cohenc9735cf2015-01-23 16:11:55 -0800299 mLauncher.getDragLayer().announceForAccessibility(confirmation);
300
301 }
302
303 public boolean isInAccessibleDrag() {
304 return mDragInfo != null;
305 }
306
307 public DragInfo getDragInfo() {
308 return mDragInfo;
309 }
310
Sunny Goyal1a70cef2015-04-22 11:29:51 -0700311 /**
312 * @param clickedTarget the actual view that was clicked
313 * @param dropLocation relative to {@param clickedTarget}. If provided, its center is used
314 * as the actual drop location otherwise the views center is used.
315 */
316 public void handleAccessibleDrop(View clickedTarget, Rect dropLocation,
Adam Cohenc9735cf2015-01-23 16:11:55 -0800317 String confirmation) {
318 if (!isInAccessibleDrag()) return;
319
320 int[] loc = new int[2];
Sunny Goyal1a70cef2015-04-22 11:29:51 -0700321 if (dropLocation == null) {
322 loc[0] = clickedTarget.getWidth() / 2;
323 loc[1] = clickedTarget.getHeight() / 2;
324 } else {
325 loc[0] = dropLocation.centerX();
326 loc[1] = dropLocation.centerY();
327 }
Adam Cohenc9735cf2015-01-23 16:11:55 -0800328
Sunny Goyal1a70cef2015-04-22 11:29:51 -0700329 mLauncher.getDragLayer().getDescendantCoordRelativeToSelf(clickedTarget, loc);
Adam Cohenc9735cf2015-01-23 16:11:55 -0800330 mLauncher.getDragController().completeAccessibleDrag(loc);
331
Sunny Goyal1a70cef2015-04-22 11:29:51 -0700332 if (!TextUtils.isEmpty(confirmation)) {
333 announceConfirmation(confirmation);
334 }
Adam Cohenc9735cf2015-01-23 16:11:55 -0800335 }
336
337 public void beginAccessibleDrag(View item, ItemInfo info) {
338 mDragInfo = new DragInfo();
339 mDragInfo.info = info;
340 mDragInfo.item = item;
341 mDragInfo.dragType = DragType.ICON;
342 if (info instanceof FolderInfo) {
343 mDragInfo.dragType = DragType.FOLDER;
344 } else if (info instanceof LauncherAppWidgetInfo) {
345 mDragInfo.dragType = DragType.WIDGET;
346 }
347
348 CellLayout.CellInfo cellInfo = new CellLayout.CellInfo(item, info);
349
350 Rect pos = new Rect();
351 mLauncher.getDragLayer().getDescendantRectRelativeToSelf(item, pos);
Adam Cohenc9735cf2015-01-23 16:11:55 -0800352 mLauncher.getDragController().prepareAccessibleDrag(pos.centerX(), pos.centerY());
Sunny Goyale9b651e2015-04-24 11:44:51 -0700353
354 Workspace workspace = mLauncher.getWorkspace();
355
356 Folder folder = workspace.getOpenFolder();
357 if (folder != null) {
358 if (folder.getItemsInReadingOrder().contains(item)) {
359 mDragSource = folder;
360 } else {
361 mLauncher.closeFolder();
362 }
363 }
364 if (mDragSource == null) {
365 mDragSource = workspace;
366 }
367 mDragSource.enableAccessibleDrag(true);
368 mDragSource.startDrag(cellInfo, true);
Adam Cohenc9735cf2015-01-23 16:11:55 -0800369
Sunny Goyal45478022015-06-08 16:52:41 -0700370 if (mLauncher.getDragController().isDragging()) {
371 mLauncher.getDragController().addDragListener(this);
Adam Cohenc9735cf2015-01-23 16:11:55 -0800372 }
Adam Cohenc9735cf2015-01-23 16:11:55 -0800373 }
374
Sunny Goyal45478022015-06-08 16:52:41 -0700375
376 @Override
Sunny Goyalaa8ef112015-06-12 20:04:41 -0700377 public void onDragStart(DragSource source, ItemInfo info, int dragAction) {
Sunny Goyal45478022015-06-08 16:52:41 -0700378 // No-op
Adam Cohenc9735cf2015-01-23 16:11:55 -0800379 }
380
Sunny Goyal45478022015-06-08 16:52:41 -0700381 @Override
382 public void onDragEnd() {
383 mLauncher.getDragController().removeDragListener(this);
Adam Cohenc9735cf2015-01-23 16:11:55 -0800384 mDragInfo = null;
Sunny Goyale9b651e2015-04-24 11:44:51 -0700385 if (mDragSource != null) {
386 mDragSource.enableAccessibleDrag(false);
387 mDragSource = null;
388 }
389 }
390
391 public static interface AccessibilityDragSource {
392 void startDrag(CellLayout.CellInfo cellInfo, boolean accessible);
393
394 void enableAccessibleDrag(boolean enable);
Adam Cohenc9735cf2015-01-23 16:11:55 -0800395 }
Sunny Goyala9116722015-04-29 13:55:58 -0700396
397 /**
398 * Find empty space on the workspace and returns the screenId.
399 */
400 private long findSpaceOnWorkspace(ItemInfo info, int[] outCoordinates) {
401 Workspace workspace = mLauncher.getWorkspace();
402 ArrayList<Long> workspaceScreens = workspace.getScreenOrder();
403 long screenId;
404
405 // First check if there is space on the current screen.
406 int screenIndex = workspace.getCurrentPage();
407 screenId = workspaceScreens.get(screenIndex);
408 CellLayout layout = (CellLayout) workspace.getPageAt(screenIndex);
409
410 boolean found = layout.findCellForSpan(outCoordinates, info.spanX, info.spanY);
411 screenIndex = workspace.hasCustomContent() ? 1 : 0;
412 while (!found && screenIndex < workspaceScreens.size()) {
413 screenId = workspaceScreens.get(screenIndex);
414 layout = (CellLayout) workspace.getPageAt(screenIndex);
415 found = layout.findCellForSpan(outCoordinates, info.spanX, info.spanY);
416 screenIndex++;
417 }
418
419 if (found) {
420 return screenId;
421 }
422
423 workspace.addExtraEmptyScreen();
424 screenId = workspace.commitExtraEmptyScreen();
425 layout = workspace.getScreenWithId(screenId);
426 found = layout.findCellForSpan(outCoordinates, info.spanX, info.spanY);
427
428 if (!found) {
429 Log.wtf(TAG, "Not enough space on an empty screen");
430 }
431 return screenId;
432 }
Sunny Goyal71b5c0b2015-01-08 16:59:04 -0800433}