List of usage examples for android.view HapticFeedbackConstants FLAG_IGNORE_GLOBAL_SETTING
int FLAG_IGNORE_GLOBAL_SETTING
To view the source code for android.view HapticFeedbackConstants FLAG_IGNORE_GLOBAL_SETTING.
Click Source Link
From source file:com.andrewsummers.otashu.DepthPageTransformer.java
/** * transformPage used to apply a custom transformation (animation) to page view scrolling. * //from w w w . j a v a 2 s. c o m * @param view Incoming view. * @param position Current position of page relative to current "front and center" page. As per * the official ViewPager documentation, possible values are: -1 is one page position * to the left 0 is front and center. 1 is one page position to the right */ public void transformPage(View view, float position) { int pageWidth = view.getWidth(); // if application touch feedback setting is set, enable touch feedback if (pref_touch_feedback_enabled) { view.setHapticFeedbackEnabled(true); view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } // current page setting: [-Infinity, -1) if (position < -1) { // this page is way off-screen to the left view.setAlpha(0); } // current page setting: [-1, 0] else if (position <= 0) { // use the default slide transition when moving to the left page view.setAlpha(1); // view.setHapticFeedbackEnabled(hapticFeedbackEnabled); view.setTranslationY(pageWidth * position); view.setScaleX(1); view.setScaleY(1); } // current page setting: (0, 1) else if (position <= 1) { // fade page out view.setAlpha(1 - position); // counteract the default slide transition view.setTranslationY(pageWidth * -position); // scale the page down (between MIN_SCALE and 1) float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position)); view.setScaleX(scaleFactor); view.setScaleY(scaleFactor); } // current page setting: (1, +Infinity] else { // this page is way off-screen to the right view.setAlpha(0); } }
From source file:org.docrj.smartcard.reader.AppSelectActivity.java
private void prepareViewForMode() { mIntro.setText(mManual ? R.string.intro_app_select_manual : R.string.intro_app_select); if (mManual) { mSelectButton.setOnClickListener(new View.OnClickListener() { @Override//from w w w .j a v a2s . c om public void onClick(View v) { if (mSelectHaptic) { v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } clearMessages(false); // short delay to show cleared messages mHandler.postDelayed(new Runnable() { public void run() { onError(getString(R.string.manual_disconnected)); } }, 50L); } }); if (mSelectBar.getVisibility() == View.INVISIBLE) { // slide select bar up and shake the button! mSelectBar.setVisibility(View.VISIBLE); Animation slideUp = AnimationUtils.loadAnimation(this, R.anim.slide_up); mSelectBar.startAnimation(slideUp); Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake); mSelectButton.startAnimation(shake); } } else { if (mSelectBar.getVisibility() == View.VISIBLE) { Animation slideDown = AnimationUtils.loadAnimation(this, R.anim.slide_down); mSelectBar.startAnimation(slideDown); mSelectBar.setVisibility(View.INVISIBLE); } } }
From source file:com.metinkale.prayerapp.vakit.PrefsView.java
@Override public void onClick(View v) { Object o = getValue();/*w w w .j ava 2s .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 w w.j av a 2 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:org.docrj.smartcard.reader.AppSelectActivity.java
@Override public void setUserSelectListener(final ReaderXcvr.UiListener callback) { mSelectButton.setOnClickListener(new View.OnClickListener() { @Override//from w w w .j a v a 2 s .c o m public void onClick(View v) { // haptic feedback if (mSelectHaptic) { v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } // update console and do select transaction if (mAutoClear) { clearMessages(false); // short delay to show cleared messages mHandler.postDelayed(new Runnable() { public void run() { callback.onUserSelect(mApps.get(mSelectedAppPos).getAid()); } }, 50L); } else { clearImage(); addMessageSeparator(); callback.onUserSelect(mApps.get(mSelectedAppPos).getAid()); } } }); }
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.// w w w .j av a2s .c o 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:org.distantshoresmedia.keyboard.LatinIME.java
void vibrate(int len) { Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); if (v != null) { v.vibrate(len);// w w w . ja v a 2s. co m return; } if (mKeyboardSwitcher.getInputView() != null) { mKeyboardSwitcher.getInputView().performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } }