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


Java SoundEffectConstants类代码示例

本文整理汇总了Java中android.view.SoundEffectConstants的典型用法代码示例。如果您正苦于以下问题:Java SoundEffectConstants类的具体用法?Java SoundEffectConstants怎么用?Java SoundEffectConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onSingleTapUp

import android.view.SoundEffectConstants; //导入依赖的package包/类
@Override
public boolean onSingleTapUp(MotionEvent e) {
  int position = mDecor.findHeaderPositionUnder((int) e.getX(), (int) e.getY());
  if (position != -1) {
    View headerView = mDecor.getHeaderView(mRecyclerView, position);
    long headerId = getAdapter().getHeaderId(position);
    mOnHeaderClickListener.onHeaderClick(headerView, position, headerId);
    mRecyclerView.playSoundEffect(SoundEffectConstants.CLICK);
    headerView.onTouchEvent(e);
    return true;
  }
  return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:StickyRecyclerHeadersTouchListener.java

示例2: playSoundEffect

import android.view.SoundEffectConstants; //导入依赖的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

示例3: onSingleTapUp

import android.view.SoundEffectConstants; //导入依赖的package包/类
@Override
public boolean onSingleTapUp(MotionEvent e) {
    int position = mDecor.findHeaderPositionUnder((int) e.getX(), (int) e.getY());
    if (position != -1) {
        View headerView = mDecor.getHeaderView(mRecyclerView, position);
        long headerId = getAdapter().getHeaderId(position);
        mOnHeaderClickListener.onHeaderClick(headerView, position, headerId);
        mRecyclerView.playSoundEffect(SoundEffectConstants.CLICK);
        headerView.onTouchEvent(e);
        return true;
    }
    return false;
}
 
开发者ID:sswukang,项目名称:RvAdapter,代码行数:14,代码来源:StickyRecyclerHeadersTouchListener.java

示例4: checkOtherButtonMotionEvent

import android.view.SoundEffectConstants; //导入依赖的package包/类
private boolean checkOtherButtonMotionEvent(MotionEvent event) {
    if (documentAttachType != DOCUMENT_ATTACH_TYPE_DOCUMENT && currentMessageObject.type != 12 && documentAttachType != DOCUMENT_ATTACH_TYPE_MUSIC && documentAttachType != DOCUMENT_ATTACH_TYPE_VIDEO && documentAttachType != DOCUMENT_ATTACH_TYPE_GIF && currentMessageObject.type != 8) {
        return false;
    }

    int x = (int) event.getX();
    int y = (int) event.getY();

    boolean result = false;
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
        if (x >= otherX - dp(20) && x <= otherX + dp(20) && y >= otherY - dp(4) && y <= otherY + dp(30)) {
            otherPressed = true;
            result = true;
        }
    } else {
        if (event.getAction() == MotionEvent.ACTION_UP) {
            if (otherPressed) {
                otherPressed = false;
                playSoundEffect(SoundEffectConstants.CLICK);
                delegate.didPressedOther(this);
            }
        }
    }
    return result;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:26,代码来源:ChatMessageCell.java

示例5: arrowScroll

import android.view.SoundEffectConstants; //导入依赖的package包/类
/**
 * 获得滑动的方向
 */
public boolean arrowScroll(int direction) {
    View currentFocused = findFocus();
    if (currentFocused == this) currentFocused = null;

    boolean handled = false;

    View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused,
            direction);
    if (nextFocused != null && nextFocused != currentFocused) {
        if (direction == View.FOCUS_LEFT) {
            handled = nextFocused.requestFocus();
        } else if (direction == View.FOCUS_RIGHT) {
            // If there is nothing to the right, or this is causing us to
            // jump to the left, then what we really want to do is page right.
            if (currentFocused != null && nextFocused.getLeft() <= currentFocused.getLeft()) {
                handled = pageRight();
            } else {
                handled = nextFocused.requestFocus();
            }
        }
    } else if (direction == FOCUS_LEFT || direction == FOCUS_BACKWARD) {
        // Trying to move left and nothing there; try to page.
        handled = pageLeft();
    } else if (direction == FOCUS_RIGHT || direction == FOCUS_FORWARD) {
        // Trying to move right and nothing there; try to page.
        handled = pageRight();
    }
    if (handled) {
        playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));
    }
    return handled;
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:36,代码来源:CustomViewAbove.java

示例6: checkOtherButtonMotionEvent

import android.view.SoundEffectConstants; //导入依赖的package包/类
private boolean checkOtherButtonMotionEvent(MotionEvent event) {
    if (documentAttachType != DOCUMENT_ATTACH_TYPE_DOCUMENT && currentMessageObject.type != 12 && documentAttachType != DOCUMENT_ATTACH_TYPE_MUSIC && documentAttachType != DOCUMENT_ATTACH_TYPE_VIDEO && documentAttachType != DOCUMENT_ATTACH_TYPE_GIF && currentMessageObject.type != 8 || hasGamePreview) {
        return false;
    }

    int x = (int) event.getX();
    int y = (int) event.getY();

    boolean result = false;
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
        if (x >= otherX - dp(20) && x <= otherX + dp(20) && y >= otherY - dp(4) && y <= otherY + dp(30)) {
            otherPressed = true;
            result = true;
        }
    } else {
        if (event.getAction() == MotionEvent.ACTION_UP) {
            if (otherPressed) {
                otherPressed = false;
                playSoundEffect(SoundEffectConstants.CLICK);
                delegate.didPressedOther(this);
            }
        }
    }
    return result;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:26,代码来源:ChatMessageCell.java

示例7: arrowScroll

import android.view.SoundEffectConstants; //导入依赖的package包/类
public boolean arrowScroll(int direction) {
	View currentFocused = findFocus();
	if (currentFocused == this) currentFocused = null;

	boolean handled = false;

	View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused,
			direction);
	if (nextFocused != null && nextFocused != currentFocused) {
		if (direction == View.FOCUS_LEFT) {
			handled = nextFocused.requestFocus();
		} else if (direction == View.FOCUS_RIGHT) {
			// If there is nothing to the right, or this is causing us to
			// jump to the left, then what we really want to do is page right.
			if (currentFocused != null && nextFocused.getLeft() <= currentFocused.getLeft()) {
				handled = pageRight();
			} else {
				handled = nextFocused.requestFocus();
			}
		}
	} else if (direction == FOCUS_LEFT || direction == FOCUS_BACKWARD) {
		// Trying to move left and nothing there; try to page.
		handled = pageLeft();
	} else if (direction == FOCUS_RIGHT || direction == FOCUS_FORWARD) {
		// Trying to move right and nothing there; try to page.
		handled = pageRight();
	}
	if (handled) {
		playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));
	}
	return handled;
}
 
开发者ID:6ag,项目名称:LiuAGeAndroid,代码行数:33,代码来源:CustomViewAbove.java

示例8: onHandleIntent

import android.view.SoundEffectConstants; //导入依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    // Play a click sound and vibrate quickly
    GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);
    AudioManager audioManager = (AudioManager)getSystemService(AUDIO_SERVICE);
    audioManager.playSoundEffect(SoundEffectConstants.CLICK, 1.0f);
    Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
    vibrator.vibrate(VIBRATOR_PULSE);

    try {
        Bundle data = new Bundle();
        data.putString("user",
                sharedPreferences.getString(GarageDoorWidgetProvider.PREF_USERNAME, ""));
        data.putString("password",
                sharedPreferences.getString(GarageDoorWidgetProvider.PREF_PASSWORD, ""));
        data.putString("timestamp", String.valueOf(System.currentTimeMillis() / 1000));

        String id = Integer.toString(getNextMsgId());
        gcm.send(GarageDoorWidgetProvider.GCM_SENDER_ID + "@gcm.googleapis.com",
                id, TIME_TO_LIVE, data);
    } catch (IOException e) {
        Log.e(TAG, "Error sending message", e);
    }
}
 
开发者ID:jpuderer,项目名称:GarageDoor,代码行数:27,代码来源:GarageDoorIntentService.java

示例9: playSoundEffect

import android.view.SoundEffectConstants; //导入依赖的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

示例10: bindPredefinedRepositoriesLink

import android.view.SoundEffectConstants; //导入依赖的package包/类
private void bindPredefinedRepositoriesLink() {
    mBinding.repositoryPredefined.setMovementMethod(new LinkMovementMethod());
    String msg = getString(R.string.account_wizard_repository_page_message2);
    String link = getString(R.string.account_wizard_repository_page_message2_predefined);
    String text = String.format(Locale.getDefault(), msg, link);
    int pos = msg.indexOf("%1$s");

    // Create a clickable span
    Spannable span = Spannable.Factory.getInstance().newSpannable(text);
    if (pos >= 0) {
        span.setSpan(new ClickableSpan() {
            @Override
            public void onClick(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);
    }
    mBinding.repositoryPredefined.setText(span);
}
 
开发者ID:jruesga,项目名称:rview,代码行数:23,代码来源:RepositoryPageFragment.java

示例11: onSingleTapUp

import android.view.SoundEffectConstants; //导入依赖的package包/类
@Override
public boolean onSingleTapUp(MotionEvent e) {
    View view = mRecyclerView.findChildViewUnder(e.getX(), e.getY());

    if (view != null) {
        view.playSoundEffect(SoundEffectConstants.CLICK);

        int pos = mRecyclerView.getChildPosition(view);

        Intent i = new Intent(getActivity(), ViewEntryActivity.class);
        Bundle b = new Bundle();
        b.putParcelable(ViewEntryActivity.ENTRY_KEY, mDisplayedEntries.get(pos));
        i.putExtras(b);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            view.buildDrawingCache(true);
            Bitmap drawingCache = view.getDrawingCache(true);
            Bundle bundle = ActivityOptions.makeThumbnailScaleUpAnimation(view, drawingCache, 0, 0).toBundle();
            getActivity().startActivity(i, bundle);
        } else {
            startActivity(i);
        }
    }

    return super.onSingleTapUp(e);
}
 
开发者ID:timothymiko,项目名称:narrate-android,代码行数:27,代码来源:CalendarFragment.java

示例12: onSingleTapUp

import android.view.SoundEffectConstants; //导入依赖的package包/类
@Override
public boolean onSingleTapUp(MotionEvent e) {
    View view = mList.findChildViewUnder(e.getX(), e.getY());

    if (view != null) {
        view.playSoundEffect(SoundEffectConstants.CLICK);

        int pos = mList.getChildPosition(view);

        Intent i = new Intent(getActivity(), ViewEntryActivity.class);
        Bundle b = new Bundle();
        b.putParcelable(ViewEntryActivity.ENTRY_KEY, mItems.get(pos - mAdapter.getSectionOffset(pos)));
        i.putExtras(b);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            view.buildDrawingCache(true);
            Bitmap drawingCache = view.getDrawingCache(true);
            Bundle bundle = ActivityOptions.makeThumbnailScaleUpAnimation(view, drawingCache, 0, 0).toBundle();
            getActivity().startActivity(i, bundle);
        } else {
            startActivity(i);
        }
    }

    return super.onSingleTapUp(e);
}
 
开发者ID:timothymiko,项目名称:narrate-android,代码行数:27,代码来源:EntryListDialogFragment.java

示例13: onKeyDown

import android.view.SoundEffectConstants; //导入依赖的package包/类
/**
 * Handles left, right, and clicking
 *
 * @see android.view.View#onKeyDown
 */
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {

        case KeyEvent.KEYCODE_DPAD_LEFT:
            if (movePrevious()) {
                playSoundEffect(SoundEffectConstants.NAVIGATION_LEFT);
            }
            return true;

        case KeyEvent.KEYCODE_DPAD_RIGHT:
            if (moveNext()) {
                playSoundEffect(SoundEffectConstants.NAVIGATION_RIGHT);
            }
            return true;

        case KeyEvent.KEYCODE_DPAD_CENTER:
        case KeyEvent.KEYCODE_ENTER:
            mReceivedInvokeKeyDown = true;
            // fallthrough to default handling
    }

    return super.onKeyDown(keyCode, event);
}
 
开发者ID:wuzhendev,项目名称:android-wgallery,代码行数:30,代码来源:EcoGallery.java

示例14: performCloseIconClick

import android.view.SoundEffectConstants; //导入依赖的package包/类
/**
 * Call this chip's {@link #onCloseIconClickListener}, if it is defined. Performs all normal
 * actions associated with clicking: reporting accessibility event, playing a sound, etc.
 *
 * @return True there was an assigned {@link #onCloseIconClickListener} that was called, false
 *     otherwise is returned.
 */
@CallSuper
public boolean performCloseIconClick() {
  playSoundEffect(SoundEffectConstants.CLICK);

  boolean result;
  if (onCloseIconClickListener != null) {
    onCloseIconClickListener.onClick(this);
    result = true;
  } else {
    result = false;
  }

  touchHelper.sendEventForVirtualView(
      CLOSE_ICON_VIRTUAL_ID, AccessibilityEvent.TYPE_VIEW_CLICKED);
  return result;
}
 
开发者ID:material-components,项目名称:material-components-android,代码行数:24,代码来源:Chip.java

示例15: getTagView

import android.view.SoundEffectConstants; //导入依赖的package包/类
@Override
public View getTagView(int position) {
    String tag = mTagList.get(position);
    TextView view = (TextView) View.inflate(mContext, R.layout.view_hot_tag, null);
    view.setText(tag);
    view.setTag(tag);
    view.setTextColor(ColorList.randomNextColor());
    view.setOnClickListener(mTagViewClickListener);

    if (mEditable) {
        view.setOnLongClickListener(mTagViewLongClickListener);

        view.performHapticFeedback(
                HapticFeedbackConstants.LONG_PRESS,
                HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
        view.playSoundEffect(SoundEffectConstants.CLICK);
    }

    return view;
}
 
开发者ID:Android-Jungle,项目名称:android-jungle-framework,代码行数:21,代码来源:CommonHotTagAdapter.java


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