コード例 #1
0
 public String getMediaId() {
   MediaBrowserFragment fragment = getBrowseFragment();
   if (fragment == null) {
     return null;
   }
   return fragment.getMediaId();
 }
コード例 #2
0
  private void navigateToBrowser(String mediaId) {
    LogHelper.d(TAG, "navigateToBrowser, mediaId=" + mediaId);
    MediaBrowserFragment fragment = getBrowseFragment();

    if (fragment == null || !TextUtils.equals(fragment.getMediaId(), mediaId)) {
      fragment = new MediaBrowserFragment();
      fragment.setMediaId(mediaId);
      FragmentTransaction transaction = getFragmentManager().beginTransaction();
      transaction.setCustomAnimations(
          R.animator.slide_in_from_right, R.animator.slide_out_to_left,
          R.animator.slide_in_from_left, R.animator.slide_out_to_right);
      transaction.replace(R.id.container, fragment, FRAGMENT_TAG);
      // If this is not the top level media (root), we add it to the fragment back stack,
      // so that actionbar toggle and Back will work appropriately:
      if (mediaId != null) {
        transaction.addToBackStack(null);
      }
      transaction.commit();
    }
  }