Example usage for android.view HapticFeedbackConstants FLAG_IGNORE_VIEW_SETTING

List of usage examples for android.view HapticFeedbackConstants FLAG_IGNORE_VIEW_SETTING

Introduction

In this page you can find the example usage for android.view HapticFeedbackConstants FLAG_IGNORE_VIEW_SETTING.

Prototype

int FLAG_IGNORE_VIEW_SETTING

To view the source code for android.view HapticFeedbackConstants FLAG_IGNORE_VIEW_SETTING.

Click Source Link

Document

Flag for View#performHapticFeedback(int,int) View.performHapticFeedback(int, int) : Ignore the setting in the view for whether to perform haptic feedback, do it always.

Usage

From source file:com.metinkale.prayerapp.vakit.PrefsView.java

@Override
public void onClick(View v) {
    Object o = getValue();/* w  ww  . j a  v a 2  s  .c o  m*/
    if ((mPref == Pref.Sound) || (mPref == Pref.Dua) || (mPref == Pref.Sela)) {
        new SoundChooser().showExpanded(((Activity) getContext()).getFragmentManager(), new Callback() {

            @Override
            public String getCurrent() {
                return (String) getValue();
            }

            @Override
            public void setCurrent(String current) {
                setValue(current);

            }

            @Override
            public Vakit getVakit() {
                return mVakit;
            }

            @Override
            public List<Sound> getSounds() {
                if (mPref == Pref.Sound) {
                    return Sounds.getSounds(mVakit);
                } else if (mPref == Pref.Dua) {
                    return Sounds.getSounds("dua", "extra");
                } else if (mPref == Pref.Sela) {
                    return Sounds.getSounds("sela", "extra");
                }

                return Sounds.getSounds(mVakit);
            }

        });

    } else if (mPref == Pref.SabahTime) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
        LayoutInflater inflater = LayoutInflater.from(getContext());
        View view = inflater.inflate(R.layout.sabahtime_dialog, null);
        final NumberPicker np = (NumberPicker) view.findViewById(R.id.number_picker);
        final RadioGroup rg = (RadioGroup) view.findViewById(R.id.rg);

        int val = (Integer) getValue();
        np.setMinValue(0);
        np.setMaxValue(300);
        np.setValue(Math.abs(val));

        rg.check((val < 0) ? R.id.afterImsak : R.id.beforeGunes);
        builder.setView(view).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int id) {
                setValue(np.getValue() * ((rg.getCheckedRadioButtonId() == R.id.beforeGunes) ? 1 : -1));
            }
        }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int id) {
            }
        });
        builder.show();
    } else if (mPref == Pref.Vibration2) {
        int i = (Integer) o;
        i++;
        if ((i < -1) || (i > 1)) {
            i = -1;
        }
        setValue(i);
        performHapticFeedback(HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING
                | HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
    } else if (o instanceof Boolean) {
        setValue(!(Boolean) o);
        performHapticFeedback(HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING
                | HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
    } else if (o instanceof Integer) {
        int titleId = 0;
        switch (mPref) {
        case Silenter:
            PermissionUtils.get(getContext()).needNotificationPolicy((Activity) getContext());
            titleId = R.string.silenterDuration;
            break;
        case Time:
            titleId = R.string.time;
            break;
        default:
            break;
        }
        NumberPickerDialog npd = new NumberPickerDialog(getContext(), new OnNumberSetListener() {

            @Override
            public void onNumberSet(int dialogId, int number) {
                setValue(number);

            }
        }, (Integer) o, 0, 300, titleId, 0, 0);
        npd.show();
    }

}

From source file:com.hippo.widget.lockpattern.LockPatternView.java

/**
 * Determines whether the point x, y will add a new point to the current
 * pattern (in addition to finding the cell, also makes heuristic choices
 * such as filling in gaps based on current pattern).
 * @param x The x coordinate.//from   w ww. j  ava2  s  . co  m
 * @param y The y coordinate.
 */
private Cell detectAndAddHit(float x, float y) {
    final Cell cell = checkForNewHit(x, y);
    if (cell != null) {

        // check for gaps in existing pattern
        Cell fillInGapCell = null;
        final ArrayList<Cell> pattern = mPattern;
        if (!pattern.isEmpty()) {
            final Cell lastCell = pattern.get(pattern.size() - 1);
            int dRow = cell.row - lastCell.row;
            int dColumn = cell.column - lastCell.column;

            int fillInRow = lastCell.row;
            int fillInColumn = lastCell.column;

            if (Math.abs(dRow) == 2 && Math.abs(dColumn) != 1) {
                fillInRow = lastCell.row + ((dRow > 0) ? 1 : -1);
            }

            if (Math.abs(dColumn) == 2 && Math.abs(dRow) != 1) {
                fillInColumn = lastCell.column + ((dColumn > 0) ? 1 : -1);
            }

            fillInGapCell = Cell.of(fillInRow, fillInColumn);
        }

        if (fillInGapCell != null && !mPatternDrawLookup[fillInGapCell.row][fillInGapCell.column]) {
            addCellToPattern(fillInGapCell);
        }
        addCellToPattern(cell);
        if (mEnableHapticFeedback) {
            performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
                    HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING
                            | HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
        }
        return cell;
    }
    return null;
}

From source file:io.authme.sdk.widget.LockPatternView.java

/**
 * Determines whether the point x, y will add a new point to the current pattern (in addition to finding the cell,
 * also makes heuristic choices such as filling in gaps based on current pattern).
 *
 * @param x The x coordinate./* ww  w. jav  a 2  s.  co  m*/
 * @param y The y coordinate.
 */
@TargetApi(Build.VERSION_CODES.ECLAIR)
private Cell detectAndAddHit(float x, float y) {
    final Cell cell = checkForNewHit(x, y);
    if (cell != null) {

        // check for gaps in existing pattern
        Cell fillInGapCell = null;
        final ArrayList<Cell> pattern = mPattern;
        if (!pattern.isEmpty()) {
            final Cell lastCell = pattern.get(pattern.size() - 1);
            int dRow = cell.row - lastCell.row;
            int dColumn = cell.column - lastCell.column;

            int fillInRow = lastCell.row;
            int fillInColumn = lastCell.column;

            if (Math.abs(dRow) == 2 && Math.abs(dColumn) != 1) {
                fillInRow = lastCell.row + ((dRow > 0) ? 1 : -1);
            }

            if (Math.abs(dColumn) == 2 && Math.abs(dRow) != 1) {
                fillInColumn = lastCell.column + ((dColumn > 0) ? 1 : -1);
            }

            fillInGapCell = Cell.of(fillInRow, fillInColumn);
        }

        if (fillInGapCell != null && !mPatternDrawLookup[fillInGapCell.row][fillInGapCell.column]) {
            addCellToPattern(fillInGapCell);
        }
        addCellToPattern(cell);
        if (mEnableHapticFeedback) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR)
                performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
                        HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING
                                | HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
        }
        return cell;
    }
    return null;
}

From source file:com.android.leanlauncher.LauncherTransitionable.java

public boolean onLongClick(View v) {
    if (!isDraggingEnabled())
        return false;
    if (isWorkspaceLocked())
        return false;
    if (mState != State.WORKSPACE)
        return false;

    if (v instanceof Workspace) {
        if (!mWorkspace.isInOverviewMode()) {
            if (mWorkspace.enterOverviewMode()) {
                mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                        HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
                return true;
            } else {
                return false;
            }/*from w  w  w  . j a  v a 2s .  co  m*/
        } else {
            return false;
        }
    }

    CellLayout.CellInfo longClickCellInfo = null;
    View itemUnderLongClick = null;
    if (v.getTag() instanceof ItemInfo) {
        ItemInfo info = (ItemInfo) v.getTag();
        longClickCellInfo = new CellLayout.CellInfo(v, info);
        itemUnderLongClick = longClickCellInfo.cell;
        resetAddInfo();
    }

    if (!mDragController.isDragging()) {
        if (itemUnderLongClick == null) {
            // User long pressed on empty space
            mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                    HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
            if (!mWorkspace.isInOverviewMode()) {
                mWorkspace.enterOverviewMode();
            }
        } else {
            // User long pressed on an item
            mWorkspace.startDrag(longClickCellInfo);
        }
    }
    return true;
}

From source file:com.android.launcher2.Launcher.java

public boolean onLongClick(View v) {
    if (!isDraggingEnabled())
        return false;
    if (isWorkspaceLocked())
        return false;
    if (mState != State.WORKSPACE)
        return false;

    if (!(v instanceof CellLayout)) {
        v = (View) v.getParent().getParent();
    }/*from   w w w. ja va2  s .c  o  m*/

    resetAddInfo();
    CellLayout.CellInfo longClickCellInfo = (CellLayout.CellInfo) v.getTag();
    // This happens when long clicking an item with the dpad/trackball
    if (longClickCellInfo == null) {
        return true;
    }

    // The hotseat touch handling does not go through Workspace, and we always allow long press
    // on hotseat items.
    final View itemUnderLongClick = longClickCellInfo.cell;
    boolean allowLongPress = isHotseatLayout(v) || mWorkspace.allowLongPress();
    if (allowLongPress && !mDragController.isDragging()) {
        if (itemUnderLongClick == null) {
            // User long pressed on empty space
            mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                    HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
            startWallpaper();
        } else {
            if (!(itemUnderLongClick instanceof Folder)) {
                // User long pressed on an item
                mWorkspace.startDrag(longClickCellInfo);
            }
        }
    }
    return true;
}

From source file:com.android.soma.Launcher.java

public boolean onLongClick(View v) {
    if (!isDraggingEnabled())
        return false;
    if (isWorkspaceLocked())
        return false;
    if (mState != State.WORKSPACE)
        return false;

    if (v instanceof Workspace) {
        if (!mWorkspace.isInOverviewMode()) {
            if (mWorkspace.enterOverviewMode()) {
                mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                        HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
                return true;
            } else {
                return false;
            }/*from  w w  w  .  j a v  a 2s  .  co  m*/
        }
    }

    if (!(v instanceof CellLayout)) {
        v = (View) v.getParent().getParent();
    }

    resetAddInfo();
    CellLayout.CellInfo longClickCellInfo = (CellLayout.CellInfo) v.getTag();
    // This happens when long clicking an item with the dpad/trackball
    if (longClickCellInfo == null) {
        return true;
    }

    // The hotseat touch handling does not go through Workspace, and we always allow long press
    // on hotseat items.
    final View itemUnderLongClick = longClickCellInfo.cell;
    boolean allowLongPress = isHotseatLayout(v) || mWorkspace.allowLongPress();
    if (allowLongPress && !mDragController.isDragging()) {
        if (itemUnderLongClick == null) {
            // User long pressed on empty space
            mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                    HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
            // Disabling reordering until we sort out some issues.
            if (mWorkspace.isInOverviewMode()) {
                mWorkspace.startReordering(v);
            } else {
                mWorkspace.enterOverviewMode();
            }
        } else {
            if (!(itemUnderLongClick instanceof Folder)) {
                // User long pressed on an item
                mWorkspace.startDrag(longClickCellInfo);
            }
        }
    }
    return true;
}

From source file:com.cognizant.trumobi.PersonaLauncher.java

public boolean onLongClick(View v) {
    if (mDesktopLocked) {
        return false;
    }//from   ww w .j ava 2s.c  om
    // ADW: Show previews on longpressing the dots
    switch (v.getId()) {
    case R.id.btn_scroll_left:
        mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
        showPreviousPreview(v);
        return true;
    case R.id.btn_scroll_right:
        mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
        showNextPreview(v);
        return true;
    }

    if (!(v instanceof PersonaCellLayout)) {
        v = (View) v.getParent();
    }

    PersonaCellLayout.CellInfo cellInfo = (PersonaCellLayout.CellInfo) v.getTag();

    // This happens when long clicking an item with the dpad/trackball
    if (cellInfo == null) {
        return true;
    }

    if (mWorkspace.allowLongPress() && !mBlockDesktop) {
        if (cellInfo.cell == null) {
            if (cellInfo.valid) {
                // User long pressed on empty space
                mWorkspace.setAllowLongPress(false);
                showAddDialog(cellInfo);
            }
        } else {
            if (!(cellInfo.cell instanceof PersonaFolder)) {
                // User long pressed on an item
                mWorkspace.startDrag(cellInfo);
            }
        }
    }
    return true;
}

From source file:com.klinker.android.launcher.launcher3.Launcher.java

public boolean onLongClick(View v) {
    lockLauncherDrawer(true);//from  w  w  w. j  a  v  a2s .co m

    if (!isDraggingEnabled())
        return false;
    if (isWorkspaceLocked())
        return false;
    if (mState != State.WORKSPACE)
        return false;

    if (v == mAllAppsButton) {
        onLongClickAllAppsButton(v);
        return true;
    }

    if (v instanceof Workspace) {
        if (!mWorkspace.isInOverviewMode()) {
            if (!mWorkspace.isTouchActive()) {
                showOverviewMode(true);
                mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                        HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }

    CellLayout.CellInfo longClickCellInfo = null;
    View itemUnderLongClick = null;
    if (v.getTag() instanceof ItemInfo) {
        ItemInfo info = (ItemInfo) v.getTag();
        longClickCellInfo = new CellLayout.CellInfo(v, info);
        itemUnderLongClick = longClickCellInfo.cell;
        resetAddInfo();
    }

    // The hotseat touch handling does not go through Workspace, and we always allow long press
    // on hotseat items.
    final boolean inHotseat = isHotseatLayout(v);
    if (!mDragController.isDragging()) {
        if (itemUnderLongClick == null) {
            // User long pressed on empty space
            mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                    HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
            if (mWorkspace.isInOverviewMode()) {
                mWorkspace.startReordering(v);
            } else {
                showOverviewMode(true);
            }
        } else {
            final boolean isAllAppsButton = inHotseat && isAllAppsButtonRank(
                    mHotseat.getOrderInHotseat(longClickCellInfo.cellX, longClickCellInfo.cellY));
            if (!(itemUnderLongClick instanceof Folder || isAllAppsButton)) {
                // User long pressed on an item
                mWorkspace.startDrag(longClickCellInfo);
            }
        }
    }
    return true;
}

From source file:g7.bluesky.launcher3.Launcher.java

public boolean onLongClick(View v) {
    if (!isDraggingEnabled())
        return false;
    if (isWorkspaceLocked())
        return false;
    if (mState != State.WORKSPACE)
        return false;
    if (LOGD)//from w ww. ja v a 2 s . c o  m
        Log.d(TAG, "onLongClick");

    if (v instanceof Workspace) {
        if (!mWorkspace.isInOverviewMode()) {
            if (mWorkspace.enterOverviewMode()) {
                mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                        HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }

    CellLayout.CellInfo longClickCellInfo = null;
    View itemUnderLongClick = null;
    if (v.getTag() instanceof ItemInfo) {
        ItemInfo info = (ItemInfo) v.getTag();
        longClickCellInfo = new CellLayout.CellInfo(v, info);
        ;
        itemUnderLongClick = longClickCellInfo.cell;
        resetAddInfo();
    }

    // The hotseat touch handling does not go through Workspace, and we always allow long press
    // on hotseat items.
    final boolean inHotseat = isHotseatLayout(v);
    boolean allowLongPress = inHotseat || mWorkspace.allowLongPress();
    if (allowLongPress && !mDragController.isDragging()) {
        if (itemUnderLongClick == null) {
            // User long pressed on empty space
            mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                    HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
            if (mWorkspace.isInOverviewMode()) {
                mWorkspace.startReordering(v);
            } else {
                mWorkspace.enterOverviewMode();
            }
        } else {
            final boolean isAllAppsButton = inHotseat && isAllAppsButtonRank(
                    mHotseat.getOrderInHotseat(longClickCellInfo.cellX, longClickCellInfo.cellY));
            if (!(itemUnderLongClick instanceof Folder || isAllAppsButton)) {
                // User long pressed on an item
                mWorkspace.startDrag(longClickCellInfo);
            }
        }
    }
    return true;
}

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

@Override
public boolean onLongClick(View v) {
    if (!isDraggingEnabled())
        return false;
    if (isWorkspaceLocked())
        return false;
    if (mState != State.WORKSPACE)
        return false;

    if (creation != null)
        creation.clearAllLayout();/*from w  ww  .  j a  v  a2s. co m*/

    if ((FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && v instanceof PageIndicator)
            || (v == mAllAppsButton && mAllAppsButton != null)) {
        onLongClickAllAppsButton(v);
        return true;
    }

    if (v instanceof Workspace) {
        if (!mWorkspace.isInOverviewMode()) {
            if (!mWorkspace.isTouchActive()) {
                showOverviewMode(true);
                mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                        HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }

    CellLayout.CellInfo longClickCellInfo = null;
    View itemUnderLongClick = null;
    if (v.getTag() instanceof ItemInfo) {
        ItemInfo info = (ItemInfo) v.getTag();
        longClickCellInfo = new CellLayout.CellInfo(v, info);
        itemUnderLongClick = longClickCellInfo.cell;
        mPendingRequestArgs = null;
    }

    // The hotseat touch handling does not go through Workspace, and we always allow long press
    // on hotseat items.
    if (!mDragController.isDragging()) {
        if (itemUnderLongClick == null) {
            // User long pressed on empty space
            mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                    HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
            if (mWorkspace.isInOverviewMode()) {
                mWorkspace.startReordering(v);
            } else {
                showOverviewMode(true);
            }
        } else {
            final boolean isAllAppsButton = !FeatureFlags.NO_ALL_APPS_ICON && isHotseatLayout(v)
                    && mDeviceProfile.inv.isAllAppsButtonRank(
                            mHotseat.getOrderInHotseat(longClickCellInfo.cellX, longClickCellInfo.cellY));
            if (!(itemUnderLongClick instanceof Folder || isAllAppsButton)) {
                // User long pressed on an item
                DragOptions dragOptions = new DragOptions();
                if (itemUnderLongClick instanceof BubbleTextView) {
                    BubbleTextView icon = (BubbleTextView) itemUnderLongClick;
                    if (icon.hasDeepShortcuts()) {
                        DeepShortcutsContainer dsc = DeepShortcutsContainer.showForIcon(icon);
                        if (dsc != null) {
                            dragOptions.deferDragCondition = dsc.createDeferDragCondition(null);
                        }
                    }
                }

                int positionInGrid = mHotseat.getOrderInHotseat(longClickCellInfo.cellX,
                        longClickCellInfo.cellY);

                List<Shortcuts> shortcutses = new ArrayList<Shortcuts>();

                if (creation != null)
                    creation.clearAllLayout();

                mWorkspace.startDrag(longClickCellInfo, dragOptions);

                //Get selected app info
                final Object tag = v.getTag();
                final ShortcutInfo shortcut;
                try {
                    shortcut = (ShortcutInfo) tag;
                    Drawable icon;
                    if (Utilities.loadBitmapPref(Launcher.getLauncherActivity(),
                            shortcut.getTargetComponent().getPackageName()) != null) {
                        icon = new BitmapDrawable(activity.getResources(), Utilities.loadBitmapPref(activity,
                                shortcut.getTargetComponent().getPackageName()));
                    } else {
                        icon = new BitmapDrawable(activity.getResources(),
                                shortcut.getIcon(new IconCache(Launcher.this, getDeviceProfile().inv)));
                    }

                    shortcutses = ShortcutsManager.getShortcutsBasedOnTag(Launcher.this.getApplicationContext(),
                            Launcher.this, shortcut, icon);
                    ShortcutsBuilder builder = new ShortcutsBuilder.Builder(this, masterLayout)
                            .launcher3Shortcuts(gridSize, positionInGrid, (int) v.getY(), v.getBottom(),
                                    Hotseat.isHotseatTouched,
                                    Utilities.getDockSizeDefaultValue(getApplicationContext()))
                            .setOptionLayoutStyle(StyleOption.NONE).setPackageImage(icon)
                            .setShortcutsList(shortcutses).build();

                    creation = new ShortcutsCreation(builder);

                    creation.init();

                    Hotseat.isHotseatTouched = false;

                } catch (ClassCastException e) {
                    Log.e(TAG, "Clicked on Folder/Widget!");
                    positionInGrid = mHotseat.getOrderInHotseat(longClickCellInfo.cellX,
                            longClickCellInfo.cellY);
                    try {
                        //Get selected folder info
                        final View f = v;
                        final Object tagF = v.getTag();
                        final FolderInfo folder;
                        folder = (FolderInfo) tagF;

                        shortcutses = new ArrayList<Shortcuts>();
                        shortcutses.add(new Shortcuts(R.drawable.ic_folder_open_black_24dp,
                                getString(R.string.folder_open), new OnClickListener() {
                                    @Override
                                    public void onClick(View view) {
                                        if (f instanceof FolderIcon) {
                                            onClickFolderIcon(f);
                                            creation.clearAllLayout();
                                        }
                                    }
                                }));
                        shortcutses.add(new Shortcuts(R.drawable.ic_title_black_24dp,
                                getString(R.string.folder_rename), new OnClickListener() {
                                    @Override
                                    public void onClick(View view) {
                                        if (f instanceof FolderIcon) {
                                            AlertDialog.Builder alert = new AlertDialog.Builder(
                                                    new ContextThemeWrapper(Launcher.this,
                                                            R.style.AlertDialogCustom));
                                            LinearLayout layout = new LinearLayout(getApplicationContext());
                                            layout.setOrientation(LinearLayout.VERTICAL);
                                            layout.setPadding(100, 50, 100, 100);

                                            final EditText titleBox = new EditText(Launcher.this);

                                            titleBox.getBackground().mutate()
                                                    .setColorFilter(
                                                            ContextCompat.getColor(getApplicationContext(),
                                                                    R.color.colorPrimary),
                                                            PorterDuff.Mode.SRC_ATOP);
                                            alert.setMessage(getString(R.string.folder_title));
                                            alert.setTitle(getString(R.string.folder_enter_title));

                                            layout.addView(titleBox);
                                            alert.setView(layout);

                                            alert.setPositiveButton(getString(R.string.ok),
                                                    new DialogInterface.OnClickListener() {
                                                        public void onClick(DialogInterface dialog,
                                                                int whichButton) {
                                                            folder.setTitle(titleBox.getText().toString());
                                                            LauncherModel.updateItemInDatabase(
                                                                    Launcher.getLauncherActivity(), folder);
                                                        }
                                                    });

                                            alert.setNegativeButton(getString(R.string.cancel),
                                                    new DialogInterface.OnClickListener() {
                                                        public void onClick(DialogInterface dialog,
                                                                int whichButton) {
                                                            creation.clearAllLayout();
                                                        }
                                                    });
                                            alert.show();
                                            creation.clearAllLayout();
                                        }
                                    }
                                }));

                        ShortcutsBuilder builder = new ShortcutsBuilder.Builder(this, masterLayout)
                                .launcher3Shortcuts(gridSize, positionInGrid, (int) v.getY(), v.getBottom(),
                                        Hotseat.isHotseatTouched,
                                        Utilities.getDockSizeDefaultValue(getApplicationContext()))
                                .setOptionLayoutStyle(0)
                                .setPackageImage(
                                        ContextCompat.getDrawable(Launcher.this, R.mipmap.ic_launcher_home))
                                .setShortcutsList(shortcutses).build();

                        creation = new ShortcutsCreation(builder);

                        creation.init();
                    } catch (ClassCastException ee) {
                    }
                }
            }
        }
    }
    return true;
}