isDragViewUnder((int) x, (int) y) && !isScrollViewUnder((int) x, (int) y)) { dragView.playSoundEffect(SoundEffectConstants.CLICK);
myButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { v.playSoundEffect(SoundEffectConstants.CLICK); } });
Button01.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { v.playSoundEffect(SoundEffectConstants.CLICK); } });
Button01.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { v.playSoundEffect(SoundEffectConstants.CLICK); } });
Button b = (Button) findViewById(R.id.button); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Settings.System.putInt(getContentResolver(), Settings.System.SOUND_EFFECTS_ENABLED, 1); v.playSoundEffect(SoundEffectConstants.CLICK); Settings.System.putInt(getContentResolver(), Settings.System.SOUND_EFFECTS_ENABLED, 0); } });
public static void playClickSound(View view) { view.playSoundEffect(SoundEffectConstants.CLICK); }
public static void playClickSound(View view) { view.playSoundEffect(SoundEffectConstants.CLICK); }
@Override public void onClick(@NonNull View v) { // Click on span doesn't provide sound feedback it the text view doesn't // handle a click event. Just perform a click effect. v.playSoundEffect(SoundEffectConstants.CLICK); openHttpPasswordUrl(); } }, pos, pos + link.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
@Override public void onClick(@NonNull View v) { // Click on span doesn't provide sound feedback it the text view doesn't // handle a click event. Just perform a click effect. v.playSoundEffect(SoundEffectConstants.CLICK); performOpenPredefinedRepositories(); } }, pos, pos + link.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
public boolean onTouch(View v, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_DOWN) { v.playSoundEffect(SoundEffectConstants.CLICK); edLCD.setText(edLCD.getText().toString() + "1"); } return true; }
@Override public void onClick(@NonNull View v) { // Click on span doesn't provide sound feedback it the text view doesn't // handle a click event. Just perform a click effect. v.playSoundEffect(SoundEffectConstants.CLICK); openSignInUrl(); } }, pos, pos + link.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
this.spinner=(Spinner)findViewById(R.id.spinner); this.spinner.setClickable(false); this.spinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { Log.v(TAG, "spinner touch"); //replicating a click if(event.getAction() == MotionEvent.ACTION_UP){ v.playSoundEffect(android.view.SoundEffectConstants.CLICK); } return true; } });
/** * Helper method to be used for playing sound effects. */ @Thunk private static void playSoundEffect(int keyCode, View v) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_LEFT: v.playSoundEffect(SoundEffectConstants.NAVIGATION_LEFT); break; case KeyEvent.KEYCODE_DPAD_RIGHT: v.playSoundEffect(SoundEffectConstants.NAVIGATION_RIGHT); break; case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_PAGE_DOWN: case KeyEvent.KEYCODE_MOVE_END: v.playSoundEffect(SoundEffectConstants.NAVIGATION_DOWN); break; case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_PAGE_UP: case KeyEvent.KEYCODE_MOVE_HOME: v.playSoundEffect(SoundEffectConstants.NAVIGATION_UP); break; default: break; } }
/** * Helper method to be used for playing sound effects. */ @Thunk static void playSoundEffect(int keyCode, View v) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_LEFT: v.playSoundEffect(SoundEffectConstants.NAVIGATION_LEFT); break; case KeyEvent.KEYCODE_DPAD_RIGHT: v.playSoundEffect(SoundEffectConstants.NAVIGATION_RIGHT); break; case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_PAGE_DOWN: case KeyEvent.KEYCODE_MOVE_END: v.playSoundEffect(SoundEffectConstants.NAVIGATION_DOWN); break; case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_PAGE_UP: case KeyEvent.KEYCODE_MOVE_HOME: v.playSoundEffect(SoundEffectConstants.NAVIGATION_UP); break; default: break; } } }
/** * Helper method to be used for playing sound effects. */ @Thunk static void playSoundEffect(int keyCode, View v) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_LEFT: v.playSoundEffect(SoundEffectConstants.NAVIGATION_LEFT); break; case KeyEvent.KEYCODE_DPAD_RIGHT: v.playSoundEffect(SoundEffectConstants.NAVIGATION_RIGHT); break; case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_PAGE_DOWN: case KeyEvent.KEYCODE_MOVE_END: v.playSoundEffect(SoundEffectConstants.NAVIGATION_DOWN); break; case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_PAGE_UP: case KeyEvent.KEYCODE_MOVE_HOME: v.playSoundEffect(SoundEffectConstants.NAVIGATION_UP); break; default: break; } }
@Override boolean performItemClick(RecyclerView parent, View view, int position, long id) { if (mItemClickListener != null) { view.playSoundEffect(SoundEffectConstants.CLICK); mItemClickListener.onItemClick(parent, view, position, id); return true; } return false; }
@Override boolean performItemClick(RecyclerView parent, View view, int position, long id) { if (mItemClickListener != null) { view.playSoundEffect(SoundEffectConstants.CLICK); mItemClickListener.onItemClick(parent, view, position, id); return true; } return false; }
@Override public boolean onInterceptTouchEvent(@NonNull RecyclerView view, @NonNull MotionEvent motionEvent) { final View childView = view.findChildViewUnder(motionEvent.getX(), motionEvent.getY()); if (childView != null && mGestureDetector.onTouchEvent(motionEvent)) { childView.playSoundEffect(SoundEffectConstants.CLICK); mOnItemClickListener.onItemClick(view.getChildAdapterPosition(childView)); return true; } return false; }
class onClickHandler implements View.OnClickListener { public void onClick(View v) { Button button = (Button) v.findViewById(v.getId()); if ("On" == button.getText()){ button.setText("Off"); } else { button.setText("On"); } v.playSoundEffect(SoundEffectConstants.CLICK); } }
@Override public void onClick(@NonNull View v) { // Click on span doesn't provide sound feedback it the text view doesn't // handle a click event. Just perform a click effect. v.playSoundEffect(SoundEffectConstants.CLICK); Uri uri = StringHelper.buildUriAndEnsureScheme(link); boolean isHttpScheme = uri.getScheme().equals("http") || uri.getScheme().equals("https"); if (!isHttpScheme || ModelHelper.canAnyAccountHandleUrl(getContext(), link)) { ActivityHelper.handleUri(getContext(), uri); } else { ActivityHelper.openUriInCustomTabs((Activity) getContext(), uri); } } }, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);