am 63e8181c: Removed Browsing example from Showcase app

* commit '63e8181cee42782e4bac6817db2214d0c1954177':
  Removed Browsing example from Showcase app
This commit is contained in:
Robert Hahn
2015-08-05 21:20:54 +00:00
committed by Android Git Automerger
4 changed files with 1 additions and 456 deletions

View File

@@ -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);
}
}

View File

@@ -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));

View File

@@ -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"
}
]
}
]

View File

@@ -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",