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


Java MetadataEditor类代码示例

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


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

示例1: updateRemoteControlClientMetadata

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void updateRemoteControlClientMetadata() {
    if (!LibVlcUtil.isICSOrLater()) // NOP check
        return;

    Media media = getCurrentMedia();
    if (mRemoteControlClient != null && media != null) {
        MetadataEditor editor = mRemoteControlClient.editMetadata(true);
        editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, media.getAlbum());
        editor.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, media.getArtist());
        editor.putString(MediaMetadataRetriever.METADATA_KEY_GENRE, media.getGenre());
        editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, media.getTitle());
        editor.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, media.getLength());
        // Copy the cover bitmap because the RemonteControlClient can recycle its artwork bitmap.
        Bitmap cover = getCover();
        editor.putBitmap(MetadataEditor.BITMAP_KEY_ARTWORK, ((cover != null) ? cover.copy(cover.getConfig(), false) : null));
        editor.apply();
    }
}
 
开发者ID:smyhvae,项目名称:VlcTest,代码行数:20,代码来源:AudioService.java

示例2: updateRemoteControlClientMetadata

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void updateRemoteControlClientMetadata() {
    if(!Util.isICSOrLater()) // NOP check
        return;

    Media media = getCurrentMedia();
    if (mRemoteControlClient != null && media != null) {
        MetadataEditor editor = mRemoteControlClient.editMetadata(true);
        editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, media.getAlbum());
        editor.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, media.getArtist());
        editor.putString(MediaMetadataRetriever.METADATA_KEY_GENRE, media.getGenre());
        editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, media.getTitle());
        editor.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, media.getLength());
        editor.putBitmap(MetadataEditor.BITMAP_KEY_ARTWORK, getCover());
        editor.apply();
    }
}
 
开发者ID:KlepikovMD,项目名称:popcorntime-android-kitkat,代码行数:18,代码来源:AudioService.java

示例3: showNotify

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
public void showNotify(String artist, String album, String title, int tracknr) {
       getAudioFocus();
       mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
	MetadataEditor edit = mRemoteControlClient.editMetadata(true);
	edit.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, title);
	edit.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, artist);
	edit.putString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST, artist);
	edit.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, album);
	edit.putLong(MediaMetadataRetriever.METADATA_KEY_CD_TRACK_NUMBER, tracknr);
       edit.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, 10);
	edit.apply();
	int timeout = getTimeout();
	if (timeout != 0) {
		mHandler.removeMessages(HANDLER_WHAT_CLEAR);
		mHandler.sendEmptyMessageDelayed(HANDLER_WHAT_CLEAR, timeout * 1000);
	}
}
 
开发者ID:grimpy,项目名称:Botifier,代码行数:18,代码来源:AvrcpService.java

示例4: setMetadata

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
public static void setMetadata(Object rccObj, Bundle metadata, long actions) {
    MetadataEditor editor = ((RemoteControlClient) rccObj).editMetadata(true);
    MediaSessionCompatApi14.buildOldMetadata(metadata, editor);
    addNewMetadata(metadata, editor);
    if ((128 & actions) != 0) {
        editor.addEditableKey(268435457);
    }
    editor.apply();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:MediaSessionCompatApi19.java

示例5: addNewMetadata

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
static void addNewMetadata(Bundle metadata, MetadataEditor editor) {
    if (metadata != null) {
        if (metadata.containsKey("android.media.metadata.YEAR")) {
            editor.putLong(8, metadata.getLong("android.media.metadata.YEAR"));
        }
        if (metadata.containsKey("android.media.metadata.RATING")) {
            editor.putObject(101, metadata.getParcelable("android.media.metadata.RATING"));
        }
        if (metadata.containsKey("android.media.metadata.USER_RATING")) {
            editor.putObject(268435457, metadata.getParcelable("android.media.metadata.USER_RATING"));
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:MediaSessionCompatApi19.java

示例6: updateRemoteControlClientMetadata

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void updateRemoteControlClientMetadata() {
    if (!AndroidUtil.isICSOrLater()) // NOP check
        return;

    MediaWrapper media = getCurrentMedia();
    if (mRemoteControlClient != null && media != null) {
        MetadataEditor editor = mRemoteControlClient.editMetadata(true);
        if (media.getNowPlaying() != null) {
            editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, "");
            editor.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, "");
            editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST, media.getNowPlaying());
        } else {
            editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST, "");
            editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, Util.getMediaAlbum(this, media));
            editor.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, Util.getMediaArtist(this, media));
        }
        editor.putString(MediaMetadataRetriever.METADATA_KEY_GENRE, Util.getMediaGenre(this, media));
        editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, media.getTitle());
        editor.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, media.getLength());

        // Copy the cover bitmap because the RemonteControlClient can recycle its artwork bitmap.
        Bitmap cover = AudioUtil.getCover(this, media, 512);
        if (cover != null && cover.getConfig() != null) //In case of format not supported
            editor.putBitmap(MetadataEditor.BITMAP_KEY_ARTWORK, (cover.copy(cover.getConfig(), false)));

        editor.apply();
    }

    //Send metadata to Pebble watch
    if (media != null && mPebbleEnabled) {
        final Intent i = new Intent("com.getpebble.action.NOW_PLAYING");
        i.putExtra("artist", Util.getMediaArtist(this, media));
        i.putExtra("album", Util.getMediaAlbum(this, media));
        i.putExtra("track", media.getTitle());
        sendBroadcast(i);
    }
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:39,代码来源:PlaybackService.java

示例7: notifyChange

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
/**
 * Notify the change-receivers that something has changed.
 * The intent that is sent contains the following data
 * for the currently playing track:
 * "id" - Integer: the database row ID
 * "artist" - String: the name of the artist
 * "album" - String: the name of the album
 * "track" - String: the name of the track
 * The intent has an action that is one of
 * "com.android.music.metachanged"
 * "com.android.music.queuechanged",
 * "com.android.music.playbackcomplete"
 * "com.android.music.playstatechanged"
 * respectively indicating that a new track has
 * started playing, that the playback queue has
 * changed, that playback has stopped because
 * the last file in the list has been played,
 * or that the play-state changed (paused/resumed).
 */
private void notifyChange(String what) {

    Intent i = new Intent(what);
    i.putExtra("id", Long.valueOf(getAudioId()));
    i.putExtra("artist", getArtistName());
    i.putExtra("album",getAlbumName());
    i.putExtra("track", getTrackName());
    i.putExtra("playing", isPlaying());
    sendStickyBroadcast(i);

    if (what.equals(PLAYSTATE_CHANGED)) {
        mRemoteControlClient.setPlaybackState(isPlaying() ?
                RemoteControlClient.PLAYSTATE_PLAYING : RemoteControlClient.PLAYSTATE_PAUSED);
    } else if (what.equals(META_CHANGED)) {
        RemoteControlClient.MetadataEditor ed = mRemoteControlClient.editMetadata(true);
        ed.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, getTrackName());
        ed.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, getAlbumName());
        ed.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, getArtistName());
        ed.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, duration());
        Bitmap b = MusicUtils.getArtwork(this, getAudioId(), getAlbumId(), false);
        if (b != null) {
            ed.putBitmap(MetadataEditor.BITMAP_KEY_ARTWORK, b);
        }
        ed.apply();
    }

    if (what.equals(QUEUE_CHANGED)) {
        saveQueue(true);
    } else {
        saveQueue(false);
    }
    
    // Share this notification directly with our widgets
    mAppWidgetProvider.notifyChange(this, what);
}
 
开发者ID:AndroidLearnerchn,项目名称:Android-Application-Using-CAF-Library,代码行数:55,代码来源:MediaPlaybackService.java

示例8: setMusicCover

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
@TargetApi(14)
private void setMusicCover(Bitmap cover) {
    if (Build.VERSION.SDK_INT > 14 && remoteControlClient != null) {
        ((RemoteControlClient) remoteControlClient).editMetadata(false)
                .putBitmap(RemoteControlClient.MetadataEditor.BITMAP_KEY_ARTWORK, cover).apply();
    }
}
 
开发者ID:philchand,项目名称:mpdroid-2014,代码行数:8,代码来源:StreamingService.java

示例9: setMusicInfo

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
@TargetApi(14)
private void setMusicInfo(Music song) {
    if (Build.VERSION.SDK_INT > 14 && remoteControlClient != null && song != null) {
        MetadataEditor editor = ((RemoteControlClient) remoteControlClient).editMetadata(true);
        //TODO : maybe add cover art here someday
        editor.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, song.getTime() * 1000);
        editor.putLong(MediaMetadataRetriever.METADATA_KEY_CD_TRACK_NUMBER, song.getTrack());
        editor.putLong(MediaMetadataRetriever.METADATA_KEY_DISC_NUMBER, song.getDisc());
        editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, song.getAlbum());
        editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST, song.getAlbumArtist());
        editor.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, song.getArtist());
        editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, song.getTitle());
        editor.apply();
    }
}
 
开发者ID:philchand,项目名称:mpdroid-2014,代码行数:16,代码来源:StreamingService.java

示例10: setMetadata

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
public static void setMetadata(Object rccObj, Bundle metadata) {
    MetadataEditor editor = ((RemoteControlClient) rccObj).editMetadata(true);
    buildOldMetadata(metadata, editor);
    editor.apply();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:6,代码来源:MediaSessionCompatApi14.java

示例11: buildOldMetadata

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
static void buildOldMetadata(Bundle metadata, MetadataEditor editor) {
    if (metadata != null) {
        if (metadata.containsKey("android.media.metadata.ART")) {
            editor.putBitmap(100, (Bitmap) metadata.getParcelable("android.media.metadata.ART"));
        } else if (metadata.containsKey("android.media.metadata.ALBUM_ART")) {
            editor.putBitmap(100, (Bitmap) metadata.getParcelable("android.media.metadata.ALBUM_ART"));
        }
        if (metadata.containsKey("android.media.metadata.ALBUM")) {
            editor.putString(1, metadata.getString("android.media.metadata.ALBUM"));
        }
        if (metadata.containsKey("android.media.metadata.ALBUM_ARTIST")) {
            editor.putString(13, metadata.getString("android.media.metadata.ALBUM_ARTIST"));
        }
        if (metadata.containsKey("android.media.metadata.ARTIST")) {
            editor.putString(2, metadata.getString("android.media.metadata.ARTIST"));
        }
        if (metadata.containsKey("android.media.metadata.AUTHOR")) {
            editor.putString(3, metadata.getString("android.media.metadata.AUTHOR"));
        }
        if (metadata.containsKey("android.media.metadata.COMPILATION")) {
            editor.putString(15, metadata.getString("android.media.metadata.COMPILATION"));
        }
        if (metadata.containsKey("android.media.metadata.COMPOSER")) {
            editor.putString(4, metadata.getString("android.media.metadata.COMPOSER"));
        }
        if (metadata.containsKey("android.media.metadata.DATE")) {
            editor.putString(5, metadata.getString("android.media.metadata.DATE"));
        }
        if (metadata.containsKey("android.media.metadata.DISC_NUMBER")) {
            editor.putLong(14, metadata.getLong("android.media.metadata.DISC_NUMBER"));
        }
        if (metadata.containsKey("android.media.metadata.DURATION")) {
            editor.putLong(9, metadata.getLong("android.media.metadata.DURATION"));
        }
        if (metadata.containsKey("android.media.metadata.GENRE")) {
            editor.putString(6, metadata.getString("android.media.metadata.GENRE"));
        }
        if (metadata.containsKey("android.media.metadata.TITLE")) {
            editor.putString(7, metadata.getString("android.media.metadata.TITLE"));
        }
        if (metadata.containsKey("android.media.metadata.TRACK_NUMBER")) {
            editor.putLong(0, metadata.getLong("android.media.metadata.TRACK_NUMBER"));
        }
        if (metadata.containsKey("android.media.metadata.WRITER")) {
            editor.putString(11, metadata.getString("android.media.metadata.WRITER"));
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:49,代码来源:MediaSessionCompatApi14.java

示例12: notifyChange

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
/**
 * Notify the change-receivers that something has changed. The intent that
 * is sent contains the following data for the currently playing track: "id"
 * - Integer: the database row ID "artist" - String: the name of the artist
 * "album" - String: the name of the album "track" - String: the name of the
 * track The intent has an action that is one of
 * "com.andrew.apolloMod.metachanged" "com.andrew.apolloMod.queuechanged",
 * "com.andrew.apolloMod.playbackcomplete" "com.andrew.apolloMod.playstatechanged"
 * respectively indicating that a new track has started playing, that the
 * playback queue has changed, that playback has stopped because the last
 * file in the list has been played, or that the play-state changed
 * (paused/resumed).
 */
public void notifyChange(String what) {

    Intent i = new Intent(what);
    i.putExtra("id", Long.valueOf(getAudioId()));
    i.putExtra("artist", getArtistName());
    i.putExtra("album", getAlbumName());
    i.putExtra("track", getTrackName());
    i.putExtra("playing", mIsSupposedToBePlaying);
    i.putExtra("isfavorite", isFavorite());
    sendStickyBroadcast(i);

    i = new Intent(i);
    i.setAction(what.replace(APOLLO_PACKAGE_NAME, MUSIC_PACKAGE_NAME));
    sendStickyBroadcast(i);

    if (what.equals(PLAYSTATE_CHANGED)) {
        mRemoteControlClient
                .setPlaybackState(mIsSupposedToBePlaying ? RemoteControlClient.PLAYSTATE_PLAYING
                        : RemoteControlClient.PLAYSTATE_PAUSED);
    } else if (what.equals(META_CHANGED)) {
        MetadataEditor ed = mRemoteControlClient.editMetadata(true);
        ed.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, getTrackName());
        ed.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, getAlbumName());
        ed.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, getArtistName());
        ed.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, duration());
        Bitmap b = getAlbumBitmap();
        if (b != null) {
            ed.putBitmap(MetadataEditor.BITMAP_KEY_ARTWORK, b);
        }
        ed.apply();
    }

    if (what.equals(QUEUE_CHANGED)) {
        saveQueue(true);
    } else {
        saveQueue(false);
    }
    mAppWidgetProvider1x1.notifyChange(this, what);
    mAppWidgetProvider4x1.notifyChange(this, what);
    mAppWidgetProvider4x2.notifyChange(this, what);

}
 
开发者ID:hubcarl,项目名称:mobile-manager-tool,代码行数:56,代码来源:ApolloService.java

示例13: refreshRemoteControlClientState

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
/**
 * Refresh player status and metadata.
 */
@SuppressLint("NewApi")
private void refreshRemoteControlClientState(PlaybackServiceMediaPlayer.PSMPInfo info) {
    if (android.os.Build.VERSION.SDK_INT >= 14) {
        if (remoteControlClient != null) {
            switch (info.playerStatus) {
                case PLAYING:
                    remoteControlClient
                            .setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
                    break;
                case PAUSED:
                case INITIALIZED:
                    remoteControlClient
                            .setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED);
                    break;
                case STOPPED:
                    remoteControlClient
                            .setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
                    break;
                case ERROR:
                    remoteControlClient
                            .setPlaybackState(RemoteControlClient.PLAYSTATE_ERROR);
                    break;
                default:
                    remoteControlClient
                            .setPlaybackState(RemoteControlClient.PLAYSTATE_BUFFERING);
            }
            if (info.playable != null) {
                MetadataEditor editor = remoteControlClient
                        .editMetadata(false);
                editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE,
                        info.playable.getEpisodeTitle());

                editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM,
                        info.playable.getFeedTitle());

                editor.apply();
            }
            if (AppConfig.DEBUG)
                Log.d(TAG, "RemoteControlClient state was refreshed");
        }
    }
}
 
开发者ID:danieloeh,项目名称:AntennaPodSP,代码行数:46,代码来源:PlaybackService.java

示例14: notifyChange

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
/**
 * Notify the change-receivers that something has changed. The intent that
 * is sent contains the following data for the currently playing track: "id"
 * - Integer: the database row ID "artist" - String: the name of the artist
 * "album" - String: the name of the album "track" - String: the name of the
 * track The intent has an action that is one of
 * "com.cp.monsterMod.metachanged" "com.cp.monsterMod.queuechanged",
 * "com.cp.monsterMod.playbackcomplete" "com.cp.monsterMod.playstatechanged"
 * respectively indicating that a new track has started playing, that the
 * playback queue has changed, that playback has stopped because the last
 * file in the list has been played, or that the play-state changed
 * (paused/resumed).
 */
public void notifyChange(String what) {

    Intent i = new Intent(what);
    i.putExtra("id", Long.valueOf(getAudioId()));
    i.putExtra("artist", getArtistName());
    i.putExtra("album", getAlbumName());
    i.putExtra("track", getTrackName());
    i.putExtra("playing", mIsSupposedToBePlaying);
    i.putExtra("isfavorite", isFavorite());
    //粘滞广播
    sendStickyBroadcast(i);

    i = new Intent(i);
    i.setAction(what.replace(APOLLO_PACKAGE_NAME, MUSIC_PACKAGE_NAME));
    sendStickyBroadcast(i);

    if (what.equals(PLAYSTATE_CHANGED)) {
        mRemoteControlClient
                .setPlaybackState(mIsSupposedToBePlaying ? RemoteControlClient.PLAYSTATE_PLAYING
                        : RemoteControlClient.PLAYSTATE_PAUSED);
    } else if (what.equals(META_CHANGED)) {
        RemoteControlClient.MetadataEditor ed = mRemoteControlClient.editMetadata(true);
        ed.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, getTrackName());
        ed.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, getAlbumName());
        ed.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, getArtistName());
        ed.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, duration());
        Bitmap b = getAlbumBitmap();
        if (b != null) {
            ed.putBitmap(MetadataEditor.BITMAP_KEY_ARTWORK, b);
        }
        ed.apply();
    }

    if (what.equals(QUEUE_CHANGED)) {
        saveQueue(true);
    } else {
        saveQueue(false);
    }
    mAppWidgetProvider1x1.notifyChange(this, what);
    mAppWidgetProvider4x1.notifyChange(this, what);
    mAppWidgetProvider4x2.notifyChange(this, what);

}
 
开发者ID:cpoopc,项目名称:com.cp.monsterMod,代码行数:57,代码来源:ApolloService.java

示例15: notifyChange

import android.media.RemoteControlClient.MetadataEditor; //导入依赖的package包/类
/**
 * Notify the change-receivers that something has changed. The intent that
 * is sent contains the following data for the currently playing track: "id"
 * - Integer: the database row ID "artist" - String: the name of the artist
 * "album" - String: the name of the album "track" - String: the name of the
 * track The intent has an action that is one of
 * "com.andrew.apolloMod.metachanged" "com.andrew.apolloMod.queuechanged",
 * "com.andrew.apolloMod.playbackcomplete" "com.andrew.apolloMod.playstatechanged"
 * respectively indicating that a new track has started playing, that the
 * playback queue has changed, that playback has stopped because the last
 * file in the list has been played, or that the play-state changed
 * (paused/resumed).
 */
public void notifyChange(String what) {

    Intent i = new Intent(what);
    i.putExtra("id", Long.valueOf(getAudioId()));
    i.putExtra("artist", getArtistName());
    i.putExtra("album", getAlbumName());
    i.putExtra("track", getTrackName());
    i.putExtra("playing", mIsSupposedToBePlaying);
    i.putExtra("isfavorite", isFavorite());
    sendStickyBroadcast(i);

    i = new Intent(i);
    i.setAction(what.replace(APOLLO_PACKAGE_NAME, MUSIC_PACKAGE_NAME));
    sendStickyBroadcast(i);

    if (what.equals(PLAYSTATE_CHANGED)) {
        mRemoteControlClient
                .setPlaybackState(mIsSupposedToBePlaying ? RemoteControlClient.PLAYSTATE_PLAYING
                        : RemoteControlClient.PLAYSTATE_PAUSED);
    } else if (what.equals(META_CHANGED)) {
        RemoteControlClient.MetadataEditor ed = mRemoteControlClient.editMetadata(true);
        ed.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, getTrackName());
        ed.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, getAlbumName());
        ed.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, getArtistName());
        ed.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, duration());
        Bitmap b = getAlbumBitmap();
        if (b != null) {
            ed.putBitmap(MetadataEditor.BITMAP_KEY_ARTWORK, b);
        }
        ed.apply();
    }

    if (what.equals(QUEUE_CHANGED)) {
        saveQueue(true);
    } else {
        saveQueue(false);
    }
    mAppWidgetProvider1x1.notifyChange(this, what);
    mAppWidgetProvider4x1.notifyChange(this, what);
    mAppWidgetProvider4x2.notifyChange(this, what);

}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:56,代码来源:ApolloService.java


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