BrowserListFragmentpublic class BrowserListFragment extends android.support.v4.app.ListFragment
Fields Summary |
---|
private static final String | TAG | public static final String | HINT_DISPLAY | public static final String | ARG_COMPONENT | public static final String | ARG_ID | private Adapter | mAdapter | private List | mItems | private android.content.ComponentName | mComponent | private String | mNodeId | private android.media.browse.MediaBrowser | mBrowser | final MediaBrowser.ConnectionCallback | mConnectionCallbacks |
Constructors Summary |
---|
public BrowserListFragment()
|
Methods Summary |
---|
public void | onActivityCreated(android.os.Bundle savedInstanceState)
super.onActivityCreated(savedInstanceState);
Log.d(TAG, "onActivityCreated -- " + hashCode());
mAdapter = new Adapter();
setListAdapter(mAdapter);
// Get our arguments
final Bundle args = getArguments();
mComponent = args.getParcelable(ARG_COMPONENT);
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();
rootHints.putBoolean(HINT_DISPLAY, true);
mBrowser = new MediaBrowser(getActivity(), mComponent, mConnectionCallbacks, rootHints);
| public void | onListItemClick(android.widget.ListView l, android.view.View v, int position, long id)
final Item item = mItems.get(position);
Log.i("BrowserListFragment", "Item clicked: " + position + " -- "
+ mAdapter.getItem(position).media.getDescription().getIconUri());
final BrowserListFragment fragment = new BrowserListFragment();
final Bundle args = new Bundle();
args.putParcelable(BrowserListFragment.ARG_COMPONENT, mComponent);
args.putParcelable(BrowserListFragment.ARG_ID, item.media.getDescription().getIconUri());
fragment.setArguments(args);
getFragmentManager().beginTransaction()
.replace(android.R.id.content, fragment)
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.addToBackStack(null)
.commit();
| public void | onStart()
super.onStart();
mBrowser.connect();
| public void | onStop()
super.onStop();
mBrowser.disconnect();
|
|