use of android.support.v4.util.SimpleArrayMap in project vlc-android by videolan.
the class BaseBrowserFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (mAdapter == null)
mAdapter = new BaseBrowserAdapter(this);
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
registerForContextMenu(mRecyclerView);
mSwipeRefreshLayout.setOnRefreshListener(this);
@SuppressWarnings("unchecked") final SimpleArrayMap<MediaLibraryItem, List<MediaLibraryItem>> content = (SimpleArrayMap<MediaLibraryItem, List<MediaLibraryItem>>) VLCApplication.getData(KEY_CONTENT_LIST + mMrl);
if (content != null)
mFoldersContentLists = content;
@SuppressWarnings("unchecked") final List<MediaLibraryItem> mediaList = mRoot ? null : (List<MediaLibraryItem>) VLCApplication.getData(KEY_MEDIA_LIST + mMrl);
if (!Util.isListEmpty(mediaList)) {
mAdapter.update(mediaList);
parseSubDirectories();
} else
mHandler.sendEmptyMessage(BrowserFragmentHandler.MSG_REFRESH);
}
use of android.support.v4.util.SimpleArrayMap in project Tangram-Android by alibaba.
the class GridCard method offsetChildCard.
@Override
public void offsetChildCard(Card anchorCard, int offset) {
if (anchorCard == null) {
return;
}
ArrayMap<Range<Integer>, Card> newChildren = new ArrayMap<>();
boolean startOffset = false;
for (int i = 0, size = mChildren.size(); i < size; i++) {
Range<Integer> key = mChildren.keyAt(i);
Card child = mChildren.valueAt(i);
if (child == anchorCard) {
Range<Integer> newKey = Range.create(key.getLower().intValue(), key.getUpper().intValue() + offset);
newChildren.put(newKey, child);
startOffset = true;
continue;
}
if (startOffset) {
Range<Integer> newKey = Range.create(key.getLower().intValue() + offset, key.getUpper().intValue() + offset);
newChildren.put(newKey, child);
} else {
newChildren.put(key, child);
}
}
mChildren.clear();
mChildren.putAll((SimpleArrayMap<? extends Range<Integer>, ? extends Card>) newChildren);
}
Aggregations