Example usage for android.view View isInTouchMode

List of usage examples for android.view View isInTouchMode

Introduction

In this page you can find the example usage for android.view View isInTouchMode.

Prototype

@ViewDebug.ExportedProperty
public boolean isInTouchMode() 

Source Link

Document

Returns whether the device is currently in touch mode.

Usage

From source file:com.android.launcher3.allapps.FullMergeAlgorithm.java

@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//from w w  w  . j  av  a  2 s.c o  m
                    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;
}

From source file:cc.flydev.launcher.Folder.java

public boolean onLongClick(View v) {
    // Return if global dragging is not enabled
    if (!mLauncher.isDraggingEnabled())
        return true;

    Object tag = v.getTag();/*from  ww  w .j a v a2  s. co m*/
    if (tag instanceof ShortcutInfo) {
        ShortcutInfo item = (ShortcutInfo) tag;
        if (!v.isInTouchMode()) {
            return false;
        }

        mLauncher.dismissFolderCling(null);

        mLauncher.getWorkspace().onDragStartedWithItem(v);
        mLauncher.getWorkspace().beginDragShared(v, this);
        mIconDrawable = ((TextView) v).getCompoundDrawables()[1];

        mCurrentDragInfo = item;
        mEmptyCell[0] = item.cellX;
        mEmptyCell[1] = item.cellY;
        mCurrentDragView = v;

        mContent.removeView(mCurrentDragView);
        mInfo.remove(mCurrentDragInfo);
        mDragInProgress = true;
        mItemAddedBackToSelfViaIcon = false;
    }
    return true;
}

From source file:com.example.launcher3.Folder.java

public boolean onLongClick(View v) {
    // Return if global dragging is not enabled
    if (!mLauncher.isDraggingEnabled())
        return true;

    Object tag = v.getTag();/*w ww .jav a2  s  .c o m*/
    if (tag instanceof ShortcutInfo) {
        ShortcutInfo item = (ShortcutInfo) tag;
        if (!v.isInTouchMode()) {
            return false;
        }

        // mLauncher.dismissFolderCling(null);

        mLauncher.getWorkspace().onDragStartedWithItem(v);
        mLauncher.getWorkspace().beginDragShared(v, this);
        mIconDrawable = ((TextView) v).getCompoundDrawables()[1];

        mCurrentDragInfo = item;
        mEmptyCell[0] = item.cellX;
        mEmptyCell[1] = item.cellY;
        mCurrentDragView = v;

        mContent.removeView(mCurrentDragView);
        mInfo.remove(mCurrentDragInfo);
        mDragInProgress = true;
        mItemAddedBackToSelfViaIcon = false;
    }
    return true;
}

From source file:com.llf.android.launcher3.Folder.java

@Override
public boolean onLongClick(View v) {
    // Return if global dragging is not enabled
    if (!mLauncher.isDraggingEnabled())
        return true;

    Object tag = v.getTag();// w w  w . ja v a2  s  .  c o m
    if (tag instanceof ShortcutInfo) {
        ShortcutInfo item = (ShortcutInfo) tag;
        if (!v.isInTouchMode()) {
            return false;
        }

        mLauncher.dismissFolderCling(null);

        mLauncher.getWorkspace().onDragStartedWithItem(v);
        mLauncher.getWorkspace().beginDragShared(v, this);
        mIconDrawable = ((TextView) v).getCompoundDrawables()[1];

        mCurrentDragInfo = item;
        mEmptyCell[0] = item.cellX;
        mEmptyCell[1] = item.cellY;
        mCurrentDragView = v;

        mContent.removeView(mCurrentDragView);
        mInfo.remove(mCurrentDragInfo);
        mDragInProgress = true;
        mItemAddedBackToSelfViaIcon = false;
    }
    return true;
}

From source file:com.auratech.launcher.Folder.java

public boolean onLongClick(View v) {
    // Return if global dragging is not enabled
    if (!mLauncher.isDraggingEnabled())
        return true;

    Object tag = v.getTag();//from  w w  w.  j  av  a 2  s . co  m
    if (tag instanceof ShortcutInfo) {
        ShortcutInfo item = (ShortcutInfo) tag;
        if (!v.isInTouchMode()) {
            return false;
        }

        mLauncher.getLauncherClings().dismissFolderCling(null);

        mLauncher.getWorkspace().onDragStartedWithItem(v);
        mLauncher.getWorkspace().beginDragShared(v, this);

        mCurrentDragInfo = item;
        mEmptyCell[0] = item.cellX;
        mEmptyCell[1] = item.cellY;
        mCurrentDragView = v;

        mContent.removeView(mCurrentDragView);
        mInfo.remove(mCurrentDragInfo);
        mDragInProgress = true;
        mItemAddedBackToSelfViaIcon = false;
    }
    return true;
}

From source file:com.phonemetra.turbo.launcher.Folder.java

public boolean onLongClick(View v) {
    // Return if global dragging is not enabled
    if (!mLauncher.isDraggingEnabled())
        return true;

    Object tag = v.getTag();/* w w w  .j  av a 2  s.c o m*/
    if (tag instanceof ShortcutInfo) {
        ShortcutInfo item = (ShortcutInfo) tag;
        if (!v.isInTouchMode()) {
            return false;
        }

        mLauncher.getWorkspace().onDragStartedWithItem(v);
        mLauncher.getWorkspace().beginDragShared(v, this);

        mCurrentDragInfo = item;
        mEmptyCell[0] = item.cellX;
        mEmptyCell[1] = item.cellY;
        mCurrentDragView = v;

        mContent.removeView(mCurrentDragView);
        mInfo.remove(mCurrentDragInfo);
        mDragInProgress = true;
        mItemAddedBackToSelfViaIcon = false;
    }
    return true;
}

From source file:com.android.launcher3.Folder.java

public boolean onLongClick(View v) {
    // Return if global dragging is not enabled
    if (!mLauncher.isDraggingEnabled())
        return true;

    Object tag = v.getTag();//from   w  ww  .  j  ava  2 s .  c  o m
    if (tag instanceof ShortcutInfo) {
        ShortcutInfo item = (ShortcutInfo) tag;
        if (!v.isInTouchMode()) {
            return false;
        }

        mLauncher.getWorkspace().beginDragShared(v, this);

        mCurrentDragInfo = item;
        mEmptyCell[0] = item.cellX;
        mEmptyCell[1] = item.cellY;
        mCurrentDragView = v;

        mContent.removeView(mCurrentDragView);
        mInfo.remove(mCurrentDragInfo);
        mDragInProgress = true;
        mItemAddedBackToSelfViaIcon = false;
    }
    return true;
}

From source file:com.fairphone.fplauncher3.Folder.java

public boolean onLongClick(View v) {
    // Return if global dragging is not enabled
    if (!mLauncher.isDraggingEnabled()) {
        return true;
    }//from   w  ww .ja  va2  s  .co m

    Object tag = v.getTag();
    if (tag instanceof ShortcutInfo) {
        ShortcutInfo item = (ShortcutInfo) tag;
        if (!v.isInTouchMode()) {
            return false;
        }

        mLauncher.getWorkspace().beginDragShared(v, this);

        mCurrentDragInfo = item;
        mEmptyCell[0] = item.cellX;
        mEmptyCell[1] = item.cellY;
        mCurrentDragView = v;

        mContent.removeView(mCurrentDragView);
        mInfo.remove(mCurrentDragInfo);
        mDragInProgress = true;
        mItemAddedBackToSelfViaIcon = false;
    }
    return true;
}

From source file:com.android.launcher3.folder.Folder.java

public boolean startDrag(View v, DragOptions options) {
    Object tag = v.getTag();/*  w  ww .  j av a  2  s  . co m*/
    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;
}

From source file:com.lb.launcher.Folder.java

public boolean onLongClick(View v) {
    Log.v(getClass().toString() + "::onLongClick:", v.toString()); // added by H.Yasui 2016/11/

    // Return if global dragging is not enabled
    if (!mLauncher.isDraggingEnabled())
        return true;

    Object tag = v.getTag();/* ww w.  java2  s.  com*/
    if (tag instanceof ShortcutInfo) {
        ShortcutInfo item = (ShortcutInfo) tag;
        if (!v.isInTouchMode()) {
            return false;
        }

        mLauncher.getWorkspace().beginDragShared(v, this);

        mCurrentDragInfo = item;
        mEmptyCell[0] = item.cellX;
        mEmptyCell[1] = item.cellY;
        mCurrentDragView = v;

        mContent.removeView(mCurrentDragView);
        mInfo.remove(mCurrentDragInfo);
        mDragInProgress = true;
        mItemAddedBackToSelfViaIcon = false;
    }
    return true;
}