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


Java PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID属性代码示例

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


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

示例1: getAvailableActions

private long getAvailableActions() {
    long actions =
            PlaybackStateCompat.ACTION_PLAY_PAUSE |
                    PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID |
                    PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH |
                    PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS |
                    PlaybackStateCompat.ACTION_SKIP_TO_NEXT;
    if (playback.isPlaying()) {
        actions |= PlaybackStateCompat.ACTION_PAUSE;
    } else {
        actions |= PlaybackStateCompat.ACTION_PLAY;
    }
    //
    if(isRepeat){
        actions|=PlaybackStateCompat.ACTION_SET_REPEAT_MODE;
    }
    //
    if(isShuffle){
        actions|=PlaybackStateCompat.ACTION_SET_SHUFFLE_MODE_ENABLED;
    }
    return actions;
}
 
开发者ID:vpaliyX,项目名称:Melophile,代码行数:22,代码来源:PlaybackManager.java

示例2: c

public static String c(String str) {
    String str2 = "";
    try {
        long longValue = Long.valueOf(str).longValue();
        if (longValue < PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) {
            return ((int) longValue) + "B";
        }
        if (longValue < 1048576) {
            return new DecimalFormat("#0.00").format(((double) ((float) longValue)) / 1024.0d) + "K";
        } else if (longValue < 1073741824) {
            return new DecimalFormat("#0.00").format(((double) ((float) longValue)) / 1048576.0d) + "M";
        } else {
            return new DecimalFormat("#0.00").format(((double) ((float) longValue)) / 1.073741824E9d) + "G";
        }
    } catch (NumberFormatException e) {
        return str;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:bu.java

示例3: getFolderSize

public static long getFolderSize(File file) {
    long size = 0;
    try {
        if (!file.exists()) {
            return 0;
        }
        if (!file.isDirectory()) {
            return file.length() / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID;
        }
        File[] fileList = file.listFiles();
        for (int i = 0; i < fileList.length; i++) {
            if (fileList[i].isDirectory()) {
                size += getFolderSize(fileList[i]) * PlaybackStateCompat
                        .ACTION_PLAY_FROM_MEDIA_ID;
            } else {
                size += fileList[i].length();
            }
        }
        return size / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID;
    } catch (Exception e) {
        e.printStackTrace();
        return 0;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:FileUtil.java

示例4: getAvailableActions

@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,代码行数:13,代码来源:PlaybackManager.java

示例5: getAvailableActions

@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,代码行数:12,代码来源:VideoFragment.java

示例6: getTinkerRomSpace

public long getTinkerRomSpace() {
    if (this.patchDirectory == null) {
        return 0;
    }
    return SharePatchFileUtil.getFileOrDirectorySize(this.patchDirectory) /
            PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:7,代码来源:Tinker.java

示例7: requestMoreIfNecessary

private void requestMoreIfNecessary() {
    if (REQUESTED.get(this) == 0 && this.terminated == 0) {
        long toRequest = PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID - BUFFERED_COUNT.get(this);
        if (toRequest > 0 && REQUESTED.compareAndSet(this, 0, toRequest)) {
            request(toRequest);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:8,代码来源:OperatorGroupBy.java

示例8: getAvailableActions

/**
 * 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,代码行数:34,代码来源:MediaPlayerAdapter.java

示例9: getAvailableActions

/**
 * 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,代码行数:34,代码来源:MediaPlayerManager.java

示例10: updatePlaybackState

public void updatePlaybackState(int errorCode, String errorMsg) {
        Log.d(TAG, "updatePlaybackState, playback state = " + mPlayback.getState());
        long position = PlaybackStateCompat.PLAYBACK_POSITION_UNKNOWN;
        if (mPlayback != null && mPlayback.isConnected()) {
            position = mPlayback.getCurrentStreamPosition();
        }

        long playbackActions = PlaybackStateCompat.ACTION_PLAY
                | PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID;

        if (mPlayback.isPlaying()) {
            playbackActions |= PlaybackStateCompat.ACTION_PAUSE;
        }

        PlaybackStateCompat.Builder builder = new PlaybackStateCompat.Builder().setActions(playbackActions);

        int state = mPlayback.getState();

        if (errorCode != -1 && errorMsg != null) {
            builder.setErrorMessage(errorCode, errorMsg);
            state = PlaybackStateCompat.STATE_ERROR;
        }

        builder.setState(state, position, SystemClock.elapsedRealtime());

         MediaSessionCompat.QueueItem currentMedia = mQueueManager.getCurrentMedia();
        if (currentMedia != null) {
            builder.setActiveQueueItemId(currentMedia.getQueueId());
        }

//        mSession.setPlaybackState(builder.build());

        mServiceCallback.onPlaybackStateUpdate(builder.build());

//        if (state == PlaybackStateCompat.STATE_PLAYING ||
//                state == PlaybackStateCompat.STATE_PAUSED) {
//            mServiceCallback.onHandleNotification();
//        }

//
    }
 
开发者ID:Jaysaw,项目名称:NovaMusicPlayer,代码行数:41,代码来源:PlaybackManager.java


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