當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。