private boolean handleTouchDown(MotionEvent ev, boolean intercept) { Rect hitRect = new Rect(); int x = (int) ev.getX(); int y = (int) ev.getY(); for (AppWidgetResizeFrame child : mResizeFrames) { child.getHitRect(hitRect); if (hitRect.contains(x, y)) { if (child.beginResizeIfPointInRegion(x - child.getLeft(), y - child.getTop())) { mCurrentResizeFrame = child; mXDown = x; mYDown = y; requestDisallowInterceptTouchEvent(true); return true; } } } Folder currentFolder = mLauncher.getWorkspace().getOpenFolder(); if (currentFolder != null && !mLauncher.isFolderClingVisible() && intercept) { if (currentFolder.isEditingName()) { if (!isEventOverFolderTextRegion(currentFolder, ev)) { currentFolder.dismissEditingName(); return true; } } getDescendantRectRelativeToSelf(currentFolder, hitRect); if (!isEventOverFolder(currentFolder, ev)) { mLauncher.closeFolder(); return true; } } return false; }
@Override public boolean onInterceptHoverEvent(MotionEvent ev) { Log.d("DragLayer", "onInterceptHoverEvent"); if (mLauncher == null || mLauncher.getWorkspace() == null) { return false; } Folder currentFolder = mLauncher.getWorkspace().getOpenFolder(); if (currentFolder == null) { return false; } else { AccessibilityManager accessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); if (accessibilityManager.isTouchExplorationEnabled()) { final int action = ev.getAction(); boolean isOverFolder; switch (action) { case MotionEvent.ACTION_HOVER_ENTER: isOverFolder = isEventOverFolder(currentFolder, ev); if (!isOverFolder) { sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName()); mHoverPointClosesFolder = true; return true; } else if (isOverFolder) { mHoverPointClosesFolder = false; } else { return true; } case MotionEvent.ACTION_HOVER_MOVE: isOverFolder = isEventOverFolder(currentFolder, ev); if (!isOverFolder && !mHoverPointClosesFolder) { sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName()); mHoverPointClosesFolder = true; return true; } else if (isOverFolder) { mHoverPointClosesFolder = false; } else { return true; } } } } return false; }