Java Code Examples for androidx.leanback.widget.ArrayObjectAdapter#addAll()
The following examples show how to use
androidx.leanback.widget.ArrayObjectAdapter#addAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeSevenPresenter.java From LeanbackTvSample with MIT License | 6 votes |
private void updatePresenter(List<Content.DataBean.WidgetsBean> widgetsBeanList) { ArrayObjectAdapter mArrayObjectAdapter = new ArrayObjectAdapter(new TypeSevenContentPresenter()); MyItemBridgeAdapter myItemBridgeAdapter = new MyItemBridgeAdapter(mArrayObjectAdapter) { @Override public OnItemViewClickedListener getOnItemViewClickedListener() { return new OnItemViewClickedListener() { @Override public void onItemClicked(View focusView, Presenter.ViewHolder itemViewHolder, Object item) { } }; } }; mHorizontalGridView.setAdapter(myItemBridgeAdapter); mArrayObjectAdapter.addAll(0, widgetsBeanList); }
Example 2
Source File: MainActivity.java From LeanbackTvSample with MIT License | 5 votes |
@Override public void handleMessage(Message msg) { MainActivity activity = mActivity.get(); if (activity != null) { switch (msg.what) { case MSG_NOTIFY_TITLE: @SuppressWarnings("unchecked") List<Title.DataBean> dataBeans = (List<Title.DataBean>) msg.obj; ArrayObjectAdapter adapter = activity.getArrayObjectAdapter(); if (adapter != null) { adapter.addAll(0, dataBeans); activity.initViewPager(dataBeans); HorizontalGridView horizontalGridView = activity.getHorizontalGridView(); if (dataBeans.size() > Constants.TAG_FEATURE_POSITION) { if (horizontalGridView != null) { horizontalGridView.setSelectedPositionSmooth(Constants.TAG_FEATURE_POSITION); View positionView = horizontalGridView.getChildAt(Constants.TAG_FEATURE_POSITION); if (positionView != null) { activity.mOldTitle = positionView.findViewById(R.id.tv_main_title); } } } else if (dataBeans.size() > 0) { if (activity.getHorizontalGridView() != null) { horizontalGridView.setSelectedPositionSmooth(0); View position0 = horizontalGridView.getChildAt(0); if (position0 != null) { activity.mOldTitle = position0.findViewById(R.id.tv_main_title); } } } } break; case 2: break; default: break; } } }
Example 3
Source File: VodTvSectionFragment.java From xipl with Apache License 2.0 | 5 votes |
/** * Adds a new {@link ArrayObjectAdapter} for a new VOD content category * * @param tempMap the map used to retrieve contents * @param group the name of the VOD content group */ private void addContentRow(Map<String, List<AvContent>> tempMap, String group) { if (mRowsAdapter != null) { ArrayObjectAdapter arrayObjectAdapter = new ArrayObjectAdapter(new CardViewPresenter(getImageProcessor())); HeaderItem header = new HeaderItem(group); arrayObjectAdapter.addAll(0, tempMap.get(group)); mRowsAdapter.add(new ListRow(header, arrayObjectAdapter)); } }