當前位置: 首頁>>代碼示例>>Java>>正文


Java PlaybackStateCompat.Actions方法代碼示例

本文整理匯總了Java中android.support.v4.media.session.PlaybackStateCompat.Actions方法的典型用法代碼示例。如果您正苦於以下問題:Java PlaybackStateCompat.Actions方法的具體用法?Java PlaybackStateCompat.Actions怎麽用?Java PlaybackStateCompat.Actions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.media.session.PlaybackStateCompat的用法示例。


在下文中一共展示了PlaybackStateCompat.Actions方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showActions

import android.support.v4.media.session.PlaybackStateCompat; //導入方法依賴的package包/類
/**
 * This updates the buttons on the controller view to show actions that
 * aren't included in the declared supported actions in red to more easily
 * detect potential bugs.
 *
 * @param actions The mask of currently supported actions from {@see
 *                PlaybackStateCompat.getActions()}.
 */
private void showActions(@PlaybackStateCompat.Actions long actions) {
    final int count = mActionViewIdMap.size();
    for (int i = 0; i < count; ++i) {
        final int viewId = mActionViewIdMap.keyAt(i);
        final long action = mActionViewIdMap.valueAt(i);

        final ImageButton button = mActionButtonMap.get(viewId);
        if (actionSupported(actions, action)) {
            button.setBackground(null);
        } else {
            button.setBackgroundResource(R.drawable.bg_unsuported_action);
        }
    }

    final boolean shuffleEnabled =
            mController.getShuffleMode() == PlaybackStateCompat.SHUFFLE_MODE_ALL ||
                    mController.getShuffleMode() == PlaybackStateCompat.SHUFFLE_MODE_GROUP;
    final int shuffleTint = shuffleEnabled
            ? ContextCompat.getColor(this, R.color.colorPrimary)
            : ContextCompat.getColor(this, R.color.colorInactive);
    DrawableCompat.setTint(mShuffleToggle.getDrawable(), shuffleTint);
}
 
開發者ID:googlesamples,項目名稱:android-media-controller,代碼行數:31,代碼來源:MediaAppControllerActivity.java

示例2: getAvailableActions

import android.support.v4.media.session.PlaybackStateCompat; //導入方法依賴的package包/類
@PlaybackStateCompat.Actions
private long getAvailableActions() {
    long actions =
            PlaybackStateCompat.ACTION_PLAY
                    | PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID
                    | PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH
                    | PlaybackStateCompat.ACTION_SKIP_TO_NEXT
                    | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS;
    if (isPlaying()) {
        actions |= PlaybackStateCompat.ACTION_PAUSE;
    }
    return actions;
}
 
開發者ID:googlecodelabs,項目名稱:musicplayer-devices,代碼行數:14,代碼來源:PlaybackManager.java

示例3: getAvailableActions

import android.support.v4.media.session.PlaybackStateCompat; //導入方法依賴的package包/類
@PlaybackStateCompat.Actions
private long getAvailableActions() {
    long actions = PlaybackStateCompat.ACTION_PLAY_PAUSE
            | PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID
            | PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH;
    if (mMediaPlayerGlue.isPlaying()) {
        actions |= PlaybackStateCompat.ACTION_PAUSE;
    } else {
        actions |= PlaybackStateCompat.ACTION_PLAY;
    }
    return actions;
}
 
開發者ID:googlesamples,項目名稱:leanback-homescreen-channels,代碼行數:13,代碼來源:VideoFragment.java

示例4: getAvailableActions

import android.support.v4.media.session.PlaybackStateCompat; //導入方法依賴的package包/類
/**
 * Set the current capabilities available on this session. Note: If a capability is not
 * listed in the bitmask of capabilities then the MediaSession will not handle it. For
 * example, if you don't want ACTION_STOP to be handled by the MediaSession, then don't
 * included it in the bitmask that's returned.
 */
@PlaybackStateCompat.Actions
private long getAvailableActions() {
    long actions = PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID
                   | PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH
                   | PlaybackStateCompat.ACTION_SKIP_TO_NEXT
                   | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS;
    switch (mState) {
        case PlaybackStateCompat.STATE_STOPPED:
            actions |= PlaybackStateCompat.ACTION_PLAY
                       | PlaybackStateCompat.ACTION_PAUSE;
            break;
        case PlaybackStateCompat.STATE_PLAYING:
            actions |= PlaybackStateCompat.ACTION_STOP
                       | PlaybackStateCompat.ACTION_PAUSE
                       | PlaybackStateCompat.ACTION_SEEK_TO;
            break;
        case PlaybackStateCompat.STATE_PAUSED:
            actions |= PlaybackStateCompat.ACTION_PLAY
                       | PlaybackStateCompat.ACTION_STOP;
            break;
        default:
            actions |= PlaybackStateCompat.ACTION_PLAY
                       | PlaybackStateCompat.ACTION_PLAY_PAUSE
                       | PlaybackStateCompat.ACTION_STOP
                       | PlaybackStateCompat.ACTION_PAUSE;
    }
    return actions;
}
 
開發者ID:nazmulidris,項目名稱:mediasession-mediaplayer,代碼行數:35,代碼來源:MediaPlayerAdapter.java

示例5: getAvailableActions

import android.support.v4.media.session.PlaybackStateCompat; //導入方法依賴的package包/類
/**
 * Set the current capabilities available on this session. Note: If a capability is not
 * listed in the bitmask of capabilities then the MediaSession will not handle it. For
 * example, if you don't want ACTION_STOP to be handled by the MediaSession, then don't
 * included it in the bitmask that's returned.
 */
@PlaybackStateCompat.Actions
private long getAvailableActions() {
    long actions = PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID
            | PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH
            | PlaybackStateCompat.ACTION_SKIP_TO_NEXT
            | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS;
    switch (mState) {
        case PlaybackStateCompat.STATE_STOPPED:
            actions |= PlaybackStateCompat.ACTION_PLAY
                    | PlaybackStateCompat.ACTION_PAUSE;
            break;
        case PlaybackStateCompat.STATE_PLAYING:
            actions |= PlaybackStateCompat.ACTION_STOP
                    | PlaybackStateCompat.ACTION_PAUSE
                    | PlaybackStateCompat.ACTION_SEEK_TO;
            break;
        case PlaybackStateCompat.STATE_PAUSED:
            actions |= PlaybackStateCompat.ACTION_PLAY
                    | PlaybackStateCompat.ACTION_STOP;
            break;
        default:
            actions |= PlaybackStateCompat.ACTION_PLAY
                    | PlaybackStateCompat.ACTION_PLAY_PAUSE
                    | PlaybackStateCompat.ACTION_STOP
                    | PlaybackStateCompat.ACTION_PAUSE;
    }
    return actions;
}
 
開發者ID:fendoudebb,項目名稱:PlayAndroid,代碼行數:35,代碼來源:MediaPlayerManager.java

示例6: actionSupported

import android.support.v4.media.session.PlaybackStateCompat; //導入方法依賴的package包/類
private boolean actionSupported(@PlaybackStateCompat.Actions long actions,
                                @PlaybackStateCompat.Actions long checkAction) {
    return ((actions & checkAction) != 0);
}
 
開發者ID:googlesamples,項目名稱:android-media-controller,代碼行數:5,代碼來源:MediaAppControllerActivity.java


注:本文中的android.support.v4.media.session.PlaybackStateCompat.Actions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。