当前位置: 首页>>代码示例>>Java>>正文


Java ObjectAdapter类代码示例

本文整理汇总了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();

}
 
开发者ID:googlecodelabs,项目名称:android-tv-leanback,代码行数:24,代码来源:LeanbackBrowseFragment.java

示例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());

}
 
开发者ID:googlecodelabs,项目名称:android-tv-leanback,代码行数:20,代码来源:LeanbackBrowseFragment.java

示例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()));
    }

}
 
开发者ID:googlecodelabs,项目名称:android-tv-leanback,代码行数:18,代码来源:LeanbackBrowseFragment.java

示例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();
    }
}
 
开发者ID:kingargyle,项目名称:adt-leanback-support,代码行数:23,代码来源:SearchSupportFragment.java

示例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();
    }
}
 
开发者ID:kingargyle,项目名称:adt-leanback-support,代码行数:23,代码来源:SearchFragment.java

示例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;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:16,代码来源:MainFragment.java

示例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));
        }
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:12,代码来源:IconListRow.java

示例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));
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:8,代码来源:SortedArrayAdapterTest.java

示例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);

}
 
开发者ID:googlecodelabs,项目名称:android-tv-leanback,代码行数:11,代码来源:VideoDataManager.java

示例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()));
}
 
开发者ID:googlecodelabs,项目名称:android-tv-leanback,代码行数:9,代码来源:PlaybackOverlayFragment.java

示例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);
}
 
开发者ID:emmby,项目名称:easy-a,代码行数:10,代码来源:MainFragment.java

示例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);
}
 
开发者ID:emmby,项目名称:easy-a,代码行数:14,代码来源:MainFragment.java

示例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);
    }
}
 
开发者ID:kingargyle,项目名称:adt-leanback-support,代码行数:14,代码来源:PlaybackOverlaySupportFragment.java

示例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);
    }
}
 
开发者ID:kingargyle,项目名称:adt-leanback-support,代码行数:10,代码来源:DetailsSupportFragment.java

示例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);
    }
}
 
开发者ID:kingargyle,项目名称:adt-leanback-support,代码行数:10,代码来源:DetailsFragment.java


注:本文中的android.support.v17.leanback.widget.ObjectAdapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。