当前位置: 首页>>代码示例>>Java>>正文


Java View.playSoundEffect方法代码示例

本文整理汇总了Java中android.view.View.playSoundEffect方法的典型用法代码示例。如果您正苦于以下问题:Java View.playSoundEffect方法的具体用法?Java View.playSoundEffect怎么用?Java View.playSoundEffect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.playSoundEffect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: playSoundEffect

import android.view.View; //导入方法依赖的package包/类
/**
 * 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;
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:26,代码来源:FocusHelper.java

示例2: playSoundEffect

import android.view.View; //导入方法依赖的package包/类
/**
 * 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;
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:26,代码来源:FocusHelper.java

示例3: onInterceptTouchEvent

import android.view.View; //导入方法依赖的package包/类
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent motionEvent) {
  View child = rv.findChildViewUnder(motionEvent.getX(), motionEvent.getY());
  if (child != null && gestureDetector.onTouchEvent(motionEvent)) {
    child.playSoundEffect(SoundEffectConstants.CLICK);
    int position = rv.getChildAdapterPosition(child);
    callback.onFeedbackItemClick(position);
  }
  return false;
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:11,代码来源:FeedbackClickListener.java

示例4: RecyclerListViewItemClickListener

import android.view.View; //导入方法依赖的package包/类
public RecyclerListViewItemClickListener(Context context) {
    mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        @Override
        public boolean onSingleTapUp(MotionEvent e) {
            if (currentChildView != null && onItemClickListener != null) {
                currentChildView.setPressed(true);
                final View view = currentChildView;
                if (instantClick) {
                    view.playSoundEffect(SoundEffectConstants.CLICK);
                    onItemClickListener.onItemClick(view, currentChildPosition);
                }
                AndroidUtilities.runOnUIThread(clickRunnable = new Runnable() {
                    @Override
                    public void run() {
                        if (this == clickRunnable) {
                            clickRunnable = null;
                        }
                        if (view != null) {
                            view.setPressed(false);
                            if (!instantClick) {
                                view.playSoundEffect(SoundEffectConstants.CLICK);
                                if (onItemClickListener != null) {
                                    onItemClickListener.onItemClick(view, currentChildPosition);
                                }
                            }
                        }
                    }
                }, ViewConfiguration.getPressedStateDuration());

                if (selectChildRunnable != null) {
                    AndroidUtilities.cancelRunOnUIThread(selectChildRunnable);
                    selectChildRunnable = null;
                    currentChildView = null;
                    interceptedByChild = false;
                }
            }
            return true;
        }

        @Override
        public void onLongPress(MotionEvent event) {
            if (currentChildView != null) {
                if (onItemLongClickListener != null) {
                    if (onItemLongClickListener.onItemClick(currentChildView, currentChildPosition)) {
                        currentChildView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
                    }
                }
            }
        }
    });
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:52,代码来源:RecyclerListView.java

示例5: RecyclerListViewItemClickListener

import android.view.View; //导入方法依赖的package包/类
public RecyclerListViewItemClickListener(Context context) {
    mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        @Override
        public boolean onSingleTapUp(MotionEvent e) {
            if (currentChildView != null && onItemClickListener != null) {
                currentChildView.setPressed(true);
                final View view = currentChildView;
                if (instantClick) {
                    view.playSoundEffect(SoundEffectConstants.CLICK);
                    onItemClickListener.onItemClick(view, currentChildPosition);
                }
                AndroidUtilities.runOnUIThread(clickRunnable = new Runnable() {
                    @Override
                    public void run() {
                        if (this == clickRunnable) {
                            clickRunnable = null;
                        }
                        if (view != null) {
                            view.setPressed(false);
                            if (!instantClick) {
                                view.playSoundEffect(SoundEffectConstants.CLICK);
                                if (onItemClickListener != null) {
                                    onItemClickListener.onItemClick(view, currentChildPosition);
                                }
                            }
                        }
                    }
                }, ViewConfiguration.getPressedStateDuration());

                if (selectChildRunnable != null) {
                    AndroidUtilities.cancelRunOnUIThread(selectChildRunnable);
                    selectChildRunnable = null;
                    currentChildView = null;
                    interceptedByChild = false;
                }
            }
            return true;
        }

        @Override
        public void onLongPress(MotionEvent event) {
            if (currentChildView != null) {
                View child = currentChildView;
                if (onItemLongClickListener != null) {
                    if (onItemLongClickListener.onItemClick(currentChildView, currentChildPosition)) {
                        child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
                    }
                }
            }
        }
    });
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:53,代码来源:RecyclerListView.java


注:本文中的android.view.View.playSoundEffect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。