Example usage for android.view SoundEffectConstants CLICK

List of usage examples for android.view SoundEffectConstants CLICK

Introduction

In this page you can find the example usage for android.view SoundEffectConstants CLICK.

Prototype

int CLICK

To view the source code for android.view SoundEffectConstants CLICK.

Click Source Link

Usage

From source file:com.hippo.widget.recyclerview.EasyRecyclerView.java

private boolean performItemClick(View view, int position, long id) {
    boolean handled = false;
    boolean dispatchItemClick = true;

    if (mChoiceMode != CHOICE_MODE_NONE && mChoiceMode != CHOICE_MODE_MULTIPLE_CUSTOM) {
        handled = true;/*from w  ww  .  ja  v  a2 s . co  m*/
        boolean checkedStateChanged = false;

        if (mChoiceMode == CHOICE_MODE_MULTIPLE
                || (mChoiceMode == CHOICE_MODE_MULTIPLE_MODAL && mChoiceActionMode != null)) {
            boolean checked = !mCheckStates.get(position, false);
            mCheckStates.put(position, checked);
            if (mCheckedIdStates != null && mAdapter.hasStableIds()) {
                if (checked) {
                    mCheckedIdStates.put(mAdapter.getItemId(position), position);
                } else {
                    mCheckedIdStates.delete(mAdapter.getItemId(position));
                }
            }
            if (checked) {
                mCheckedItemCount++;
            } else {
                mCheckedItemCount--;
            }
            if (mChoiceActionMode != null) {
                mMultiChoiceModeCallback.onItemCheckedStateChanged(mChoiceActionMode, position, id, checked);
                dispatchItemClick = false;
            }
            checkedStateChanged = true;
        } else if (mChoiceMode == CHOICE_MODE_SINGLE) {
            boolean checked = !mCheckStates.get(position, false);
            if (checked) {
                mCheckStates.clear();
                mCheckStates.put(position, true);
                if (mCheckedIdStates != null && mAdapter.hasStableIds()) {
                    mCheckedIdStates.clear();
                    mCheckedIdStates.put(mAdapter.getItemId(position), position);
                }
                mCheckedItemCount = 1;
            } else if (mCheckStates.size() == 0 || !mCheckStates.valueAt(0)) {
                mCheckedItemCount = 0;
            }
            checkedStateChanged = true;
        }

        if (checkedStateChanged) {
            updateOnScreenCheckedViews();
        }
    }

    if (dispatchItemClick) {
        if (mOnItemClickListener != null) {
            playSoundEffect(SoundEffectConstants.CLICK);
            mOnItemClickListener.onItemClick(this, view, position, id);
            if (view != null) {
                view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
            }
            handled = true;
        }
    }

    return handled;
}

From source file:chan.android.app.bitwise.util.StaggeredGridView.java

public boolean performItemClick(View view, int position, long id) {
    if (mOnItemClickListener != null) {
        playSoundEffect(SoundEffectConstants.CLICK);
        if (view != null) {
            view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
        }/*from   ww  w . j  a v  a 2  s  .  c  o m*/
        mOnItemClickListener.onItemClick(this, view, position, id);
        return true;
    }

    return false;
}

From source file:com.ruesga.timelinechart.TimelineChartView.java

private void performSelectionSoundEffect() {
    if (!isInEditMode()) {
        if (mPlaySelectionSoundEffect) {
            if (mSelectionSoundEffectSource == SYSTEM_SOUND_EFFECT) {
                mAudioManager.playSoundEffect(SoundEffectConstants.CLICK, SOUND_EFFECT_VOLUME);
            } else {
                mSoundEffectMP.start();/*w w  w.  ja va 2 s . com*/
            }
        }
    }
}