summaryrefslogtreecommitdiff
path: root/src/com/android/car/media/BrowseFragment.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/car/media/BrowseFragment.java')
-rw-r--r--src/com/android/car/media/BrowseFragment.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/com/android/car/media/BrowseFragment.java b/src/com/android/car/media/BrowseFragment.java
index 1a6571d..ecb3f6c 100644
--- a/src/com/android/car/media/BrowseFragment.java
+++ b/src/com/android/car/media/BrowseFragment.java
@@ -90,14 +90,19 @@ public class BrowseFragment extends Fragment {
mBrowseAdapter.update();
if (mBrowseAdapter.getItemCount() > 0) {
ViewUtils.showViewAnimated(mBrowseList, mFadeDuration);
+ ViewUtils.hideViewAnimated(mErrorIcon, mFadeDuration);
+ ViewUtils.hideViewAnimated(mErrorMessage, mFadeDuration);
} else {
mErrorMessage.setText(R.string.nothing_to_play);
+ ViewUtils.hideViewAnimated(mBrowseList, mFadeDuration);
+ ViewUtils.hideViewAnimated(mErrorIcon, mFadeDuration);
ViewUtils.showViewAnimated(mErrorMessage, mFadeDuration);
}
break;
case ERROR:
stopLoadingIndicator();
mErrorMessage.setText(R.string.unknown_error);
+ ViewUtils.hideViewAnimated(mBrowseList, mFadeDuration);
ViewUtils.showViewAnimated(mErrorMessage, mFadeDuration);
ViewUtils.showViewAnimated(mErrorIcon, mFadeDuration);
break;
@@ -167,6 +172,7 @@ public class BrowseFragment extends Fragment {
/**
* Creates a new instance of this fragment.
*
+ * @param mediaSource media source being displayed
* @param item media tree node to display on this fragment.
* @return a fully initialized {@link BrowseFragment}
*/
@@ -244,9 +250,6 @@ public class BrowseFragment extends Fragment {
if (mMediaSource != null) {
mMediaSource.subscribe(mBrowseObserver);
}
- if (mBrowseAdapter != null) {
- mBrowseAdapter.start();
- }
}
private Runnable mProgressIndicatorRunnable = new Runnable() {
@@ -276,6 +279,7 @@ public class BrowseFragment extends Fragment {
}
if (mBrowseAdapter != null) {
mBrowseAdapter.stop();
+ mBrowseAdapter = null;
}
}
@@ -299,8 +303,8 @@ public class BrowseFragment extends Fragment {
ViewUtils.showViewAnimated(mErrorMessage, mFadeDuration);
return;
}
- mBrowseAdapter = new BrowseAdapter(getContext(), mMediaSource.getMediaBrowser(),
- getCurrentMediaItem(), ContentForwardStrategy.DEFAULT_STRATEGY);
+ mBrowseAdapter = new BrowseAdapter(getContext(), mMediaSource, getCurrentMediaItem(),
+ ContentForwardStrategy.DEFAULT_STRATEGY);
mBrowseList.setAdapter(mBrowseAdapter);
mBrowseList.setDividerVisibilityManager(mBrowseAdapter);
mBrowseAdapter.registerObserver(mBrowseAdapterObserver);