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
This commit is contained in:
@@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -98,7 +98,7 @@ public class MainFragment extends BrowseFragment {
|
|||||||
|
|
||||||
private void createRows() {
|
private void createRows() {
|
||||||
String json = Utils
|
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);
|
CardRow[] rows = new Gson().fromJson(json, CardRow[].class);
|
||||||
for (CardRow row : rows) {
|
for (CardRow row : rows) {
|
||||||
mRowsAdapter.add(createCardRow(row));
|
mRowsAdapter.add(createCardRow(row));
|
||||||
|
|||||||
@@ -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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -9,13 +9,6 @@
|
|||||||
"localImageResource": "thumbnail_example_cards",
|
"localImageResource": "thumbnail_example_cards",
|
||||||
"description": "Showcase of various card design and layouts"
|
"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,
|
"id": 2,
|
||||||
"type": "DEFAULT",
|
"type": "DEFAULT",
|
||||||
Reference in New Issue
Block a user