本文整理匯總了Java中com.android.launcher3.DeleteDropTarget類的典型用法代碼示例。如果您正苦於以下問題:Java DeleteDropTarget類的具體用法?Java DeleteDropTarget怎麽用?Java DeleteDropTarget使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DeleteDropTarget類屬於com.android.launcher3包,在下文中一共展示了DeleteDropTarget類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initDropTarget
import com.android.launcher3.DeleteDropTarget; //導入依賴的package包/類
private static Target initDropTarget(View v) {
Target t = new LauncherLogProto.Target();
t.type = (v instanceof ButtonDropTarget)? Target.CONTROL : Target.CONTAINER;
if (t.type == Target.CONTAINER) {
return t;
}
if (v instanceof InfoDropTarget) {
t.controlType = LauncherLogProto.APPINFO_TARGET;
} else if (v instanceof UninstallDropTarget) {
t.controlType = LauncherLogProto.UNINSTALL_TARGET;
} else if (v instanceof DeleteDropTarget) {
t.controlType = LauncherLogProto.REMOVE_TARGET;
}
return t;
}
示例2: onDropCompleted
import com.android.launcher3.DeleteDropTarget; //導入依賴的package包/類
@Override
public void onDropCompleted(View target, DropTarget.DragObject d, boolean isFlingToDelete,
boolean success) {
if (isFlingToDelete || !success || (target != mLauncher.getWorkspace() &&
!(target instanceof DeleteDropTarget) && !(target instanceof Folder))) {
// Exit spring loaded mode if we have not successfully dropped or have not handled the
// drop in Workspace
mLauncher.exitSpringLoadedDragModeDelayed(true,
Launcher.EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT, null);
}
mLauncher.unlockScreenOrientation(false);
// Display an error message if the drag failed due to there not being enough space on the
// target layout we were dropping on.
if (!success) {
boolean showOutOfSpaceMessage = false;
if (target instanceof Workspace && !mLauncher.getDragController().isDeferringDrag()) {
int currentScreen = mLauncher.getCurrentWorkspaceScreen();
Workspace workspace = (Workspace) target;
CellLayout layout = (CellLayout) workspace.getChildAt(currentScreen);
ItemInfo itemInfo = d.dragInfo;
if (layout != null) {
showOutOfSpaceMessage =
!layout.findCellForSpan(null, itemInfo.spanX, itemInfo.spanY);
}
}
if (showOutOfSpaceMessage) {
mLauncher.showOutOfSpaceMessage(false);
}
d.deferDragViewCleanupPostAnimation = false;
}
}
示例3: addActions
import com.android.launcher3.DeleteDropTarget; //導入依賴的package包/類
protected void addActions(View host, AccessibilityNodeInfo info) {
if (!(host.getTag() instanceof ItemInfo)) return;
ItemInfo item = (ItemInfo) host.getTag();
if (host instanceof BubbleTextView && ((BubbleTextView) host).hasDeepShortcuts()) {
info.addAction(mActions.get(DEEP_SHORTCUTS));
}
if (DeleteDropTarget.supportsAccessibleDrop(item)) {
info.addAction(mActions.get(REMOVE));
}
if (UninstallDropTarget.supportsDrop(host.getContext(), item)) {
info.addAction(mActions.get(UNINSTALL));
}
if (InfoDropTarget.supportsDrop(item)) {
info.addAction(mActions.get(INFO));
}
if ((item instanceof ShortcutInfo)
|| (item instanceof LauncherAppWidgetInfo)
|| (item instanceof FolderInfo)) {
info.addAction(mActions.get(MOVE));
if (item.container >= 0) {
info.addAction(mActions.get(MOVE_TO_WORKSPACE));
} else if (item instanceof LauncherAppWidgetInfo) {
if (!getSupportedResizeActions(host, (LauncherAppWidgetInfo) item).isEmpty()) {
info.addAction(mActions.get(RESIZE));
}
}
}
if ((item instanceof AppInfo) || (item instanceof PendingAddItemInfo)) {
info.addAction(mActions.get(ADD_TO_WORKSPACE));
}
}
示例4: onDropCompleted
import com.android.launcher3.DeleteDropTarget; //導入依賴的package包/類
@Override
public void onDropCompleted(View target, DragObject d, boolean isFlingToDelete,
boolean success) {
if (LOGD) {
Log.d(TAG, "onDropCompleted");
}
if (isFlingToDelete || !success || (target != mLauncher.getWorkspace() &&
!(target instanceof DeleteDropTarget) && !(target instanceof Folder))) {
// Exit spring loaded mode if we have not successfully dropped or have not handled the
// drop in Workspace
mLauncher.exitSpringLoadedDragModeDelayed(true,
Launcher.EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT, null);
}
mLauncher.unlockScreenOrientation(false);
// Display an error message if the drag failed due to there not being enough space on the
// target layout we were dropping on.
if (!success) {
boolean showOutOfSpaceMessage = false;
if (target instanceof Workspace) {
int currentScreen = mLauncher.getCurrentWorkspaceScreen();
Workspace workspace = (Workspace) target;
CellLayout layout = (CellLayout) workspace.getChildAt(currentScreen);
ItemInfo itemInfo = d.dragInfo;
if (layout != null) {
showOutOfSpaceMessage =
!layout.findCellForSpan(null, itemInfo.spanX, itemInfo.spanY);
}
}
if (showOutOfSpaceMessage) {
mLauncher.showOutOfSpaceMessage(false);
}
d.deferDragViewCleanupPostAnimation = false;
}
}
示例5: onDropCompleted
import com.android.launcher3.DeleteDropTarget; //導入依賴的package包/類
@Override
public void onDropCompleted(View target, DropTarget.DragObject d, boolean isFlingToDelete,
boolean success) {
if (isFlingToDelete || !success || (target != mLauncher.getWorkspace() &&
!(target instanceof DeleteDropTarget) && !(target instanceof Folder))) {
// Exit spring loaded mode if we have not successfully dropped or have not handled the
// drop in Workspace
mLauncher.exitSpringLoadedDragModeDelayed(true,
Launcher.EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT, null);
}
mLauncher.unlockScreenOrientation(false);
// Display an error message if the drag failed due to there not being enough space on the
// target layout we were dropping on.
if (!success) {
boolean showOutOfSpaceMessage = false;
if (target instanceof Workspace) {
int currentScreen = mLauncher.getCurrentWorkspaceScreen();
Workspace workspace = (Workspace) target;
CellLayout layout = (CellLayout) workspace.getChildAt(currentScreen);
ItemInfo itemInfo = (ItemInfo) d.dragInfo;
if (layout != null) {
showOutOfSpaceMessage =
!layout.findCellForSpan(null, itemInfo.spanX, itemInfo.spanY);
}
}
if (showOutOfSpaceMessage) {
mLauncher.showOutOfSpaceMessage(false);
}
d.deferDragViewCleanupPostAnimation = false;
}
}
示例6: onInitializeAccessibilityNodeInfo
import com.android.launcher3.DeleteDropTarget; //導入依賴的package包/類
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(host, info);
if (!(host.getTag() instanceof ItemInfo)) return;
ItemInfo item = (ItemInfo) host.getTag();
if (DeleteDropTarget.supportsDrop(item)) {
info.addAction(mActions.get(REMOVE));
}
if (UninstallDropTarget.supportsDrop(host.getContext(), item)) {
info.addAction(mActions.get(UNINSTALL));
}
if (InfoDropTarget.supportsDrop(host.getContext(), item)) {
info.addAction(mActions.get(INFO));
}
if ((item instanceof ShortcutInfo)
|| (item instanceof LauncherAppWidgetInfo)
|| (item instanceof FolderInfo)) {
info.addAction(mActions.get(MOVE));
if (item.container >= 0) {
info.addAction(mActions.get(MOVE_TO_WORKSPACE));
} else if (item instanceof LauncherAppWidgetInfo) {
if (!getSupportedResizeActions(host, (LauncherAppWidgetInfo) item).isEmpty()) {
info.addAction(mActions.get(RESIZE));
}
}
} if ((item instanceof AppInfo) || (item instanceof PendingAddItemInfo)) {
info.addAction(mActions.get(ADD_TO_WORKSPACE));
}
}
示例7: onDropCompleted
import com.android.launcher3.DeleteDropTarget; //導入依賴的package包/類
@Override
public void onDropCompleted(View target, DragObject d, boolean isFlingToDelete,
boolean success) {
if (isFlingToDelete || !success || (target != mLauncher.getWorkspace() &&
!(target instanceof DeleteDropTarget) && !(target instanceof Folder))) {
// Exit spring loaded mode if we have not successfully dropped or have not handled the
// drop in Workspace
mLauncher.exitSpringLoadedDragModeDelayed(true,
Launcher.EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT, null);
}
mLauncher.unlockScreenOrientation(false);
// Display an error message if the drag failed due to there not being enough space on the
// target layout we were dropping on.
if (!success) {
boolean showOutOfSpaceMessage = false;
if (target instanceof Workspace) {
int currentScreen = mLauncher.getCurrentWorkspaceScreen();
Workspace workspace = (Workspace) target;
CellLayout layout = (CellLayout) workspace.getChildAt(currentScreen);
ItemInfo itemInfo = (ItemInfo) d.dragInfo;
if (layout != null) {
showOutOfSpaceMessage =
!layout.findCellForSpan(null, itemInfo.spanX, itemInfo.spanY);
}
}
if (showOutOfSpaceMessage) {
mLauncher.showOutOfSpaceMessage(false);
}
d.deferDragViewCleanupPostAnimation = false;
}
}