Search in sources :

Example 1 with SimpleArrayMap

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);
}
Also used : MediaLibraryItem(org.videolan.medialibrary.media.MediaLibraryItem) SimpleArrayMap(android.support.v4.util.SimpleArrayMap) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 2 with SimpleArrayMap

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);
}
Also used : SimpleArrayMap(android.support.v4.util.SimpleArrayMap) ArrayMap(android.support.v4.util.ArrayMap) Range(com.alibaba.android.vlayout.Range) Card(com.tmall.wireless.tangram3.dataparser.concrete.Card)

Aggregations

SimpleArrayMap (android.support.v4.util.SimpleArrayMap)2 ArrayMap (android.support.v4.util.ArrayMap)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 Range (com.alibaba.android.vlayout.Range)1 Card (com.tmall.wireless.tangram3.dataparser.concrete.Card)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 MediaLibraryItem (org.videolan.medialibrary.media.MediaLibraryItem)1