summaryrefslogtreecommitdiffstats
path: root/samples/SupportLeanbackShowcase/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'samples/SupportLeanbackShowcase/app/src/main')
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/AndroidManifest.xml59
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/MainActivity.java39
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/MainFragment.java181
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/cards/CardExampleActivity.java34
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/cards/CardExampleFragment.java132
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/DetailViewExampleActivity.java32
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/DetailViewExampleFragment.java179
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/DetailsDescriptionPresenter.java62
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/ShadowRowPresenterSelector.java44
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/dialog/DialogExampleActivity.java35
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/dialog/DialogExampleFragment.java67
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/grid/GridExampleActivity.java30
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/grid/GridExampleFragment.java72
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/MediaPlayerGlue.java446
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/MusicConsumptionExampleFragment.java155
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/MusicExampleActivity.java30
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/SongListRow.java20
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/TrackListHeader.java50
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoConsumptionExampleFragment.java117
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoExampleActivity.java39
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoMediaPlayerGlue.java57
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoSurfaceFragment.java39
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/settings/SettingsExampleActivity.java31
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/settings/SettingsExampleFragment.java107
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample1stStepFragment.java70
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample2ndStepFragment.java101
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample3rdStepFragment.java98
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample4thStepFragment.java69
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExampleActivity.java47
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExampleBaseStepFragment.java47
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/CharacterCardView.java69
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/TextCardView.java56
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/AbstractCardPresenter.java79
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/CardPresenterSelector.java92
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/CharacterCardPresenter.java40
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/IconCardPresenter.java51
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/ImageCardViewPresenter.java60
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/SideInfoCardPresenter.java74
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/SingleLineCardPresenter.java38
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/TextCardPresenter.java41
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/Card.java129
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/CardRow.java44
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/DetailedCard.java71
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/Movie.java50
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/Song.java116
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/SongList.java31
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/CardListRow.java45
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/Constants.java17
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/PicassoBackgroundManagerTarget.java61
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/ResourceCache.java36
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/Utils.java58
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable-v21/song_row_background_focused.xml20
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/background_canyon.jpgbin0 -> 610277 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/background_food.jpgbin0 -> 233732 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/background_sax.jpgbin0 -> 224765 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_dummy_16_9_l.pngbin0 -> 3937 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_01.pngbin0 -> 389440 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_02.pngbin0 -> 286778 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_03.pngbin0 -> 126637 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_04.pngbin0 -> 302881 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_05.pngbin0 -> 303924 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_06.pngbin0 -> 368153 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_07.pngbin0 -> 219069 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_08.pngbin0 -> 269862 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_09.pngbin0 -> 277175 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_01.jpgbin0 -> 173059 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_02.jpgbin0 -> 188294 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_03.jpgbin0 -> 96252 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_04.jpgbin0 -> 84782 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_05.jpgbin0 -> 187373 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_06.jpgbin0 -> 131330 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_07.jpgbin0 -> 120184 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_08.jpgbin0 -> 79576 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_09.jpgbin0 -> 80383 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_10.jpgbin0 -> 129864 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_11.jpgbin0 -> 110962 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_12.jpgbin0 -> 137199 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_13.jpgbin0 -> 84534 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_action.pngbin0 -> 19388 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_animation.pngbin0 -> 20711 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_classics.pngbin0 -> 18841 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_comedy.pngbin0 -> 19503 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_crime.pngbin0 -> 19844 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_documentary.pngbin0 -> 20660 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_drama.pngbin0 -> 19306 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_01.pngbin0 -> 223879 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_02.pngbin0 -> 330472 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_03.pngbin0 -> 314348 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_04.pngbin0 -> 343150 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_05.pngbin0 -> 288062 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_06.pngbin0 -> 367936 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_07.pngbin0 -> 293103 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_08.pngbin0 -> 339101 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_01.pngbin0 -> 368998 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_02.pngbin0 -> 535491 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_03.pngbin0 -> 526847 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_04.pngbin0 -> 680355 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_05.pngbin0 -> 532167 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_06.pngbin0 -> 521465 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_07.pngbin0 -> 509352 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_08.pngbin0 -> 568748 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_09.pngbin0 -> 344469 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_10.pngbin0 -> 422496 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_11.pngbin0 -> 613934 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_12.pngbin0 -> 390241 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_13.pngbin0 -> 392126 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_14.pngbin0 -> 422442 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_angry_bird_w.pngbin0 -> 137211 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_badland_w.pngbin0 -> 285313 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_leos_fortune_w.pngbin0 -> 338385 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_minion_rush_w.pngbin0 -> 230633 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_monument_valley_w.pngbin0 -> 162442 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_cc.pngbin0 -> 1252 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_installed.pngbin0 -> 507 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_apps.pngbin0 -> 1436 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_more.pngbin0 -> 629 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_parental_control.pngbin0 -> 1453 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_settings.pngbin0 -> 1893 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_time.pngbin0 -> 2317 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_wifi_3_bar.pngbin0 -> 1806 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_wifi_4_bar.pngbin0 -> 1372 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_star_off.pngbin0 -> 1236 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_star_on_yellow.pngbin0 -> 1265 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/movie_poster_01.pngbin0 -> 371243 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/stars_red.pngbin0 -> 2053 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/stars_white.pngbin0 -> 2081 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_browse.pngbin0 -> 2939 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_cards.pngbin0 -> 1768 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_custom_01.pngbin0 -> 2189 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_detail.pngbin0 -> 1603 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_dialog.pngbin0 -> 1258 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_grid.pngbin0 -> 2509 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_music_consumption.pngbin0 -> 1771 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_settings.pngbin0 -> 1367 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_video_consumption.pngbin0 -> 2326 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_wizard.pngbin0 -> 1250 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/title_android_tv.pngbin0 -> 5641 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/app_icon_your_company.pngbin0 -> 12416 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/bg_living_room.jpgbin0 -> 136080 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/bg_living_room_wide.jpgbin0 -> 166393 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/character_focused.xml26
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/character_not_focused.xml26
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/character_not_focused_padding.xml26
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/default_background.xml23
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable/face_01.pngbin0 -> 29995 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable/face_02.pngbin0 -> 32856 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable/face_03.pngbin0 -> 28412 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable/face_04.pngbin0 -> 25692 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable/face_05.pngbin0 -> 15358 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable/face_06.pngbin0 -> 28374 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable/face_07.pngbin0 -> 19390 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/drawable/face_08.pngbin0 -> 26494 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/icon_focused.xml23
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/overlay_black.xml19
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/song_row_background.xml22
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/song_row_background_focused.xml24
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_background_blackned.xml20
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_important_action_item_background.xml20
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_important_action_item_background_focused.xml21
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_important_action_item_background_not_focused.xml21
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_cards_example.xml26
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_detail_example.xml25
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_grid_example.xml26
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_main.xml25
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_music_example.xml26
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_settings_example.xml25
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_video_example.xml27
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/character_card.xml52
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/detail_view_content.xml96
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/row_song.xml77
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/row_track_list_header.xml44
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/side_info_card.xml64
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/text_icon_card.xml79
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/video_surface_fragment.xml20
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/wizard_progress_action_container.xml35
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/layout/wizard_progress_action_item.xml42
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/mipmap-hdpi/ic_launcher.pngbin0 -> 3418 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/mipmap-mdpi/ic_launcher.pngbin0 -> 2206 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/mipmap-xhdpi/app_banner_sample_app.pngbin0 -> 3492 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/mipmap-xhdpi/ic_launcher.pngbin0 -> 4842 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/mipmap-xxhdpi/ic_launcher.pngbin0 -> 7718 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/raw/cards_example.json506
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/raw/detail_example.json106
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/raw/grid_example.json88
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/raw/launcher_cards.json63
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/raw/music_consumption_example.json76
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/raw/music_example.json106
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/raw/track_01.mp3bin0 -> 6950210 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/raw/track_02.mp3bin0 -> 8017184 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/raw/track_03.mp3bin0 -> 3320646 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/raw/track_04.mp3bin0 -> 4153235 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/raw/track_05.mp3bin0 -> 4516029 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/raw/track_06.mp3bin0 -> 366592 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/raw/track_07.mp3bin0 -> 6972648 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/raw/track_08.mp3bin0 -> 5779145 bytes
-rwxr-xr-xsamples/SupportLeanbackShowcase/app/src/main/res/raw/track_09.mp3bin0 -> 5321271 bytes
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/raw/wizard_example.json6
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/values/arrays.xml44
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/values/colors.xml44
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/values/dims.xml46
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/values/strings.xml58
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/values/styles.xml186
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/values/themes.xml62
-rw-r--r--samples/SupportLeanbackShowcase/app/src/main/res/xml/prefs.xml113
204 files changed, 6231 insertions, 0 deletions
diff --git a/samples/SupportLeanbackShowcase/app/src/main/AndroidManifest.xml b/samples/SupportLeanbackShowcase/app/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..087bbd3ab
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/AndroidManifest.xml
@@ -0,0 +1,59 @@
+<manifest
+ package="android.support.v17.leanback.supportleanbackshowcase"
+ xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <uses-permission android:name="android.permission.INTERNET"/>
+ <uses-permission android:name="android.permission.RECORD_AUDIO"/>
+
+ <uses-feature
+ android:name="android.hardware.touchscreen"
+ android:required="false"/>
+ <uses-feature
+ android:name="android.software.leanback"
+ android:required="true"/>
+
+ <application
+ android:allowBackup="true"
+ android:icon="@mipmap/app_banner_sample_app"
+ android:label="@string/app_name"
+ android:largeHeap="true"
+ android:theme="@style/Theme.Example.LeanbackLauncher">
+ <activity
+ android:name=".app.MainActivity"
+ android:icon="@mipmap/app_banner_sample_app"
+ android:label="@string/app_name"
+ android:logo="@mipmap/app_banner_sample_app"
+ android:screenOrientation="landscape">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+
+ <category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".app.wizard.WizardExampleActivity"
+ android:theme="@style/Theme.Example.LeanbackWizard"></activity>
+ <activity
+ android:name=".app.settings.SettingsExampleActivity"
+ android:theme="@style/Theme.Example.LeanbackPreferences"></activity>
+ <activity
+ android:name=".app.dialog.DialogExampleActivity"
+ android:theme="@style/Theme.Example.LeanbackDialog"></activity>
+ <activity
+ android:name=".app.details.DetailViewExampleActivity"
+ android:theme="@style/Theme.Example.LeanbackDetails"></activity>
+ <activity
+ android:name=".app.cards.CardExampleActivity"
+ android:theme="@style/Theme.Example.LeanbackBrowse"></activity>
+ <activity
+ android:name=".app.grid.GridExampleActivity"
+ android:theme="@style/Theme.Example.LeanbackVerticalGrid"></activity>
+ <activity
+ android:name=".app.media.VideoExampleActivity"
+ android:theme="@style/Theme.Example.Leanback"></activity>
+ <activity
+ android:name=".app.media.MusicExampleActivity"
+ android:theme="@style/Theme.Example.LeanbackMusic"></activity>
+ </application>
+
+</manifest>
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/MainActivity.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/MainActivity.java
new file mode 100644
index 000000000..e84c8cc8c
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/MainActivity.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app;
+
+import android.app.Activity;
+import android.app.Fragment;
+import android.os.Bundle;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+
+/*
+ * MainActivity class that loads MainFragment
+ */
+public class MainActivity extends Activity {
+
+ /**
+ * Called when the activity is first created.
+ */
+ @Override public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ if (savedInstanceState == null) {
+ Fragment fragment = new MainFragment();
+ getFragmentManager().beginTransaction().replace(R.id.fragmentContainer, fragment)
+ .commit();
+ }
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/MainFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/MainFragment.java
new file mode 100644
index 000000000..ab22928d8
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/MainFragment.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v17.leanback.app.BrowseFragment;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.supportleanbackshowcase.app.cards.CardExampleActivity;
+import android.support.v17.leanback.supportleanbackshowcase.app.details.DetailViewExampleActivity;
+import android.support.v17.leanback.supportleanbackshowcase.app.dialog.DialogExampleActivity;
+import android.support.v17.leanback.supportleanbackshowcase.app.grid.GridExampleActivity;
+import android.support.v17.leanback.supportleanbackshowcase.app.media.MusicExampleActivity;
+import android.support.v17.leanback.supportleanbackshowcase.app.media.VideoExampleActivity;
+import android.support.v17.leanback.supportleanbackshowcase.app.settings.SettingsExampleActivity;
+import android.support.v17.leanback.supportleanbackshowcase.app.wizard.WizardExampleActivity;
+import android.support.v17.leanback.supportleanbackshowcase.cards.presenters.CardPresenterSelector;
+import android.support.v17.leanback.supportleanbackshowcase.models.Card;
+import android.support.v17.leanback.supportleanbackshowcase.models.CardRow;
+import android.support.v17.leanback.supportleanbackshowcase.models.Movie;
+import android.support.v17.leanback.supportleanbackshowcase.utils.Utils;
+import android.support.v17.leanback.widget.ArrayObjectAdapter;
+import android.support.v17.leanback.widget.ImageCardView;
+import android.support.v17.leanback.widget.ListRow;
+import android.support.v17.leanback.widget.ListRowPresenter;
+import android.support.v17.leanback.widget.OnItemViewClickedListener;
+import android.support.v17.leanback.widget.OnItemViewSelectedListener;
+import android.support.v17.leanback.widget.Presenter;
+import android.support.v17.leanback.widget.PresenterSelector;
+import android.support.v17.leanback.widget.Row;
+import android.support.v17.leanback.widget.RowPresenter;
+import android.support.v4.app.ActivityOptionsCompat;
+
+import com.google.gson.Gson;
+
+
+public class MainFragment extends BrowseFragment {
+
+ private ArrayObjectAdapter mRowsAdapter;
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ setupUIElements();
+ setupRowAdapter();
+ setupEventListeners();
+ }
+
+ private void setupRowAdapter() {
+ mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
+ createRows();
+ setAdapter(mRowsAdapter);
+ }
+
+ private void createRows() {
+ String json = Utils
+ .inputStreamToString(getResources().openRawResource(R.raw.launcher_cards));
+ CardRow[] rows = new Gson().fromJson(json, CardRow[].class);
+ for (CardRow row : rows) {
+ mRowsAdapter.add(createCardRow(row));
+ }
+ }
+
+ private ListRow createCardRow(CardRow cardRow) {
+ PresenterSelector presenterSelector = new CardPresenterSelector(getActivity());
+ ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(presenterSelector);
+ for (Card card : cardRow.getCards()) {
+ listRowAdapter.add(card);
+ }
+ return new ListRow(listRowAdapter);
+ }
+
+ private void setupUIElements() {
+ setTitle(getString(R.string.browse_title));
+ setBadgeDrawable(getResources().getDrawable(R.drawable.title_android_tv, null));
+ setHeadersState(HEADERS_DISABLED);
+ setHeadersTransitionOnBackEnabled(false);
+ setBrandColor(getResources().getColor(R.color.fastlane_background));
+ }
+
+ private void setupEventListeners() {
+ setOnItemViewClickedListener(new ItemViewClickedListener());
+ setOnItemViewSelectedListener(new ItemViewSelectedListener());
+ }
+
+ private final class ItemViewClickedListener implements OnItemViewClickedListener {
+
+ @Override
+ public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
+ RowPresenter.ViewHolder rowViewHolder, Row row) {
+ Intent intent = null;
+ Card card = (Card) item;
+ int id = card.getId();
+ switch (id) {
+ case 0: {
+ intent = new Intent(getActivity().getBaseContext(),
+ CardExampleActivity.class);
+ break;
+ }
+ case 2: {
+ intent = new Intent(getActivity().getBaseContext(),
+ GridExampleActivity.class);
+ break;
+ }
+ case 3: {
+ intent = new Intent(getActivity().getBaseContext(),
+ DetailViewExampleActivity.class);
+ break;
+ }
+ case 4: {
+ intent = new Intent(getActivity().getBaseContext(),
+ VideoExampleActivity.class);
+ break;
+ }
+ case 5: {
+ intent = new Intent(getActivity().getBaseContext(),
+ MusicExampleActivity.class);
+ break;
+ }
+ case 6: {
+ // Let's create a new Wizard for a given Movie. The movie can come from any sort
+ // of data source. To simplify this example we decode it from a JSON source
+ // which might be loaded from a server in a real world example.
+ intent = new Intent(getActivity().getBaseContext(),
+ WizardExampleActivity.class);
+
+ // Prepare extras which contains the Movie and will be passed to the Activity
+ // which is started through the Intent/.
+ Bundle extras = new Bundle();
+ String json = Utils.inputStreamToString(
+ getResources().openRawResource(R.raw.wizard_example));
+ Movie movie = new Gson().fromJson(json, Movie.class);
+ extras.putSerializable("movie", movie);
+ intent.putExtras(extras);
+
+ // Finally, start the wizard Activity.
+ break;
+ }
+ case 7: {
+ intent = new Intent(getActivity().getBaseContext(),
+ SettingsExampleActivity.class);
+ startActivity(intent);
+ return;
+ }
+ case 8: {
+ intent = new Intent(getActivity().getBaseContext(),
+ DialogExampleActivity.class);
+ break;
+ }
+ default:
+ break;
+ }
+ if (intent != null) {
+ Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity())
+ .toBundle();
+ startActivity(intent, bundle);
+ }
+ }
+ }
+
+ private final class ItemViewSelectedListener implements OnItemViewSelectedListener {
+
+ @Override
+ public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
+ RowPresenter.ViewHolder rowViewHolder, Row row) {
+ }
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/cards/CardExampleActivity.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/cards/CardExampleActivity.java
new file mode 100644
index 000000000..7b8225fe7
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/cards/CardExampleActivity.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.cards;
+
+import android.app.Activity;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.os.Bundle;
+import android.support.v17.leanback.app.GuidedStepFragment;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.supportleanbackshowcase.app.dialog.DialogExampleFragment;
+
+/**
+ * TODO: Javadoc
+ */
+public class CardExampleActivity extends Activity {
+
+ @Override public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_cards_example);
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/cards/CardExampleFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/cards/CardExampleFragment.java
new file mode 100644
index 000000000..4b2a44557
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/cards/CardExampleFragment.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.cards;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.v17.leanback.app.BrowseFragment;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.supportleanbackshowcase.app.details.DetailViewExampleActivity;
+import android.support.v17.leanback.supportleanbackshowcase.app.details.DetailViewExampleFragment;
+import android.support.v17.leanback.supportleanbackshowcase.app.details.ShadowRowPresenterSelector;
+import android.support.v17.leanback.supportleanbackshowcase.cards.presenters.CardPresenterSelector;
+import android.support.v17.leanback.supportleanbackshowcase.models.Card;
+import android.support.v17.leanback.supportleanbackshowcase.models.CardRow;
+import android.support.v17.leanback.supportleanbackshowcase.utils.CardListRow;
+import android.support.v17.leanback.supportleanbackshowcase.utils.Utils;
+import android.support.v17.leanback.widget.ArrayObjectAdapter;
+import android.support.v17.leanback.widget.HeaderItem;
+import android.support.v17.leanback.widget.ImageCardView;
+import android.support.v17.leanback.widget.ListRow;
+import android.support.v17.leanback.widget.OnItemViewClickedListener;
+import android.support.v17.leanback.widget.Presenter;
+import android.support.v17.leanback.widget.PresenterSelector;
+import android.support.v17.leanback.widget.Row;
+import android.support.v17.leanback.widget.RowPresenter;
+import android.support.v17.leanback.widget.SearchOrbView;
+import android.support.v4.app.ActivityOptionsCompat;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+
+/**
+ * This fragment will be shown when the "Card Examples" card is selected at the home menu. It will
+ * display multiple card types.
+ */
+public class CardExampleFragment extends BrowseFragment {
+
+ private ArrayObjectAdapter mRowsAdapter;
+
+ @Override public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ setupUi();
+ setupRowAdapter();
+ }
+
+ private void setupUi() {
+ setHeadersState(HEADERS_ENABLED);
+ setHeadersTransitionOnBackEnabled(true);
+ setSearchAffordanceColors(
+ new SearchOrbView.Colors(getResources().getColor(R.color.search_color),
+ getResources().getColor(R.color.search_bright_color),
+ getResources().getColor(R.color.search_icon_color)));
+ setBrandColor(getResources().getColor(R.color.fastlane_background));
+ setTitle(getString(R.string.card_examples_title));
+ setOnSearchClickedListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Toast.makeText(getActivity(), getString(R.string.implement_search),
+ Toast.LENGTH_LONG).show();
+ }
+ });
+ setOnItemViewClickedListener(new OnItemViewClickedListener() {
+
+ @Override
+ public void onItemClicked(Presenter.ViewHolder viewHolder, Object item, RowPresenter.ViewHolder viewHolder1, Row row) {
+ if (!(item instanceof Card)) return;
+ if (!(viewHolder.view instanceof ImageCardView)) return;
+
+ ImageView imageView = ((ImageCardView) viewHolder.view).getMainImageView();
+ Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),
+ imageView, DetailViewExampleFragment.TRANSITION_NAME).toBundle();
+ Intent intent = new Intent(getActivity().getBaseContext(),
+ DetailViewExampleActivity.class);
+ Card card = (Card) item;
+ int imageResId = card.getLocalImageResourceId(getContext());
+ intent.putExtra(DetailViewExampleFragment.EXTRA_CARD, imageResId);
+ startActivity(intent, bundle);
+ }
+
+ });
+
+ prepareEntranceTransition();
+ }
+
+ private void setupRowAdapter() {
+ mRowsAdapter = new ArrayObjectAdapter(new ShadowRowPresenterSelector());
+ setAdapter(mRowsAdapter);
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ createRows();
+ startEntranceTransition();
+ }
+ }, 500);
+ }
+
+ private void createRows() {
+ String json = Utils
+ .inputStreamToString(getResources().openRawResource(R.raw.cards_example));
+ CardRow[] rows = new Gson().fromJson(json, CardRow[].class);
+ for (CardRow row : rows) {
+ mRowsAdapter.add(createCardRow(row));
+ }
+ }
+
+ private ListRow createCardRow(final CardRow cardRow) {
+ // Build main row using the ImageCardViewPresenter.
+ PresenterSelector presenterSelector = new CardPresenterSelector(getActivity());
+ ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(presenterSelector);
+ for (Card card : cardRow.getCards()) {
+ listRowAdapter.add(card);
+ }
+ HeaderItem header = new HeaderItem(cardRow.getTitle());
+ return new CardListRow(header, listRowAdapter, cardRow);
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/DetailViewExampleActivity.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/DetailViewExampleActivity.java
new file mode 100644
index 000000000..6b9c1434f
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/DetailViewExampleActivity.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.details;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.v17.leanback.app.DetailsFragment;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+
+/**
+ * Contains a {@link DetailsFragment} in order to display more details for a given card.
+ */
+public class DetailViewExampleActivity extends Activity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_detail_example);
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/DetailViewExampleFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/DetailViewExampleFragment.java
new file mode 100644
index 000000000..eed800ffd
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/DetailViewExampleFragment.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.details;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.v17.leanback.app.DetailsFragment;
+import android.support.v17.leanback.supportleanbackshowcase.models.DetailedCard;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.supportleanbackshowcase.utils.CardListRow;
+import android.support.v17.leanback.supportleanbackshowcase.utils.Utils;
+import android.support.v17.leanback.supportleanbackshowcase.cards.presenters.CardPresenterSelector;
+import android.support.v17.leanback.supportleanbackshowcase.models.Card;
+import android.support.v17.leanback.widget.Action;
+import android.support.v17.leanback.widget.ArrayObjectAdapter;
+import android.support.v17.leanback.widget.ClassPresenterSelector;
+import android.support.v17.leanback.widget.DetailsOverviewRow;
+import android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter;
+import android.support.v17.leanback.widget.FullWidthDetailsOverviewSharedElementHelper;
+import android.support.v17.leanback.widget.HeaderItem;
+import android.support.v17.leanback.widget.ListRow;
+import android.support.v17.leanback.widget.ListRowPresenter;
+import android.support.v17.leanback.widget.OnItemViewClickedListener;
+import android.support.v17.leanback.widget.OnItemViewSelectedListener;
+import android.support.v17.leanback.widget.Presenter;
+import android.support.v17.leanback.widget.Row;
+import android.support.v17.leanback.widget.RowPresenter;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Toast;
+
+import com.google.gson.Gson;
+
+/**
+ * Displays a card with more details using a {@link DetailsFragment}.
+ */
+public class DetailViewExampleFragment extends DetailsFragment implements OnItemViewClickedListener,
+ OnItemViewSelectedListener {
+
+ public static final String TRANSITION_NAME = "t_for_transition";
+ public static final String EXTRA_CARD = "card";
+
+ private ArrayObjectAdapter mRowsAdapter;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setupUi();
+ setupEventListeners();
+ }
+
+ private void setupUi() {
+ // Load the card we want to display from a JSON resource. This JSON data could come from
+ // anywhere in a real world app, e.g. a server.
+ String json = Utils
+ .inputStreamToString(getResources().openRawResource(R.raw.detail_example));
+ DetailedCard data = new Gson().fromJson(json, DetailedCard.class);
+
+ // Setup fragment
+ setTitle(getString(R.string.detail_view_title));
+
+ FullWidthDetailsOverviewRowPresenter rowPresenter = new FullWidthDetailsOverviewRowPresenter(
+ new DetailsDescriptionPresenter(getActivity())) {
+
+ @Override
+ protected RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent) {
+ // Customize Actionbar and Content by using custom colors.
+ RowPresenter.ViewHolder viewHolder = super.createRowViewHolder(parent);
+
+ View actionsView = viewHolder.view.
+ findViewById(R.id.details_overview_actions_background);
+ actionsView.setBackgroundColor(getActivity().getResources().
+ getColor(R.color.detail_view_actionbar_background, null));
+
+ View detailsView = viewHolder.view.findViewById(R.id.details_frame);
+ detailsView.setBackgroundColor(
+ getResources().getColor(R.color.detail_view_background, null));
+ return viewHolder;
+ }
+ };
+
+ FullWidthDetailsOverviewSharedElementHelper mHelper = new FullWidthDetailsOverviewSharedElementHelper();
+ mHelper.setSharedElementEnterTransition(getActivity(), TRANSITION_NAME);
+ rowPresenter.setListener(mHelper);
+ rowPresenter.setParticipatingEntranceTransition(false);
+ prepareEntranceTransition();
+
+ ListRowPresenter shadowDisabledRowPresenter = new ListRowPresenter();
+ shadowDisabledRowPresenter.setShadowEnabled(false);
+
+ // Setup PresenterSelector to distinguish between the different rows.
+ ClassPresenterSelector rowPresenterSelector = new ClassPresenterSelector();
+ rowPresenterSelector.addClassPresenter(DetailsOverviewRow.class, rowPresenter);
+ rowPresenterSelector.addClassPresenter(CardListRow.class, shadowDisabledRowPresenter);
+ rowPresenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
+ mRowsAdapter = new ArrayObjectAdapter(rowPresenterSelector);
+
+ // Setup action and detail row.
+ DetailsOverviewRow detailsOverview = new DetailsOverviewRow(data);
+ int imageResId = data.getLocalImageResourceId(getActivity());
+
+ Bundle extras = getActivity().getIntent().getExtras();
+ if (extras != null && extras.containsKey(EXTRA_CARD)) {
+ imageResId = extras.getInt(EXTRA_CARD, imageResId);
+ }
+ detailsOverview.setImageDrawable(getResources().getDrawable(imageResId, null));
+ ArrayObjectAdapter actionAdapter = new ArrayObjectAdapter();
+ actionAdapter.add(new Action(1, getString(R.string.action_buy) + data.getPrice()));
+ actionAdapter.add(new Action(2, getString(R.string.action_wishlist)));
+ actionAdapter.add(new Action(3, getString(R.string.action_related)));
+ detailsOverview.setActionsAdapter(actionAdapter);
+ mRowsAdapter.add(detailsOverview);
+
+ // Setup related row.
+ ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(
+ new CardPresenterSelector(getActivity()));
+ for (Card characterCard : data.getCharacters()) listRowAdapter.add(characterCard);
+ HeaderItem header = new HeaderItem(0, getString(R.string.header_related));
+ mRowsAdapter.add(new CardListRow(header, listRowAdapter, null));
+
+ // Setup recommended row.
+ listRowAdapter = new ArrayObjectAdapter(new CardPresenterSelector(getActivity()));
+ for (Card card : data.getRecommended()) listRowAdapter.add(card);
+ header = new HeaderItem(1, getString(R.string.header_recommended));
+ mRowsAdapter.add(new ListRow(header, listRowAdapter));
+
+ setAdapter(mRowsAdapter);
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ startEntranceTransition();
+ }
+ }, 500);
+ }
+
+ private void setupEventListeners() {
+ setOnItemViewSelectedListener(this);
+ setOnItemViewClickedListener(this);
+ }
+
+ @Override
+ public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
+ RowPresenter.ViewHolder rowViewHolder, Row row) {
+ if (!(item instanceof Action)) return;
+ Action action = (Action) item;
+ if (action.getId() == 3) {
+ setSelectedPosition(1);
+ } else {
+ Toast.makeText(getActivity(), getString(R.string.action_cicked), Toast.LENGTH_LONG)
+ .show();
+ }
+ }
+
+ @Override
+ public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
+ RowPresenter.ViewHolder rowViewHolder, Row row) {
+ if (mRowsAdapter.indexOf(row) > 0) {
+ int backgroundColor = getResources().getColor(R.color.detail_view_related_background,
+ null);
+ getView().setBackgroundColor(backgroundColor);
+ } else {
+ getView().setBackground(null);
+ }
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/DetailsDescriptionPresenter.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/DetailsDescriptionPresenter.java
new file mode 100644
index 000000000..b8488a11e
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/DetailsDescriptionPresenter.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.details;
+
+import android.content.Context;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.supportleanbackshowcase.models.DetailedCard;
+import android.support.v17.leanback.supportleanbackshowcase.utils.ResourceCache;
+import android.support.v17.leanback.widget.Presenter;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+/**
+ * This presenter is used to render a {@link DetailedCard} in the {@link
+ * DetailViewExampleFragment}.
+ */
+public class DetailsDescriptionPresenter extends Presenter {
+
+ private ResourceCache mResourceCache = new ResourceCache();
+ private Context mContext;
+
+ public DetailsDescriptionPresenter(Context context) {
+ mContext = context;
+ }
+
+ @Override public ViewHolder onCreateViewHolder(ViewGroup parent) {
+ View view = LayoutInflater.from(mContext).inflate(R.layout.detail_view_content, null);
+ return new ViewHolder(view);
+ }
+
+ @Override public void onBindViewHolder(ViewHolder viewHolder, Object item) {
+ TextView primaryText = mResourceCache.getViewById(viewHolder.view, R.id.primary_text);
+ TextView sndText1 = mResourceCache.getViewById(viewHolder.view, R.id.secondary_text_first);
+ TextView sndText2 = mResourceCache.getViewById(viewHolder.view, R.id.secondary_text_second);
+ TextView extraText = mResourceCache.getViewById(viewHolder.view, R.id.extra_text);
+
+ DetailedCard card = (DetailedCard) item;
+ primaryText.setText(card.getTitle());
+ sndText1.setText(card.getDescription());
+ sndText2.setText(card.getYear() + "");
+ extraText.setText(card.getText());
+ }
+
+ @Override public void onUnbindViewHolder(ViewHolder viewHolder) {
+ // Nothing to do here.
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/ShadowRowPresenterSelector.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/ShadowRowPresenterSelector.java
new file mode 100644
index 000000000..987365a87
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/details/ShadowRowPresenterSelector.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.details;
+
+import android.support.v17.leanback.supportleanbackshowcase.models.CardRow;
+import android.support.v17.leanback.supportleanbackshowcase.utils.CardListRow;
+import android.support.v17.leanback.widget.ListRowPresenter;
+import android.support.v17.leanback.widget.Presenter;
+import android.support.v17.leanback.widget.PresenterSelector;
+
+/**
+ * This {@link PresenterSelector} will return a {@link ListRowPresenter} which has shadow support
+ * enabled or not depending on {@link CardRow#useShadow()} for a given row.
+ */
+public class ShadowRowPresenterSelector extends PresenterSelector {
+
+ private ListRowPresenter mShadowEnabledRowPresenter = new ListRowPresenter();
+ private ListRowPresenter mShadowDisabledRowPresenter = new ListRowPresenter();
+
+ public ShadowRowPresenterSelector() {
+ mShadowDisabledRowPresenter.setShadowEnabled(false);
+ }
+
+ @Override public Presenter getPresenter(Object item) {
+ if (!(item instanceof CardListRow)) return mShadowDisabledRowPresenter;
+ CardListRow listRow = (CardListRow) item;
+ CardRow row = listRow.getCardRow();
+ if (row.useShadow()) return mShadowEnabledRowPresenter;
+ return mShadowDisabledRowPresenter;
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/dialog/DialogExampleActivity.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/dialog/DialogExampleActivity.java
new file mode 100644
index 000000000..55f75759a
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/dialog/DialogExampleActivity.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.dialog;
+
+import android.app.Activity;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.os.Bundle;
+import android.support.v17.leanback.app.GuidedStepFragment;
+
+/**
+ * TODO: Javadoc
+ */
+public class DialogExampleActivity extends Activity {
+
+ @Override public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ getWindow().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#21272A")));
+
+ GuidedStepFragment fragment = new DialogExampleFragment();
+ GuidedStepFragment.addAsRoot(this, fragment, android.R.id.content);
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/dialog/DialogExampleFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/dialog/DialogExampleFragment.java
new file mode 100644
index 000000000..80b22a931
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/dialog/DialogExampleFragment.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.dialog;
+
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.v17.leanback.app.GuidedStepFragment;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.widget.GuidanceStylist.Guidance;
+import android.support.v17.leanback.widget.GuidedAction;
+import android.widget.Toast;
+
+import java.util.List;
+
+/**
+ * TODO: Javadoc
+ */
+public class DialogExampleFragment extends GuidedStepFragment {
+
+ private static final int ACTION_ID_POSITIVE = 1;
+ private static final int ACTION_ID_NEGATIVE = ACTION_ID_POSITIVE + 1;
+
+ @NonNull
+ @Override
+ public Guidance onCreateGuidance(Bundle savedInstanceState) {
+ Guidance guidance = new Guidance(getString(R.string.dialog_example_title),
+ getString(R.string.dialog_example_description),
+ "", null);
+ return guidance;
+ }
+
+ @Override
+ public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
+ GuidedAction action = new GuidedAction.Builder()
+ .id(ACTION_ID_POSITIVE)
+ .title(getString(R.string.dialog_example_button_positive)).build();
+ actions.add(action);
+ action = new GuidedAction.Builder()
+ .id(ACTION_ID_NEGATIVE)
+ .title(getString(R.string.dialog_example_button_negative)).build();
+ actions.add(action);
+ }
+
+ @Override
+ public void onGuidedActionClicked(GuidedAction action) {
+ if (ACTION_ID_POSITIVE == action.getId()) {
+ Toast.makeText(getActivity(), R.string.dialog_example_button_toast_positive_clicked,
+ Toast.LENGTH_SHORT).show();
+ } else {
+ Toast.makeText(getActivity(), R.string.dialog_example_button_toast_negative_clicked,
+ Toast.LENGTH_SHORT).show();
+ }
+ getActivity().finish();
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/grid/GridExampleActivity.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/grid/GridExampleActivity.java
new file mode 100644
index 000000000..e2d0887af
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/grid/GridExampleActivity.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.grid;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+
+/**
+ * TODO: Javadoc
+ */
+public class GridExampleActivity extends Activity {
+
+ @Override public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_grid_example);
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/grid/GridExampleFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/grid/GridExampleFragment.java
new file mode 100644
index 000000000..6640b5180
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/grid/GridExampleFragment.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.grid;
+
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.v17.leanback.app.VerticalGridFragment;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.supportleanbackshowcase.utils.Utils;
+import android.support.v17.leanback.supportleanbackshowcase.models.CardRow;
+import android.support.v17.leanback.supportleanbackshowcase.cards.presenters.CardPresenterSelector;
+import android.support.v17.leanback.widget.ArrayObjectAdapter;
+import android.support.v17.leanback.widget.FocusHighlight;
+import android.support.v17.leanback.widget.PresenterSelector;
+import android.support.v17.leanback.widget.VerticalGridPresenter;
+
+import com.google.gson.Gson;
+
+/**
+ * An example how to use leanback's {@link VerticalGridFragment}.
+ */
+public class GridExampleFragment extends VerticalGridFragment {
+
+ private static final int COLUMNS = 4;
+ private static final int ZOOM_FACTOR = FocusHighlight.ZOOM_FACTOR_MEDIUM;
+
+ private ArrayObjectAdapter mAdapter;
+
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setTitle(getString(R.string.grid_example_title));
+ setupRowAdapter();
+ }
+
+ private void setupRowAdapter() {
+ VerticalGridPresenter gridPresenter = new VerticalGridPresenter(ZOOM_FACTOR);
+ gridPresenter.setNumberOfColumns(COLUMNS);
+ setGridPresenter(gridPresenter);
+
+ PresenterSelector cardPresenterSelector = new CardPresenterSelector(getActivity());
+ mAdapter = new ArrayObjectAdapter(cardPresenterSelector);
+ setAdapter(mAdapter);
+
+ prepareEntranceTransition();
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ createRows();
+ startEntranceTransition();
+ }
+ }, 1000);
+ }
+
+ private void createRows() {
+ String json = Utils.inputStreamToString(getResources()
+ .openRawResource(R.raw.grid_example));
+ CardRow row = new Gson().fromJson(json, CardRow.class);
+ mAdapter.addAll(0, row.getCards());
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/MediaPlayerGlue.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/MediaPlayerGlue.java
new file mode 100644
index 000000000..bc757cd19
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/MediaPlayerGlue.java
@@ -0,0 +1,446 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.media;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.graphics.drawable.Drawable;
+import android.media.AudioManager;
+import android.media.MediaPlayer;
+import android.net.Uri;
+import android.os.Handler;
+import android.support.v17.leanback.app.PlaybackControlGlue;
+import android.support.v17.leanback.app.PlaybackOverlayFragment;
+import android.support.v17.leanback.widget.Action;
+import android.support.v17.leanback.widget.ArrayObjectAdapter;
+import android.support.v17.leanback.widget.ControlButtonPresenterSelector;
+import android.support.v17.leanback.widget.OnItemViewSelectedListener;
+import android.support.v17.leanback.widget.PlaybackControlsRow;
+import android.support.v17.leanback.widget.PlaybackControlsRowPresenter;
+import android.support.v17.leanback.widget.Presenter;
+import android.support.v17.leanback.widget.Row;
+import android.support.v17.leanback.widget.RowPresenter;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.SurfaceHolder;
+import android.view.View;
+
+import java.io.IOException;
+
+/**
+ * This glue extends the {@link PlaybackControlGlue} with a {@link MediaPlayer} synchronization. It
+ * supports 7 actions: <ul> <li>{@link android.support.v17.leanback.widget.PlaybackControlsRow.FastForwardAction}</li>
+ * <li>{@link android.support.v17.leanback.widget.PlaybackControlsRow.RewindAction}</li> <li>{@link
+ * android.support.v17.leanback.widget.PlaybackControlsRow.PlayPauseAction}</li> <li>{@link
+ * android.support.v17.leanback.widget.PlaybackControlsRow.ShuffleAction}</li> <li>{@link
+ * android.support.v17.leanback.widget.PlaybackControlsRow.RepeatAction}</li> <li>{@link
+ * android.support.v17.leanback.widget.PlaybackControlsRow.ThumbsDownAction}</li> <li>{@link
+ * android.support.v17.leanback.widget.PlaybackControlsRow.ThumbsUpAction}</li> </ul>
+ * <p/>
+ */
+public abstract class MediaPlayerGlue extends PlaybackControlGlue implements
+ OnItemViewSelectedListener {
+
+ public static final int FAST_FORWARD_REWIND_STEP = 10 * 1000; // in milliseconds
+ public static final int FAST_FORWARD_REWIND_REPEAT_DELAY = 200; // in milliseconds
+ private static final String TAG = "MediaPlayerGlue";
+ protected final PlaybackControlsRow.ThumbsDownAction mThumbsDownAction;
+ protected final PlaybackControlsRow.ThumbsUpAction mThumbsUpAction;
+ private final Context mContext;
+ private final MediaPlayer mPlayer = new MediaPlayer();
+ private final PlaybackControlsRow.RepeatAction mRepeatAction;
+ private final PlaybackControlsRow.ShuffleAction mShuffleAction;
+ private PlaybackControlsRow mControlsRow;
+ private Runnable mRunnable;
+ private Handler mHandler = new Handler();
+ private boolean mPaused = false;
+ private boolean mInitialized = false; // true when the MediaPlayer is prepared/initialized
+ private OnMediaFileFinishedPlayingListener mMediaFileFinishedPlayingListener;
+ private Action mSelectedAction; // the action which is currently selected by the user
+ private long mLastKeyDownEvent = 0L; // timestamp when the last DPAD_CENTER KEY_DOWN occurred
+ private MetaData mMetaData;
+ private Uri mMediaSourceUri = null;
+ private String mMediaSourcePath = null;
+
+ public MediaPlayerGlue(Context context, PlaybackOverlayFragment fragment) {
+ super(context, fragment, new int[]{1});
+ mContext = context;
+
+ // Instantiate secondary actions
+ mShuffleAction = new PlaybackControlsRow.ShuffleAction(mContext);
+ mRepeatAction = new PlaybackControlsRow.RepeatAction(mContext);
+ mThumbsDownAction = new PlaybackControlsRow.ThumbsDownAction(mContext);
+ mThumbsUpAction = new PlaybackControlsRow.ThumbsUpAction(mContext);
+ mThumbsDownAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE);
+ mThumbsUpAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE);
+
+ // Setup controls and notify UI about change.
+ setFadingEnabled(false);
+ onStateChanged();
+
+ // Register selected listener such that we know what action the user currently has focused.
+ fragment.setOnItemViewSelectedListener(this);
+ }
+
+ /**
+ * Will reset the {@link MediaPlayer} and the glue such that a new file can be played. You are
+ * not required to call this method before playing the first file. However you have to call it
+ * before playing a second one.
+ */
+ public void reset() {
+ mPaused = mInitialized = false;
+ mPlayer.reset();
+ }
+
+ public void setOnMediaFileFinishedPlayingListener(OnMediaFileFinishedPlayingListener listener) {
+ mMediaFileFinishedPlayingListener = listener;
+ }
+
+ /**
+ * Override this method in case you need to add different secondary actions.
+ *
+ * @param secondaryActionsAdapter The adapter you need to add the {@link Action}s to.
+ */
+ protected void addSecondaryActions(ArrayObjectAdapter secondaryActionsAdapter) {
+ secondaryActionsAdapter.add(mShuffleAction);
+ secondaryActionsAdapter.add(mRepeatAction);
+ secondaryActionsAdapter.add(mThumbsDownAction);
+ secondaryActionsAdapter.add(mThumbsUpAction);
+ }
+
+ /**
+ * @see MediaPlayer#setDisplay(SurfaceHolder)
+ */
+ public void setDisplay(SurfaceHolder surfaceHolder) {
+ mPlayer.setDisplay(surfaceHolder);
+ }
+
+ /**
+ * Use this method to setup the {@link PlaybackControlsRowPresenter}. It'll be called
+ * <u>after</u> the {@link PlaybackControlsRowPresenter} has been created and the primary and
+ * secondary actions have been added.
+ *
+ * @param presenter The PlaybackControlsRowPresenter used to display the controls.
+ */
+ public void setupControlsRowPresenter(PlaybackControlsRowPresenter presenter) {
+ // TODO: hahnr@ move into resources
+ presenter.setProgressColor(Color.parseColor("#feab91"));
+ presenter.setBackgroundColor(Color.parseColor("#db2a0f"));
+ }
+
+ @Override public PlaybackControlsRowPresenter createControlsRowAndPresenter() {
+ PlaybackControlsRowPresenter presenter = super.createControlsRowAndPresenter();
+ mControlsRow = getControlsRow();
+
+ // Add secondary actions and change the control row color.
+ ArrayObjectAdapter secondaryActions = new ArrayObjectAdapter(
+ new ControlButtonPresenterSelector());
+ mControlsRow.setSecondaryActionsAdapter(secondaryActions);
+ addSecondaryActions(secondaryActions);
+ setupControlsRowPresenter(presenter);
+ return presenter;
+ }
+
+ @Override public void enableProgressUpdating(final boolean enabled) {
+ if (!enabled) {
+ if (mRunnable != null) mHandler.removeCallbacks(mRunnable);
+ return;
+ }
+ mRunnable = new Runnable() {
+ @Override public void run() {
+ updateProgress();
+ Log.d(TAG, "enableProgressUpdating(boolean)");
+ mHandler.postDelayed(this, getUpdatePeriod());
+ }
+ };
+ mHandler.postDelayed(mRunnable, getUpdatePeriod());
+ }
+
+ @Override public void onActionClicked(Action action) {
+ // If either 'Shuffle' or 'Repeat' has been clicked we need to make sure the acitons index
+ // is incremented and the UI updated such that we can display the new state.
+ super.onActionClicked(action);
+ if (action instanceof PlaybackControlsRow.ShuffleAction) {
+ mShuffleAction.nextIndex();
+ } else if (action instanceof PlaybackControlsRow.RepeatAction) {
+ mRepeatAction.nextIndex();
+ } else if (action instanceof PlaybackControlsRow.ThumbsUpAction) {
+ if (mThumbsUpAction.getIndex() == PlaybackControlsRow.ThumbsAction.SOLID) {
+ mThumbsUpAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE);
+ } else {
+ mThumbsUpAction.setIndex(PlaybackControlsRow.ThumbsAction.SOLID);
+ mThumbsDownAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE);
+ }
+ } else if (action instanceof PlaybackControlsRow.ThumbsDownAction) {
+ if (mThumbsDownAction.getIndex() == PlaybackControlsRow.ThumbsAction.SOLID) {
+ mThumbsDownAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE);
+ } else {
+ mThumbsDownAction.setIndex(PlaybackControlsRow.ThumbsAction.SOLID);
+ mThumbsUpAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE);
+ }
+ }
+ onMetadataChanged();
+ }
+
+ @Override public boolean onKey(View v, int keyCode, KeyEvent event) {
+ // This method is overridden in order to make implement fast forwarding and rewinding when
+ // the user keeps the corresponding action pressed.
+ // We only consume DPAD_CENTER Action_DOWN events on the Fast-Forward and Rewind action and
+ // only if it has not been pressed in the last X milliseconds.
+ boolean consume = mSelectedAction instanceof PlaybackControlsRow.RewindAction;
+ consume = consume || mSelectedAction instanceof PlaybackControlsRow.FastForwardAction;
+ consume = consume && mInitialized;
+ consume = consume && event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER;
+ consume = consume && event.getAction() == KeyEvent.ACTION_DOWN;
+ consume = consume && System
+ .currentTimeMillis() - mLastKeyDownEvent > FAST_FORWARD_REWIND_REPEAT_DELAY;
+ if (consume) {
+ mLastKeyDownEvent = System.currentTimeMillis();
+ int newPosition = getCurrentPosition() + FAST_FORWARD_REWIND_STEP;
+ if (mSelectedAction instanceof PlaybackControlsRow.RewindAction) {
+ newPosition = getCurrentPosition() - FAST_FORWARD_REWIND_STEP;
+ }
+ // Make sure the new calculated duration is in the range 0 >= X >= MediaDuration
+ if (newPosition < 0) newPosition = 0;
+ if (newPosition > getMediaDuration()) newPosition = getMediaDuration();
+ seekTo(newPosition);
+ return true;
+ }
+ return super.onKey(v, keyCode, event);
+ }
+
+ @Override public boolean hasValidMedia() {
+ return mMetaData != null;
+ }
+
+ @Override public boolean isMediaPlaying() {
+ return mPlayer.isPlaying();
+ }
+
+ @Override public CharSequence getMediaTitle() {
+ return hasValidMedia() ? mMetaData.getTitle() : "N/a";
+ }
+
+ @Override public CharSequence getMediaSubtitle() {
+ return hasValidMedia() ? mMetaData.getArtist() : "N/a";
+ }
+
+ @Override public int getMediaDuration() {
+ return mInitialized ? mPlayer.getDuration() : 0;
+ }
+
+ @Override public Drawable getMediaArt() {
+ return hasValidMedia() ? mMetaData.getCover() : null;
+ }
+
+ @Override public long getSupportedActions() {
+ return PlaybackControlGlue.ACTION_PLAY_PAUSE | PlaybackControlGlue.ACTION_FAST_FORWARD | PlaybackControlGlue.ACTION_REWIND;
+ }
+
+ @Override public int getCurrentSpeedId() {
+ // 0 = Pause, 1 = Normal Playback Speed
+ return mPlayer.isPlaying() ? 1 : 0;
+ }
+
+ @Override public int getCurrentPosition() {
+ return mInitialized ? mPlayer.getCurrentPosition() : 0;
+ }
+
+ @Override protected void startPlayback(int speed) throws IllegalStateException {
+ if (mPaused) {
+ mPlayer.start();
+ } else if (!isMediaPlaying()) {
+ reset();
+ try {
+ if (mMediaSourceUri != null) mPlayer.setDataSource(getContext(), mMediaSourceUri);
+ else mPlayer.setDataSource(mMediaSourcePath);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
+ mPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
+ @Override public void onPrepared(MediaPlayer mp) {
+ mInitialized = true;
+ mPaused = false;
+ mPlayer.start();
+ onMetadataChanged();
+ onStateChanged();
+ updateProgress();
+ }
+ });
+ mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
+ @Override public void onCompletion(MediaPlayer mp) {
+ if (mInitialized && mMediaFileFinishedPlayingListener != null)
+ mMediaFileFinishedPlayingListener.onMediaFileFinishedPlaying(mMetaData);
+ }
+ });
+ mPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() {
+ @Override public void onBufferingUpdate(MediaPlayer mp, int percent) {
+ mControlsRow.setBufferedProgress((int) (mp.getDuration() * (percent / 100f)));
+ }
+ });
+ mPlayer.prepareAsync();
+ onStateChanged();
+ }
+ }
+
+ @Override protected void pausePlayback() {
+ if (mPlayer.isPlaying()) {
+ mPlayer.pause();
+ mPaused = true;
+ }
+ }
+
+ @Override protected void skipToNext() {
+ // Not supported.
+ }
+
+ @Override protected void skipToPrevious() {
+ // Not supported.
+ }
+
+ /**
+ * Called whenever the user presses fast-forward/rewind or when the user keeps the corresponding
+ * action pressed.
+ *
+ * @param newPosition The new position of the media track in milliseconds.
+ */
+ protected void seekTo(int newPosition) {
+ mPlayer.seekTo(newPosition);
+ }
+
+ /**
+ * @see MediaPlayer#setDataSource(Context, Uri)
+ */
+ public void setMediaSource(Uri uri) {
+ mMediaSourceUri = uri;
+ }
+
+ /**
+ * @see MediaPlayer#setDataSource(String)
+ */
+ public void setMediaSource(String path) {
+ mMediaSourcePath = path;
+ }
+
+ /**
+ * Call to <code>startPlayback(1)</code>.
+ *
+ * @throws IllegalStateException See {@link MediaPlayer} for further information about it's
+ * different states when setting a data source and preparing it to be played.
+ */
+ public void startPlayback() throws IllegalStateException {
+ startPlayback(1);
+ }
+
+ /**
+ * @return Returns <code>true</code> iff 'Shuffle' is <code>ON</code>.
+ */
+ public boolean useShuffle() {
+ return mShuffleAction.getIndex() == PlaybackControlsRow.ShuffleAction.ON;
+ }
+
+ /**
+ * @return Returns <code>true</code> iff 'Repeat-One' is <code>ON</code>.
+ */
+ public boolean repeatOne() {
+ return mRepeatAction.getIndex() == PlaybackControlsRow.RepeatAction.ONE;
+ }
+
+ /**
+ * @return Returns <code>true</code> iff 'Repeat-All' is <code>ON</code>.
+ */
+ public boolean repeatAll() {
+ return mRepeatAction.getIndex() == PlaybackControlsRow.RepeatAction.ALL;
+ }
+
+ public void setMetaData(MetaData metaData) {
+ mMetaData = metaData;
+ onMetadataChanged();
+ }
+
+ /**
+ * This is a listener implementation for the {@link OnItemViewSelectedListener} of the {@link
+ * PlaybackOverlayFragment}. This implementation is required in order to detect KEY_DOWN events
+ * on the {@link android.support.v17.leanback.widget.PlaybackControlsRow.FastForwardAction} and
+ * {@link android.support.v17.leanback.widget.PlaybackControlsRow.RewindAction}. Thus you should
+ * <u>NOT</u> set another {@link OnItemViewSelectedListener} on your {@link
+ * PlaybackOverlayFragment}. Instead, override this method and call its super (this)
+ * implementation.
+ *
+ * @see OnItemViewSelectedListener#onItemSelected(Presenter.ViewHolder, Object,
+ * RowPresenter.ViewHolder, Row)
+ */
+ @Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
+ RowPresenter.ViewHolder rowViewHolder, Row row) {
+ if (item instanceof Action) {
+ mSelectedAction = (Action) item;
+ } else {
+ mSelectedAction = null;
+ }
+ }
+
+ /**
+ * A listener which will be called whenever a track is finished playing.
+ */
+ public interface OnMediaFileFinishedPlayingListener {
+
+ /**
+ * Called when a track is finished playing.
+ *
+ * @param metaData The track's {@link MetaData} which just finished playing.
+ */
+ void onMediaFileFinishedPlaying(MetaData metaData);
+
+ }
+
+ /**
+ * Holds the meta data such as track title, artist and cover art. It'll be used by the {@link
+ * MediaPlayerGlue}.
+ */
+ public static class MetaData {
+
+ private String mTitle;
+ private String mArtist;
+ private Drawable mCover;
+
+
+ public String getTitle() {
+ return mTitle;
+ }
+
+ public void setTitle(String title) {
+ this.mTitle = title;
+ }
+
+ public String getArtist() {
+ return mArtist;
+ }
+
+ public void setArtist(String artist) {
+ this.mArtist = artist;
+ }
+
+ public Drawable getCover() {
+ return mCover;
+ }
+
+ public void setCover(Drawable cover) {
+ this.mCover = cover;
+ }
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/MusicConsumptionExampleFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/MusicConsumptionExampleFragment.java
new file mode 100644
index 000000000..fdb8ec41f
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/MusicConsumptionExampleFragment.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.media;
+
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.v17.leanback.app.PlaybackOverlayFragment;
+import android.support.v17.leanback.supportleanbackshowcase.utils.Constants;
+import android.support.v17.leanback.supportleanbackshowcase.app.media.MediaPlayerGlue;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.supportleanbackshowcase.app.media.TrackListHeader;
+import android.support.v17.leanback.supportleanbackshowcase.utils.Utils;
+import android.support.v17.leanback.supportleanbackshowcase.models.Song;
+import android.support.v17.leanback.supportleanbackshowcase.models.SongList;
+import android.support.v17.leanback.widget.Action;
+import android.support.v17.leanback.widget.ArrayObjectAdapter;
+import android.support.v17.leanback.widget.ClassPresenterSelector;
+import android.support.v17.leanback.widget.OnItemViewClickedListener;
+import android.support.v17.leanback.widget.PlaybackControlsRow;
+import android.support.v17.leanback.widget.PlaybackControlsRowPresenter;
+import android.support.v17.leanback.widget.Presenter;
+import android.support.v17.leanback.widget.Row;
+import android.support.v17.leanback.widget.RowPresenter;
+import android.util.Log;
+
+import com.google.gson.Gson;
+
+import java.util.List;
+
+/**
+ * This example shows how to play music files and build a simple track list.
+ */
+public class MusicConsumptionExampleFragment extends PlaybackOverlayFragment implements
+ OnItemViewClickedListener, Song.OnSongRowClickListener,
+ MediaPlayerGlue.OnMediaFileFinishedPlayingListener {
+
+ private static final String TAG = "MusicConsumptionExampleFragment";
+ private ArrayObjectAdapter mRowsAdapter;
+ private MediaPlayerGlue mGlue;
+ private int mCurrentSongIndex = 0;
+ private List<Song> mSongList;
+ private boolean mAdapterNotified = false;
+
+ @Override public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (Constants.LOCAL_LOGD) Log.d(TAG, "onCreate");
+
+ mGlue = new MediaPlayerGlue(getActivity(), this) {
+
+ @Override protected void onRowChanged(PlaybackControlsRow row) {
+ if (mRowsAdapter == null || mAdapterNotified) return;
+ //mAdapterNotified = true;
+ mRowsAdapter.notifyArrayItemRangeChanged(0, 1);
+ }
+ };
+ mGlue.setOnMediaFileFinishedPlayingListener(this);
+
+ String json = Utils.inputStreamToString(
+ getResources().openRawResource(R.raw.music_consumption_example));
+ mSongList = new Gson().fromJson(json, SongList.class).getSongs();
+ Song song = mSongList.get(mCurrentSongIndex);
+ MediaPlayerGlue.MetaData metaData = new MediaPlayerGlue.MetaData();
+ metaData.setArtist(song.getDescription());
+ metaData.setTitle(song.getTitle());
+ metaData.setCover(getResources().getDrawable(song.getImageResource(getActivity()), null));
+ Uri uri = Utils.getResourceUri(getActivity(), song.getFileResource(getActivity()));
+ mGlue.setMetaData(metaData);
+ mGlue.setMediaSource(uri);
+
+ setBackgroundType(PlaybackOverlayFragment.BG_LIGHT);
+ addPlaybackControlsRow();
+ }
+
+ @Override public void onStart() {
+ super.onStart();
+ mGlue.enableProgressUpdating(mGlue.hasValidMedia() && mGlue.isMediaPlaying());
+ }
+
+ @Override public void onStop() {
+ super.onStop();
+ mGlue.enableProgressUpdating(false);
+ mGlue.reset();
+ }
+
+ private void addPlaybackControlsRow() {
+ final PlaybackControlsRowPresenter controlsPresenter = mGlue
+ .createControlsRowAndPresenter();
+ ClassPresenterSelector selector = new ClassPresenterSelector();
+ Song.Presenter songPresenter = new Song.Presenter(getActivity());
+ songPresenter.setOnClickListener(this);
+ selector.addClassPresenter(Song.class, songPresenter);
+ selector.addClassPresenter(TrackListHeader.class,
+ new TrackListHeader.Presenter(getActivity()));
+ selector.addClassPresenter(PlaybackControlsRow.class, controlsPresenter);
+ mRowsAdapter = new ArrayObjectAdapter(selector);
+ mRowsAdapter.add(mGlue.getControlsRow());
+ mRowsAdapter.add(new TrackListHeader());
+ mRowsAdapter.addAll(2, mSongList);
+ setAdapter(mRowsAdapter);
+ setOnItemViewClickedListener(this);
+ }
+
+ @Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
+ RowPresenter.ViewHolder rowViewHolder, Row row) {
+ if (!(item instanceof Action)) return;
+ mGlue.onActionClicked((Action) item);
+ }
+
+
+ @Override public void onSongRowClicked(Song song) {
+ mCurrentSongIndex = mSongList.indexOf(song);
+ startPlayback();
+ }
+
+
+ @Override public void onMediaFileFinishedPlaying(MediaPlayerGlue.MetaData song) {
+ if (mGlue.repeatOne()) {
+ startPlayback();
+ return;
+ }
+ if (mGlue.useShuffle()) {
+ mCurrentSongIndex = (int) (Math.random() * mSongList.size());
+ } else mCurrentSongIndex++;
+ if (mCurrentSongIndex >= mSongList.size()) {
+ mCurrentSongIndex = 0;
+ if (!mGlue.repeatAll()) return;
+ }
+ startPlayback();
+ }
+
+ private void startPlayback() {
+ Song song = mSongList.get(mCurrentSongIndex);
+ MediaPlayerGlue.MetaData metaData = new MediaPlayerGlue.MetaData();
+ metaData.setArtist(song.getDescription());
+ metaData.setTitle(song.getTitle());
+ metaData.setCover(getResources().getDrawable(song.getImageResource(getActivity()), null));
+
+ Uri uri = Utils.getResourceUri(getActivity(), song.getFileResource(getActivity()));
+ mGlue.setMetaData(metaData);
+ mGlue.setMediaSource(uri);
+ mGlue.startPlayback();
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/MusicExampleActivity.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/MusicExampleActivity.java
new file mode 100644
index 000000000..3107ed615
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/MusicExampleActivity.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.media;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+
+/**
+ * TODO: Javadoc
+ */
+public class MusicExampleActivity extends Activity {
+
+ @Override public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_music_example);
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/SongListRow.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/SongListRow.java
new file mode 100644
index 000000000..409613241
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/SongListRow.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.media;
+
+import android.support.v17.leanback.widget.Row;
+
+public class SongListRow extends Row {}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/TrackListHeader.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/TrackListHeader.java
new file mode 100644
index 000000000..ff794a24d
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/TrackListHeader.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.media;
+
+import android.content.Context;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.widget.Row;
+import android.support.v17.leanback.widget.RowPresenter;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class TrackListHeader extends Row {
+
+ public static class Presenter extends RowPresenter {
+
+ private final Context mContext;
+
+ public Presenter(Context context) {
+ mContext = context;
+ setHeaderPresenter(null);
+ }
+
+ @Override public boolean isUsingDefaultSelectEffect() {
+ return false;
+ }
+
+ @Override protected ViewHolder createRowViewHolder(ViewGroup parent) {
+ View view = LayoutInflater.from(mContext).inflate(R.layout.row_track_list_header, parent, false);
+ view.setFocusable(false);
+ view.setFocusableInTouchMode(false);
+ return new ViewHolder(view);
+ }
+ }
+
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoConsumptionExampleFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoConsumptionExampleFragment.java
new file mode 100644
index 000000000..9a40635cf
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoConsumptionExampleFragment.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.media;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.support.v17.leanback.app.PlaybackOverlayFragment;
+import android.support.v17.leanback.supportleanbackshowcase.app.MainFragment;
+import android.support.v17.leanback.widget.Action;
+import android.support.v17.leanback.widget.ArrayObjectAdapter;
+import android.support.v17.leanback.widget.OnItemViewClickedListener;
+import android.support.v17.leanback.widget.PlaybackControlsRow;
+import android.support.v17.leanback.widget.PlaybackControlsRowPresenter;
+import android.support.v17.leanback.widget.Presenter;
+import android.support.v17.leanback.widget.Row;
+import android.support.v17.leanback.widget.RowPresenter;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+
+
+public class VideoConsumptionExampleFragment extends PlaybackOverlayFragment implements
+ OnItemViewClickedListener, MediaPlayerGlue.OnMediaFileFinishedPlayingListener {
+
+ private static final String URL = "http://techslides.com/demos/sample-videos/small.mp4";
+ private ArrayObjectAdapter mRowsAdapter;
+ private MediaPlayerGlue mGlue;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ mGlue = new VideoMediaPlayerGlue(getActivity(), this) {
+
+ @Override
+ protected void onRowChanged(PlaybackControlsRow row) {
+ if (mRowsAdapter == null) return;
+ mRowsAdapter.notifyArrayItemRangeChanged(0, 1);
+ }
+ };
+ mGlue.setOnMediaFileFinishedPlayingListener(this);
+ MediaPlayerGlue.MetaData metaData = new MediaPlayerGlue.MetaData();
+ metaData.setArtist("A Googler");
+ metaData.setTitle("Diving with Sharks");
+ mGlue.setMetaData(metaData);
+ mGlue.setMediaSource(URL);
+
+ Fragment videoSurfaceFragment = getFragmentManager()
+ .findFragmentByTag(VideoExampleActivity.VIDEO_SURFACE_FRAGMENT_TAG);
+ SurfaceView surface = (SurfaceView) videoSurfaceFragment.getView();
+ surface.getHolder().addCallback(new SurfaceHolder.Callback() {
+ @Override
+ public void surfaceCreated(SurfaceHolder holder) {
+ mGlue.setDisplay(holder);
+ }
+
+ @Override
+ public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+ // Nothing to do
+ }
+
+ @Override
+ public void surfaceDestroyed(SurfaceHolder holder) {
+ }
+ });
+
+ setBackgroundType(PlaybackOverlayFragment.BG_LIGHT);
+ addPlaybackControlsRow();
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ mGlue.enableProgressUpdating(mGlue.hasValidMedia() && mGlue.isMediaPlaying());
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ mGlue.enableProgressUpdating(false);
+ mGlue.reset();
+ }
+
+ private void addPlaybackControlsRow() {
+ final PlaybackControlsRowPresenter controlsPresenter = mGlue
+ .createControlsRowAndPresenter();
+ mRowsAdapter = new ArrayObjectAdapter(controlsPresenter);
+ mRowsAdapter.add(mGlue.getControlsRow());
+ setAdapter(mRowsAdapter);
+ setOnItemViewClickedListener(this);
+ }
+
+ @Override
+ public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
+ RowPresenter.ViewHolder rowViewHolder, Row row) {
+ if (!(item instanceof Action)) return;
+ mGlue.onActionClicked((Action) item);
+ }
+
+
+ @Override
+ public void onMediaFileFinishedPlaying(MediaPlayerGlue.MetaData metaData) {
+ mGlue.startPlayback();
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoExampleActivity.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoExampleActivity.java
new file mode 100644
index 000000000..63eef8219
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoExampleActivity.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.media;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+
+/**
+ * TODO: Javadoc
+ */
+public class VideoExampleActivity extends Activity {
+
+ public static final String VIDEO_SURFACE_FRAGMENT_TAG = "VIDEO_SURFACE";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_video_example);
+
+
+ getFragmentManager().beginTransaction()
+ .replace(R.id.videoFragment, new VideoSurfaceFragment(), VIDEO_SURFACE_FRAGMENT_TAG)
+ .add(R.id.videoFragment, new VideoConsumptionExampleFragment())
+ .commit();
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoMediaPlayerGlue.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoMediaPlayerGlue.java
new file mode 100644
index 000000000..52ab09fb9
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoMediaPlayerGlue.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.media;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.support.v17.leanback.app.PlaybackOverlayFragment;
+import android.support.v17.leanback.supportleanbackshowcase.app.media.MediaPlayerGlue;
+import android.support.v17.leanback.widget.Action;
+import android.support.v17.leanback.widget.ArrayObjectAdapter;
+import android.support.v17.leanback.widget.PlaybackControlsRow;
+import android.support.v17.leanback.widget.PlaybackControlsRowPresenter;
+
+public abstract class VideoMediaPlayerGlue extends MediaPlayerGlue {
+
+ private final PlaybackControlsRow.ClosedCaptioningAction mClosedCaptioningAction;
+
+ public VideoMediaPlayerGlue(Context context, PlaybackOverlayFragment fragment) {
+ super(context, fragment);
+
+ // Instantiate secondary actions
+ mClosedCaptioningAction = new PlaybackControlsRow.ClosedCaptioningAction(context);
+ setFadingEnabled(true);
+ }
+
+ @Override protected void addSecondaryActions(ArrayObjectAdapter secondaryActionsAdapter) {
+ secondaryActionsAdapter.add(mClosedCaptioningAction);
+ secondaryActionsAdapter.add(mThumbsDownAction);
+ secondaryActionsAdapter.add(mThumbsUpAction);
+ }
+
+ @Override public void onActionClicked(Action action) {
+ super.onActionClicked(action);
+ if (action == mClosedCaptioningAction) {
+ mClosedCaptioningAction.nextIndex();
+ }
+ }
+
+ public void setupControlsRowPresenter(PlaybackControlsRowPresenter presenter) {
+ // TODO: hahnr@ move into resources
+ presenter.setProgressColor(Color.parseColor("#EEFF41"));
+ presenter.setBackgroundColor(Color.parseColor("#007236"));
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoSurfaceFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoSurfaceFragment.java
new file mode 100644
index 000000000..158a048c4
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/media/VideoSurfaceFragment.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.media;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+
+public class VideoSurfaceFragment extends Fragment {
+
+ private static final String TAG = "VideoSurfaceFragment";
+
+ @Override public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ }
+
+ @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.video_surface_fragment, null);
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/settings/SettingsExampleActivity.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/settings/SettingsExampleActivity.java
new file mode 100644
index 000000000..01963caf7
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/settings/SettingsExampleActivity.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.settings;
+
+import android.app.Activity;
+import android.app.Fragment;
+import android.os.Bundle;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+
+/*
+ * TODO: Javadoc
+ */
+public class SettingsExampleActivity extends Activity {
+
+ @Override public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_settings_example);
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/settings/SettingsExampleFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/settings/SettingsExampleFragment.java
new file mode 100644
index 000000000..b9bb77f6a
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/settings/SettingsExampleFragment.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.settings;
+
+import android.app.Fragment;
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v14.preference.PreferenceFragment;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.preference.LeanbackPreferenceFragment;
+import android.support.v17.preference.LeanbackSettingsFragment;
+import android.support.v7.preference.DialogPreference;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
+import android.widget.Toast;
+
+import java.util.Arrays;
+import java.util.Stack;
+
+public class SettingsExampleFragment extends LeanbackSettingsFragment implements DialogPreference.TargetFragment {
+
+ private final Stack<Fragment> fragments = new Stack<Fragment>();
+
+ @Override
+ public void onPreferenceStartInitialScreen() {
+ startPreferenceFragment(buildPreferenceFragment(R.xml.prefs, null));
+ }
+
+ @Override
+ public boolean onPreferenceStartFragment(PreferenceFragment preferenceFragment,
+ Preference preference) {
+ return false;
+ }
+
+ @Override
+ public boolean onPreferenceStartScreen(PreferenceFragment preferenceFragment,
+ PreferenceScreen preferenceScreen) {
+ PreferenceFragment frag = buildPreferenceFragment(R.xml.prefs, preferenceScreen.getKey());
+ startPreferenceFragment(frag);
+ return true;
+ }
+
+ @Override
+ public Preference findPreference(CharSequence prefKey) {
+ return ((PreferenceFragment) fragments.peek()).findPreference(prefKey);
+ }
+
+ private PreferenceFragment buildPreferenceFragment(int preferenceResId, String root) {
+ PreferenceFragment fragment = new PrefFragment();
+ Bundle args = new Bundle();
+ args.putInt("preferenceResource", preferenceResId);
+ args.putString("root", root);
+ fragment.setArguments(args);
+ return fragment;
+ }
+
+ private class PrefFragment extends LeanbackPreferenceFragment {
+
+ @Override
+ public void onCreatePreferences(Bundle bundle, String s) {
+ String root = getArguments().getString("root", null);
+ int prefResId = getArguments().getInt("preferenceResource");
+ if (root == null) {
+ addPreferencesFromResource(prefResId);
+ } else {
+ setPreferencesFromResource(prefResId, root);
+ }
+ }
+
+ @Override
+ public boolean onPreferenceTreeClick(Preference preference) {
+ final String[] keys = {"prefs_wifi_connect_wps", "prefs_date", "prefs_time",
+ "prefs_date_time_use_timezone", "app_banner_sample_app", "pref_force_stop",
+ "pref_uninstall", "pref_more_info"};
+ if (Arrays.asList(keys).contains(preference.getKey())) {
+ Toast.makeText(getActivity(), "Implement your own action handler.", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+ return super.onPreferenceTreeClick(preference);
+ }
+
+ @Override
+ public void onAttach(Context context) {
+ fragments.push(this);
+ super.onAttach(context);
+ }
+
+ @Override
+ public void onDetach() {
+ fragments.pop();
+ super.onDetach();
+ }
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample1stStepFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample1stStepFragment.java
new file mode 100644
index 000000000..b40cc8257
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample1stStepFragment.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.wizard;
+
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.v17.leanback.app.GuidedStepFragment;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.widget.GuidanceStylist;
+import android.support.v17.leanback.widget.GuidedAction;
+
+import java.util.List;
+
+/**
+ * The first screen of the rental wizard. Gives the user the choice between renting the movie in SD
+ * or HD quality.
+ */
+public class WizardExample1stStepFragment extends WizardExampleBaseStepFragment {
+
+ private static final int ACTION_ID_BUY_HD = 1;
+ private static final int ACTION_ID_BUY_SD = ACTION_ID_BUY_HD + 1;
+
+ @NonNull
+ @Override
+ public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) {
+ GuidanceStylist.Guidance guidance = new GuidanceStylist.Guidance(mMovie.getTitle(),
+ getString(R.string.wizard_example_choose_rent_options),
+ mMovie.getBreadcrump(), null);
+ return guidance;
+ }
+
+ @Override
+ public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
+ GuidedAction action = new GuidedAction.Builder()
+ .id(ACTION_ID_BUY_HD)
+ .title(getString(R.string.wizard_example_rent_hd))
+ .editable(false)
+ .description(mMovie.getPriceHd() + " " +
+ getString(R.string.wizard_example_watch_hd))
+ .build();
+ actions.add(action);
+ action = new GuidedAction.Builder()
+ .id(ACTION_ID_BUY_SD)
+ .title(getString(R.string.wizard_example_rent_sd))
+ .editable(false)
+ .description(mMovie.getPriceSd() + " " +
+ getString(R.string.wizard_example_watch_sd))
+ .build();
+ actions.add(action);
+ }
+
+ @Override
+ public void onGuidedActionClicked(GuidedAction action) {
+ boolean rentHd = ACTION_ID_BUY_HD == action.getId();
+ GuidedStepFragment fragment = WizardExample2ndStepFragment.build(rentHd, this);
+ add(getFragmentManager(), fragment);
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample2ndStepFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample2ndStepFragment.java
new file mode 100644
index 000000000..c1df8a131
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample2ndStepFragment.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.wizard;
+
+import android.graphics.Color;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.support.annotation.NonNull;
+import android.support.v17.leanback.app.GuidedStepFragment;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.widget.GuidanceStylist;
+import android.support.v17.leanback.widget.GuidedAction;
+import android.support.v17.leanback.widget.GuidedActionsStylist;
+import android.widget.Toast;
+
+import java.util.List;
+
+/**
+ * Displays the second screen of the rental wizard which requires the user to confirm his purchase.
+ */
+public class WizardExample2ndStepFragment extends WizardExampleBaseStepFragment {
+
+ private static final String ARG_HD = "hd";
+ private static final int ACTION_ID_CONFIRM = 1;
+ private static final int ACTION_ID_PAYMENT_METHOD = ACTION_ID_CONFIRM + 1;
+
+ public static GuidedStepFragment build(boolean hd, WizardExampleBaseStepFragment previousFragment) {
+ GuidedStepFragment fragment = new WizardExample2ndStepFragment();
+ // Reuse the same arguments this fragment was given.
+ Bundle args = previousFragment.getArguments();
+ args.putBoolean(ARG_HD, hd);
+ fragment.setArguments(args);
+ return fragment;
+ }
+
+ @NonNull
+ @Override
+ public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) {
+ GuidanceStylist.Guidance guidance = new GuidanceStylist.Guidance(mMovie.getTitle(),
+ getString(R.string.wizard_example_rental_period),
+ mMovie.getBreadcrump(), null);
+ return guidance;
+
+ }
+
+ @Override
+ public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
+ boolean rentHighDefinition = getArguments().getBoolean(ARG_HD);
+
+ GuidedAction action = new GuidedAction.Builder()
+ .id(ACTION_ID_CONFIRM)
+ .title(getString(R.string.wizard_example_rent))
+ .description(rentHighDefinition ? mMovie.getPriceHd() : mMovie.getPriceSd())
+ .editable(false)
+ .build();
+ actions.add(action);
+ action = new GuidedAction.Builder()
+ .id(ACTION_ID_PAYMENT_METHOD)
+ .title(getString(R.string.wizard_example_payment_method))
+ .editTitle("")
+ .description(getString(R.string.wizard_example_input_credit))
+ .editable(true)
+ .build();
+ actions.add(action);
+ }
+
+ @Override
+ public void onGuidedActionEdited(GuidedAction action) {
+ CharSequence editTitle = action.getEditTitle();
+ if (TextUtils.isDigitsOnly(editTitle) && editTitle.length() == 16) {
+ action.setDescription(getString(R.string.wizard_example_visa,
+ editTitle.subSequence(editTitle.length() - 4, editTitle.length())));
+ } else if (editTitle.length() == 0) {
+ action.setDescription(getString(R.string.wizard_example_input_credit));
+ } else {
+ action.setDescription(getString(R.string.wizard_example_input_credit_wrong));
+ }
+ }
+
+ @Override
+ public void onGuidedActionClicked(GuidedAction action) {
+ if (ACTION_ID_CONFIRM == action.getId()) {
+ GuidedStepFragment fragment = new WizardExample3rdStepFragment();
+ fragment.setArguments(getArguments());
+ add(getFragmentManager(), fragment);
+ }
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample3rdStepFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample3rdStepFragment.java
new file mode 100644
index 000000000..37f662f0a
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample3rdStepFragment.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.wizard;
+
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.annotation.NonNull;
+import android.support.v17.leanback.app.GuidedStepFragment;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.widget.GuidanceStylist;
+import android.support.v17.leanback.widget.GuidedAction;
+import android.support.v17.leanback.widget.GuidedActionsStylist;
+
+import java.util.List;
+
+/**
+ * This is the third screen of the rental wizard which will display a progressbar while waiting for
+ * the server to process the rental. The server communication is faked for the sake of this example
+ * by waiting four seconds until continuing.
+ */
+public class WizardExample3rdStepFragment extends WizardExampleBaseStepFragment {
+
+ private static final int ACTION_ID_PROCESSING = 1;
+ private final Handler mFakeHttpHandler = new Handler();
+
+ @Override
+ public void onStart() {
+ super.onStart();
+
+ // Fake Http call by creating some sort of delay.
+ mFakeHttpHandler.postDelayed(fakeHttpRequestRunnable, 4000L);
+ }
+
+ @Override
+ public GuidedActionsStylist onCreateActionsStylist() {
+ GuidedActionsStylist stylist = new GuidedActionsStylist() {
+ @Override
+ public int onProvideItemLayoutId() {
+ return R.layout.wizard_progress_action_item;
+ }
+
+ @Override
+ public int onProvideLayoutId() {
+ return R.layout.wizard_progress_action_container;
+ }
+ };
+ return stylist;
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+
+ // Make sure to cancel the execution of the Runnable in case the fragment is stopped.
+ mFakeHttpHandler.removeCallbacks(fakeHttpRequestRunnable);
+ }
+
+ @NonNull
+ @Override
+ public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) {
+ GuidanceStylist.Guidance guidance = new GuidanceStylist.Guidance(mMovie.getTitle(),
+ getString(R.string.wizard_example_just_a_second),
+ mMovie.getBreadcrump(), null);
+ return guidance;
+ }
+
+ @Override
+ public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
+ GuidedAction action = new GuidedAction.Builder()
+ .id(ACTION_ID_PROCESSING)
+ .title(getString(R.string.wizard_example_processing))
+ .infoOnly(true)
+ .build();
+ actions.add(action);
+ }
+
+ private final Runnable fakeHttpRequestRunnable = new Runnable() {
+ @Override
+ public void run() {
+ GuidedStepFragment fragment = new WizardExample4thStepFragment();
+ fragment.setArguments(getArguments());
+ add(getFragmentManager(), fragment);
+ }
+ };
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample4thStepFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample4thStepFragment.java
new file mode 100644
index 000000000..be5e6459a
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExample4thStepFragment.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.wizard;
+
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.widget.GuidanceStylist;
+import android.support.v17.leanback.widget.GuidedAction;
+import android.widget.Toast;
+
+import java.util.List;
+
+/**
+ * The last screen of the Wizard gives to options to either watch the rented movie now or later. Due
+ * to keep this example simple and focused on the usage of the GuidedStepFragment, clicking on
+ * either action will end the wizard. You might however start a new Activity playing the movie.
+ */
+public class WizardExample4thStepFragment extends WizardExampleBaseStepFragment {
+
+ private static final int ACTION_ID_WATCH = 1;
+ private static final int ACTION_ID_LATER = ACTION_ID_WATCH + 1;
+
+ @NonNull
+ @Override
+ public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) {
+ GuidanceStylist.Guidance guidance = new GuidanceStylist.Guidance(mMovie.getTitle(),
+ getString(R.string.wizard_example_rental_period),
+ mMovie.getBreadcrump(), null);
+ return guidance;
+ }
+
+ @Override
+ public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
+ GuidedAction action = new GuidedAction.Builder()
+ .id(ACTION_ID_WATCH)
+ .editable(false)
+ .title(getString(R.string.wizard_example_watch_now))
+ .build();
+ actions.add(action);
+ action = new GuidedAction.Builder()
+ .id(ACTION_ID_LATER)
+ .editable(false)
+ .title(getString(R.string.wizard_example_later))
+ .build();
+ actions.add(action);
+ }
+
+ @Override
+ public void onGuidedActionClicked(GuidedAction action) {
+ if (ACTION_ID_WATCH == action.getId()) {
+ Toast.makeText(getActivity(), getString(R.string.wizard_example_watch_now_clicked),
+ Toast.LENGTH_SHORT).show();
+ }
+ getActivity().finish();
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExampleActivity.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExampleActivity.java
new file mode 100644
index 000000000..f5d293708
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExampleActivity.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.wizard;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.PersistableBundle;
+import android.support.v17.leanback.app.GuidedStepFragment;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+
+/**
+ * An Activity displaying a wizard for renting a movie.
+ */
+public class WizardExampleActivity extends Activity {
+
+ @Override public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ getWindow().setBackgroundDrawableResource(R.drawable.wizard_background_blackned);
+
+ GuidedStepFragment fragment = new WizardExample1stStepFragment();
+ fragment.setArguments(getIntent().getExtras()); // Delegate Movie to first step.
+ GuidedStepFragment.addAsRoot(this, fragment, android.R.id.content);
+ }
+
+ @Override
+ public void onBackPressed() {
+ if (GuidedStepFragment.getCurrentGuidedStepFragment(getFragmentManager())
+ instanceof WizardExample4thStepFragment) {
+ // The user 'bought' the product. When he presses 'Back' the Wizard will be closed and
+ // he will not be send back to 'Processing Payment...'-Screen.
+ finish();
+ } else super.onBackPressed();
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExampleBaseStepFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExampleBaseStepFragment.java
new file mode 100644
index 000000000..8fd59814b
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/wizard/WizardExampleBaseStepFragment.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.app.wizard;
+
+import android.os.Bundle;
+import android.support.v17.leanback.app.GuidedStepFragment;
+import android.support.v17.leanback.supportleanbackshowcase.models.Movie;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+
+/**
+ * A base class which provides all it's implementations with a method #getWizardActivity(). It also
+ * makes sure that the wizard is using the correct theme.
+ */
+public abstract class WizardExampleBaseStepFragment extends GuidedStepFragment {
+
+ protected Movie mMovie;
+
+ @Override
+ public int onProvideTheme() {
+ return R.style.Theme_Example_LeanbackWizard;
+ }
+
+ WizardExampleActivity getWizardActivity() {
+ if (!(getActivity() instanceof WizardExampleActivity)) {
+ throw new IllegalStateException(WizardExampleActivity.class.getName() + " expected.");
+ }
+ return (WizardExampleActivity) getActivity();
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ mMovie = (Movie) getArguments().getSerializable("movie");
+ super.onCreate(savedInstanceState);
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/CharacterCardView.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/CharacterCardView.java
new file mode 100644
index 000000000..962adb007
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/CharacterCardView.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.cards;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.supportleanbackshowcase.models.Card;
+import android.support.v17.leanback.widget.BaseCardView;
+import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
+import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+public class CharacterCardView extends BaseCardView {
+
+ public CharacterCardView(Context context) {
+ super(context, null, R.style.CharacterCardStyle);
+ LayoutInflater.from(getContext()).inflate(R.layout.character_card, this);
+ setOnFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ ImageView mainImage = (ImageView) findViewById(R.id.main_image);
+ View container = findViewById(R.id.container);
+ if (hasFocus) {
+ container.setBackgroundResource(R.drawable.character_focused);
+ mainImage.setBackgroundResource(R.drawable.character_focused);
+ } else {
+ container.setBackgroundResource(R.drawable.character_not_focused_padding);
+ mainImage.setBackgroundResource(R.drawable.character_not_focused);
+ }
+ }
+ });
+ setFocusable(true);
+ }
+
+ public void updateUi(Card card) {
+ TextView primaryText = (TextView) findViewById(R.id.primary_text);
+ final ImageView imageView = (ImageView) findViewById(R.id.main_image);
+
+ primaryText.setText(card.getTitle());
+ if (card.getLocalImageResourceName() != null) {
+ int resourceId = card.getLocalImageResourceId(getContext());
+ Bitmap bitmap = BitmapFactory
+ .decodeResource(getContext().getResources(), resourceId);
+ RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(getContext().getResources(), bitmap);
+ drawable.setAntiAlias(true);
+ drawable.setCornerRadius(Math.max(bitmap.getWidth(), bitmap.getHeight()) / 2.0f);
+ imageView.setImageDrawable(drawable);
+ }
+ }
+
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/TextCardView.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/TextCardView.java
new file mode 100644
index 000000000..830b47441
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/TextCardView.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.cards;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.supportleanbackshowcase.models.Card;
+import android.support.v17.leanback.widget.BaseCardView;
+import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
+import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
+import android.view.LayoutInflater;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+public class TextCardView extends BaseCardView {
+
+ public TextCardView(Context context) {
+ super(context, null, R.style.TextCardStyle);
+ LayoutInflater.from(getContext()).inflate(R.layout.text_icon_card, this);
+ setFocusable(true);
+ }
+
+ public void updateUi(Card card) {
+ TextView extraText = (TextView) findViewById(R.id.extra_text);
+ TextView primaryText = (TextView) findViewById(R.id.primary_text);
+ final ImageView imageView = (ImageView) findViewById(R.id.main_image);
+
+ extraText.setText(card.getExtraText());
+ primaryText.setText(card.getTitle());
+
+ // Create a rounded drawable.
+ int resourceId = card.getLocalImageResourceId(getContext());
+ Bitmap bitmap = BitmapFactory
+ .decodeResource(getContext().getResources(), resourceId);
+ RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(getContext().getResources(), bitmap);
+ drawable.setAntiAlias(true);
+ drawable.setCornerRadius(
+ Math.max(bitmap.getWidth(), bitmap.getHeight()) / 2.0f);
+ imageView.setImageDrawable(drawable);
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/AbstractCardPresenter.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/AbstractCardPresenter.java
new file mode 100644
index 000000000..0301cdc1c
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/AbstractCardPresenter.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package android.support.v17.leanback.supportleanbackshowcase.cards.presenters;
+
+import android.content.Context;
+import android.support.v17.leanback.supportleanbackshowcase.models.Card;
+import android.support.v17.leanback.widget.BaseCardView;
+import android.support.v17.leanback.widget.Presenter;
+import android.view.ViewGroup;
+
+/**
+ * This abstract, generic class will create and manage the
+ * ViewHolder and will provide typed Presenter callbacks such that you do not have to perform casts
+ * on your own.
+ *
+ * @param <CardViewType> The cards' View Type.
+ */
+public abstract class AbstractCardPresenter<CardViewType extends BaseCardView> extends Presenter {
+
+ private static final String TAG = "AbstractCardPresenter";
+ private final Context mContext;
+
+ /**
+ * @param context The current context.
+ */
+ public AbstractCardPresenter(Context context) {
+ mContext = context;
+ }
+
+ public Context getContext() {
+ return mContext;
+ }
+
+ @Override public final ViewHolder onCreateViewHolder(ViewGroup parent) {
+ CardViewType cardView = onCreateView();
+ return new ViewHolder(cardView);
+ }
+
+ @Override public final void onBindViewHolder(ViewHolder viewHolder, Object item) {
+ Card card = (Card) item;
+ onBindViewHolder(card, (CardViewType) viewHolder.view);
+ }
+
+ @Override public final void onUnbindViewHolder(ViewHolder viewHolder) {
+ onUnbindViewHolder((CardViewType) viewHolder.view);
+ }
+
+ public void onUnbindViewHolder(CardViewType cardView) {
+ // Nothing to clean up. Override if necessary.
+ }
+
+ /**
+ * Invoked when a new view is created.
+ *
+ * @return Returns the newly created view.
+ */
+ protected abstract CardViewType onCreateView();
+
+ /**
+ * Implement this method to update your card's view with the data bound to it.
+ *
+ * @param card The model containing the data for the card.
+ * @param cardView The view the card is bound to.
+ * @see Presenter#onBindViewHolder(Presenter.ViewHolder, Object)
+ */
+ public abstract void onBindViewHolder(Card card, CardViewType cardView);
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/CardPresenterSelector.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/CardPresenterSelector.java
new file mode 100644
index 000000000..1228b14a9
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/CardPresenterSelector.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.cards.presenters;
+
+import android.content.Context;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.supportleanbackshowcase.models.Card;
+import android.support.v17.leanback.widget.Presenter;
+import android.support.v17.leanback.widget.PresenterSelector;
+
+import java.util.HashMap;
+
+/**
+ * This PresenterSelector will decide what Presenter to use depending on a given card's type.
+ */
+public class CardPresenterSelector extends PresenterSelector {
+
+ private final Context mContext;
+ private final HashMap<Card.Type, Presenter> presenters = new HashMap<Card.Type, Presenter>();
+
+ public CardPresenterSelector(Context context) {
+ mContext = context;
+ }
+
+ @Override
+ public Presenter getPresenter(Object item) {
+ if (!(item instanceof Card)) throw new RuntimeException(
+ String.format("The PresenterSelector only supports data items of type '%s'",
+ Card.class.getName()));
+ Card card = (Card) item;
+ Presenter presenter = presenters.get(card.getType());
+ if (presenter == null) {
+ switch (card.getType()) {
+ case SINGLE_LINE:
+ presenter = new SingleLineCardPresenter(mContext);
+ break;
+ case MOVIE:
+ case MOVIE_BASE:
+ case MOVIE_COMPLETE:
+ case SQUARE_BIG:
+ case GRID_SQUARE:
+ case GAME: {
+ int style = R.style.MovieCardSimpleStyle;
+ if (card.getType() == Card.Type.MOVIE_BASE) {
+ style = R.style.MovieCardBasicStyle;
+ } else if (card.getType() == Card.Type.MOVIE_COMPLETE) {
+ style = R.style.MovieCardCompleteStyle;
+ } else if (card.getType() == Card.Type.SQUARE_BIG) {
+ style = R.style.SquareBigCard;
+ } else if (card.getType() == Card.Type.GRID_SQUARE) {
+ style = R.style.GridCardStyle;
+ } else if (card.getType() == Card.Type.GAME) {
+ style = R.style.GameCardStyle;
+ }
+ presenter = new ImageCardViewPresenter(mContext, style);
+ break;
+ }
+ case SIDE_INFO:
+ presenter = new SideInfoCardPresenter(mContext);
+ break;
+ case TEXT:
+ presenter = new TextCardPresenter(mContext);
+ break;
+ case ICON:
+ presenter = new IconCardPresenter(mContext);
+ break;
+ case CHARACTER:
+ presenter = new CharacterCardPresenter(mContext);
+ break;
+ default:
+ presenter = new ImageCardViewPresenter(mContext);
+ break;
+ }
+ }
+ presenters.put(card.getType(), presenter);
+ return presenter;
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/CharacterCardPresenter.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/CharacterCardPresenter.java
new file mode 100644
index 000000000..35a42a969
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/CharacterCardPresenter.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.cards.presenters;
+
+import android.content.Context;
+import android.support.v17.leanback.supportleanbackshowcase.cards.CharacterCardView;
+import android.support.v17.leanback.supportleanbackshowcase.models.Card;
+
+/**
+ * This Presenter is used to display the characters card row in the DetailView examples.
+ */
+public class CharacterCardPresenter extends AbstractCardPresenter<CharacterCardView> {
+
+ public CharacterCardPresenter(Context context) {
+ super(context);
+ }
+
+ @Override
+ protected CharacterCardView onCreateView() {
+ return new CharacterCardView(getContext());
+ }
+
+ @Override
+ public void onBindViewHolder(Card card, CharacterCardView cardView) {
+ cardView.updateUi(card);
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/IconCardPresenter.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/IconCardPresenter.java
new file mode 100644
index 000000000..bf5be70f4
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/IconCardPresenter.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.cards.presenters;
+
+import android.content.Context;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.widget.ImageCardView;
+import android.view.View;
+import android.widget.ImageView;
+
+/**
+ * This Presenter will display cards which consists of a single icon which will be highlighted by a
+ * surrounding circle when the card is focused. AndroidTV uses these cards for entering settings
+ * menu.
+ */
+public class IconCardPresenter extends ImageCardViewPresenter {
+
+ public IconCardPresenter(Context context) {
+ super(context, R.style.IconCardStyle);
+ }
+
+ @Override
+ protected ImageCardView onCreateView() {
+ final ImageCardView imageCardView = super.onCreateView();
+ final ImageView image = imageCardView.getMainImageView();
+ imageCardView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (hasFocus) {
+ image.setBackgroundResource(R.drawable.icon_focused);
+ } else {
+ image.setBackground(null);
+ }
+ }
+ });
+ return imageCardView;
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/ImageCardViewPresenter.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/ImageCardViewPresenter.java
new file mode 100644
index 000000000..813c1e78d
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/ImageCardViewPresenter.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.cards.presenters;
+
+import android.content.Context;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.supportleanbackshowcase.models.Card;
+import android.support.v17.leanback.widget.ImageCardView;
+import com.squareup.picasso.Picasso;
+
+/**
+ * A very basic {@link ImageCardView} {@link android.support.v17.leanback.widget.Presenter}.You can
+ * pass a custom style for the ImageCardView in the constructor. Use the default constructor to
+ * create a Presenter with a default ImageCardView style.
+ */
+public class ImageCardViewPresenter extends AbstractCardPresenter<ImageCardView> {
+
+ private final int mCardStyleResId;
+
+ public ImageCardViewPresenter(Context context, int cardStyleResId) {
+ super(context);
+ mCardStyleResId = cardStyleResId;
+ }
+
+ public ImageCardViewPresenter(Context context) {
+ super(context);
+ mCardStyleResId = R.style.DefaultCardStyle;
+ }
+
+ @Override
+ protected ImageCardView onCreateView() {
+ return new ImageCardView(getContext(), mCardStyleResId);
+ }
+
+ @Override
+ public void onBindViewHolder(Card card, final ImageCardView cardView) {
+ cardView.setTag(card);
+ cardView.setTitleText(card.getTitle());
+ cardView.setContentText(card.getDescription());
+ if (card.getLocalImageResourceName() != null) {
+ int resourceId = getContext().getResources()
+ .getIdentifier(card.getLocalImageResourceName(),
+ "drawable", getContext().getPackageName());
+ Picasso.with(getContext()).load(resourceId).into(cardView.getMainImageView());
+ }
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/SideInfoCardPresenter.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/SideInfoCardPresenter.java
new file mode 100644
index 000000000..b9f44fc43
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/SideInfoCardPresenter.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.cards.presenters;
+
+import android.content.Context;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.supportleanbackshowcase.models.Card;
+import android.support.v17.leanback.widget.BaseCardView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.squareup.picasso.Picasso;
+
+/**
+ * This Presenter will display a card consisting of an image on the left side of the card followed
+ * by text on the right side. The image and text have equal width. The text will work like a info
+ * box, thus it will be hidden if the parent row is inactive. This behavior is unique to this card
+ * and requires a special focus handler.
+ */
+public class SideInfoCardPresenter extends AbstractCardPresenter<BaseCardView> {
+
+ public SideInfoCardPresenter(Context context) {
+ super(context);
+ }
+
+ @Override
+ protected BaseCardView onCreateView() {
+ final BaseCardView cardView = new BaseCardView(getContext(), null,
+ R.style.SideInfoCardStyle);
+ cardView.setFocusable(true);
+ cardView.addView(LayoutInflater.from(getContext()).inflate(R.layout.side_info_card, null));
+ return cardView;
+ }
+
+ @Override
+ public void onBindViewHolder(Card card, BaseCardView cardView) {
+ ImageView imageView = (ImageView) cardView.findViewById(R.id.main_image);
+ if (card.getLocalImageResourceName() != null) {
+ int width = (int) getContext().getResources()
+ .getDimension(R.dimen.sidetext_image_card_width);
+ int height = (int) getContext().getResources()
+ .getDimension(R.dimen.sidetext_image_card_height);
+ int resourceId = getContext().getResources()
+ .getIdentifier(card.getLocalImageResourceName(),
+ "drawable", getContext().getPackageName());
+ Picasso.with(getContext()).load(resourceId).resize(width, height).centerCrop()
+ .into(imageView);
+ }
+
+ TextView primaryText = (TextView) cardView.findViewById(R.id.primary_text);
+ primaryText.setText(card.getTitle());
+
+ TextView secondaryText = (TextView) cardView.findViewById(R.id.secondary_text);
+ secondaryText.setText(card.getDescription());
+
+ TextView extraText = (TextView) cardView.findViewById(R.id.extra_text);
+ extraText.setText(card.getExtraText());
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/SingleLineCardPresenter.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/SingleLineCardPresenter.java
new file mode 100644
index 000000000..24dedd5c6
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/SingleLineCardPresenter.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.cards.presenters;
+
+import android.content.Context;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.supportleanbackshowcase.models.Card;
+import android.support.v17.leanback.widget.ImageCardView;
+
+/**
+ * This Presenter will display a card which consists of a big image followed by a colored footer.
+ * Not only the colored footer is unique to this card, but also it's footer (info) will be visible
+ * even when its parent row is inactive.
+ */
+public class SingleLineCardPresenter extends ImageCardViewPresenter {
+
+ public SingleLineCardPresenter(Context context) {
+ super(context, R.style.SingleLineCardStyle);
+ }
+
+ @Override public void onBindViewHolder(Card card, ImageCardView cardView) {
+ super.onBindViewHolder(card, cardView);
+ cardView.setInfoAreaBackgroundColor(card.getFooterColor());
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/TextCardPresenter.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/TextCardPresenter.java
new file mode 100644
index 000000000..7e65f0f13
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/cards/presenters/TextCardPresenter.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.cards.presenters;
+
+import android.content.Context;
+import android.support.v17.leanback.supportleanbackshowcase.cards.TextCardView;
+import android.support.v17.leanback.supportleanbackshowcase.models.Card;
+
+/**
+ * The Presenter displays a card consisting of text as a replacement for a big image. The footer is
+ * also quite unique since it does contain two images rather than one or non.
+ */
+public class TextCardPresenter extends AbstractCardPresenter<TextCardView> {
+
+ public TextCardPresenter(Context context) {
+ super(context);
+ }
+
+ @Override
+ protected TextCardView onCreateView() {
+ return new TextCardView(getContext());
+ }
+
+ @Override
+ public void onBindViewHolder(Card card, TextCardView cardView) {
+ cardView.updateUi(card);
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/Card.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/Card.java
new file mode 100644
index 000000000..ccaaf72df
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/Card.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.models;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.util.Log;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * This is a generic example of a custom data object, containing info we might want to keep with
+ * each card on the home screen
+ */
+public class Card {
+
+ @SerializedName("title") private String mTitle = "";
+ @SerializedName("description") private String mDescription = "";
+ @SerializedName("extraText") private String mExtraText = "";
+ @SerializedName("imageUrl") private String mImageUrl;
+ @SerializedName("footerColor") private String mFooterColor = null;
+ @SerializedName("selectedColor") private String mSelectedColor = null;
+ @SerializedName("localImageResource") private String mLocalImageResource = null;
+ @SerializedName("footerIconLocalImageResource") private String mFooterResource = null;
+ @SerializedName("type") private Card.Type mType;
+ @SerializedName("id") private int mId;
+ @SerializedName("width") private int mWidth;
+ @SerializedName("height") private int mHeight;
+
+ public String getTitle() {
+ return mTitle;
+ }
+
+ public int getWidth() {
+ return mWidth;
+ }
+
+ public int getHeight() {
+ return mHeight;
+ }
+
+ public int getId() {
+ return mId;
+ }
+
+ public Card.Type getType() {
+ return mType;
+ }
+
+ public String getDescription() {
+ return mDescription;
+ }
+
+ public String getExtraText() {
+ return mExtraText;
+ }
+
+ public int getFooterColor() {
+ if (mFooterColor == null) return -1;
+ return Color.parseColor(mFooterColor);
+ }
+
+ public int getSelectedColor() {
+ if (mSelectedColor == null) return -1;
+ return Color.parseColor(mSelectedColor);
+ }
+
+ public String getImageUrl() {
+ return mImageUrl;
+ }
+
+ public URI getImageURI() {
+ if (getImageUrl() == null) return null;
+ try {
+ return new URI(getImageUrl());
+ } catch (URISyntaxException e) {
+ Log.d("URI exception: ", getImageUrl());
+ return null;
+ }
+ }
+
+ public int getLocalImageResourceId(Context context) {
+ return context.getResources().getIdentifier(getLocalImageResourceName(), "drawable",
+ context.getPackageName());
+ }
+
+ public String getLocalImageResourceName() {
+ return mLocalImageResource;
+ }
+
+ public String getFooterLocalImageResourceName() {
+ return mFooterResource;
+ }
+
+ public enum Type {
+
+ MOVIE_COMPLETE,
+ MOVIE,
+ MOVIE_BASE,
+ ICON,
+ SQUARE_BIG,
+ SINGLE_LINE,
+ GAME,
+ SQUARE_SMALL,
+ DEFAULT,
+ SIDE_INFO,
+ SIDE_INFO_TEST_1,
+ TEXT,
+ CHARACTER,
+ GRID_SQUARE
+
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/CardRow.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/CardRow.java
new file mode 100644
index 000000000..932b9b940
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/CardRow.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.models;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+/**
+ * This class represents a row of cards. In a real world application you might want to store more
+ * data than in this example.
+ */
+public class CardRow {
+
+ // Used to determine whether the row shall use shadows when displaying its cards or not.
+ @SerializedName("shadow") private boolean mShadow = true;
+ @SerializedName("title") private String mTitle;
+ @SerializedName("cards") private List<Card> mCards;
+
+ public String getTitle() {
+ return mTitle;
+ }
+
+ public boolean useShadow() {
+ return mShadow;
+ }
+
+ public List<Card> getCards() {
+ return mCards;
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/DetailedCard.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/DetailedCard.java
new file mode 100644
index 000000000..8727a4053
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/DetailedCard.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.models;
+
+import android.content.Context;
+import android.support.v17.leanback.supportleanbackshowcase.models.Card;
+
+import com.google.gson.annotations.SerializedName;
+
+public class DetailedCard {
+
+ @SerializedName("title") private String mTitle = "";
+ @SerializedName("description") private String mDescription = "";
+ @SerializedName("text") private String mText = "";
+ @SerializedName("localImageResource") private String mLocalImageResource = null;
+ @SerializedName("price") private String mPrice = null;
+ @SerializedName("characters") private Card[] mCharacters = null;
+ @SerializedName("recommended") private Card[] mRecommended = null;
+ @SerializedName("year") private int mYear = 0;
+
+
+ public String getPrice() {
+ return mPrice;
+ }
+
+ public int getYear() {
+ return mYear;
+ }
+
+ public String getLocalImageResource() {
+ return mLocalImageResource;
+ }
+
+ public String getText() {
+ return mText;
+ }
+
+ public String getDescription() {
+ return mDescription;
+ }
+
+ public String getTitle() {
+ return mTitle;
+ }
+
+ public Card[] getCharacters() {
+ return mCharacters;
+ }
+
+ public Card[] getRecommended() {
+ return mRecommended;
+ }
+
+ public int getLocalImageResourceId(Context context) {
+ return context.getResources()
+ .getIdentifier(getLocalImageResource(), "drawable", context.getPackageName());
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/Movie.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/Movie.java
new file mode 100644
index 000000000..83912b3a0
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/Movie.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.models;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class Movie implements Serializable {
+
+ private static final long serialVersionUID = 133742L;
+
+ @SerializedName("title")
+ private String mTitle = "";
+ @SerializedName("price_hd")
+ private String mPriceHd = "n/a";
+ @SerializedName("price_sd")
+ private String mPriceSd = "n/a";
+ @SerializedName("breadcrump")
+ private String mBreadcrump = "";
+
+ public String getTitle() {
+ return mTitle;
+ }
+
+ public String getBreadcrump() {
+ return mBreadcrump;
+ }
+
+ public String getPriceHd() {
+ return mPriceHd;
+ }
+
+ public String getPriceSd() {
+ return mPriceSd;
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/Song.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/Song.java
new file mode 100644
index 000000000..89729be80
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/Song.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.models;
+
+import android.content.Context;
+import android.support.v17.leanback.supportleanbackshowcase.R;
+import android.support.v17.leanback.widget.Row;
+import android.support.v17.leanback.widget.RowPresenter;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import com.google.gson.annotations.SerializedName;
+
+public class Song extends Row {
+
+ @SerializedName("title") private String mTitle = "";
+ @SerializedName("description") private String mDescription = "";
+ @SerializedName("text") private String mText = "";
+ @SerializedName("image") private String mImage = null;
+ @SerializedName("file") private String mFile = null;
+ @SerializedName("duration") private String mDuration = null;
+ @SerializedName("number") private int mNumber = 0;
+
+
+ public String getDuration() {
+ return mDuration;
+ }
+
+ public int getNumber() {
+ return mNumber;
+ }
+
+ public String getText() {
+ return mText;
+ }
+
+ public String getDescription() {
+ return mDescription;
+ }
+
+ public String getTitle() {
+ return mTitle;
+ }
+
+ public int getFileResource(Context context) {
+ return context.getResources()
+ .getIdentifier(mFile, "raw", context.getPackageName());
+ }
+
+ public int getImageResource(Context context) {
+ return context.getResources()
+ .getIdentifier(mImage, "drawable", context.getPackageName());
+ }
+
+ public interface OnSongRowClickListener {
+
+ void onSongRowClicked(Song song);
+
+ }
+
+ public static class Presenter extends RowPresenter implements View.OnClickListener {
+
+ private final Context mContext;
+ private OnSongRowClickListener mClickListener;
+
+
+ public Presenter(Context context) {
+ mContext = context;
+ setHeaderPresenter(null);
+ }
+
+ public void setOnClickListener(OnSongRowClickListener listener) {
+ mClickListener = listener;
+ }
+
+ @Override protected ViewHolder createRowViewHolder(ViewGroup parent) {
+ View view = LayoutInflater.from(mContext).inflate(R.layout.row_song, parent, false);
+ view.findViewById(R.id.rowContainer).setOnClickListener(this);
+ return new ViewHolder(view);
+ }
+
+ @Override public boolean isUsingDefaultSelectEffect() {
+ return false;
+ }
+
+ @Override protected void onBindRowViewHolder(ViewHolder vh, Object item) {
+ super.onBindRowViewHolder(vh, item);
+ Song song = (Song) item;
+ ((TextView) vh.view.findViewById(R.id.trackNumber)).setText("" + song.getNumber());
+ ((TextView) vh.view.findViewById(R.id.trackDuration)).setText(song.getDuration());
+ String text = song.getTitle() + " / " + song.getDescription();
+ ((TextView) vh.view.findViewById(R.id.trackName)).setText(text);
+ vh.view.findViewById(R.id.rowContainer).setTag(item);
+ }
+
+ @Override public void onClick(View v) {
+ if (mClickListener == null) return;
+ mClickListener.onSongRowClicked((Song) v.getTag());
+ }
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/SongList.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/SongList.java
new file mode 100644
index 000000000..034ae19b5
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/models/SongList.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.models;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+/**
+ */
+public class SongList {
+
+ @SerializedName("songs") private List<Song> mSongs;
+
+ public List<Song> getSongs() {
+ return mSongs;
+ }
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/CardListRow.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/CardListRow.java
new file mode 100644
index 000000000..19f2437da
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/CardListRow.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.utils;
+
+import android.support.v17.leanback.supportleanbackshowcase.app.details.ShadowRowPresenterSelector;
+import android.support.v17.leanback.supportleanbackshowcase.models.CardRow;
+import android.support.v17.leanback.widget.HeaderItem;
+import android.support.v17.leanback.widget.ListRow;
+import android.support.v17.leanback.widget.ObjectAdapter;
+
+/**
+ * The {@link CardListRow} allows the {@link ShadowRowPresenterSelector} to access the {@link CardRow}
+ * held by the row and determine whether to use a {@link android.support.v17.leanback.widget.Presenter}
+ * with or without a shadow.
+ */
+public class CardListRow extends ListRow {
+
+ private CardRow mCardRow;
+
+ public CardListRow(HeaderItem header, ObjectAdapter adapter, CardRow cardRow) {
+ super(header, adapter);
+ setCardRow(cardRow);
+ }
+
+ public CardRow getCardRow() {
+ return mCardRow;
+ }
+
+ public void setCardRow(CardRow cardRow) {
+ this.mCardRow = cardRow;
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/Constants.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/Constants.java
new file mode 100644
index 000000000..1c9dd9cf6
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/Constants.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.utils;
+
+public class Constants {
+
+ public static final boolean LOCAL_LOGD = true;
+
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/PicassoBackgroundManagerTarget.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/PicassoBackgroundManagerTarget.java
new file mode 100644
index 000000000..2723d0b07
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/PicassoBackgroundManagerTarget.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.utils;
+
+import android.graphics.Bitmap;
+import android.graphics.drawable.Drawable;
+import android.support.v17.leanback.app.BackgroundManager;
+
+import com.squareup.picasso.Picasso;
+import com.squareup.picasso.Target;
+
+/**
+ * Picasso target for updating default_background images
+ */
+public class PicassoBackgroundManagerTarget implements Target {
+
+ private BackgroundManager mBackgroundManager;
+
+ public PicassoBackgroundManagerTarget(BackgroundManager backgroundManager) {
+ this.mBackgroundManager = backgroundManager;
+ }
+
+ @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) {
+ this.mBackgroundManager.setBitmap(bitmap);
+ }
+
+ @Override public void onBitmapFailed(Drawable drawable) {
+ this.mBackgroundManager.setDrawable(drawable);
+ }
+
+ @Override public void onPrepareLoad(Drawable drawable) {
+ // Do nothing, default_background manager has its own transitions
+ }
+
+ @Override public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ PicassoBackgroundManagerTarget that = (PicassoBackgroundManagerTarget) o;
+
+ if (!mBackgroundManager.equals(that.mBackgroundManager)) return false;
+
+ return true;
+ }
+
+ @Override public int hashCode() {
+ return mBackgroundManager.hashCode();
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/ResourceCache.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/ResourceCache.java
new file mode 100644
index 000000000..09a196565
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/ResourceCache.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.utils;
+
+import android.util.SparseArray;
+import android.view.View;
+
+/**
+ * ResourceCache allows retrieving children from a given view and caches the resulting views in
+ * order to prevent future lookups.
+ */
+public class ResourceCache {
+
+ private final SparseArray<View> mCachedViews = new SparseArray<View>();
+
+ public <ViewType extends View> ViewType getViewById(View view, int resId) {
+ View child = mCachedViews.get(resId, null);
+ if (child == null) {
+ child = view.findViewById(resId);
+ mCachedViews.put(resId, child);
+ }
+ return (ViewType) child;
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/Utils.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/Utils.java
new file mode 100644
index 000000000..4416cbe49
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/utils/Utils.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package android.support.v17.leanback.supportleanbackshowcase.utils;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.net.Uri;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * A collection of utility methods, all static.
+ */
+public class Utils {
+
+ public static int convertDpToPixel(Context ctx, int dp) {
+ float density = ctx.getResources().getDisplayMetrics().density;
+ return Math.round((float) dp * density);
+ }
+
+ /**
+ * Will read the content from a given {@link InputStream} and return it as a {@link String}.
+ *
+ * @param inputStream The {@link InputStream} which should be read.
+ * @return Returns <code>null</code> if the the {@link InputStream} could not be read. Else
+ * returns the content of the {@link InputStream} as {@link String}.
+ */
+ public static String inputStreamToString(InputStream inputStream) {
+ try {
+ byte[] bytes = new byte[inputStream.available()];
+ inputStream.read(bytes, 0, bytes.length);
+ String json = new String(bytes);
+ return json;
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ public static Uri getResourceUri(Context context, int resID) {
+ return Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" +
+ context.getResources().getResourcePackageName(resID) + '/' +
+ context.getResources().getResourceTypeName(resID) + '/' +
+ context.getResources().getResourceEntryName(resID));
+ }
+}
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-v21/song_row_background_focused.xml b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-v21/song_row_background_focused.xml
new file mode 100644
index 000000000..34e2bd74b
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-v21/song_row_background_focused.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item>
+ <color android:color="#384248"></color>
+ </item>
+ <item>
+ <ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="?android:attr/colorControlHighlight">
+ <item android:id="@android:id/mask">
+ <shape android:shape="rectangle">
+ <corners android:radius="2dp"/>
+ <solid android:color="#FFFFFF"/>
+ </shape>
+ </item>
+
+ </ripple>
+ </item>
+
+</layer-list> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/background_canyon.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/background_canyon.jpg
new file mode 100644
index 000000000..0f7726175
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/background_canyon.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/background_food.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/background_food.jpg
new file mode 100644
index 000000000..cbe05f83b
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/background_food.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/background_sax.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/background_sax.jpg
new file mode 100644
index 000000000..20fec8cac
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/background_sax.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_dummy_16_9_l.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_dummy_16_9_l.png
new file mode 100644
index 000000000..6088150b3
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_dummy_16_9_l.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_01.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_01.png
new file mode 100755
index 000000000..862f8d6fb
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_01.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_02.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_02.png
new file mode 100755
index 000000000..e10e38387
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_02.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_03.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_03.png
new file mode 100755
index 000000000..9e4ffac9f
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_03.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_04.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_04.png
new file mode 100755
index 000000000..4d0d25d1c
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_04.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_05.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_05.png
new file mode 100755
index 000000000..436af8ee3
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_05.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_06.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_06.png
new file mode 100755
index 000000000..ff05fadc5
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_06.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_07.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_07.png
new file mode 100755
index 000000000..38261b76a
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_07.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_08.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_08.png
new file mode 100755
index 000000000..517467a4f
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_08.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_09.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_09.png
new file mode 100755
index 000000000..7c052cb23
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_movie_09.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_01.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_01.jpg
new file mode 100755
index 000000000..435b2be5f
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_01.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_02.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_02.jpg
new file mode 100755
index 000000000..ca2b0abab
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_02.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_03.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_03.jpg
new file mode 100755
index 000000000..26016ddd9
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_03.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_04.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_04.jpg
new file mode 100755
index 000000000..7c9ea0116
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_04.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_05.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_05.jpg
new file mode 100755
index 000000000..8dbd701a1
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_05.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_06.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_06.jpg
new file mode 100755
index 000000000..9e90c202c
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_06.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_07.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_07.jpg
new file mode 100755
index 000000000..3b7d3913e
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_07.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_08.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_08.jpg
new file mode 100755
index 000000000..c9c00d7d5
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_08.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_09.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_09.jpg
new file mode 100755
index 000000000..4223bc64f
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_09.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_10.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_10.jpg
new file mode 100755
index 000000000..322854619
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_10.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_11.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_11.jpg
new file mode 100755
index 000000000..473954880
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_11.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_12.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_12.jpg
new file mode 100755
index 000000000..734ba57c4
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_12.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_13.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_13.jpg
new file mode 100755
index 000000000..a94a3c34d
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/card_image_music_13.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_action.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_action.png
new file mode 100755
index 000000000..f3cb7afeb
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_action.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_animation.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_animation.png
new file mode 100755
index 000000000..a1d9f40da
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_animation.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_classics.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_classics.png
new file mode 100755
index 000000000..17c1580b1
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_classics.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_comedy.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_comedy.png
new file mode 100755
index 000000000..5a23e6e20
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_comedy.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_crime.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_crime.png
new file mode 100755
index 000000000..52450a6b5
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_crime.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_documentary.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_documentary.png
new file mode 100755
index 000000000..afb2b61d4
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_documentary.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_drama.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_drama.png
new file mode 100755
index 000000000..79e1b571b
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/category_drama.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_01.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_01.png
new file mode 100755
index 000000000..9fb73f75e
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_01.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_02.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_02.png
new file mode 100755
index 000000000..9e0abfe51
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_02.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_03.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_03.png
new file mode 100755
index 000000000..cd78b71e2
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_03.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_04.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_04.png
new file mode 100755
index 000000000..bf7561c3a
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_04.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_05.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_05.png
new file mode 100755
index 000000000..eae533875
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_05.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_06.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_06.png
new file mode 100755
index 000000000..b1feda0f2
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_06.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_07.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_07.png
new file mode 100755
index 000000000..0f7dd2136
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_07.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_08.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_08.png
new file mode 100755
index 000000000..b9041372a
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/coffee_and_tea_08.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_01.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_01.png
new file mode 100755
index 000000000..b4757a857
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_01.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_02.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_02.png
new file mode 100755
index 000000000..0d746d323
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_02.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_03.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_03.png
new file mode 100755
index 000000000..ddde1ef0d
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_03.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_04.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_04.png
new file mode 100755
index 000000000..ca09156fe
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_04.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_05.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_05.png
new file mode 100755
index 000000000..8c4d7e6bc
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_05.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_06.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_06.png
new file mode 100755
index 000000000..d81ad8c54
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_06.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_07.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_07.png
new file mode 100755
index 000000000..a0f381daf
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_07.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_08.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_08.png
new file mode 100755
index 000000000..c377d2705
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_08.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_09.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_09.png
new file mode 100755
index 000000000..de5a20774
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_09.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_10.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_10.png
new file mode 100755
index 000000000..958f47e86
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_10.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_11.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_11.png
new file mode 100755
index 000000000..36a8007b4
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_11.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_12.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_12.png
new file mode 100755
index 000000000..4d60e8efd
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_12.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_13.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_13.png
new file mode 100755
index 000000000..b4a883763
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_13.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_14.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_14.png
new file mode 100755
index 000000000..ae3d40b4f
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/food_14.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_angry_bird_w.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_angry_bird_w.png
new file mode 100755
index 000000000..09bc30327
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_angry_bird_w.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_badland_w.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_badland_w.png
new file mode 100755
index 000000000..703a33ee3
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_badland_w.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_leos_fortune_w.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_leos_fortune_w.png
new file mode 100755
index 000000000..badd00a77
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_leos_fortune_w.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_minion_rush_w.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_minion_rush_w.png
new file mode 100755
index 000000000..e76631cb6
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_minion_rush_w.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_monument_valley_w.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_monument_valley_w.png
new file mode 100755
index 000000000..740421952
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/game_monument_valley_w.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_cc.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_cc.png
new file mode 100644
index 000000000..461539485
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_cc.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_installed.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_installed.png
new file mode 100644
index 000000000..190f6bac5
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_installed.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_apps.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_apps.png
new file mode 100755
index 000000000..ed92603d7
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_apps.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_more.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_more.png
new file mode 100755
index 000000000..530757674
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_more.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_parental_control.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_parental_control.png
new file mode 100755
index 000000000..d541c6ac3
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_parental_control.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_settings.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_settings.png
new file mode 100755
index 000000000..f2eaa459d
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_settings.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_time.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_time.png
new file mode 100755
index 000000000..72899aea2
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_time.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_wifi_3_bar.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_wifi_3_bar.png
new file mode 100755
index 000000000..f9abb6c59
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_wifi_3_bar.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_wifi_4_bar.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_wifi_4_bar.png
new file mode 100755
index 000000000..dcd208884
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_settings_wifi_4_bar.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_star_off.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_star_off.png
new file mode 100644
index 000000000..cbee75a4f
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_star_off.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_star_on_yellow.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_star_on_yellow.png
new file mode 100644
index 000000000..28cd07a19
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/ic_star_on_yellow.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/movie_poster_01.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/movie_poster_01.png
new file mode 100644
index 000000000..e09af320f
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/movie_poster_01.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/stars_red.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/stars_red.png
new file mode 100644
index 000000000..e4c6056da
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/stars_red.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/stars_white.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/stars_white.png
new file mode 100644
index 000000000..83e7c8b03
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/stars_white.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_browse.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_browse.png
new file mode 100755
index 000000000..374f35710
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_browse.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_cards.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_cards.png
new file mode 100755
index 000000000..1ddadfab5
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_cards.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_custom_01.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_custom_01.png
new file mode 100755
index 000000000..f73b9b793
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_custom_01.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_detail.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_detail.png
new file mode 100755
index 000000000..aa881b8eb
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_detail.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_dialog.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_dialog.png
new file mode 100755
index 000000000..6508d080c
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_dialog.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_grid.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_grid.png
new file mode 100755
index 000000000..686566f99
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_grid.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_music_consumption.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_music_consumption.png
new file mode 100755
index 000000000..ffc653db5
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_music_consumption.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_settings.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_settings.png
new file mode 100755
index 000000000..8337b928e
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_settings.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_video_consumption.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_video_consumption.png
new file mode 100755
index 000000000..a0a9d95c8
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_video_consumption.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_wizard.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_wizard.png
new file mode 100755
index 000000000..4338d30e0
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/thumbnail_example_wizard.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/title_android_tv.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/title_android_tv.png
new file mode 100644
index 000000000..8d1e24105
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable-xhdpi/title_android_tv.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/app_icon_your_company.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/app_icon_your_company.png
new file mode 100644
index 000000000..0a47b018c
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/app_icon_your_company.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/bg_living_room.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/bg_living_room.jpg
new file mode 100644
index 000000000..47e885179
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/bg_living_room.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/bg_living_room_wide.jpg b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/bg_living_room_wide.jpg
new file mode 100644
index 000000000..156d55cf6
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/bg_living_room_wide.jpg
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/character_focused.xml b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/character_focused.xml
new file mode 100644
index 000000000..5c2570d53
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/character_focused.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+ <padding
+ android:bottom="4dp"
+ android:left="4dp"
+ android:right="4dp"
+ android:top="4dp"></padding>
+ <solid android:color="#FFEEEEEE"></solid>
+</shape> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/character_not_focused.xml b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/character_not_focused.xml
new file mode 100644
index 000000000..db4cf9c7d
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/character_not_focused.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+ <padding
+ android:bottom="4dp"
+ android:left="4dp"
+ android:right="4dp"
+ android:top="4dp"></padding>
+ <solid android:color="#FFCCCCCC"></solid>
+</shape> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/character_not_focused_padding.xml b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/character_not_focused_padding.xml
new file mode 100644
index 000000000..8da381217
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/character_not_focused_padding.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+ <padding
+ android:bottom="4dp"
+ android:left="4dp"
+ android:right="4dp"
+ android:top="4dp"></padding>
+ <solid android:color="#00CCCCCC"></solid>
+</shape> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/default_background.xml b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/default_background.xml
new file mode 100644
index 000000000..d9fa80b2c
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/default_background.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <gradient
+ android:angle="-270"
+ android:endColor="@color/background_gradient_end"
+ android:startColor="@color/background_gradient_start"/>
+</shape> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_01.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_01.png
new file mode 100755
index 000000000..d5b2900f6
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_01.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_02.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_02.png
new file mode 100755
index 000000000..ced0a7cd5
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_02.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_03.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_03.png
new file mode 100755
index 000000000..276cacf05
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_03.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_04.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_04.png
new file mode 100755
index 000000000..e90487d11
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_04.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_05.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_05.png
new file mode 100755
index 000000000..f048ecb20
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_05.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_06.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_06.png
new file mode 100755
index 000000000..f4d15ebfb
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_06.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_07.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_07.png
new file mode 100755
index 000000000..7ac0af3b6
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_07.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_08.png b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_08.png
new file mode 100755
index 000000000..e6fc51e61
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/face_08.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/icon_focused.xml b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/icon_focused.xml
new file mode 100644
index 000000000..bab1cc6f9
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/icon_focused.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+ <solid android:color="#4DEEEEEE"></solid>
+ <size
+ android:width="96dp"
+ android:height="96dp"/>
+</shape> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/overlay_black.xml b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/overlay_black.xml
new file mode 100644
index 000000000..9fccc2454
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/overlay_black.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="#E6000000"></solid>
+</shape> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/song_row_background.xml b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/song_row_background.xml
new file mode 100644
index 000000000..0329874e6
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/song_row_background.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:drawable="@drawable/song_row_background_focused" android:state_focused="true"></item>
+ <item>
+ <color android:color="#384248"></color>
+ </item>
+</selector> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/song_row_background_focused.xml b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/song_row_background_focused.xml
new file mode 100644
index 000000000..152e7e6f8
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/song_row_background_focused.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <color android:color="#384248"></color>
+ </item>
+ <item>
+ <color android:color="#1AFFFFFF"></color>
+ </item>
+</layer-list> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_background_blackned.xml b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_background_blackned.xml
new file mode 100644
index 000000000..bea8d6689
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_background_blackned.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:drawable="@drawable/background_canyon"></item>
+ <item android:drawable="@drawable/overlay_black"></item>
+</layer-list> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_important_action_item_background.xml b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_important_action_item_background.xml
new file mode 100644
index 000000000..b4fd39ec4
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_important_action_item_background.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:drawable="@drawable/wizard_important_action_item_background_focused" android:state_focused="true"></item>
+ <item android:drawable="@drawable/wizard_important_action_item_background_not_focused"></item>
+</selector> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_important_action_item_background_focused.xml b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_important_action_item_background_focused.xml
new file mode 100644
index 000000000..d6a1023c3
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_important_action_item_background_focused.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="#FFFFFF"></solid>
+</shape> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_important_action_item_background_not_focused.xml b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_important_action_item_background_not_focused.xml
new file mode 100644
index 000000000..74cccd0f5
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/drawable/wizard_important_action_item_background_not_focused.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="#B2FFFFFF"></solid>
+</shape> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_cards_example.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_cards_example.xml
new file mode 100644
index 000000000..45b550567
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_cards_example.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <fragment
+ android:id="@+id/cardsFragment"
+ android:name="android.support.v17.leanback.supportleanbackshowcase.app.cards.CardExampleFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"></fragment>
+</RelativeLayout> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_detail_example.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_detail_example.xml
new file mode 100644
index 000000000..1dd92d8c9
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_detail_example.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <fragment
+ android:id="@+id/detailsFragment"
+ android:name="android.support.v17.leanback.supportleanbackshowcase.app.details.DetailViewExampleFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"></fragment>
+</RelativeLayout> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_grid_example.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_grid_example.xml
new file mode 100644
index 000000000..f3fcdeaac
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_grid_example.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <fragment
+ android:id="@+id/cardsFragment"
+ android:name="android.support.v17.leanback.supportleanbackshowcase.app.grid.GridExampleFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"></fragment>
+</RelativeLayout> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_main.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 000000000..9d2eda6c7
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<RelativeLayout
+ android:id="@+id/fragmentContainer"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:deviceIds="tv"
+ tools:ignore="MergeRootFrame">
+</RelativeLayout>
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_music_example.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_music_example.xml
new file mode 100644
index 000000000..9eef61a91
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_music_example.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <fragment
+ android:id="@+id/musicFragment"
+ android:name="android.support.v17.leanback.supportleanbackshowcase.app.media.MusicConsumptionExampleFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"></fragment>
+</RelativeLayout> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_settings_example.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_settings_example.xml
new file mode 100644
index 000000000..c6c81a3a1
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_settings_example.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <fragment
+ android:id="@+id/settingsFragment"
+ android:name="android.support.v17.leanback.supportleanbackshowcase.app.settings.SettingsExampleFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"></fragment>
+</RelativeLayout> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_video_example.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_video_example.xml
new file mode 100644
index 000000000..89e4e6e51
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/activity_video_example.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <RelativeLayout
+ android:id="@+id/videoFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ </RelativeLayout>
+</RelativeLayout> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/character_card.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/character_card.xml
new file mode 100644
index 000000000..dee09a8e6
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/character_card.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:lb="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ lb:cardBackground="@null"
+ lb:layout_viewType="main">
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <FrameLayout
+ android:id="@+id/container"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/character_not_focused_padding">
+
+ <ImageView
+ android:id="@+id/main_image"
+ android:layout_width="@dimen/character_image_card_width"
+ android:layout_height="@dimen/character_image_card_height"
+ android:background="@drawable/character_not_focused"
+ android:src="@drawable/face_08"/>
+ </FrameLayout>
+
+ <TextView
+ android:id="@+id/primary_text"
+ style="@style/Widget.Leanback.ImageCardView.TitleStyle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="7dp"
+ android:fontFamily="sans-serif-condensed"
+ android:gravity="center"/>
+ </LinearLayout>
+</FrameLayout> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/detail_view_content.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/detail_view_content.xml
new file mode 100644
index 000000000..5140ed7e6
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/detail_view_content.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/primary_text"
+ style="@style/Widget.Leanback.DetailsDescriptionTitleStyle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="3dp"
+ android:layout_marginTop="15dp"
+ android:fontFamily="sans-serif-light"
+ android:text="Title Text"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="14dp"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/secondary_text_first"
+ style="@style/Widget.Leanback.DetailsDescriptionSubtitleStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="16dp"
+ android:fontFamily="sans-serif-condensed"
+ android:text="Secondary Text Area"/>
+
+ <TextView
+ android:id="@+id/secondary_text_second"
+ style="@style/Widget.Leanback.DetailsDescriptionSubtitleStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="16dp"
+ android:fontFamily="sans-serif-condensed"
+ android:text="With Icons"/>
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="16dp"
+ android:src="@drawable/ic_cc"/>
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_star_on_yellow"/>
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_star_on_yellow"/>
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_star_on_yellow"/>
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_star_off"/>
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_star_off"/>
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/extra_text"
+ style="@style/Widget.Leanback.DetailsDescriptionBodyStyle"
+ android:layout_width="match_parent"
+ android:fontFamily="sans-serif-regular"
+ android:layout_height="wrap_content"
+ android:text="Filmmaker Guillermo del Toro teas up with Legendary Pictures to bring audiences a unique take on the monster film with this sci/fi production."/>
+</LinearLayout> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/row_song.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/row_song.xml
new file mode 100644
index 000000000..b8d660d50
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/row_song.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:lb="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:orientation="horizontal"
+ android:paddingEnd="@dimen/lb_playback_controls_margin_end"
+ android:paddingStart="@dimen/lb_playback_controls_margin_start"
+ lb:rowHeight="wrap_content">
+
+
+ <RelativeLayout
+ android:id="@+id/rowContainer"
+ android:layout_width="match_parent"
+ android:layout_height="48dp"
+ android:background="@drawable/song_row_background"
+ android:focusable="true"
+ android:focusableInTouchMode="true">
+
+ <TextView
+ android:id="@+id/trackNumber"
+ android:layout_width="56dp"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="32dp"
+ android:fontFamily="sans-serif-regular"
+ android:gravity="center_vertical"
+ android:text="1"
+ android:textColor="#FFFFFF"
+ android:textSize="18sp"/>
+
+
+ <TextView
+ android:id="@+id/trackName"
+ android:layout_width="wrap_content"
+ android:layout_height="48dp"
+ android:layout_alignParentTop="true"
+ android:layout_toEndOf="@+id/trackNumber"
+ android:layout_toLeftOf="@+id/trackDuration"
+ android:fontFamily="sans-serif-regular"
+ android:gravity="center_vertical"
+ android:singleLine="true"
+ android:text="A Song!!11"
+ android:textColor="#FFFFFF"
+ android:textSize="18sp"/>
+
+
+ <TextView
+ android:id="@+id/trackDuration"
+ android:layout_width="66dp"
+ android:layout_height="48dp"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentTop="true"
+ android:layout_marginRight="32dp"
+ android:fontFamily="sans-serif-regular"
+ android:gravity="center_vertical|right"
+ android:text="1:13:54"
+ android:textColor="#80FFFFFF"
+ android:textSize="18sp"/>
+ </RelativeLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/row_track_list_header.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/row_track_list_header.xml
new file mode 100644
index 000000000..df16028fb
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/row_track_list_header.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:lb="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:clipChildren="false"
+ android:clipToPadding="false"
+ android:paddingEnd="@dimen/lb_playback_controls_margin_end"
+ android:paddingStart="@dimen/lb_playback_controls_margin_start"
+ lb:rowHeight="wrap_content">
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="48dp"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentTop="true"
+ android:background="#263238"
+ android:fontFamily="sans-serif-regular"
+ android:gravity="center_vertical"
+ android:paddingLeft="32dp"
+ android:text="Tracks"
+ android:textColor="#80EEEEEE"
+ android:textSize="18sp"/>
+ </RelativeLayout>
+</RelativeLayout> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/side_info_card.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/side_info_card.xml
new file mode 100644
index 000000000..725af09fb
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/side_info_card.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:lb="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/container"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:id="@+id/main_image"
+ android:layout_width="144dp"
+ android:layout_height="144dp"
+ lb:layout_viewType="main"
+ />
+
+ <LinearLayout
+ android:id="@+id/info"
+ android:layout_width="144dp"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingLeft="11dp"
+ android:paddingRight="11dp"
+ android:paddingTop="7dp"
+ android:background="@color/default_card_footer_background_color">
+
+ <TextView
+ android:id="@+id/primary_text"
+ style="@style/Widget.Leanback.ImageCardView.TitleStyle"
+ android:fontFamily="sans-serif-condensed"
+ android:maxLines="2"
+ android:textSize="16sp"/>
+
+ <TextView
+ android:id="@+id/secondary_text"
+ style="@style/Widget.Leanback.ImageCardView.ContentStyle"
+ android:layout_marginTop="4dp"
+ android:fontFamily="sans-serif-condensed"
+ android:maxLines="1"
+ android:textColor="#EEEEEE"/>
+
+ <TextView
+ android:id="@+id/extra_text"
+ style="@style/Widget.Leanback.ImageCardView.ContentStyle"
+ android:layout_marginTop="6dp"
+ android:fontFamily="sans-serif-condensed"
+ android:maxLines="5"/>
+ </LinearLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/text_icon_card.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/text_icon_card.xml
new file mode 100644
index 000000000..339549a07
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/text_icon_card.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:lb="http://schemas.android.com/apk/res-auto"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:id="@+id/extra_text"
+ style="@style/Widget.Leanback.ImageCardView.ContentStyle"
+ android:layout_width="256dp"
+ android:layout_height="wrap_content"
+ android:background="@color/default_card_background_color"
+ android:fontFamily="sans-serif-condensed"
+ android:lines="7"
+ android:maxLines="7"
+ android:paddingBottom="14dp"
+ android:paddingLeft="15dp"
+ android:paddingRight="15dp"
+ android:paddingTop="12dp"
+ lb:layout_viewType="main"/>
+
+ <android.support.v17.leanback.widget.NonOverlappingRelativeLayout
+ android:layout_width="256dp"
+ android:layout_height="36dp"
+ android:background="@color/default_card_footer_background_color"
+ android:gravity="left"
+ android:orientation="horizontal"
+ android:paddingBottom="7dp"
+ android:paddingLeft="12dp"
+ android:paddingRight="12dp"
+ android:paddingTop="7dp">
+
+ <ImageView
+ android:id="@+id/main_image"
+ android:layout_width="36dp"
+ android:layout_height="36dp"
+ android:layout_centerVertical="true"
+ android:layout_gravity="center_vertical"
+ android:layout_marginRight="8dp"
+ android:adjustViewBounds="true"/>
+
+ <TextView
+ android:id="@+id/primary_text"
+ style="@style/Widget.Leanback.ImageCardView.TitleStyle"
+ android:layout_width="match_parent"
+ android:layout_centerVertical="true"
+ android:layout_gravity="left"
+ android:layout_toRightOf="@+id/main_image"
+ android:fontFamily="sans-serif-condensed"
+ android:maxLines="1"
+ />
+
+ <ImageView
+ android:id="@+id/footer_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="32dp"
+ android:layout_alignParentEnd="true"
+ android:layout_centerVertical="true"
+ android:layout_gravity="center_vertical"
+ android:adjustViewBounds="true"
+ android:src="@drawable/stars_white"/>
+
+ </android.support.v17.leanback.widget.NonOverlappingRelativeLayout>
+</merge> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/video_surface_fragment.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/video_surface_fragment.xml
new file mode 100644
index 000000000..ff5be6929
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/video_surface_fragment.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<SurfaceView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+</SurfaceView> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/wizard_progress_action_container.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/wizard_progress_action_container.xml
new file mode 100644
index 000000000..52b8a5ef5
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/wizard_progress_action_container.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <RelativeLayout
+ style="?attr/guidedActionsContainerStyle">
+
+ <FrameLayout
+ android:id="@+id/guidedactions_selector"
+ style="?attr/guidedActionsSelectorStyle"
+ android:visibility="gone"/>
+
+ <android.support.v17.leanback.widget.VerticalGridView
+ android:id="@+id/guidedactions_list"
+ style="?attr/guidedActionsListStyle"/>
+
+ </RelativeLayout>
+
+</RelativeLayout>
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/layout/wizard_progress_action_item.xml b/samples/SupportLeanbackShowcase/app/src/main/res/layout/wizard_progress_action_item.xml
new file mode 100644
index 000000000..32a967939
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/layout/wizard_progress_action_item.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<android.support.v17.leanback.widget.NonOverlappingLinearLayout
+ style="?attr/guidedActionItemContainerStyle"
+ xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <ProgressBar
+ android:id="@+id/progressBar"
+ style="?android:attr/progressBarStyle"
+ android:indeterminateTintMode="src_in"
+ android:indeterminateTint="#FFAB91"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="10dp"
+ android:indeterminate="false"/>
+
+ <android.support.v17.leanback.widget.NonOverlappingLinearLayout
+ android:id="@+id/guidedactions_item_content"
+ style="?attr/guidedActionItemContentStyle">
+
+ <TextView
+ android:id="@+id/guidedactions_item_title"
+ style="?attr/guidedActionItemTitleStyle"
+ android:text="Processing..."/>
+
+ </android.support.v17.leanback.widget.NonOverlappingLinearLayout>
+
+</android.support.v17.leanback.widget.NonOverlappingLinearLayout>
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-hdpi/ic_launcher.png b/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 000000000..cde69bccc
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-mdpi/ic_launcher.png b/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 000000000..c133a0cbd
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-xhdpi/app_banner_sample_app.png b/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-xhdpi/app_banner_sample_app.png
new file mode 100644
index 000000000..222c1e580
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-xhdpi/app_banner_sample_app.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 000000000..bfa42f0e7
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 000000000..324e72cdd
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/cards_example.json b/samples/SupportLeanbackShowcase/app/src/main/res/raw/cards_example.json
new file mode 100644
index 000000000..8b52b02ab
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/cards_example.json
@@ -0,0 +1,506 @@
+[
+ {
+ "title": "Standard",
+ "cards": [
+ {
+ "type": "MOVIE",
+ "title": "The Amazing Spider-Man",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_01"
+ },
+ {
+ "type": "MOVIE",
+ "title": "American Psycho",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_02"
+ },
+ {
+ "type": "MOVIE",
+ "title": "Big Hero 6",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_03"
+ },
+ {
+ "type": "MOVIE",
+ "title": "Edge of Tomorrow",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_04"
+ },
+ {
+ "type": "MOVIE",
+ "title": "The Hobbit: The Desolation of Smaug",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_05"
+ },
+ {
+ "type": "MOVIE",
+ "title": "Interstellar",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_06"
+ },
+ {
+ "type": "MOVIE",
+ "title": "Jurassic Park",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_07"
+ },
+ {
+ "type": "MOVIE",
+ "title": "The Hunger Games: Mockingjay Part I",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_08"
+ },
+ {
+ "type": "MOVIE",
+ "title": "Planes",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_09"
+ }
+ ]
+ },
+ {
+ "title": "Two Line Title",
+ "cards": [
+ {
+ "type": "MOVIE_BASE",
+ "title": "The Amazing Spider-Man",
+ "localImageResource": "card_image_movie_01"
+ },
+ {
+ "type": "MOVIE_BASE",
+ "title": "American Psycho",
+ "localImageResource": "card_image_movie_02"
+ },
+ {
+ "type": "MOVIE_BASE",
+ "title": "Big Hero 6",
+ "localImageResource": "card_image_movie_03"
+ },
+ {
+ "type": "MOVIE_BASE",
+ "title": "Edge of Tomorrow",
+ "localImageResource": "card_image_movie_04"
+ },
+ {
+ "type": "MOVIE_BASE",
+ "title": "The Hobbit: The Desolation of Smaug",
+ "localImageResource": "card_image_movie_05"
+ },
+ {
+ "type": "MOVIE_BASE",
+ "title": "Interstellar",
+ "localImageResource": "card_image_movie_06"
+ },
+ {
+ "type": "MOVIE_BASE",
+ "title": "Jurassic Park",
+ "localImageResource": "card_image_movie_07"
+ },
+ {
+ "type": "MOVIE_BASE",
+ "title": "The Hunger Games: Mockingjay Part I",
+ "localImageResource": "card_image_movie_08"
+ },
+ {
+ "type": "MOVIE_BASE",
+ "title": "Planes",
+ "localImageResource": "card_image_movie_09"
+ }
+ ]
+ },
+ {
+ "title": "Two Line Title + Icon",
+ "cards": [
+ {
+ "type": "MOVIE_COMPLETE",
+ "description": "$3.99",
+ "title": "The Amazing Spider-Man",
+ "footerIconLocalImageResource": "stars_red",
+ "localImageResource": "card_image_movie_01"
+ },
+ {
+ "type": "MOVIE_COMPLETE",
+ "title": "American Psycho",
+ "description": "$3.99",
+ "footerIconLocalImageResource": "stars_red",
+ "localImageResource": "card_image_movie_02"
+ },
+ {
+ "type": "MOVIE_COMPLETE",
+ "title": "Big Hero 6",
+ "description": "$3.99",
+ "footerIconLocalImageResource": "stars_red",
+ "localImageResource": "card_image_movie_03"
+ },
+ {
+ "type": "MOVIE_COMPLETE",
+ "title": "Edge of Tomorrow",
+ "description": "$3.99",
+ "footerIconLocalImageResource": "stars_red",
+ "localImageResource": "card_image_movie_04"
+ },
+ {
+ "type": "MOVIE_COMPLETE",
+ "title": "The Hobbit: The Desolation of Smaug",
+ "description": "$3.99",
+ "footerIconLocalImageResource": "stars_red",
+ "localImageResource": "card_image_movie_05"
+ },
+ {
+ "type": "MOVIE_COMPLETE",
+ "title": "Interstellar",
+ "description": "$3.99",
+ "footerIconLocalImageResource": "stars_red",
+ "localImageResource": "card_image_movie_06"
+ },
+ {
+ "type": "MOVIE_COMPLETE",
+ "title": "Jurassic Park",
+ "description": "$3.99",
+ "footerIconLocalImageResource": "stars_red",
+ "localImageResource": "card_image_movie_07"
+ },
+ {
+ "type": "MOVIE_COMPLETE",
+ "description": "$3.99",
+ "title": "The Hunger Games: Mockingjay Part I",
+ "footerIconLocalImageResource": "stars_red",
+ "localImageResource": "card_image_movie_08"
+ },
+ {
+ "type": "MOVIE_COMPLETE",
+ "title": "Planes",
+ "description": "$3.99",
+ "footerIconLocalImageResource": "stars_red",
+ "localImageResource": "card_image_movie_09"
+ }
+ ]
+ },
+ {
+ "title": "Standard Square",
+ "cards": [
+ {
+ "type": "SQUARE_BIG",
+ "title": "Blue in Green",
+ "description": "Miles Davis",
+ "footerColor": "#bf360C",
+ "localImageResource": "card_image_music_02"
+ },
+ {
+ "type": "SQUARE_BIG",
+ "title": "Blue in Green",
+ "description": "Miles Davis",
+ "footerColor": "#b93221",
+ "localImageResource": "card_image_music_13"
+ },
+ {
+ "type": "SQUARE_BIG",
+ "title": "Blue in Green",
+ "description": "Miles Davis",
+ "footerColor": "#311b92",
+ "localImageResource": "card_image_music_08"
+ },
+ {
+ "type": "SQUARE_BIG",
+ "title": "Blue in Green",
+ "description": "Miles Davis",
+ "footerColor": "#33691e",
+ "localImageResource": "card_image_music_05"
+ },
+ {
+ "type": "SQUARE_BIG",
+ "title": "Blue in Green",
+ "description": "Miles Davis",
+ "footerColor": "#37474f",
+ "localImageResource": "card_image_music_06"
+ },
+ {
+ "type": "SQUARE_BIG",
+ "title": "Blue in Green",
+ "description": "Miles Davis",
+ "footerColor": "#3e2723",
+ "localImageResource": "card_image_music_09"
+ },
+ {
+ "type": "SQUARE_BIG",
+ "title": "Blue in Green",
+ "description": "Miles Davis",
+ "footerColor": "#01579B",
+ "localImageResource": "card_image_music_11"
+ }
+ ]
+ },
+ {
+ "title": "Side Info",
+ "cards": [
+ {
+ "type": "SIDE_INFO",
+ "title": "The Life Aquatic",
+ "description": "Seu Jorge",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "card_image_music_02"
+ },
+ {
+ "type": "SIDE_INFO",
+ "title": "The Life Aquatic",
+ "description": "Seu Jorge",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "card_image_music_13"
+ },
+ {
+ "type": "SIDE_INFO",
+ "title": "The Life Aquatic",
+ "description": "Seu Jorge",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "card_image_music_08"
+ },
+ {
+ "type": "SIDE_INFO",
+ "title": "The Life Aquatic",
+ "description": "Seu Jorge",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "card_image_music_05"
+ },
+ {
+ "type": "SIDE_INFO",
+ "title": "The Life Aquatic",
+ "description": "Seu Jorge",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "card_image_music_06"
+ },
+ {
+ "type": "SIDE_INFO",
+ "title": "The Life Aquatic",
+ "description": "Seu Jorge",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "card_image_music_09"
+ },
+ {
+ "type": "SIDE_INFO",
+ "title": "The Life Aquatic",
+ "description": "Seu Jorge",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "card_image_music_11"
+ }
+ ]
+ },
+ {
+ "title": "Wide (Games)",
+ "cards": [
+ {
+ "type": "GAME",
+ "title": "Angry Birds",
+ "description": "Purchased",
+ "localImageResource": "game_angry_bird_w",
+ "footerIconLocalImageResource": "ic_installed"
+ },
+ {
+ "type": "GAME",
+ "title": "Badland",
+ "description": "Purchased",
+ "localImageResource": "game_badland_w",
+ "footerIconLocalImageResource": "ic_installed"
+ },
+ {
+ "type": "GAME",
+ "title": "Leo's Fortune",
+ "description": "Purchased",
+ "localImageResource": "game_leos_fortune_w",
+ "footerIconLocalImageResource": "ic_installed"
+ },
+ {
+ "type": "GAME",
+ "title": "Minion Rush",
+ "description": "Purchased",
+ "localImageResource": "game_minion_rush_w",
+ "footerIconLocalImageResource": "ic_installed"
+ },
+ {
+ "type": "GAME",
+ "title": "Monument Valley",
+ "description": "Purchased",
+ "localImageResource": "game_monument_valley_w",
+ "footerIconLocalImageResource": "ic_installed"
+ }
+ ]
+ },
+ {
+ "title": "Wide (Videos)",
+ "cards": [
+ {
+ "type": "DEFAULT",
+ "title": "Marseille sea food tour",
+ "description": "9,089 views 3 years ago by ADELAIDE",
+ "localImageResource": "coffee_and_tea_01"
+ },
+ {
+ "type": "DEFAULT",
+ "title": "Marseille sea food tour",
+ "description": "9,089 views 3 years ago by ADELAIDE",
+ "localImageResource": "coffee_and_tea_02"
+ },
+ {
+ "type": "DEFAULT",
+ "title": "Marseille sea food tour",
+ "description": "9,089 views 3 years ago by ADELAIDE",
+ "localImageResource": "coffee_and_tea_03"
+ },
+ {
+ "type": "DEFAULT",
+ "title": "Marseille sea food tour",
+ "description": "9,089 views 3 years ago by ADELAIDE",
+ "localImageResource": "coffee_and_tea_04"
+ },
+ {
+ "type": "DEFAULT",
+ "title": "Marseille sea food tour",
+ "description": "9,089 views 3 years ago by ADELAIDE",
+ "localImageResource": "coffee_and_tea_05"
+ },
+ {
+ "type": "DEFAULT",
+ "title": "Marseille sea food tour",
+ "description": "9,089 views 3 years ago by ADELAIDE",
+ "localImageResource": "coffee_and_tea_06"
+ },
+ {
+ "type": "DEFAULT",
+ "title": "Marseille sea food tour",
+ "description": "9,089 views 3 years ago by ADELAIDE",
+ "localImageResource": "coffee_and_tea_07"
+ },
+ {
+ "type": "DEFAULT",
+ "title": "Marseille sea food tour",
+ "description": "9,089 views 3 years ago by ADELAIDE",
+ "localImageResource": "coffee_and_tea_08"
+ }
+ ]
+ },
+ {
+ "title": "Text",
+ "cards": [
+ {
+ "type": "TEXT",
+ "title": "Jonathan Max",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "face_01"
+ },
+ {
+ "type": "TEXT",
+ "title": "Jonathan Max",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "face_02"
+ },
+ {
+ "type": "TEXT",
+ "title": "Jonathan Max",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "face_03"
+ },
+ {
+ "type": "TEXT",
+ "title": "Jonathan Max",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "face_04"
+ },
+ {
+ "type": "TEXT",
+ "title": "Jonathan Max",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "face_05"
+ },
+ {
+ "type": "TEXT",
+ "title": "Jonathan Max",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "face_06"
+ },
+ {
+ "type": "TEXT",
+ "title": "Jonathan Max",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "face_07"
+ },
+ {
+ "type": "TEXT",
+ "title": "Jonathan Max",
+ "extraText": "Bacon ipsum dolor amet bresaola kevin tenderloin swine shoulder strip steak t-bone picanha turducken beef. Ribeye turkey t-bone pastrami meatball corned beef. Pork belly landjaeger short ribs ground round cupim, brisket ham tri-tip. Pig pork loin hamburger picanha ribeye, pork belly meatball chicken ham boudin sirloin corned beef frankfurter ham hock.",
+ "localImageResource": "face_08"
+ }
+ ]
+ },
+ {
+ "title": "Single Line",
+ "cards": [
+ {
+ "type": "SINGLE_LINE",
+ "title": "Action & Adventure",
+ "footerColor": "#dd004e",
+ "localImageResource": "category_action"
+ },
+ {
+ "type": "SINGLE_LINE",
+ "title": "Animation",
+ "footerColor": "#c51162",
+ "localImageResource": "category_animation"
+ },
+ {
+ "type": "SINGLE_LINE",
+ "title": "Classics",
+ "footerColor": "#9c27b0",
+ "localImageResource": "category_classics"
+ },
+ {
+ "type": "SINGLE_LINE",
+ "title": "Comedy",
+ "footerColor": "#cf4900",
+ "localImageResource": "category_comedy"
+ },
+ {
+ "type": "SINGLE_LINE",
+ "title": "Crime",
+ "footerColor": "#3f51b5",
+ "localImageResource": "category_crime"
+ },
+ {
+ "type": "SINGLE_LINE",
+ "title": "Documentary",
+ "footerColor": "#02639b",
+ "localImageResource": "category_documentary"
+ },
+ {
+ "type": "SINGLE_LINE",
+ "title": "Drama",
+ "footerColor": "#2a56c6",
+ "localImageResource": "category_drama"
+ }
+ ]
+ },
+ {
+ "title": "Icon",
+ "shadow": false,
+ "cards": [
+ {
+ "type": "ICON",
+ "title": "Settings",
+ "localImageResource": "ic_settings_settings"
+ },
+ {
+ "type": "ICON",
+ "title": "WiFi",
+ "localImageResource": "ic_settings_wifi_3_bar"
+ },
+ {
+ "type": "ICON",
+ "title": "Parental Control",
+ "localImageResource": "ic_settings_parental_control"
+ },
+ {
+ "type": "ICON",
+ "title": "Time",
+ "localImageResource": "ic_settings_time"
+ }
+ ]
+ }
+] \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/detail_example.json b/samples/SupportLeanbackShowcase/app/src/main/res/raw/detail_example.json
new file mode 100644
index 000000000..b6d06e26a
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/detail_example.json
@@ -0,0 +1,106 @@
+{
+ "title": "A Summer in a Canyon",
+ "description": "Kate Douglas Smith Wiggin",
+ "year": 1914,
+ "text": "It was nine o’clock one sunny California morning, and Geoffrey Strong stood under the live-oak trees in Las Flores Cañon, with a pot of black paint in one hand and a huge brush in the other. He could have handled these implements to better purpose and with better grace had not his arms been firmly held by three laughing girls, who pulled not wisely, but too well. He was further incommoded by the presence of a small urchin who lay on the dusty ground beneath his feet, fastening an upward clutch on the legs of his trousers.\n\nThere were three large canvas tents directly in front of them, yet no one of these seemed to be the object of dissension, but rather a redwood board, some three feet in length, which was nailed on a tree near by. twitch of her cousin’s sleeve.",
+ "localImageResource": "movie_poster_01",
+ "price": "$9.99",
+ "characters": [
+ {
+ "type": "CHARACTER",
+ "title": "Leonardo Di Caprio",
+ "localImageResource": "face_01"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Gerald Butler",
+ "localImageResource": "face_08"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Russle Crow",
+ "localImageResource": "face_02"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Emma Stone",
+ "localImageResource": "face_03"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Natalie Portman",
+ "localImageResource": "face_04"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Jack Gyllanhall",
+ "localImageResource": "face_05"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Ryan Gossling",
+ "localImageResource": "face_06"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Olivia Wilde",
+ "localImageResource": "face_07"
+ }
+ ],
+ "recommended": [
+ {
+ "type": "MOVIE",
+ "title": "The Amazing Spuder-Man",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_01"
+ },
+ {
+ "type": "MOVIE",
+ "title": "American Psycho",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_02"
+ },
+ {
+ "type": "MOVIE",
+ "title": "Big Hero 6",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_03"
+ },
+ {
+ "type": "MOVIE",
+ "title": "Edge of Tomorrow",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_04"
+ },
+ {
+ "type": "MOVIE",
+ "title": "The Hobbit: The Desolation of Smaug",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_05"
+ },
+ {
+ "type": "MOVIE",
+ "title": "Interstellar",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_06"
+ },
+ {
+ "type": "MOVIE",
+ "title": "Jurassic Park",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_07"
+ },
+ {
+ "type": "MOVIE",
+ "title": "The Hunger Games: Mockingjay Part I",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_08"
+ },
+ {
+ "type": "MOVIE",
+ "title": "Planes",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_09"
+ }
+ ]
+} \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/grid_example.json b/samples/SupportLeanbackShowcase/app/src/main/res/raw/grid_example.json
new file mode 100644
index 000000000..56da5db02
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/grid_example.json
@@ -0,0 +1,88 @@
+{
+ "cards": [
+ {
+ "type": "GRID_SQUARE",
+ "title": "Nüsse",
+ "description": "$3.99/lb",
+ "localImageResource": "food_01"
+ },
+ {
+ "type": "GRID_SQUARE",
+ "title": "Undefinierbar",
+ "description": "$3.99/lb",
+ "localImageResource": "food_02"
+ },
+ {
+ "type": "GRID_SQUARE",
+ "title": "Brocoli",
+ "description": "$3.99/lb",
+ "localImageResource": "food_03"
+ },
+ {
+ "type": "GRID_SQUARE",
+ "title": "Salat",
+ "description": "$3.99/lb",
+ "localImageResource": "food_04"
+ },
+ {
+ "type": "GRID_SQUARE",
+ "title": "Große Radischen",
+ "description": "$3.99/lb",
+ "localImageResource": "food_05"
+ },
+ {
+ "type": "GRID_SQUARE",
+ "title": "Rote Zwiebeln",
+ "description": "$3.99/lb",
+ "localImageResource": "food_06"
+ },
+ {
+ "type": "GRID_SQUARE",
+ "title": "Lauch",
+ "description": "$3.99/lb",
+ "localImageResource": "food_07"
+ },
+ {
+ "type": "GRID_SQUARE",
+ "title": "Exotisches Zeugs",
+ "description": "$3.99/lb",
+ "localImageResource": "food_08"
+ },
+ {
+ "type": "GRID_SQUARE",
+ "title": "Zitronen",
+ "description": "$3.99/lb",
+ "localImageResource": "food_09"
+ },
+ {
+ "type": "GRID_SQUARE",
+ "title": "Meerirgendwas",
+ "description": "$3.99/lb",
+ "localImageResource": "food_10"
+ },
+ {
+ "type": "GRID_SQUARE",
+ "title": "Irgendein Kohl",
+ "description": "$3.99/lb",
+ "localImageResource": "food_11"
+ },
+ {
+ "type": "GRID_SQUARE",
+ "title": "Apfel",
+ "description": "$3.99/lb",
+ "localImageResource": "food_12"
+ },
+ {
+ "type": "GRID_SQUARE",
+ "title": "Mehr Äpfel",
+ "description": "$3.99/lb",
+ "localImageResource": "food_13"
+ },
+ {
+ "type": "GRID_SQUARE",
+ "title": "Tomaten",
+ "description": "$3.99/lb",
+ "localImageResource": "food_14"
+ }
+ ]
+} \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/launcher_cards.json b/samples/SupportLeanbackShowcase/app/src/main/res/raw/launcher_cards.json
new file mode 100644
index 000000000..20faafda0
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/launcher_cards.json
@@ -0,0 +1,63 @@
+[
+ {
+ "title": "",
+ "cards": [
+ {
+ "id": 0,
+ "type": "DEFAULT",
+ "title": "Card Examples",
+ "localImageResource": "thumbnail_example_cards",
+ "description": "Showcase of various card design and layouts"
+ },
+ {
+ "id": 2,
+ "type": "DEFAULT",
+ "title": "Grid Examples",
+ "localImageResource": "thumbnail_example_grid",
+ "description": "Showcase of various card design and layouts"
+ },
+ {
+ "id": 3,
+ "type": "DEFAULT",
+ "title": "Detail Examples",
+ "localImageResource": "thumbnail_example_detail",
+ "description": "Showcase of various card design and layouts"
+ },
+ {
+ "id": 4,
+ "type": "DEFAULT",
+ "title": "Video consumption Examples",
+ "localImageResource": "thumbnail_example_video_consumption",
+ "description": "Showcase of various card design and layouts"
+ },
+ {
+ "id": 5,
+ "type": "DEFAULT",
+ "title": "Music consumption Examples",
+ "localImageResource": "thumbnail_example_music_consumption",
+ "description": "Showcase of various card design and layouts"
+ },
+ {
+ "id": 6,
+ "type": "DEFAULT",
+ "title": "Wizard Examples",
+ "localImageResource": "thumbnail_example_wizard",
+ "description": "Showcase of various card design and layouts"
+ },
+ {
+ "id": 7,
+ "type": "DEFAULT",
+ "title": "Settings Examples",
+ "localImageResource": "thumbnail_example_settings",
+ "description": "Showcase of various card design and layouts"
+ },
+ {
+ "id": 8,
+ "type": "DEFAULT",
+ "title": "Dialog Examples",
+ "localImageResource": "thumbnail_example_dialog",
+ "description": "Showcase of various card design and layouts"
+ }
+ ]
+ }
+] \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/music_consumption_example.json b/samples/SupportLeanbackShowcase/app/src/main/res/raw/music_consumption_example.json
new file mode 100644
index 000000000..0da65c32d
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/music_consumption_example.json
@@ -0,0 +1,76 @@
+{
+ "songs": [
+ {
+ "number": 1,
+ "duration": "2:54",
+ "title": "Blue Mood",
+ "description": "Duke Ellington & His Famous Orchestra",
+ "image": "card_image_music_01",
+ "file": "track_01"
+ },
+ {
+ "number": 2,
+ "duration": "3:20",
+ "title": "I Saw Stars",
+ "description": "Patrick Et Son Orchestre De Danse",
+ "image": "card_image_music_02",
+ "file": "track_02"
+ },
+ {
+ "number": 3,
+ "duration": "2:46",
+ "title": "Laura",
+ "description": "Dave Brubeck Trio",
+ "image": "card_image_music_03",
+ "file": "track_03"
+ },
+ {
+ "number": 4,
+ "duration": "3:27",
+ "title": "September Song",
+ "description": "Dave Brubeck Trio",
+ "image": "card_image_music_07",
+ "file": "track_04"
+ },
+ {
+ "number": 5,
+ "duration": "3:46",
+ "title": "Squeeze Me",
+ "description": "Dave Brubeck Trio",
+ "image": "card_image_music_08",
+ "file": "track_05"
+ },
+ {
+ "number": 6,
+ "duration": "0:22",
+ "title": "Constellation",
+ "description": "Charlie Parker",
+ "image": "card_image_music_09",
+ "file": "track_06"
+ },
+ {
+ "number": 7,
+ "duration": "2:54",
+ "title": "Satin Doll (1952)",
+ "description": "Duke Ellington & His Famous Orchestra",
+ "image": "card_image_music_10",
+ "file": "track_07"
+ },
+ {
+ "number": 8,
+ "duration": "3:26",
+ "title": "Solitude",
+ "description": "Duke Ellington & His Famous Orchestra",
+ "image": "card_image_music_11",
+ "file": "track_08"
+ },
+ {
+ "number": 9,
+ "duration": "3:10",
+ "title": "The Mooche",
+ "description": "Duke Ellington & His Famous Orchestra",
+ "image": "card_image_music_12",
+ "file": "track_09"
+ }
+ ]
+} \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/music_example.json b/samples/SupportLeanbackShowcase/app/src/main/res/raw/music_example.json
new file mode 100644
index 000000000..b01a2d45e
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/music_example.json
@@ -0,0 +1,106 @@
+{
+ "title": "A Summer in a Canyon",
+ "description": "Kate Douglas Smith Wiggin",
+ "year": 1914,
+ "text": "It was nine o’clock one sunny California morning, and Geoffrey Strong stood under the live-oak trees in Las Flores Cañon, with a pot of black paint in one hand and a huge brush in the other. He could have handled these implements to better purpose and with better grace had not his arms been firmly held by three laughing girls, who pulled not wisely, but too well. He was further incommoded by the presence of a small urchin who lay on the dusty ground beneath his feet, fastening an upward clutch on the legs of his trousers.\n\nThere were three large canvas tents directly in front of them, yet no one of these seemed to be the object of dissension, but rather a redwood board, some three feet in length, which was nailed on a tree near by. twitch of her cousin’s sleeve.",
+ "localImageResource": "movie_poster_01",
+ "price": "$9.99",
+ "characters": [
+ {
+ "type": "CHARACTER",
+ "title": "Leonardo Di Caprio",
+ "localImageResource": "face_01"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Gerald Butler",
+ "localImageResource": "face_08"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Russle Crow",
+ "localImageResource": "face_02"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Emma Stone",
+ "localImageResource": "face_03"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Natalie Portman",
+ "localImageResource": "face_04"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Jack Gyllanhall",
+ "localImageResource": "face_05"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Ryan Gossling",
+ "localImageResource": "face_06"
+ },
+ {
+ "type": "CHARACTER",
+ "title": "Olivia Wilde",
+ "localImageResource": "face_07"
+ }
+ ],
+ "recommended": [
+ {
+ "type": "THIN",
+ "title": "The Amazing Spuder-Man",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_01"
+ },
+ {
+ "type": "THIN",
+ "title": "American Psycho",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_02"
+ },
+ {
+ "type": "THIN",
+ "title": "Big Hero 6",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_03"
+ },
+ {
+ "type": "THIN",
+ "title": "Edge of Tomorrow",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_04"
+ },
+ {
+ "type": "THIN",
+ "title": "The Hobbit: The Desolation of Smaug",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_05"
+ },
+ {
+ "type": "THIN",
+ "title": "Interstellar",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_06"
+ },
+ {
+ "type": "THIN",
+ "title": "Jurassic Park",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_07"
+ },
+ {
+ "type": "THIN",
+ "title": "The Hunger Games: Mockingjay Part I",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_08"
+ },
+ {
+ "type": "THIN",
+ "title": "Planes",
+ "description": "$3.99",
+ "localImageResource": "card_image_movie_09"
+ }
+ ]
+} \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_01.mp3 b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_01.mp3
new file mode 100755
index 000000000..3b02d928c
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_01.mp3
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_02.mp3 b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_02.mp3
new file mode 100755
index 000000000..11d01fdf0
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_02.mp3
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_03.mp3 b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_03.mp3
new file mode 100755
index 000000000..3d05a0c85
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_03.mp3
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_04.mp3 b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_04.mp3
new file mode 100755
index 000000000..c4d6dfb63
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_04.mp3
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_05.mp3 b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_05.mp3
new file mode 100755
index 000000000..259831c0d
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_05.mp3
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_06.mp3 b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_06.mp3
new file mode 100755
index 000000000..c984d4413
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_06.mp3
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_07.mp3 b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_07.mp3
new file mode 100755
index 000000000..7ddf065ed
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_07.mp3
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_08.mp3 b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_08.mp3
new file mode 100755
index 000000000..a035bc5f0
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_08.mp3
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_09.mp3 b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_09.mp3
new file mode 100755
index 000000000..dd58c2096
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/track_09.mp3
Binary files differ
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/wizard_example.json b/samples/SupportLeanbackShowcase/app/src/main/res/raw/wizard_example.json
new file mode 100644
index 000000000..f46b85665
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/wizard_example.json
@@ -0,0 +1,6 @@
+{
+ "title": "Androidify! The Movie",
+ "breadcrump": "Android TV",
+ "price_hd": "$4.99",
+ "price_sd": "$2.99"
+} \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/values/arrays.xml b/samples/SupportLeanbackShowcase/app/src/main/res/values/arrays.xml
new file mode 100644
index 000000000..9933ba7e1
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/values/arrays.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software distributed under the License
+ ~ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ ~ or implied. See the License for the specific language governing permissions and limitations under
+ ~ the License.
+ ~
+ -->
+
+<resources>
+ <array name="pref_parent_control_entries">
+ <item>Everyone</item>
+ <item>Low maturity</item>
+ <item>Medium maturity</item>
+ <item>High maturity</item>
+ </array>
+ <array name="pref_parent_control_entries_values">
+ <item>everyone</item>
+ <item>low</item>
+ <item>medium</item>
+ <item>high</item>
+ </array>
+ <array name="pref_parent_control_entries_summaries">
+ <item>This description becomes visible only on focus.</item>
+ <item>This description becomes visible only on focus.</item>
+ <item>This description becomes visible only on focus.</item>
+ <item>This description becomes visible only on focus.</item>
+ </array>
+ <array name="pref_wifi_networks">
+ <item>Wi-Fi network 1</item>
+ <item>Wi-Fi network 2</item>
+ <item>Wi-Fi network 3</item>
+ <item>Wi-Fi network 4</item>
+ <item>Wi-Fi network 5</item>
+ <item>Wi-Fi network 6</item>
+ </array>
+</resources> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/values/colors.xml b/samples/SupportLeanbackShowcase/app/src/main/res/values/colors.xml
new file mode 100644
index 000000000..6305c4119
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/values/colors.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software distributed under the License
+ ~ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ ~ or implied. See the License for the specific language governing permissions and limitations under
+ ~ the License.
+ ~
+ -->
+<resources>
+ <color name="background_gradient_start">#FFFFFF</color>
+ <color name="background_gradient_end">#DDDDDD</color>
+ <color name="fastlane_background">#06838f</color>
+ <color name="fastlane_teal_background">#00796B</color>
+ <color name="search_opaque">#ffaa3f</color>
+ <color name="search_color">#FFEB3B</color>
+ <color name="search_bright_color">#FFEB3B</color>
+ <color name="search_icon_color">#222222</color>
+ <color name="accent">#80D3FB</color>
+ <color name="settings_background">#00695C</color>
+
+ <color name="default_background">#3d3d3d</color>
+
+ <color name="default_card_background_color">#263238</color>
+ <color name="default_card_footer_background_color">#37474F</color>
+ <color name="selected_card_footer_background_color">#F0F</color>
+
+ <color name="card_primary_text">#EEEEEE</color>
+ <color name="card_secondary_text">#99EEEEEE</color>
+
+ <color name="loading_error_card_background">#86c739</color>
+
+ <color name="card_examples_background">#222222</color>
+
+ <color name="detail_view_actionbar_background">#04549D</color>
+ <color name="detail_view_background">#0374BF</color>
+ <color name="detail_view_related_background">#022A4E</color>
+</resources>
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/values/dims.xml b/samples/SupportLeanbackShowcase/app/src/main/res/values/dims.xml
new file mode 100644
index 000000000..07c802733
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/values/dims.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software distributed under the License
+ ~ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ ~ or implied. See the License for the specific language governing permissions and limitations under
+ ~ the License.
+ ~
+ -->
+<resources>
+ <dimen name="default_image_card_width">224dp</dimen>
+ <dimen name="default_image_card_height">126dp</dimen>
+
+ <dimen name="movie_image_card_width">120dp</dimen>
+ <dimen name="movie_image_card_height">172dp</dimen>
+
+ <dimen name="icon_image_card_width">224dp</dimen>
+ <dimen name="icon_image_card_height">109dp</dimen>
+
+ <dimen name="big_square_image_card_width">144dp</dimen>
+ <dimen name="big_square_image_card_height">144dp</dimen>
+
+ <dimen name="square_image_card_width">128dp</dimen>
+ <dimen name="square_image_card_height">128dp</dimen>
+
+ <dimen name="small_square_image_card_width">96dp</dimen>
+ <dimen name="small_square_image_card_height">96dp</dimen>
+
+ <dimen name="sidetext_image_card_width">144dp</dimen>
+ <dimen name="sidetext_image_card_height">144dp</dimen>
+
+ <dimen name="wide_short_image_card_width">224dp</dimen>
+ <dimen name="wide_short_image_card_height">109dp</dimen>
+
+ <dimen name="character_image_card_width">120dp</dimen>
+ <dimen name="character_image_card_height">120dp</dimen>
+
+ <dimen name="grid_card_width">200dp</dimen>
+ <dimen name="grid_card_height">200dp</dimen>
+</resources> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/values/strings.xml b/samples/SupportLeanbackShowcase/app/src/main/res/values/strings.xml
new file mode 100644
index 000000000..a25b964c8
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/values/strings.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software distributed under the License
+ ~ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ ~ or implied. See the License for the specific language governing permissions and limitations under
+ ~ the License.
+ ~
+ -->
+<resources>
+ <string name="app_name">ShowcaseApp</string>
+ <string name="browse_title"><![CDATA[androidTV]]></string>
+
+ <!-- Error messages -->
+ <string name="implement_search">Implement your own in-app search.</string>
+ <string name="card_examples_title">Card Examples</string>
+ <string name="detail_view_title">DetailView Example</string>
+ <string name="action_cicked">Action clicked. Implement your own handler.</string>
+ <string name="grid_example_title">Grid Example</string>
+ <string name="action_buy">Buy </string>
+ <string name="action_wishlist">Add to wishlist</string>
+ <string name="action_related">Related</string>
+ <string name="header_related">Related Items</string>
+ <string name="header_recommended">Recommended</string>
+
+ <!-- Dialog example -->
+ <string name="dialog_example_title">Use Google\'s location service?</string>
+ <string name="dialog_example_description">Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running.</string>
+ <string name="dialog_example_button_positive">Agree</string>
+ <string name="dialog_example_button_negative">Disagree</string>
+ <string name="dialog_example_button_toast_positive_clicked">\'Agree\' clicked.</string>
+ <string name="dialog_example_button_toast_negative_clicked">\'Disagree\' clicked.</string>
+
+ <!-- Wizard example -->
+ <string name="wizard_example_choose_rent_options">Choose rent options</string>
+ <string name="wizard_example_watch_hd">Watch in HD on supported devices</string>
+ <string name="wizard_example_watch_sd">Watch in standard definition on the web and supported devices</string>
+ <string name="wizard_example_rental_period">Rental period: start within 30 days,\nfinish within 24 hours</string>
+ <string name="wizard_example_payment_method">Payment Method</string>
+ <string name="wizard_example_toast_payment_method_clicked">\'Payment Method\' clicked.</string>
+ <string name="wizard_example_rent">Rent</string>
+ <string name="wizard_example_rent_hd">Rent HD</string>
+ <string name="wizard_example_rent_sd">Rent SD</string>
+ <string name="wizard_example_processing">Processinig...</string>
+ <string name="wizard_example_watch_now">Watch now</string>
+ <string name="wizard_example_later">Later</string>
+ <string name="wizard_example_watch_now_clicked">\'Watch now\' clicked.</string>
+ <string name="wizard_example_input_credit">Input credit card number</string>
+ <string name="wizard_example_visa">Visa XXXX-XXXX-XXXX-%s</string>
+ <string name="wizard_example_input_credit_wrong">Error credit card number</string>
+ s<string name="wizard_example_just_a_second">Just a second...</string>
+</resources> \ No newline at end of file
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/values/styles.xml b/samples/SupportLeanbackShowcase/app/src/main/res/values/styles.xml
new file mode 100644
index 000000000..c9b047676
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/values/styles.xml
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software distributed under the License
+ ~ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ ~ or implied. See the License for the specific language governing permissions and limitations under
+ ~ the License.
+ ~
+ -->
+<resources>
+
+ <style name="AppTheme" parent="@style/Theme.Leanback">
+ </style>
+
+ <style name="WizardActionsContainerStyle" parent="Widget.Leanback.GuidedActionsContainerStyle">
+ <item name="android:background">#C03800</item>
+ </style>
+
+ <style name="DialogActionsContainerStyle" parent="Widget.Leanback.GuidedActionsContainerStyle">
+ <item name="android:background">#263238</item>
+ </style>
+
+ <!-- Various movie card styles. Used in cards example. -->
+ <style name="MovieCardBadgeStyle" parent="Widget.Leanback.ImageCardView.BadgeStyle">
+ <item name="android:src">@drawable/stars_red</item>
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:scaleType">center</item>
+ </style>
+
+ <style name="MovieCardTitleTwoLineStyle" parent="Widget.Leanback.ImageCardView.TitleStyle">
+ <item name="android:maxLines">2</item>
+ <item name="android:minLines">2</item>
+ </style>
+
+ <style name="MovieCardContentGoneStyle" parent="Widget.Leanback.ImageCardView.ContentStyle">
+ <item name="android:visibility">invisible</item>
+ </style>
+
+ <style name="MovieCardContentStyle" parent="Widget.Leanback.ImageCardView.ContentStyle">
+ <item name="android:gravity">right</item>
+ </style>
+
+ <style name="MovieCardImageStyle" parent="Widget.Leanback.ImageCardView.ImageStyle">
+ <item name="android:layout_width">@dimen/movie_image_card_width</item>
+ <item name="android:layout_height">@dimen/movie_image_card_height</item>
+ </style>
+
+ <style name="MovieCardSimpleStyle" parent="Widget.Leanback.ImageCardViewStyle">
+ <item name="lbImageCardViewType">Title</item>
+ <item name="lbImageCardViewImageStyle">@style/MovieCardImageStyle</item>
+ <item name="cardBackground">@null</item>
+ </style>
+
+ <style name="MovieCardCompleteStyle" parent="MovieCardSimpleStyle">
+ <item name="lbImageCardViewTitleStyle">@style/MovieCardTitleTwoLineStyle</item>
+ <item name="lbImageCardViewBadgeStyle">@style/MovieCardBadgeStyle</item>
+ <item name="lbImageCardViewContentStyle">@style/MovieCardContentStyle</item>
+ <item name="lbImageCardViewType">Title|Content|IconOnLeft</item>
+ </style>
+
+ <style name="MovieCardBasicStyle" parent="MovieCardCompleteStyle">
+ <item name="lbImageCardViewContentStyle">@style/MovieCardContentGoneStyle</item>
+ </style>
+
+ <!-- Squared Title/Content card style. Used in cards example. -->
+ <style name="SquareBigCardImageStyle" parent="Widget.Leanback.ImageCardView.ImageStyle">
+ <item name="android:layout_width">@dimen/big_square_image_card_width</item>
+ <item name="android:layout_height">@dimen/big_square_image_card_height</item>
+ </style>
+
+ <style name="SquareBigCard" parent="Widget.Leanback.ImageCardViewStyle">
+ <item name="lbImageCardViewImageStyle">@style/SquareBigCardImageStyle</item>
+ <item name="cardBackground">@null</item>
+ </style>
+
+ <!-- SideInfo. used in cards example -->
+ <style name="SideInfoCardStyle" parent="Widget.Leanback.BaseCardViewStyle">
+ <item name="cardType">mainOnly</item>
+ <item name="cardBackground">@null</item>
+ </style>
+
+ <!-- TextCardView. used in cards example -->
+ <style name="TextCardStyle" parent="Widget.Leanback.BaseCardViewStyle">
+ <item name="cardBackground">@null</item>
+ </style>
+
+ <!-- CharacterCardView. used in details example -->
+ <style name="CharacterCardStyle" parent="Widget.Leanback.BaseCardViewStyle">
+ <item name="cardBackground">@null</item>
+ </style>
+
+ <!-- Grid card style. Used by Grid example. -->
+ <style name="GridCardImageStyle" parent="Widget.Leanback.ImageCardView.ImageStyle">
+ <item name="android:layout_width">@dimen/grid_card_width</item>
+ <item name="android:layout_height">@dimen/grid_card_height</item>
+ </style>
+
+ <style name="GridCardStyle" parent="Widget.Leanback.ImageCardViewStyle">
+ <item name="lbImageCardViewImageStyle">@style/GridCardImageStyle</item>
+ <item name="cardBackground">@null</item>
+ </style>
+
+ <!-- A default card style. Used in cards example. -->
+ <style name="DefaultCardImageStyle" parent="Widget.Leanback.ImageCardView.ImageStyle">
+ <item name="android:layout_width">@dimen/default_image_card_width</item>
+ <item name="android:layout_height">@dimen/default_image_card_height</item>
+ </style>
+
+ <style name="DefaultCardStyle" parent="Widget.Leanback.ImageCardViewStyle">
+ <item name="cardBackground">@null</item>
+ <item name="lbImageCardViewImageStyle">@style/DefaultCardImageStyle</item>
+ </style>
+
+ <!-- Game card styles with custom Badge icon. Used in cards example. -->
+ <style name="GameCardContentStyle" parent="Widget.Leanback.ImageCardView.ContentStyle">
+ <item name="android:textColor">#80c349</item>
+ </style>
+
+ <style name="GameCardBadgeStyle" parent="Widget.Leanback.ImageCardView.BadgeStyle">
+ <item name="android:src">@drawable/ic_installed</item>
+ </style>
+
+ <style name="GameCardStyle" parent="DefaultCardStyle">
+ <item name="lbImageCardViewContentStyle">@style/GameCardContentStyle</item>
+ <item name="lbImageCardViewType">Title|Content|IconOnLeft</item>
+ <item name="lbImageCardViewBadgeStyle">@style/GameCardBadgeStyle</item>
+ </style>
+
+ <!-- Squared single line card with colored footer style. Used in cards example. -->
+ <style name="SingleLineCardTitleStyle" parent="Widget.Leanback.ImageCardView.TitleStyle">
+ <item name="android:textAlignment">center</item>
+ <item name="android:gravity">center</item>
+ </style>
+
+ <style name="SingleLineCardInfoAreaStyle" parent="Widget.Leanback.ImageCardView.InfoAreaStyle">
+ <item name="android:layout_width">@dimen/square_image_card_width</item>
+ <item name="layout_viewType">main</item>
+ </style>
+
+ <style name="SingleLineCardImageStyle" parent="Widget.Leanback.ImageCardView.ImageStyle">
+ <item name="android:layout_width">@dimen/square_image_card_width</item>
+ <item name="android:layout_height">@dimen/square_image_card_height</item>
+ </style>
+
+ <style name="SingleLineCardStyle" parent="DefaultCardStyle">
+ <item name="lbImageCardViewTitleStyle">@style/SingleLineCardTitleStyle</item>
+ <item name="lbImageCardViewType">Title</item>
+ <item name="lbImageCardViewImageStyle">@style/SingleLineCardImageStyle</item>
+ <item name="lbImageCardViewInfoAreaStyle">@style/SingleLineCardInfoAreaStyle</item>
+ </style>
+
+ <!-- Icon card style with custom focus handler. Used in cards example. -->
+ <style name="IconCardImageStyle" parent="Widget.Leanback.ImageCardView.ImageStyle">
+ <item name="android:layout_width">96dp</item>
+ <item name="android:layout_height">96dp</item>
+ <item name="android:padding">16dp</item>
+ </style>
+
+ <style name="IconCardTitleStyle" parent="Widget.Leanback.ImageCardView.TitleStyle">
+ <item name="android:maxLines">2</item>
+ <item name="android:minLines">2</item>
+ <item name="android:gravity">center</item>
+ </style>
+
+ <style name="IconCardInfoAreaStyle" parent="Widget.Leanback.ImageCardView.InfoAreaStyle">
+ <item name="android:layout_width">96dp</item>
+ <item name="android:background">@null</item>
+ <item name="layout_viewType">main</item>
+ </style>
+
+ <style name="IconCardStyle" parent="DefaultCardStyle">
+ <item name="android:layout_width">96dp</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="lbImageCardViewTitleStyle">@style/IconCardTitleStyle</item>
+ <item name="lbImageCardViewType">Title</item>
+ <item name="lbImageCardViewImageStyle">@style/IconCardImageStyle</item>
+ <item name="lbImageCardViewInfoAreaStyle">@style/IconCardInfoAreaStyle</item>
+ </style>
+
+</resources>
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/values/themes.xml b/samples/SupportLeanbackShowcase/app/src/main/res/values/themes.xml
new file mode 100644
index 000000000..feb9f036a
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/values/themes.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software distributed under the License
+ ~ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ ~ or implied. See the License for the specific language governing permissions and limitations under
+ ~ the License.
+ ~
+ -->
+<resources>
+
+ <style name="Theme.Example.Leanback" parent="Theme.Leanback">
+ <item name="android:colorPrimary">#00A2B8</item>
+ <item name="android:colorAccent">@color/accent</item>
+ <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14</item>
+ </style>
+
+ <style name="Theme.Example.LeanbackLauncher" parent="Theme.Example.Leanback">
+ <item name="android:windowBackground">@drawable/bg_living_room_wide</item>
+ <item name="browseRowsMarginTop">275dp</item>
+ </style>
+
+ <style name="Theme.Example.LeanbackBrowse" parent="Theme.Leanback.Browse">
+ <item name="android:windowBackground">@color/card_examples_background</item>
+ </style>
+
+ <style name="Theme.Example.LeanbackVerticalGrid" parent="Theme.Leanback.VerticalGrid">
+ <item name="android:windowBackground">@drawable/background_food</item>
+ </style>
+
+ <style name="Theme.Example.LeanbackWizard" parent="Theme.Leanback.GuidedStep">
+ <item name="guidedActionsContainerStyle">@style/WizardActionsContainerStyle</item>
+ </style>
+
+ <style name="Theme.Example.LeanbackDialog" parent="Theme.Leanback.GuidedStep">
+ <item name="guidedActionsContainerStyle">@style/DialogActionsContainerStyle</item>
+ </style>
+
+ <style name="Theme.Example.LeanbackPreferences" parent="Theme.Leanback">
+ <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14</item>
+ <item name="android:windowIsTranslucent">true</item>
+ <item name="android:windowBackground">@android:color/transparent</item>
+ <item name="android:backgroundDimEnabled">true</item>
+ <item name="android:colorPrimary">@color/settings_background</item>
+ </style>
+
+ <style name="Theme.Example.LeanbackDetails" parent="Theme.Leanback.Details">
+ <item name="android:colorPrimary">@color/detail_view_actionbar_background</item>
+ <item name="android:windowBackground">@drawable/background_canyon</item>
+ </style>
+
+ <style name="Theme.Example.LeanbackMusic" parent="Theme.Example.Leanback">
+ <item name="android:windowBackground">@drawable/background_sax</item>
+ </style>
+
+</resources>
diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/xml/prefs.xml b/samples/SupportLeanbackShowcase/app/src/main/res/xml/prefs.xml
new file mode 100644
index 000000000..e69c4e2d5
--- /dev/null
+++ b/samples/SupportLeanbackShowcase/app/src/main/res/xml/prefs.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:summary="This is a dummy activitiy only to show case how to build a settings in an application. Changing configurations in this example doesn't affect anything."
+ android:title="Settings Example">
+ <PreferenceScreen
+ android:icon="@drawable/ic_settings_wifi_4_bar"
+ android:key="prefs_wifi_screen_key"
+ android:title="Wi-Fi">
+ <PreferenceCategory
+ android:key="prefs_wifi_networks_key"
+ android:title="Available Wi-Fi networks">
+ <ListPreference
+ android:defaultValue="-1"
+ android:entries="@array/pref_wifi_networks"
+ android:entryValues="@array/pref_wifi_networks"
+ android:title="Available Wi-Fi networks"
+ android:key="prefs_wifi_key">
+ </ListPreference>
+ </PreferenceCategory>
+ <PreferenceCategory
+ android:key="prefs_wifi_others_key"
+ android:title="Other options">
+ <Preference
+ android:title="Connect via WPS"
+ android:key="prefs_wifi_connect_wps"><!-- You can use Intents here -->
+ </Preference>
+ </PreferenceCategory>
+ </PreferenceScreen>
+ <PreferenceScreen
+ android:icon="@drawable/ic_settings_time"
+ android:key="prefs_date_time_screen_key"
+ android:title="Date &amp; time">
+ <CheckBoxPreference
+ android:defaultValue="true"
+ android:disableDependentsState="true"
+ android:key="prefs_date_time_automatic"
+ android:summaryOff="On"
+ android:summaryOn="Off"
+ android:title="Automatic date &amp; time"></CheckBoxPreference>
+ <Preference
+ android:dependency="prefs_date_time_automatic"
+ android:key="prefs_date"
+ android:summary="01/01/1970"
+ android:title="Date"></Preference>
+ <Preference
+ android:dependency="prefs_date_time_automatic"
+ android:key="prefs_time"
+ android:summary="00:43 PM"
+ android:title="Time"></Preference>
+ <CheckBoxPreference
+ android:defaultValue="true"
+ android:disableDependentsState="true"
+ android:key="prefs_date_time_use_timezone"
+ android:summary="Use network provided time zone"
+ android:title="Automatic time zone"></CheckBoxPreference>
+ <Preference
+ android:dependency="prefs_date_time_use_timezone"
+ android:summary="GMT 07:00 Pacific Daylight Time"
+ android:title="Time zone"></Preference>
+ </PreferenceScreen>
+ <ListPreference
+ android:defaultValue="everyone"
+ android:icon="@drawable/ic_settings_parental_control"
+ android:entries="@array/pref_parent_control_entries"
+ android:entryValues="@array/pref_parent_control_entries_values"
+ android:key="prefs_parental_control_level_key"
+ android:dialogMessage="Allow contents rated for"
+ android:title="Parental Control">
+ </ListPreference>
+ <PreferenceScreen
+ android:icon="@drawable/ic_settings_apps"
+ android:key="prefs_apps_screen_key"
+ android:title="Apps">
+ <PreferenceCategory
+ android:key="prefs_app_settings_category"
+ android:title="Apps settings">
+ <PreferenceScreen
+ android:key="prefs_app_settings_screen_key"
+ android:summary="Lorem ipsum dolor sit amet consectur adipiscing."
+ android:title="App permissions">
+ <Preference
+ android:icon="@mipmap/app_banner_sample_app"
+ android:summary="45.5 MB"
+ android:selectable="false"
+ android:title="Application A"></Preference>
+ <Preference
+ android:selectable="false"
+ android:summary="Hier steht ein voelligst sinnfreier Text den ja sowieso niemandhier lesen kann. Deshalb macht es auch keinen Unterschied ob hier sinnvolles und nicht so sinnvolles Zeug steht. Hm... Sasha, du kannst das vielleicht lesen und denkst dir jetzt auch, dass ich voll haengen geblieben bin, oder?... ^_^"></Preference>
+ <Preference
+ android:title="Force Stop"
+ android:key="pref_force_stop"><!-- Start an Intent --></Preference>
+ <Preference
+ android:title="Uninstall"
+ android:key="pref_uninstall"><!-- Start an Intent --></Preference>
+ <Preference
+ android:title="More Information"
+ android:key="pref_more_info"></Preference>
+ </PreferenceScreen>
+ </PreferenceCategory>
+ <PreferenceCategory
+ android:key="prefs_app_downloaded_apps_category"
+ android:title="Downloaded Apps">
+ <ListPreference
+ android:defaultValue="everyone"
+ android:entries="@array/pref_parent_control_entries"
+ android:entryValues="@array/pref_parent_control_entries_values"
+ android:key="prefs_parental_control_level_key"
+ android:title="Downloaded Apps">
+ </ListPreference>
+ </PreferenceCategory>
+ </PreferenceScreen>
+</PreferenceScreen>