Java 类android.support.v17.leanback.widget.ObjectAdapter 实例源码

项目:android-tv-leanback    文件:LeanbackBrowseFragment.java   
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();

}
项目:android-tv-leanback    文件:LeanbackBrowseFragment.java   
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());

}
项目:android-tv-leanback    文件:LeanbackBrowseFragment.java   
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();

}
项目:android-tv-leanback    文件:LeanbackBrowseFragment.java   
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()));
    }

}
项目:android-tv-leanback    文件:LeanbackBrowseFragment.java   
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());

}
项目:adt-leanback-support    文件:SearchSupportFragment.java   
@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();
    }
}
项目:adt-leanback-support    文件:SearchFragment.java   
@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();
    }
}
项目:aos-Video    文件:MainFragment.java   
/**
 * @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;
}
项目:aos-Video    文件:IconListRow.java   
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));
        }
    }
}
项目:android_packages_apps_tv    文件:SortedArrayAdapterTest.java   
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));
    }
}
项目:android-tv-leanback    文件:VideoDataManager.java   
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);

}
项目:android-tv-leanback    文件:PlaybackOverlayFragment.java   
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()));
}
项目:android-tv-leanback    文件:VideoDataManager.java   
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);

}
项目:android-tv-leanback    文件:VideoDataManager.java   
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);

}
项目:android-tv-leanback    文件:VideoDataManager.java   
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);

}
项目:android-tv-leanback    文件:VideoDataManager.java   
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);

}
项目:easy-a    文件:MainFragment.java   
@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);
}
项目:easy-a    文件:MainFragment.java   
@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);
}
项目:adt-leanback-support    文件:PlaybackOverlaySupportFragment.java   
/**
 * 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);
    }
}
项目:adt-leanback-support    文件:PlaybackOverlayFragment.java   
/**
 * 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);
    }
}
项目:adt-leanback-support    文件:DetailsSupportFragment.java   
/**
 * Sets the list of rows for the fragment.
 */
public void setAdapter(ObjectAdapter adapter) {
    mAdapter = adapter;
    if (mRowsSupportFragment != null) {
        mRowsSupportFragment.setAdapter(adapter);
    }
}
项目:adt-leanback-support    文件:DetailsFragment.java   
/**
 * Sets the list of rows for the fragment.
 */
public void setAdapter(ObjectAdapter adapter) {
    mAdapter = adapter;
    if (mRowsFragment != null) {
        mRowsFragment.setAdapter(adapter);
    }
}
项目:Amphitheatre    文件:BrowseFragment.java   
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());
        }
    }
}
项目:android-for-dummies-v3    文件:MainFragment.java   
@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);
}
项目:android-for-dummies-v3    文件:MainFragment.java   
@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);
}
项目:androidtv-sample    文件:SearchFragment.java   
@Override
public ObjectAdapter getResultsAdapter() {
    return mRowsAdapter;
}
项目:leanback-homescreen-channels    文件:TvSearchFragment.java   
@Override
public ObjectAdapter getResultsAdapter() {
    return mRowsAdapter;
}
项目:aos-Video    文件:ManualScrappingSearchFragment.java   
@Override
public ObjectAdapter getResultsAdapter() {
    Log.d(TAG, "getResultsAdapter()");
    return mRowsAdapter;
}
项目:aos-Video    文件:ShadowLessListRow.java   
public ShadowLessListRow(HeaderItem headerItem, ObjectAdapter adapter) {
    super(headerItem, adapter);
}
项目:aos-Video    文件:VideoSearchFragment.java   
@Override
public ObjectAdapter getResultsAdapter() {
    return mRowsAdapter;
}
项目:aos-Video    文件:SelectableListRow.java   
public SelectableListRow(HeaderItem header, ObjectAdapter adapter) {
    super(header, adapter);
}
项目:aos-Video    文件:MyVerticalGridFragment.java   
/**
 * Sets the object adapter for the fragment.
 */
public void setAdapter(ObjectAdapter adapter) {
    mAdapter = adapter;
    updateAdapter();
}
项目:aos-Video    文件:MyVerticalGridFragment.java   
/**
 * Returns the object adapter.
 */
public ObjectAdapter getAdapter() {
    return mAdapter;
}
项目:chilly    文件:SearchFragment.java   
@Override
public ObjectAdapter getResultsAdapter() {
    return mRowsAdapter;
}
项目:android-tv-news    文件:SearchFragment.java   
@Override
public ObjectAdapter getResultsAdapter() {
    return mRowsAdapter;
}
项目:AndroidTvBoilerplate    文件:SearchContentFragment.java   
@Override
public ObjectAdapter getResultsAdapter() {
    return mResultsAdapter;
}
项目:android_packages_apps_tv    文件:ProgramGuideSearchFragment.java   
@Override
public ObjectAdapter getResultsAdapter() {
    return mResultAdapter;
}
项目:popcorn-android    文件:PTVSearchFragment.java   
@Override
public ObjectAdapter getResultsAdapter() {
    return mRowsAdapter;
}
项目:popcorn-android    文件:MediaListRow.java   
public MediaListRow(HeaderItem header, ObjectAdapter adapter) {
    super(header, adapter);
}
项目:popcorn-android    文件:MediaListRow.java   
public MediaListRow(long id, HeaderItem header, ObjectAdapter adapter) {
    super(id, header, adapter);
}