diff options
author | Simon Dai <sdai@google.com> | 2018-05-22 17:30:25 -0700 |
---|---|---|
committer | Simon Dai <sdai@google.com> | 2018-05-23 16:24:21 -0700 |
commit | ed928e81cc8e194c409bbbb79d889231e4929886 (patch) | |
tree | 1f9d5d75caacba0537b2e4d15b25825e5e3503db | |
parent | 8a97fbcb2a74f960798dac29bca522cc8870daf3 (diff) | |
download | Media-ed928e81cc8e194c409bbbb79d889231e4929886.tar.gz |
Update ContentForwardStrategy for ContentStyle
MediaItems that specify a ContentStyle in their extras will
be displayed using their provided content style hint.
Bug: 77646944
Test: Manual (with radio app implementing content style, and local media without)
Change-Id: I3593fa85a08ef42cd5489e8a8d4aea256171c9b2
-rw-r--r-- | src/com/android/car/media/browse/ContentForwardStrategy.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/car/media/browse/ContentForwardStrategy.java b/src/com/android/car/media/browse/ContentForwardStrategy.java index 3e03aed..b9e2fba 100644 --- a/src/com/android/car/media/browse/ContentForwardStrategy.java +++ b/src/com/android/car/media/browse/ContentForwardStrategy.java @@ -16,6 +16,8 @@ package com.android.car.media.browse; +import android.os.Bundle; +import com.android.car.media.common.ContentStyleMediaConstants; import com.android.car.media.common.MediaItemMetadata; /** @@ -94,12 +96,18 @@ public interface ContentForwardStrategy { @Override public BrowseItemViewType getBrowsableViewType(MediaItemMetadata mediaItem) { - return BrowseItemViewType.PANEL_ITEM; + return (mediaItem.getBrowsableContentStyleHint() + == ContentStyleMediaConstants.CONTENT_STYLE_LIST_ITEM_HINT_VALUE) + ? BrowseItemViewType.LIST_ITEM + : BrowseItemViewType.PANEL_ITEM; } @Override public BrowseItemViewType getPlayableViewType(MediaItemMetadata mediaItem) { - return BrowseItemViewType.GRID_ITEM; + return (mediaItem.getPlayableContentStyleHint() + == ContentStyleMediaConstants.CONTENT_STYLE_LIST_ITEM_HINT_VALUE) + ? BrowseItemViewType.LIST_ITEM + : BrowseItemViewType.GRID_ITEM; } @Override |