本文整理汇总了Java中android.support.v17.leanback.widget.ObjectAdapter类的典型用法代码示例。如果您正苦于以下问题:Java ObjectAdapter类的具体用法?Java ObjectAdapter怎么用?Java ObjectAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectAdapter类属于android.support.v17.leanback.widget包,在下文中一共展示了ObjectAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
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();
}
示例2: init
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
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());
}
示例3: init
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
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()));
}
}
示例4: run
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
@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();
}
}
示例5: run
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
@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();
}
}
示例6: isEmptyViewRow
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
/**
* @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;
}
示例7: IconListRow
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
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));
}
}
}
示例8: assertContentsInOrder
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
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));
}
}
示例9: VideoDataManager
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
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);
}
示例10: addOtherRows
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
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()));
}
示例11: onLoadFinished
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
@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);
}
示例12: onLoaderReset
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
@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);
}
示例13: setAdapter
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
/**
* 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);
}
}
示例14: setAdapter
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
/**
* Sets the list of rows for the fragment.
*/
public void setAdapter(ObjectAdapter adapter) {
mAdapter = adapter;
if (mRowsSupportFragment != null) {
mRowsSupportFragment.setAdapter(adapter);
}
}
示例15: setAdapter
import android.support.v17.leanback.widget.ObjectAdapter; //导入依赖的package包/类
/**
* Sets the list of rows for the fragment.
*/
public void setAdapter(ObjectAdapter adapter) {
mAdapter = adapter;
if (mRowsFragment != null) {
mRowsFragment.setAdapter(adapter);
}
}