diff options
author | RoboErik <epastern@google.com> | 2014-08-29 15:16:19 -0700 |
---|---|---|
committer | RoboErik <epastern@google.com> | 2014-08-29 15:16:19 -0700 |
commit | c692d05951561e1d9fde952cc5389ec167bdb7bb (patch) | |
tree | 484cbe75b1eb0a6671008be8452f1c3577c8e9a6 /tests | |
parent | cd74270da7a7320904f14a465b8902dd5ea56f1d (diff) | |
download | frameworks_base-c692d05951561e1d9fde952cc5389ec167bdb7bb.zip frameworks_base-c692d05951561e1d9fde952cc5389ec167bdb7bb.tar.gz frameworks_base-c692d05951561e1d9fde952cc5389ec167bdb7bb.tar.bz2 |
Update MediaBrowser to use String ids instead of Uris
Since we converted MediaDescription over to using a String media id
for identifying everything we should also use Strings in the browser
service to make it clear that it should re-use that field.
bug:17333205
Change-Id: I5fd5762bdad05068f5b1aa36074306b43432e686
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() { |