diff options
author | RoboErik <epastern@google.com> | 2014-09-02 16:58:29 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-09-02 16:58:30 +0000 |
commit | 17a1b48629138c177106a21d4350a3be0e74aad7 (patch) | |
tree | f457e137c6a7f1a5bd41fc04c80a012d5ce51b16 /tests | |
parent | 65899b10929dca755fbc43161fe5017e1fd0f0cc (diff) | |
parent | c692d05951561e1d9fde952cc5389ec167bdb7bb (diff) | |
download | frameworks_base-17a1b48629138c177106a21d4350a3be0e74aad7.zip frameworks_base-17a1b48629138c177106a21d4350a3be0e74aad7.tar.gz frameworks_base-17a1b48629138c177106a21d4350a3be0e74aad7.tar.bz2 |
Merge "Update MediaBrowser to use String ids instead of Uris" into lmp-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/MusicBrowserDemo/src/com/example/android/musicbrowserdemo/BrowserListFragment.java | 22 | ||||
-rw-r--r-- | tests/MusicServiceDemo/src/com/example/android/musicservicedemo/BrowserService.java | 4 |
2 files changed, 13 insertions, 13 deletions
diff --git a/tests/MusicBrowserDemo/src/com/example/android/musicbrowserdemo/BrowserListFragment.java b/tests/MusicBrowserDemo/src/com/example/android/musicbrowserdemo/BrowserListFragment.java index 64602d52..8cc9b97 100644 --- a/tests/MusicBrowserDemo/src/com/example/android/musicbrowserdemo/BrowserListFragment.java +++ b/tests/MusicBrowserDemo/src/com/example/android/musicbrowserdemo/BrowserListFragment.java @@ -47,12 +47,12 @@ public class BrowserListFragment extends ListFragment { // For args public static final String ARG_COMPONENT = "component"; - public static final String ARG_URI = "uri"; + public static final String ARG_ID = "uri"; private Adapter mAdapter; private List<Item> mItems = new ArrayList(); private ComponentName mComponent; - private Uri mUri; + private String mNodeId; private MediaBrowser mBrowser; private static class Item { @@ -76,7 +76,7 @@ public class BrowserListFragment extends ListFragment { // Get our arguments final Bundle args = getArguments(); mComponent = args.getParcelable(ARG_COMPONENT); - mUri = args.getParcelable(ARG_URI); + mNodeId = args.getString(ARG_ID); // A hint about who we are, so the service can customize the results if it wants to. final Bundle rootHints = new Bundle(); @@ -108,7 +108,7 @@ public class BrowserListFragment extends ListFragment { final Bundle args = new Bundle(); args.putParcelable(BrowserListFragment.ARG_COMPONENT, mComponent); - args.putParcelable(BrowserListFragment.ARG_URI, item.media.getDescription().getIconUri()); + args.putParcelable(BrowserListFragment.ARG_ID, item.media.getDescription().getIconUri()); fragment.setArguments(args); getFragmentManager().beginTransaction() @@ -124,14 +124,14 @@ public class BrowserListFragment extends ListFragment { @Override public void onConnected() { Log.d(TAG, "mConnectionCallbacks.onConnected"); - if (mUri == null) { - mUri = mBrowser.getRoot(); + if (mNodeId == null) { + mNodeId = mBrowser.getRoot(); } - mBrowser.subscribe(mUri, new MediaBrowser.SubscriptionCallback() { + mBrowser.subscribe(mNodeId, new MediaBrowser.SubscriptionCallback() { @Override - public void onChildrenLoaded(Uri parentUri, + public void onChildrenLoaded(String parentId, List<MediaBrowser.MediaItem> children) { - Log.d(TAG, "onChildrenLoaded parentUri=" + parentUri + Log.d(TAG, "onChildrenLoaded parentId=" + parentId + " children= " + children); mItems.clear(); final int N = children.size(); @@ -142,8 +142,8 @@ public class BrowserListFragment extends ListFragment { } @Override - public void onError(Uri parentUri) { - Log.d(TAG, "onError parentUri=" + parentUri); + public void onError(String parentId) { + Log.d(TAG, "onError parentId=" + parentId); } }); } diff --git a/tests/MusicServiceDemo/src/com/example/android/musicservicedemo/BrowserService.java b/tests/MusicServiceDemo/src/com/example/android/musicservicedemo/BrowserService.java index 845db6c..a216a32 100644 --- a/tests/MusicServiceDemo/src/com/example/android/musicservicedemo/BrowserService.java +++ b/tests/MusicServiceDemo/src/com/example/android/musicservicedemo/BrowserService.java @@ -118,11 +118,11 @@ public class BrowserService extends MediaBrowserService { @Override public BrowserRoot onGetRoot(String clientPackageName, int clientUid, Bundle rootHints) { - return new BrowserRoot(BROWSE_URI, null); + return new BrowserRoot(BROWSE_URI.toString(), null); } @Override - public void onLoadChildren(final Uri parentUri, + public void onLoadChildren(final String parentId, final Result<List<MediaBrowser.MediaItem>> result) { new Handler().postDelayed(new Runnable() { public void run() { |