當前位置: 首頁>>代碼示例>>Java>>正文


Java HapticFeedbackConstants類代碼示例

本文整理匯總了Java中android.view.HapticFeedbackConstants的典型用法代碼示例。如果您正苦於以下問題:Java HapticFeedbackConstants類的具體用法?Java HapticFeedbackConstants怎麽用?Java HapticFeedbackConstants使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HapticFeedbackConstants類屬於android.view包,在下文中一共展示了HapticFeedbackConstants類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onTouch

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
@TargetApi(VERSION_CODES.HONEYCOMB_MR1)
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
  switch (motionEvent.getAction()) {
  case MotionEvent.ACTION_DOWN:
    view.postDelayed(repeater, VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB_MR1
                               ? ViewConfiguration.getKeyRepeatTimeout()
                               : ViewConfiguration.getLongPressTimeout());
    performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
    return false;
  case MotionEvent.ACTION_CANCEL:
  case MotionEvent.ACTION_UP:
    view.removeCallbacks(repeater);
    return false;
  default:
    return false;
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:19,代碼來源:RepeatableImageKey.java

示例2: onAyahSelected

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
@Override
public boolean onAyahSelected(EventType eventType, SuraAyah suraAyah, AyahTracker tracker) {
  switch (eventType) {
    case SINGLE_TAP:
      if (isInAyahMode) {
        updateAyahStartSelection(suraAyah, tracker);
        return true;
      }
      return false;
    case LONG_PRESS:
      if (isInAyahMode) {
        updateAyahEndSelection(suraAyah);
      } else {
        startAyahMode(suraAyah, tracker);
      }
      viewPager.performHapticFeedback(
          HapticFeedbackConstants.LONG_PRESS);
      return true;
    default:
      return false;
  }
}
 
開發者ID:Elias33,項目名稱:Quran,代碼行數:23,代碼來源:PagerActivity.java

示例3: onInterceptTouchEvent

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    switch (ev.getActionMasked()) {
        case MotionEvent.ACTION_DOWN:
            mLongClickStarted = System.currentTimeMillis();
            break;
        case MotionEvent.ACTION_MOVE:
            boolean upVal = System.currentTimeMillis() - mLongClickStarted > ViewConfiguration.getLongPressTimeout();
            if (upVal && mLongClickListener != null) {
                mLongClickListener.onLongClick(LaunchAppWidgetHostView.this);
                performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
            }
            break;
        case MotionEvent.ACTION_UP:
            mLongClickStarted = -1;
    }

    return false;
}
 
開發者ID:quaap,項目名稱:LaunchTime,代碼行數:20,代碼來源:LaunchAppWidgetHostView.java

示例4: EntityView

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
public EntityView(Context context, Point pos) {
    super(context);

    uuid = UUID.randomUUID();
    position = pos;

    gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        public void onLongPress(MotionEvent e) {
            if (hasPanned || hasTransformed || hasReleased) {
                return;
            }

            recognizedLongPress = true;
            if (delegate != null) {
                performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
                delegate.onEntityLongClicked(EntityView.this);
            }
        }
    });
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:21,代碼來源:EntityView.java

示例5: onClick

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
public void onClick(View v) {

		v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
				HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);

		switch (v.getId()) {

		case R.id.fragment_new_tree_save:

			saveToDb();

			Toast.makeText(getActivity(), "Tree saved", Toast.LENGTH_SHORT).show();
			getActivity().getSupportFragmentManager().popBackStack();
			break;
		case R.id.fragment_new_tree_take_photo:
			takePicture();
			break;
		}

	}
 
開發者ID:Greenstand,項目名稱:treetracker-android,代碼行數:21,代碼來源:NewTreeFragment.java

示例6: onClick

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
@Override
public void onClick(View v) {
    v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
    String userId = mSharedPreferences.getString(ValueHelper.MAIN_DB_USER_ID, "-1");
    switch (v.getId()) {
        case R.id.fragment_data_sync:
            Toast.makeText(getActivity(), "Start syncing", Toast.LENGTH_SHORT).show();
            syncTask = new SyncTask(getActivity(), this, Integer.parseInt(userId)).execute();
            break;
        case R.id.fragment_data_pause:
            if (syncTask != null) {
                syncTask.cancel(true);
            }
            Toast.makeText(getActivity(), "Pause syncing", Toast.LENGTH_SHORT).show();
            break;
        case R.id.fragment_data_resume:
            Toast.makeText(getActivity(), "Resume syncing", Toast.LENGTH_SHORT).show();
            syncTask = new SyncTask(getActivity(), this, Integer.parseInt(userId)).execute();
            break;

    }
}
 
開發者ID:Greenstand,項目名稱:treetracker-android,代碼行數:23,代碼來源:DataFragment.java

示例7: onLongPress

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
@Override
public void onLongPress(MotionEvent e) {
    unpressTouchedChild();

    final int index = getChildIndex((int) e.getX(), (int) e.getY());
    if (index >= 0 && !mBlockTouchAction) {
        View child = getChildAt(index);
        OnItemLongClickListener onItemLongClickListener = getOnItemLongClickListener();
        if (onItemLongClickListener != null) {
            int adapterIndex = mLeftViewAdapterIndex + index;
            boolean handled = onItemLongClickListener.onItemLongClick(HorizontalListView.this, child, adapterIndex, mAdapter
                              .getItemId(adapterIndex));

            if (handled) {
                // BZZZTT!!1!
                performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
            }
        }
    }
}
 
開發者ID:LanguidSheep,項目名稱:sealtalk-android-master,代碼行數:21,代碼來源:HorizontalListView.java

示例8: showPopupMenu

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
private void showPopupMenu(View view) {
    final CharSequence[] items = {"Edit", "Delete"};
    view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
    AlertDialog.Builder builder = new AlertDialog.Builder(mContext);

    builder.setTitle(mTextName.getText());
    builder.setItems(items, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            int position = getAdapterPosition();
            switch (which){
                case 0://Edit
                    listener.editTask(position);
                    break;
                case 1://Delete
                    listener.deleteTask(position);
                    break;
            }
        }
    });
    builder.show();
}
 
開發者ID:swapyx,項目名稱:Channelize,代碼行數:23,代碼來源:ToDoListAdapter.java

示例9: onLongPress

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
@Override
public void onLongPress(MotionEvent e) {
    unpressTouchedChild();

    final int index = getChildIndex((int) e.getX(), (int) e.getY());
    if (index >= 0 && !mBlockTouchAction) {
        View child = getChildAt(index);
        OnItemLongClickListener onItemLongClickListener = getOnItemLongClickListener();
        if (onItemLongClickListener != null) {
            int adapterIndex = mLeftViewAdapterIndex + index;
            boolean handled = onItemLongClickListener.onItemLongClick(HorizontalListView.this, child, adapterIndex, mAdapter
                    .getItemId(adapterIndex));

            if (handled) {
                // BZZZTT!!1!
                performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
            }
        }
    }
}
 
開發者ID:YuanPengandy,項目名稱:GalleryFinal-master,代碼行數:21,代碼來源:HorizontalListView.java

示例10: dispatchLongPress

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
private boolean dispatchLongPress(View view, int position, long id) {
    boolean handled = false;

    if (mOnItemLongClickListener != null) {
        handled = mOnItemLongClickListener.onItemLongClick(this, mDownTouchView, mDownTouchPosition, id);
    }

    if (!handled) {
        mContextMenuInfo = new AdapterContextMenuInfo(view, position, id);
        handled = super.showContextMenuForChild(this);
    }

    if (handled) {
        performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
    }

    return handled;
}
 
開發者ID:wuzhendev,項目名稱:android-wgallery,代碼行數:19,代碼來源:EcoGallery.java

示例11: getLongClickDragAppListener

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
public static OnLongClickListener getLongClickDragAppListener(final Item item, final DragAction.Action action, @Nullable final LongPressCallBack eventAction) {
    return new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            if (Setup.Companion.appSettings().isDesktopLock()) {
                return false;
            }
            if (eventAction != null && !eventAction.readyForDrag(v)) {
                return false;
            }
            v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
            DragNDropHandler.startDrag(v, item, action, eventAction);
            return true;
        }
    };
}
 
開發者ID:OpenLauncherTeam,項目名稱:openlauncher,代碼行數:17,代碼來源:AppItemView.java

示例12: withOnLongClick

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
public Builder withOnLongClick(final Item item, final DragAction.Action action, @Nullable final LongPressCallBack eventAction) {
    view.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            if (Setup.Companion.appSettings().isDesktopLock()) {
                return false;
            }
            if (eventAction != null && !eventAction.readyForDrag(v)) {
                return false;
            }
            if (view.vibrateWhenLongPress) {
                v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
            }
            DragNDropHandler.startDrag(view, item, action, eventAction);
            return true;
        }
    });
    return this;
}
 
開發者ID:OpenLauncherTeam,項目名稱:openlauncher,代碼行數:20,代碼來源:AppItemView.java

示例13: onMenuItemClick

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
@Override
public boolean onMenuItemClick(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_clear:
            mSearchView.setText(null);
            mSearchView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
            break;
        case R.id.menu_toggle_icon:
            item.setChecked(!item.isChecked());
            mSearchView.showIcon(item.isChecked());
            break;
        case R.id.menu_tts:
            PackageUtils.startTextToSpeech(this, getString(R.string.speech_prompt), REQ_CODE_SPEECH_INPUT);
            break;
        case R.id.menu_icon_search:
        case R.id.menu_icon_drawer:
        case R.id.menu_icon_custom:
            updateNavigationIcon(item.getItemId());
            Toast.makeText(MainActivity.this, item.getTitle(), Toast.LENGTH_SHORT).show();
            break;
    }
    return true;
}
 
開發者ID:renaudcerrato,項目名稱:FloatingSearchView,代碼行數:24,代碼來源:MainActivity.java

示例14: performLongPress

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
boolean performLongPress(final View child,
                         final int longPressPosition, final long longPressId) {
    // CHOICE_MODE_MULTIPLE_MODAL takes over long press.
    if (mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE_MODAL) {
        if (mChoiceActionMode == null) {
            setItemChecked(longPressPosition, true);
            child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
        }
        return true;
    }

    boolean handled = false;
    if (mOnItemLongClickListener != null) {
        handled = mOnItemLongClickListener.onItemLongClick(this, child,
                longPressPosition, longPressId);
    }
    if (handled) {
        child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
    }

    return handled;
}
 
開發者ID:mobvoi,項目名稱:ticdesign,代碼行數:23,代碼來源:TrackSelectionAdapterWrapper.java

示例15: onSingleTapConfirmed

import android.view.HapticFeedbackConstants; //導入依賴的package包/類
@Override
public boolean onSingleTapConfirmed(MotionEvent e)
{
    if(currentState == STATE_MOLE_CREATE)
    {
        Mole emptyMole = new Mole();
        emptyMole.moleX = (int) e.getX();
        emptyMole.moleY = (int) e.getY();
        moles.add(emptyMole);

        postInvalidate();
    }
    else
    {
        if(touchEventMole != null)
        {
            LogExt.e(MoleOnGestureListener.class, "onMoleClick " + touchEventMole.id);
            performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
            listener.onMoleClick(touchEventMole);
            touchEventMole = null;
            return true;
        }
    }

    return super.onSingleTapConfirmed(e);
}
 
開發者ID:ResearchStack,項目名稱:MoleMapperAndroid,代碼行數:27,代碼來源:ZoneView.java


注:本文中的android.view.HapticFeedbackConstants類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。