From 63e8181cee42782e4bac6817db2214d0c1954177 Mon Sep 17 00:00:00 2001 From: Robert Hahn Date: Wed, 5 Aug 2015 10:16:38 -0700 Subject: [PATCH] Removed Browsing example from Showcase app There are no plans for now to show a browsing example which is why it can be removed for now. There was no code written so far for this example. Change-Id: I0580021ddc0f385d616074c61cc1c449e75357ad --- .../app/BrowserExample01Fragment.java | 92 ----- .../app/MainFragment.java | 2 +- .../src/main/res/raw/browsing_example_01.json | 356 ------------------ ...ards_launcher.json => launcher_cards.json} | 7 - 4 files changed, 1 insertion(+), 456 deletions(-) delete mode 100644 samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/BrowserExample01Fragment.java delete mode 100644 samples/SupportLeanbackShowcase/app/src/main/res/raw/browsing_example_01.json rename samples/SupportLeanbackShowcase/app/src/main/res/raw/{cards_launcher.json => launcher_cards.json} (89%) diff --git a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/BrowserExample01Fragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/BrowserExample01Fragment.java deleted file mode 100644 index 1575c8507..000000000 --- a/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/BrowserExample01Fragment.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.os.Bundle; -import android.support.v17.leanback.app.BrowseFragment; -import android.support.v17.leanback.supportleanbackshowcase.utils.CardListRow; -import android.support.v17.leanback.supportleanbackshowcase.R; -import android.support.v17.leanback.supportleanbackshowcase.app.details.ShadowRowPresenterSelector; -import android.support.v17.leanback.supportleanbackshowcase.utils.Utils; -import android.support.v17.leanback.supportleanbackshowcase.models.Card; -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.HeaderItem; -import android.support.v17.leanback.widget.ListRow; -import android.support.v17.leanback.widget.PresenterSelector; -import android.support.v17.leanback.widget.SearchOrbView; -import android.view.View; -import android.widget.Toast; - -import com.google.gson.Gson; - - -public class BrowserExample01Fragment extends BrowseFragment { - - private static final String TAG = "BrowserExample01Fragment"; - - 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("Browser Example 01"); - setOnSearchClickedListener(new View.OnClickListener() { - @Override public void onClick(View v) { - Toast.makeText(getActivity(), getString(R.string.implement_search), - Toast.LENGTH_LONG).show(); - } - }); - } - - private void setupRowAdapter() { - mRowsAdapter = new ArrayObjectAdapter(new ShadowRowPresenterSelector()); - createRows(); - setAdapter(mRowsAdapter); - } - - private void createRows() { - String json = Utils - .inputStreamToString(getResources().openRawResource(R.raw.browsing_example_01)); - 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/MainFragment.java b/samples/SupportLeanbackShowcase/app/src/main/java/android/support/v17/leanback/supportleanbackshowcase/app/MainFragment.java index e836ad218..42a7cc7e0 100644 --- 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 @@ -98,7 +98,7 @@ public class MainFragment extends BrowseFragment { private void createRows() { String json = Utils - .inputStreamToString(getResources().openRawResource(R.raw.cards_launcher)); + .inputStreamToString(getResources().openRawResource(R.raw.launcher_cards)); CardRow[] rows = new Gson().fromJson(json, CardRow[].class); for (CardRow row : rows) { mRowsAdapter.add(createCardRow(row)); diff --git a/samples/SupportLeanbackShowcase/app/src/main/res/raw/browsing_example_01.json b/samples/SupportLeanbackShowcase/app/src/main/res/raw/browsing_example_01.json deleted file mode 100644 index addc33ca4..000000000 --- a/samples/SupportLeanbackShowcase/app/src/main/res/raw/browsing_example_01.json +++ /dev/null @@ -1,356 +0,0 @@ -[ - { - "title": "Movie Collection", - "cards": [ - { - "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" - } - ] - }, - { - "title": "Recommendations", - "cards": [ - { - "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" - } - ] - }, - { - "title": "Featured Movies", - "cards": [ - { - "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" - } - ] - }, - { - "title": "Categories", - "cards": [ - { - "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" - } - ] - }, - { - "title": "Favorites", - "cards": [ - { - "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" - } - ] - }, - { - "title": "Settings", - "cards": [ - { - "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/cards_launcher.json b/samples/SupportLeanbackShowcase/app/src/main/res/raw/launcher_cards.json similarity index 89% rename from samples/SupportLeanbackShowcase/app/src/main/res/raw/cards_launcher.json rename to samples/SupportLeanbackShowcase/app/src/main/res/raw/launcher_cards.json index 0f35a1536..20faafda0 100644 --- a/samples/SupportLeanbackShowcase/app/src/main/res/raw/cards_launcher.json +++ b/samples/SupportLeanbackShowcase/app/src/main/res/raw/launcher_cards.json @@ -9,13 +9,6 @@ "localImageResource": "thumbnail_example_cards", "description": "Showcase of various card design and layouts" }, - { - "id": 1, - "type": "DEFAULT", - "title": "Browsing Examples", - "localImageResource": "thumbnail_example_browse", - "description": "Showcase of various card design and layouts" - }, { "id": 2, "type": "DEFAULT",