Java Code Examples for android.support.v17.leanback.widget.ArrayObjectAdapter#notifyArrayItemRangeChanged()

The following examples show how to use android.support.v17.leanback.widget.ArrayObjectAdapter#notifyArrayItemRangeChanged() . 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: DetailsFragment.java    From iview-android-tv with MIT License 6 votes vote down vote up
private void updateRelatedEpisodes(Map<String, List<EpisodeBaseModel>> others) {
    boolean updated = false;
    ArrayObjectAdapter adapter = (ArrayObjectAdapter) getAdapter();
    for (Map.Entry<String, List<EpisodeBaseModel>> list : others.entrySet()) {
        String title = list.getKey();
        Log.d(TAG, "More: " + title);
        if (ContentManagerBase.OTHER_EPISODES.equals(title)) {
            otherEpisodes.addAll(otherEpisodes.size(), list.getValue());
        } else {
            ArrayObjectAdapter more = new ArrayObjectAdapter(new CardSelector());
            more.addAll(0, list.getValue());
            adapter.add(new ListRow(new HeaderItem(0, title), more));
        }
        updated = true;
    }
    if (updated) {
        adapter.notifyArrayItemRangeChanged(0, adapter.size());
    }
}
 
Example 2
Source File: MainFragment.java    From leanback-extensions with Apache License 2.0 5 votes vote down vote up
private void refreshView() {
	// Refresh the grid without actually reloading it from scratch.
	ArrayObjectAdapter adapter = ((ArrayObjectAdapter) getAdapter());
	if (adapter != null && adapter.size() > 0) {
		adapter.notifyArrayItemRangeChanged(0, adapter.size());
	}
}
 
Example 3
Source File: PlaybackOverlayFragment.java    From android-tv-leanback with Apache License 2.0 5 votes vote down vote up
private void notifyChanged(Action action) {
    ArrayObjectAdapter adapter = mPrimaryActionsAdapter;
    if (adapter.indexOf(action) >= 0) {
        adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1);
        return;
    }
    adapter = mSecondaryActionsAdapter;
    if (adapter.indexOf(action) >= 0) {
        adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1);
        return;
    }
}
 
Example 4
Source File: BrowseFragment.java    From Amphitheatre with Apache License 2.0 5 votes vote down vote up
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());
        }
    }
}
 
Example 5
Source File: PlaybackOverlayFragment.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
private void notifyChanged(Action action) {
    ArrayObjectAdapter adapter = mPrimaryActionsAdapter;
    if (adapter.indexOf(action) >= 0) {
        adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1);
        return;
    }
    adapter = mSecondaryActionsAdapter;
    if (adapter.indexOf(action) >= 0) {
        adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1);
        return;
    }
}
 
Example 6
Source File: MediaPlayerGlue.java    From leanback-showcase with Apache License 2.0 4 votes vote down vote up
static void notifyItemChanged(ArrayObjectAdapter adapter, Object object) {
    int index = adapter.indexOf(object);
    if (index >= 0) {
        adapter.notifyArrayItemRangeChanged(index, 1);
    }
}