当前位置: 首页>>代码示例>>Java>>正文


Java View.isInTouchMode方法代码示例

本文整理汇总了Java中android.view.View.isInTouchMode方法的典型用法代码示例。如果您正苦于以下问题:Java View.isInTouchMode方法的具体用法?Java View.isInTouchMode怎么用?Java View.isInTouchMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.isInTouchMode方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLongClick

import android.view.View; //导入方法依赖的package包/类
@Override
public boolean onLongClick(View v) {
    // Return early if this is not initiated from a touch or not the correct view
    if (!v.isInTouchMode() || !(v.getParent() instanceof DeepShortcutView)) return false;
    // Return early if global dragging is not enabled
    if (!mLauncher.isDraggingEnabled()) return false;
    // Return early if an item is already being dragged (e.g. when long-pressing two shortcuts)
    if (mLauncher.getDragController().isDragging()) return false;

    // Long clicked on a shortcut.
    DeepShortcutView sv = (DeepShortcutView) v.getParent();
    sv.setWillDrawIcon(false);

    // Move the icon to align with the center-top of the touch point
    mIconShift.x = mIconLastTouchPos.x - sv.getIconCenter().x;
    mIconShift.y = mIconLastTouchPos.y - mLauncher.getDeviceProfile().iconSizePx;

    DragView dv = mLauncher.getWorkspace().beginDragShared(sv.getIconView(),
            (PopupContainerWithArrow) getParent(), sv.getFinalInfo(),
            new ShortcutDragPreviewProvider(sv.getIconView(), mIconShift), new DragOptions());
    dv.animateShift(-mIconShift.x, -mIconShift.y);

    // TODO: support dragging from within folder without having to close it
    AbstractFloatingView.closeOpenContainer(mLauncher, AbstractFloatingView.TYPE_FOLDER);
    return false;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:27,代码来源:ShortcutsItemView.java

示例2: onLongClick

import android.view.View; //导入方法依赖的package包/类
public boolean onLongClick(View v) {
    // Return early if this is not initiated from a touch or not the correct view
    if (!v.isInTouchMode() || !(v.getParent() instanceof DeepShortcutView)) return false;
    // Return if global dragging is not enabled
    if (!mLauncher.isDraggingEnabled()) return false;

    // Long clicked on a shortcut.
    mDeferContainerRemoval = true;
    DeepShortcutView sv = (DeepShortcutView) v.getParent();
    sv.setWillDrawIcon(false);

    // Move the icon to align with the center-top of the touch point
    mIconShift.x = mIconLastTouchPos.x - sv.getIconCenter().x;
    mIconShift.y = mIconLastTouchPos.y - mLauncher.getDeviceProfile().iconSizePx;

    DragView dv = mLauncher.getWorkspace().beginDragShared(
            sv.getBubbleText(), this, sv.getFinalInfo(),
            new ShortcutDragPreviewProvider(sv.getIconView(), mIconShift), new DragOptions());
    dv.animateShift(-mIconShift.x, -mIconShift.y);

    // TODO: support dragging from within folder without having to close it
    mLauncher.closeFolder();
    return false;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:25,代码来源:DeepShortcutsContainer.java

示例3: onLongClick

import android.view.View; //导入方法依赖的package包/类
@Override
public boolean onLongClick(View v) {
    if (LOGD) {
        Log.d(TAG, String.format("onLonglick [v=%s]", v));
    }
    // Return early if this is not initiated from a touch
    if (!v.isInTouchMode()) return false;
    // When we have exited all apps or are in transition, disregard long clicks
    if (!mLauncher.isWidgetsViewVisible() ||
            mLauncher.getWorkspace().isSwitchingState()) return false;
    // Return if global dragging is not enabled
    if (!mLauncher.isDraggingEnabled()) return false;

    boolean status = beginDragging(v);
    if (status && v.getTag() instanceof PendingAddWidgetInfo) {
        WidgetHostViewLoader hostLoader = new WidgetHostViewLoader(mLauncher, v);
        boolean preloadStatus = hostLoader.preloadWidget();
        if (LOGD) {
            Log.d(TAG, String.format("preloading widget [status=%s]", preloadStatus));
        }
        mLauncher.getDragController().addDragListener(hostLoader);
    }
    return status;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:25,代码来源:WidgetsContainerView.java

示例4: onLongClick

import android.view.View; //导入方法依赖的package包/类
@Override
public boolean onLongClick(final View v) {
    // Return early if this is not initiated from a touch
    if (!v.isInTouchMode()) return false;
    // When we have exited all apps or are in transition, disregard long clicks

    if (!mLauncher.isAppsViewVisible() ||
            mLauncher.getWorkspace().isSwitchingState()) return false;
    // Return if global dragging is not enabled or we are already dragging
    if (!mLauncher.isDraggingEnabled()) return false;
    if (mLauncher.getDragController().isDragging()) return false;

    // Start the drag
    final DragController dragController = mLauncher.getDragController();
    dragController.addDragListener(new DragController.DragListener() {
        @Override
        public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
            v.setVisibility(INVISIBLE);
        }

        @Override
        public void onDragEnd() {
            v.setVisibility(VISIBLE);
            dragController.removeDragListener(this);
        }
    });
    mLauncher.getWorkspace().beginDragShared(v, this, new DragOptions());
    return false;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:30,代码来源:AllAppsContainerView.java

示例5: startDrag

import android.view.View; //导入方法依赖的package包/类
public boolean startDrag(View v, DragOptions options) {
    Object tag = v.getTag();
    if (tag instanceof ShortcutInfo) {
        ShortcutInfo item = (ShortcutInfo) tag;
        if (!v.isInTouchMode()) {
            return false;
        }

        mEmptyCellRank = item.rank;
        mCurrentDragView = v;

        mDragController.addDragListener(this);
        if (options.isAccessibleDrag) {
            mDragController.addDragListener(new AccessibleDragListenerAdapter(
                    mContent, CellLayout.FOLDER_ACCESSIBILITY_DRAG) {

                @Override
                protected void enableAccessibleDrag(boolean enable) {
                    super.enableAccessibleDrag(enable);
                    mFooter.setImportantForAccessibility(enable
                            ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
                            : IMPORTANT_FOR_ACCESSIBILITY_AUTO);
                }
            });
        }

        mLauncher.getWorkspace().beginDragShared(v, this, options);
    }
    return true;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:31,代码来源:Folder.java

示例6: startDrag

import android.view.View; //导入方法依赖的package包/类
public void startDrag(CellLayout.CellInfo cellInfo, DragOptions options) {
    View child = cellInfo.cell;

    // Make sure the drag was started by a long press as opposed to a long click.
    if (!child.isInTouchMode()) {
        return;
    }

    mDragInfo = cellInfo;
    child.setVisibility(INVISIBLE);

    if (options.isAccessibleDrag) {
        mDragController.addDragListener(new AccessibleDragListenerAdapter(
                this, CellLayout.WORKSPACE_ACCESSIBILITY_DRAG) {
            @Override
            protected void enableAccessibleDrag(boolean enable) {
                super.enableAccessibleDrag(enable);
                setEnableForLayout(mLauncher.getHotseat().getLayout(),enable);

                // We need to allow our individual children to become click handlers in this
                // case, so temporarily unset the click handlers.
                setOnClickListener(enable ? null : mLauncher);
            }
        });
    }

    beginDragShared(child, this, options);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:29,代码来源:Workspace.java

示例7: handleLongClick

import android.view.View; //导入方法依赖的package包/类
public boolean handleLongClick(View v) {
    // Return early if this is not initiated from a touch
    if (!v.isInTouchMode()) return false;
    // When we  are in transition, disregard long clicks
    if (mLauncher.getWorkspace().isSwitchingState()) return false;
    // Return if global dragging is not enabled
    if (!mLauncher.isDraggingEnabled()) return false;

    return beginDragging(v);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:11,代码来源:WidgetsContainerView.java

示例8: onLongClick

import android.view.View; //导入方法依赖的package包/类
@Override
public boolean onLongClick(View v) {
    // Return early if this is not initiated from a touch
    if (!v.isInTouchMode()) return false;
    // When we have exited all apps or are in transition, disregard long clicks

    if (!mLauncher.isAppsViewVisible() ||
            mLauncher.getWorkspace().isSwitchingState()) return false;
    // Return if global dragging is not enabled or we are already dragging
    if (!mLauncher.isDraggingEnabled()) return false;
    if (mLauncher.getDragController().isDragging()) return false;

    // Start the drag
    DragOptions dragOptions = new DragOptions();
    if (v instanceof BubbleTextView) {
        final BubbleTextView icon = (BubbleTextView) v;
        if (icon.hasDeepShortcuts()) {
            DeepShortcutsContainer dsc = DeepShortcutsContainer.showForIcon(icon);
            if (dsc != null) {
                dragOptions.deferDragCondition = dsc.createDeferDragCondition(new Runnable() {
                    @Override
                    public void run() {
                        icon.setVisibility(VISIBLE);
                    }
                });
            }
        }
    }
    mLauncher.getWorkspace().beginDragShared(v, this, dragOptions);
    if (FeatureFlags.LAUNCHER3_LEGACY_WORKSPACE_DND) {
        // Enter spring loaded mode (the new workspace does this in
        // onDragStart(), so we don't want to do it here)
        mLauncher.enterSpringLoadedDragMode();
    }

    return false;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:38,代码来源:AllAppsContainerView.java

示例9: startDrag

import android.view.View; //导入方法依赖的package包/类
public boolean startDrag(View v, DragOptions options) {
    Object tag = v.getTag();
    if (tag instanceof ShortcutInfo) {
        ShortcutInfo item = (ShortcutInfo) tag;
        if (!v.isInTouchMode()) {
            return false;
        }

        mEmptyCellRank = item.rank;
        mCurrentDragView = v;

        mDragController.addDragListener(this);
        if (options.isAccessibleDrag) {
            mDragController.addDragListener(new AccessibileDragListenerAdapter(
                    mContent, CellLayout.FOLDER_ACCESSIBILITY_DRAG) {

                @Override
                protected void enableAccessibleDrag(boolean enable) {
                    super.enableAccessibleDrag(enable);
                    mFooter.setImportantForAccessibility(enable
                            ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
                            : IMPORTANT_FOR_ACCESSIBILITY_AUTO);
                }
            });
        }

        mLauncher.getWorkspace().beginDragShared(v, this, options);
    }
    return true;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:31,代码来源:Folder.java

示例10: startDrag

import android.view.View; //导入方法依赖的package包/类
public void startDrag(CellLayout.CellInfo cellInfo, DragOptions options) {
    View child = cellInfo.cell;

    // Make sure the drag was started by a long press as opposed to a long click.
    if (!child.isInTouchMode()) {
        return;
    }

    mDragInfo = cellInfo;
    child.setVisibility(INVISIBLE);
    CellLayout layout = (CellLayout) child.getParent().getParent();
    layout.prepareChildForDrag(child);

    if (options.isAccessibleDrag) {
        mDragController.addDragListener(new AccessibileDragListenerAdapter(
                this, CellLayout.WORKSPACE_ACCESSIBILITY_DRAG) {
            @Override
            protected void enableAccessibleDrag(boolean enable) {
                super.enableAccessibleDrag(enable);
                setEnableForLayout(mLauncher.getHotseat().getLayout(),enable);

                // We need to allow our individual children to become click handlers in this
                // case, so temporarily unset the click handlers.
                setOnClickListener(enable ? null : mLauncher);
            }
        });
    }

    beginDragShared(child, this, options);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:31,代码来源:Workspace.java


注:本文中的android.view.View.isInTouchMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。