public void init() { mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); setAdapter(mRowsAdapter); setBrandColor(ContextCompat.getColor(getContext(), R.color.primary)); setBadgeDrawable(ContextCompat.getDrawable(getContext(), R.drawable.filmi)); for (int position = 0; position < HEADERS.length; position++) { ObjectAdapter rowContents = new CursorObjectAdapter((new SinglePresenterSelector(new CardPresenter()))); VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowContents); manager.startDataLoading(); HeaderItem headerItem = new HeaderItem(position, HEADERS[position]); mRowsAdapter.add(new ListRow(headerItem, manager.getItemList())); } setOnItemViewClickedListener(getDefaultItemViewClickedListener()); setOnItemViewSelectedListener(getDefaultItemSelectedListener()); bgHelper = new BackgroundHelper(getActivity()); bgHelper.prepareBackgroundManager(); }
public void init() { mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); setAdapter(mRowsAdapter); setBrandColor(ContextCompat.getColor(getContext(), R.color.primary)); setBadgeDrawable(ContextCompat.getDrawable(getContext(), R.drawable.filmi)); for (int position = 0; position < HEADERS.length; position++) { ObjectAdapter rowContents = new CursorObjectAdapter((new SinglePresenterSelector(new CardPresenter()))); VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowContents); manager.startDataLoading(); HeaderItem headerItem = new HeaderItem(position, HEADERS[position]); mRowsAdapter.add(new ListRow(headerItem, manager.getItemList())); } setOnItemViewClickedListener(getDefaultItemViewClickedListener()); }
public void init() { mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); setAdapter(mRowsAdapter); setBrandColor(ContextCompat.getColor(getContext(), R.color.primary)); setBadgeDrawable(ContextCompat.getDrawable(getContext(), R.drawable.filmi)); for (int position = 0; position < HEADERS.length; position++) { ObjectAdapter rowContents = new CursorObjectAdapter((new SinglePresenterSelector(new CardPresenter()))); VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowContents); manager.startDataLoading(); HeaderItem headerItem = new HeaderItem(position, HEADERS[position]); mRowsAdapter.add(new ListRow(headerItem, manager.getItemList())); } }
@Override public void run() { // Retrieve the result adapter ObjectAdapter adapter = mProvider.getResultsAdapter(); if (adapter != mResultAdapter) { boolean firstTime = mResultAdapter == null; releaseAdapter(); mResultAdapter = adapter; if (mResultAdapter != null) { mResultAdapter.registerObserver(mAdapterObserver); } if (null != mRowsSupportFragment) { // delay the first time to avoid setting a empty result adapter // until we got first onChange() from the provider if (!(firstTime && (mResultAdapter == null || mResultAdapter.size() == 0))) { mRowsSupportFragment.setAdapter(mResultAdapter); } executePendingQuery(); } updateSearchBarNextFocusId(); } }
@Override public void run() { // Retrieve the result adapter ObjectAdapter adapter = mProvider.getResultsAdapter(); if (adapter != mResultAdapter) { boolean firstTime = mResultAdapter == null; releaseAdapter(); mResultAdapter = adapter; if (mResultAdapter != null) { mResultAdapter.registerObserver(mAdapterObserver); } if (null != mRowsFragment) { // delay the first time to avoid setting a empty result adapter // until we got first onChange() from the provider if (!(firstTime && (mResultAdapter == null || mResultAdapter.size() == 0))) { mRowsFragment.setAdapter(mResultAdapter); } executePendingQuery(); } updateSearchBarNextFocusId(); } }
/** * @param adapter * @return true if the adapter is an ArrayObjectAdapter containing just one EmptyView object */ private boolean isEmptyViewRow(ObjectAdapter adapter) { if (adapter instanceof ArrayObjectAdapter) { ArrayObjectAdapter arrayObjectAdapter = (ArrayObjectAdapter)adapter; if (arrayObjectAdapter.size()==1) { if (arrayObjectAdapter.get(0) instanceof EmptyView) { return true; } } } return false; }
public IconListRow(long id, HeaderItem headerItem, ObjectAdapter adapter) { super(id, headerItem, adapter); // Make sure the adapter contain only Icon objects for (int i=0; i<adapter.size(); i++) { Object o = adapter.get(i); if ( !(adapter.get(i) instanceof Icon) ) { throw new IllegalArgumentException("IconListRow must contain only Icon objects! not this: "+adapter.get(i)); } } }
private static void assertContentsInOrder(ObjectAdapter adapter, Object... contents) { int ex = contents.length; assertEquals("size", ex, adapter.size()); for (int i = 0; i < ex; i++) { assertEquals("element " + 1, contents[i], adapter.get(i)); } }
public VideoDataManager(Context mContext, LoaderManager mLoaderManager, Uri mRowUri, ObjectAdapter rowContents) { this.mLoaderManager = mLoaderManager; this.mRowUri = mRowUri; this.mContext = mContext; mItemList = rowContents; LOADER_ID = Double.valueOf(Math.random() * Integer.MAX_VALUE).intValue(); mMapper = new VideoItemMapper(); ((CursorObjectAdapter) mItemList).setMapper(mMapper); }
private void addOtherRows() { ObjectAdapter rowContents = new CursorObjectAdapter((new SinglePresenterSelector(new CardPresenter()))); VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowContents); manager.startDataLoading(); HeaderItem headerItem = new HeaderItem(0, "You may also like"); mRowsAdapter.add(new ListRow(headerItem, manager.getItemList())); }
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { int id = loader.getId(); ObjectAdapter adapter = getAdapter(); ListRow row = (ListRow) adapter.get(id); CursorObjectAdapter rowAdapter = (CursorObjectAdapter) row .getAdapter(); rowAdapter.swapCursor(cursor); }
@Override public void onLoaderReset(Loader<Cursor> loader) { // This is called when the last Cursor provided to // onLoadFinished() // above is about to be closed. We need to make sure we are no // longer using it. int id = loader.getId(); ObjectAdapter adapter = getAdapter(); ListRow row = (ListRow) adapter.get(id); CursorObjectAdapter rowAdapter = (CursorObjectAdapter) row .getAdapter(); rowAdapter.swapCursor(null); }
/** * Sets the list of rows for the fragment. */ @Override public void setAdapter(ObjectAdapter adapter) { if (getAdapter() != null) { getAdapter().unregisterObserver(mObserver); } super.setAdapter(adapter); if (adapter != null) { adapter.registerObserver(mObserver); } }
/** * Sets the list of rows for the fragment. */ public void setAdapter(ObjectAdapter adapter) { mAdapter = adapter; if (mRowsSupportFragment != null) { mRowsSupportFragment.setAdapter(adapter); } }
/** * Sets the list of rows for the fragment. */ public void setAdapter(ObjectAdapter adapter) { mAdapter = adapter; if (mRowsFragment != null) { mRowsFragment.setAdapter(adapter); } }
private void reloadAdapters() { for (int i = 0; i < mAdapter.size(); i++) { ListRow listRow = (ListRow) mAdapter.get(i); ObjectAdapter objectAdapter = listRow.getAdapter(); if (objectAdapter instanceof ArrayObjectAdapter) { ArrayObjectAdapter arrayObjectAdapter = ((ArrayObjectAdapter) objectAdapter); arrayObjectAdapter.notifyArrayItemRangeChanged(0, arrayObjectAdapter.size()); } } }
@Override public ObjectAdapter getResultsAdapter() { return mRowsAdapter; }
@Override public ObjectAdapter getResultsAdapter() { Log.d(TAG, "getResultsAdapter()"); return mRowsAdapter; }
public ShadowLessListRow(HeaderItem headerItem, ObjectAdapter adapter) { super(headerItem, adapter); }
public SelectableListRow(HeaderItem header, ObjectAdapter adapter) { super(header, adapter); }
/** * Sets the object adapter for the fragment. */ public void setAdapter(ObjectAdapter adapter) { mAdapter = adapter; updateAdapter(); }
/** * Returns the object adapter. */ public ObjectAdapter getAdapter() { return mAdapter; }
@Override public ObjectAdapter getResultsAdapter() { return mResultsAdapter; }
@Override public ObjectAdapter getResultsAdapter() { return mResultAdapter; }
public MediaListRow(HeaderItem header, ObjectAdapter adapter) { super(header, adapter); }
public MediaListRow(long id, HeaderItem header, ObjectAdapter adapter) { super(id, header, adapter); }