Java 类android.support.v4.util.SparseArrayCompat 实例源码

项目:AdaptiveTableLayout    文件:AdaptiveTableLayout.java   
private void init(Context context) {
    mViewHolders = new SparseMatrix<>();
    mLayoutDirectionHelper = new LayoutDirectionHelper(mLayoutDirection);
    mHeaderColumnViewHolders = new SparseArrayCompat<>();
    mHeaderRowViewHolders = new SparseArrayCompat<>();
    mDragAndDropPoints = new DragAndDropPoints();
    mState = new AdaptiveTableState();
    mManager = new AdaptiveTableManagerRTL(mLayoutDirectionHelper);
    mLastSwitchHeaderPoint = new Point();
    mVisibleArea = new Rect();
    // init scroll and fling helpers
    mScrollerRunnable = new SmoothScrollRunnable(this);
    mScrollerDragAndDropRunnable = new DragAndDropScrollRunnable(this);
    mRecycler = new Recycler();
    mSettings = new AdaptiveTableLayoutSettings();
    mScrollHelper = new ScrollHelper(context);
    mScrollHelper.setListener(this);
    mShadowHelper = new ShadowHelper(mLayoutDirectionHelper);
}
项目:letv    文件:AbsHListView.java   
@TargetApi(11)
public void setChoiceMode(int choiceMode) {
    this.mChoiceMode = choiceMode;
    if (VERSION.SDK_INT >= 11 && this.mChoiceActionMode != null) {
        if (VERSION.SDK_INT >= 11) {
            ((ActionMode) this.mChoiceActionMode).finish();
        }
        this.mChoiceActionMode = null;
    }
    if (this.mChoiceMode != 0) {
        if (this.mCheckStates == null) {
            this.mCheckStates = new SparseArrayCompat();
        }
        if (this.mCheckedIdStates == null && this.mAdapter != null && this.mAdapter.hasStableIds()) {
            this.mCheckedIdStates = new LongSparseArray();
        }
        if (VERSION.SDK_INT >= 11 && this.mChoiceMode == 3) {
            clearChoices();
            setLongClickable(true);
        }
    }
}
项目:A.scribe    文件:FragmentStatePagerAdapter2.java   
@Override
public void notifyDataSetChanged() {
    SparseArrayCompat<Fragment> newFragments =
            new SparseArrayCompat<>(fragments.size());
    for (int i = 0; i < fragments.size(); i++) {
        final int oldPos = fragments.keyAt(i);
        final Fragment f = fragments.valueAt(i);
        final int newPos = getItemPosition(f);
        if (newPos != POSITION_NONE) {
            final int pos = (newPos >= 0) ? newPos : oldPos;
            newFragments.put(pos, f);
        }
    }
    fragments = newFragments;
    super.notifyDataSetChanged();
}
项目:UIKit-ViewBlock    文件:UIKitHelper.java   
private void attachChildViewBlock(@NonNull UIKitComponent component, SparseArrayCompat<String>
        childViewBlockClassNamesArray, int index, View childView) {
    int childViewChildAtId = childView.getId();
    int indexOfKey = childViewBlockClassNamesArray.indexOfKey(childViewChildAtId);
    if (indexOfKey < 0) {
        indexOfKey = childViewBlockClassNamesArray.indexOfKey(index);
    }
    if (indexOfKey < 0) {
        return;
    }

    String name = childViewBlockClassNamesArray.valueAt(indexOfKey);

    if (name == null) {
        return;
    }

    ViewBlock parentBlock = component.getViewBlock();
    ViewBlock viewBlock = createViewBlock(childView, childViewChildAtId, name);
    if (viewBlock != null) {
        addViewBlockToViewBlockManager(viewBlock, parentBlock, component.getViewBlockManager());
    }

    childViewBlockClassNamesArray.removeAt(indexOfKey);
}
项目:nuclei-android    文件:OffsetTestActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.offset_activity_test);

    ItemsAdapter adapter = new ItemsAdapter(this);
    adapter.setList(new ItemPagedList(this));
    manage(adapter);

    SparseArrayCompat<Integer> offsetItems = new SparseArrayCompat<>();
    offsetItems.put(1, Integer.MAX_VALUE - 1);
    offsetItems.put(10, Integer.MAX_VALUE - 2);

    OffsetTestAdapter offsetAdapter = new OffsetTestAdapter(this, adapter, offsetItems);
    manage(offsetAdapter);

    RecyclerView items = (RecyclerView) findViewById(R.id.items);
    items.setLayoutManager(new LinearLayoutManager(this));
    items.setAdapter(offsetAdapter);
}
项目:nuclei-android    文件:OffsetTestActivity2.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.offset_activity_test);

    ItemsAdapter adapter = new ItemsAdapter(this);
    adapter.setList(new ItemPagedList(this));
    manage(adapter);

    SparseArrayCompat<Integer> offsetItems = new SparseArrayCompat<>();
    offsetItems.put(0, Integer.MAX_VALUE - 1);
    offsetItems.put(1, Integer.MAX_VALUE - 2);
    offsetItems.put(2, Integer.MAX_VALUE - 3);

    OffsetTestAdapter offsetAdapter = new OffsetTestAdapter(this, adapter, offsetItems);
    manage(offsetAdapter);

    RecyclerView items = (RecyclerView) findViewById(R.id.items);
    items.setLayoutManager(new LinearLayoutManager(this));
    items.setAdapter(offsetAdapter);
}
项目:lottie-android    文件:LottieComposition.java   
public void init(Rect bounds, float startFrame, float endFrame, float frameRate, int majorVersion,
    int minorVersion, int patchVersion, List<Layer> layers, LongSparseArray<Layer> layerMap,
    Map<String, List<Layer>> precomps, Map<String, LottieImageAsset> images,
    SparseArrayCompat<FontCharacter> characters, Map<String, Font> fonts) {
  this.bounds = bounds;
  this.startFrame = startFrame;
  this.endFrame = endFrame;
  this.frameRate = frameRate;
  this.majorVersion = majorVersion;
  this.minorVersion = minorVersion;
  this.patchVersion = patchVersion;
  this.layers = layers;
  this.layerMap = layerMap;
  this.precomps = precomps;
  this.images = images;
  this.characters = characters;
  this.fonts = fonts;
}
项目:WheelDemo    文件:CharacterPickerView.java   
/**
     * 设置第二个列表数据
     *
     * @param city
     */
    public void setCity(SparseArrayCompat<List<DataModel>> city) {
        mCitisDatasMap = city;
        List<DataModel> temp_city = city.get(mProvinceId);
        if (temp_city != null) {
            for (int i = 0; i < temp_city.size(); i++) {
                DataModel data = temp_city.get(i);
                if (data.Id == mCityId) {
                    mCityPosition = i;
                    break;
                }
            }
        }
        updateCities(mCityPosition);
//        mCity.setCurrentItem(mCityPosition);
    }
项目:WheelDemo    文件:CharacterPickerView.java   
/**
     * 设置第三个列表数据
     *
     * @param area
     */
    public void setArea(SparseArrayCompat<List<DataModel>> area) {
        mAreaDatasMap = area;
        List<DataModel> temp_area = area.get(mCityId);
        if (temp_area != null) {
            for (int i = 0; i < temp_area.size(); i++) {
                DataModel data = temp_area.get(i);
                if (data.Id == mAreaId) {
                    mAreaPosition = i;
                    break;
                }
            }
        }
        updateAreas(mAreaPosition);
//        mArea.setCurrentItem(mAreaPosition);
    }
项目:WheelDemo    文件:IOSCharacterPickerView.java   
/**
     * 设置第二个列表数据
     *
     * @param city
     */
    public void setCity(SparseArrayCompat<List<DataModel>> city) {
        mCitisDatasMap = city;
        List<DataModel> temp_city = city.get(mProvinceId);
        if (temp_city != null) {
            for (int i = 0; i < temp_city.size(); i++) {
                DataModel data = temp_city.get(i);
                if (data.Id == mCityId) {
                    mCityPosition = i;
                    break;
                }
            }
        }
        updateCities(mCityPosition);
//        mCity.setCurrentItem(mCityPosition);
    }
项目:WheelDemo    文件:IOSCharacterPickerView.java   
/**
     * 设置第三个列表数据
     *
     * @param area
     */
    public void setArea(SparseArrayCompat<List<DataModel>> area) {
        mAreaDatasMap = area;
        List<DataModel> temp_area = area.get(mCityId);
        if (temp_area != null) {
            for (int i = 0; i < temp_area.size(); i++) {
                DataModel data = temp_area.get(i);
                if (data.Id == mAreaId) {
                    mAreaPosition = i;
                    break;
                }
            }
        }
        updateAreas(mAreaPosition);
//        mArea.setCurrentItem(mAreaPosition);
    }
项目:ParallaxHeaderViewPager    文件:ParallaxViewPagerChangeListener.java   
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    int currentItem = mViewPager.getCurrentItem();
    if (positionOffsetPixels > 0) {
        SparseArrayCompat<ScrollTabHolder> scrollTabHolders = mAdapter.getScrollTabHolders();

        ScrollTabHolder fragmentContent;
        if (position < currentItem) {
            // Revealed the previous page
            fragmentContent = scrollTabHolders.valueAt(position);
        } else {
            // Revealed the next page
            fragmentContent = scrollTabHolders.valueAt(position + 1);
        }

        fragmentContent.adjustScroll((int) (mHeader.getHeight() + mHeader.getTranslationY()),
                mHeader.getHeight());
    }
}
项目:StickyHeaderViewPager    文件:StickHeaderViewPager.java   
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    int currentItem = mViewPager.getCurrentItem();
    if (positionOffsetPixels > 0) {
        SparseArrayCompat<ScrollHolder> scrollTabHolders = mAdapter.getScrollTabHolders();

        ScrollHolder fragmentContent;
        if (position < currentItem) {
            fragmentContent = scrollTabHolders.valueAt(position);
        } else {
            fragmentContent = scrollTabHolders.valueAt(position + 1);
        }

        fragmentContent.adjustScroll((int) (mStickheader.getHeight() + mStickheader.getTranslationY()), mStickheader.getHeight());
    }
}
项目:Android-ParallaxHeaderViewPager    文件:MainActivity.java   
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

    if (positionOffsetPixels > 0) {
        int currentItem = mViewPager.getCurrentItem();

        SparseArrayCompat<ScrollTabHolder> scrollTabHolders = mPagerAdapter.getScrollTabHolders();
        ScrollTabHolder currentHolder;

        if (position < currentItem) {
            currentHolder = scrollTabHolders.valueAt(position);
        } else {
            currentHolder = scrollTabHolders.valueAt(position + 1);
        }

        if (NEEDS_PROXY) {
            // TODO is not good
            currentHolder.adjustScroll(mHeader.getHeight() - mLastY);
            mHeader.postInvalidate();
        } else {
            currentHolder.adjustScroll((int) (mHeader.getHeight() + mHeader.getTranslationY()));
        }
    }
}
项目:HListViewAnimations    文件:SimpleHListActivity.java   
private void deleteSelectedItems() {
    SparseArrayCompat<Boolean> checkedItems = listView.getCheckedItemPositions();
    ArrayList<Integer> sorted = new ArrayList<Integer>(checkedItems.size());

    Log.i(LOG_TAG, "deleting: " + checkedItems.size());

    for (int i = 0; i < checkedItems.size(); i++) {
        if (checkedItems.valueAt(i)) {
            sorted.add(checkedItems.keyAt(i));
        }
    }

    Collections.sort(sorted);

    for (int i = sorted.size() - 1; i >= 0; i--) {
        int position = sorted.get(i);
        Log.d(LOG_TAG, "Deleting item at: " + position);
        mAdapter.mItems.remove(position);
    }
    mAdapter.notifyDataSetChanged();
}
项目:opentasks    文件:BaseTaskViewDescriptor.java   
protected <T extends View> T getView(View view, int viewId)
{
    SparseArrayCompat<View> viewHolder = (SparseArrayCompat<View>) view.getTag();
    if (viewHolder == null)
    {
        viewHolder = new SparseArrayCompat<View>();
        view.setTag(viewHolder);
    }
    View res = viewHolder.get(viewId);
    if (res == null)
    {
        res = view.findViewById(viewId);
        viewHolder.put(viewId, res);
    }
    return (T) res;
}
项目:AdaptiveTableLayout    文件:AdaptiveTableLayout.java   
/**
 * Method switch view holders in map (map with headers view holders).
 *
 * @param map       header view holder's map
 * @param fromIndex index from view holder
 * @param toIndex   index to view holder
 * @param type      type of items (column header or row header)
 */
@SuppressWarnings("unused")
private void switchHeaders(SparseArrayCompat<ViewHolder> map, int fromIndex, int toIndex, int type) {
    ViewHolder fromVh = map.get(fromIndex);

    if (fromVh != null) {
        map.remove(fromIndex);
        if (type == ViewHolderType.COLUMN_HEADER) {
            fromVh.setColumnIndex(toIndex);
        } else if (type == ViewHolderType.ROW_HEADER) {
            fromVh.setRowIndex(toIndex);
        }
    }

    ViewHolder toVh = map.get(toIndex);
    if (toVh != null) {
        map.remove(toIndex);
        if (type == ViewHolderType.COLUMN_HEADER) {
            toVh.setColumnIndex(fromIndex);
        } else if (type == ViewHolderType.ROW_HEADER) {
            toVh.setRowIndex(fromIndex);
        }
    }

    if (fromVh != null) {
        map.put(toIndex, fromVh);
    }

    if (toVh != null) {
        map.put(fromIndex, toVh);
    }
}
项目:AdaptiveTableLayout    文件:SparseMatrix.java   
/**
 * Put item to the matrix in row, column position.
 *
 * @param row    item row position
 * @param column item column  position
 * @param item   Object
 */
void put(int row, int column, @NonNull TObj item) {
    SparseArrayCompat<TObj> array = mData.get(row);
    if (array == null) {
        array = new SparseArrayCompat<>();
        array.put(column, item);
        mData.put(row, array);
    } else {
        array.put(column, item);
    }
}
项目:AdaptiveTableLayout    文件:SparseMatrix.java   
/**
 * Get all row's items
 *
 * @param row row index
 * @return Collection with row's Objects
 */
@NonNull
Collection<TObj> getRowItems(int row) {
    Collection<TObj> result = new LinkedList<>();
    SparseArrayCompat<TObj> array = mData.get(row);
    for (int count = array.size(), i = 0; i < count; i++) {
        int key = array.keyAt(i);
        TObj columnObj = array.get(key);
        if (columnObj != null) {
            result.add(columnObj);
        }

    }
    return result;
}
项目:AdaptiveTableLayout    文件:SparseMatrix.java   
/**
 * Get all matrix's items
 *
 * @return Collection with column's Objects
 */
@NonNull
Collection<TObj> getAll() {
    Collection<TObj> result = new LinkedList<>();
    for (int countR = mData.size(), i = 0; i < countR; i++) {
        int rowKey = mData.keyAt(i);
        SparseArrayCompat<TObj> columns = mData.get(rowKey);
        for (int countC = columns.size(), j = 0; j < countC; j++) {
            int key = columns.keyAt(j);
            result.add(columns.get(key));
        }
    }
    return result;
}
项目:AdaptiveTableLayout    文件:SparseMatrix.java   
/**
 * Remove item in row, column position int the matrix
 *
 * @param row    item row position
 * @param column item column position
 */
void remove(int row, int column) {
    SparseArrayCompat<TObj> array = mData.get(row);
    if (array != null) {
        array.remove(column);
    }
}
项目:RecyclerStickyHeaderView    文件:DataBean.java   
@Override
public final IViewBinder provideViewBinder(StickyHeaderViewAdapter adapter, SparseArrayCompat<? extends IViewBinder> viewBinderPool, int position) {
    if (viewBinder == null) {
        viewBinder = viewBinderPool.get(getItemLayoutId(adapter));
    }
    return viewBinder;
}
项目:letv    文件:HListView.java   
@Deprecated
public long[] getCheckItemIds() {
    if (this.mAdapter != null && this.mAdapter.hasStableIds()) {
        return getCheckedItemIds();
    }
    if (this.mChoiceMode == 0 || this.mCheckStates == null || this.mAdapter == null) {
        return new long[0];
    }
    SparseArrayCompat<Boolean> states = this.mCheckStates;
    int count = states.size();
    long[] ids = new long[count];
    ListAdapter adapter = this.mAdapter;
    int i = 0;
    int checkedCount = 0;
    while (i < count) {
        int checkedCount2;
        if (((Boolean) states.valueAt(i)).booleanValue()) {
            checkedCount2 = checkedCount + 1;
            ids[checkedCount] = adapter.getItemId(states.keyAt(i));
        } else {
            checkedCount2 = checkedCount;
        }
        i++;
        checkedCount = checkedCount2;
    }
    if (checkedCount == count) {
        return ids;
    }
    long[] result = new long[checkedCount];
    System.arraycopy(ids, 0, result, 0, checkedCount);
    return result;
}
项目:letv    文件:FragmentActivity.java   
protected void onCreate(@Nullable Bundle savedInstanceState) {
    List list = null;
    this.mFragments.attachHost(null);
    super.onCreate(savedInstanceState);
    NonConfigurationInstances nc = (NonConfigurationInstances) getLastNonConfigurationInstance();
    if (nc != null) {
        this.mFragments.restoreLoaderNonConfig(nc.loaders);
    }
    if (savedInstanceState != null) {
        Parcelable p = savedInstanceState.getParcelable(FRAGMENTS_TAG);
        FragmentController fragmentController = this.mFragments;
        if (nc != null) {
            list = nc.fragments;
        }
        fragmentController.restoreAllState(p, list);
        if (savedInstanceState.containsKey(NEXT_CANDIDATE_REQUEST_INDEX_TAG)) {
            this.mNextCandidateRequestIndex = savedInstanceState.getInt(NEXT_CANDIDATE_REQUEST_INDEX_TAG);
            int[] requestCodes = savedInstanceState.getIntArray(ALLOCATED_REQUEST_INDICIES_TAG);
            String[] fragmentWhos = savedInstanceState.getStringArray(REQUEST_FRAGMENT_WHO_TAG);
            if (requestCodes == null || fragmentWhos == null || requestCodes.length != fragmentWhos.length) {
                Log.w(TAG, "Invalid requestCode mapping in savedInstanceState.");
            } else {
                this.mPendingFragmentActivityResults = new SparseArrayCompat(requestCodes.length);
                for (int i = 0; i < requestCodes.length; i++) {
                    this.mPendingFragmentActivityResults.put(requestCodes[i], fragmentWhos[i]);
                }
            }
        }
    }
    if (this.mPendingFragmentActivityResults == null) {
        this.mPendingFragmentActivityResults = new SparseArrayCompat();
        this.mNextCandidateRequestIndex = 0;
    }
    this.mFragments.dispatchCreate();
}
项目:exciting-app    文件:HListView.java   
/**
 * Returns the set of checked items ids. The result is only valid if the
 * choice mode has not been set to {@link #CHOICE_MODE_NONE}.
 * 
 * @return A new array which contains the id of each checked item in the
 *         list.
 * 
 * @deprecated Use {@link #getCheckedItemIds()} instead.
 */
@Deprecated
public long[] getCheckItemIds() {
    // Use new behavior that correctly handles stable ID mapping.
    if (mAdapter != null && mAdapter.hasStableIds()) {
        return getCheckedItemIds();
    }

    // Old behavior was buggy, but would sort of work for adapters without
    // stable IDs.
    // Fall back to it to support legacy apps.
    if (mChoiceMode != AbsListView.CHOICE_MODE_NONE && mCheckStates != null && mAdapter != null) {
        final SparseArrayCompat<Boolean> states = mCheckStates;
        final int count = states.size();
        final long[] ids = new long[count];
        final ListAdapter adapter = mAdapter;

        int checkedCount = 0;
        for (int i = 0; i < count; i++) {
            if (states.valueAt(i)) {
                ids[checkedCount++] = adapter.getItemId(states.keyAt(i));
            }
        }

        // Trim array if needed. mCheckStates may contain false values
        // resulting in checkedCount being smaller than count.
        if (checkedCount == count) {
            return ids;
        } else {
            final long[] result = new long[checkedCount];
            System.arraycopy(ids, 0, result, 0, checkedCount);

            return result;
        }
    }
    return new long[0];
}
项目:exciting-app    文件:AbsHListView.java   
/**
 * Defines the choice behavior for the List. By default, Lists do not have
 * any choice behavior ({@link #CHOICE_MODE_NONE}). By setting the
 * choiceMode to {@link #CHOICE_MODE_SINGLE}, the List allows up to one item
 * to be in a chosen state. By setting the choiceMode to
 * {@link #CHOICE_MODE_MULTIPLE}, the list allows any number of items to be
 * chosen.
 * 
 * @param choiceMode
 *            One of {@link #CHOICE_MODE_NONE}, {@link #CHOICE_MODE_SINGLE},
 *            or {@link #CHOICE_MODE_MULTIPLE}
 */
@TargetApi(11)
public void setChoiceMode(int choiceMode) {
    mChoiceMode = choiceMode;

    if (android.os.Build.VERSION.SDK_INT >= 11) {
        if (mChoiceActionMode != null) {

            if (android.os.Build.VERSION.SDK_INT >= 11) {
                ((ActionMode) mChoiceActionMode).finish();
            }
            mChoiceActionMode = null;
        }
    }

    if (mChoiceMode != AbsListView.CHOICE_MODE_NONE) {
        if (mCheckStates == null) {
            mCheckStates = new SparseArrayCompat<Boolean>();
        }
        if (mCheckedIdStates == null && mAdapter != null
                && mAdapter.hasStableIds()) {
            mCheckedIdStates = new LongSparseArray<Integer>();
        }
        // Modal multi-choice mode only has choices when the mode is active.
        // Clear them.
        if (android.os.Build.VERSION.SDK_INT >= 11) {
            if (mChoiceMode == AbsListView.CHOICE_MODE_MULTIPLE_MODAL) {
                clearChoices();
                setLongClickable(true);
            }
        }
    }
}
项目:exciting-app    文件:AbsHListView.java   
private SparseArrayCompat<Boolean> readSparseBooleanArray(Parcel in) {
    if (LOG_ENABLED) {
        Log.i(TAG, "readSparseBooleanArray");
    }
    int N = in.readInt();
    if (N < 0) {
        return null;
    }
    SparseArrayCompat<Boolean> sa = new SparseArrayCompat<Boolean>(N);
    readSparseBooleanArrayInternal(sa, in, N);
    return sa;
}
项目:exciting-app    文件:AbsHListView.java   
private void readSparseBooleanArrayInternal(
        SparseArrayCompat<Boolean> outVal, Parcel in, int N) {
    while (N > 0) {
        int key = in.readInt();
        boolean value = in.readByte() == 1;
        if (LOG_ENABLED) {
            Log.i(TAG, "Unmarshalling key=" + key + " value=" + value);
        }
        outVal.append(key, value);
        N--;
    }
}
项目:boohee_v5.6    文件:FragmentActivity.java   
protected void onCreate(@Nullable Bundle savedInstanceState) {
    List list = null;
    this.mFragments.attachHost(null);
    super.onCreate(savedInstanceState);
    NonConfigurationInstances nc = (NonConfigurationInstances) getLastNonConfigurationInstance();
    if (nc != null) {
        this.mFragments.restoreLoaderNonConfig(nc.loaders);
    }
    if (savedInstanceState != null) {
        Parcelable p = savedInstanceState.getParcelable(FRAGMENTS_TAG);
        FragmentController fragmentController = this.mFragments;
        if (nc != null) {
            list = nc.fragments;
        }
        fragmentController.restoreAllState(p, list);
        if (savedInstanceState.containsKey(NEXT_CANDIDATE_REQUEST_INDEX_TAG)) {
            this.mNextCandidateRequestIndex = savedInstanceState.getInt(NEXT_CANDIDATE_REQUEST_INDEX_TAG);
            int[] requestCodes = savedInstanceState.getIntArray(ALLOCATED_REQUEST_INDICIES_TAG);
            String[] fragmentWhos = savedInstanceState.getStringArray(REQUEST_FRAGMENT_WHO_TAG);
            if (requestCodes == null || fragmentWhos == null || requestCodes.length != fragmentWhos.length) {
                Log.w(TAG, "Invalid requestCode mapping in savedInstanceState.");
            } else {
                this.mPendingFragmentActivityResults = new SparseArrayCompat(requestCodes.length);
                for (int i = 0; i < requestCodes.length; i++) {
                    this.mPendingFragmentActivityResults.put(requestCodes[i], fragmentWhos[i]);
                }
            }
        }
    }
    if (this.mPendingFragmentActivityResults == null) {
        this.mPendingFragmentActivityResults = new SparseArrayCompat();
        this.mNextCandidateRequestIndex = 0;
    }
    this.mFragments.dispatchCreate();
}
项目:UIKit-ViewBlock    文件:UIKitHelper.java   
void onFinishInflateViewBlock(@NonNull UIKitComponent component) {
    SparseArrayCompat<String> viewBlockClassNamesArray = component.getViewBlockClassNamesArray();
    int size = viewBlockClassNamesArray.size();

    boolean isEmpty = (size == 0);

    if (!isEmpty) {
        int mHostChildCount = mHost.getChildCount();
        for (int i = 0; i < mHostChildCount; i++) {
            View childAt = mHost.getChildAt(i);
            if (!(childAt instanceof ViewGroup)) {
                attachChildViewBlock(component, viewBlockClassNamesArray, i, childAt);
            }
        }
    }

    if (!(component.getActivity() instanceof UIKitActivity)) {
        ViewGroup parent = component.getParentContainer();
        if (parent == null) return;
        if ((parent).getId() == android.R.id.content) {
            ViewBlockManager blockManager = UIKit.getViewBlockManager(component.getActivity());
            SparseArray<ViewBlock> viewBlocks = blockManager.getViewBlocks();
            UIKitActivity.dispatch(viewBlocks, UIKitActivity.ON_CREATE_VIEW);
        }
    }

}
项目:AppOpsX    文件:ExportFragment.java   
private void export() {
  SparseArrayCompat<AppInfo> checkedApps = adapter.getCheckedApps();
  final int size = checkedApps.size();
  AppInfo[] appInfos = new AppInfo[size];
  for (int i = 0; i < size; i++) {
    appInfos[i] = checkedApps.valueAt(i);
  }

  mPresenter.export(appInfos);
}
项目:training-epam-2016    文件:AbstractAdapter.java   
public AbstractViewHolder(final View itemView, final int... ids) {
    super(itemView);

    mViewSparseArray = new SparseArrayCompat<>(ids.length);

    for (final int id : ids) {
        mViewSparseArray.append(id, itemView.findViewById(id));
    }
}
项目:nuclei-android    文件:OffsetListAdapter.java   
/**
 * If the wrapped adapter has stable IDs, the offset list adapter must have stable IDs too.
 *
 * @param context
 * @param adapter The adapter which we will be wrapping
 * @param items The items where the key is the position the value will be placed.
 */
public OffsetListAdapter(Context context, RecyclerView.Adapter<VH> adapter, SparseArrayCompat<T> items) {
    mObserver = new Observer();
    mInflater = LayoutInflater.from(context);
    super.setHasStableIds(adapter.hasStableIds());
    mOriginalAdapter = adapter;
    mItems = items;
    adapter.registerAdapterDataObserver(mObserver);
    buildOffsets();
}
项目:wnacg    文件:ViewHolder.java   
public ViewHolder(Context context, View itemView) {
    super(itemView);
    this.mContext = context;
    this.mConvertView = itemView;
    this.mConvertView.setTag(R.string.app_name, this);
    this.mViews = new SparseArrayCompat<View>();
}
项目:wnacg    文件:ViewHolder.java   
public ViewHolder(Context context, View itemView, ViewGroup parent, int position){
    this.mViews = new SparseArrayCompat<View>();
    this.mPosition = position;
    this.mConvertView = itemView;
    this.mContext = context;
    //setTag
    mConvertView.setTag(R.string.app_name, this);
}
项目:RefreshTabView    文件:MainActivity.java   
@Override
public void onPageSelected(int position) {
    tabs.onPageSelected(position);
    reLocation = true;
    SparseArrayCompat<ScrollTabHolder> scrollTabHolders = adapter.getScrollTabHolders();
    ScrollTabHolder currentHolder = scrollTabHolders.valueAt(position);
    if (NEED_RELAYOUT) {
        currentHolder.adjustScroll((int) (header.getHeight() + headerTop));// 修正滚出去的偏移量
    } else {
        currentHolder.adjustScroll((int) (header.getHeight() + ViewHelper.getTranslationY(header)));// 修正滚出去的偏移量
    }
}
项目:RefreshTabView    文件:SlidingPagerAdapter.java   
public SlidingPagerAdapter(FragmentManager fm, Context context, ViewPager pager) {
    super(fm);
    fragments = new ScrollTabHolderFragment[PageAdapterTab.values().length];
    this.context = context;
    mScrollTabHolders = new SparseArrayCompat<ScrollTabHolder>();
    init(fm);
}
项目:WIFIADB    文件:CircularRevealDrawable.java   
public CircularRevealDrawable() {
    super();
    mPaint = new Paint();

    mResources = MyApp.getContext().getResources();
    mDefaultColor = ResourcesCompat.getColor(mResources,android.R.color.white,null);

    mColorMap = new SparseArrayCompat<>();
    mCurrentColor = EOF_COLOR;
    mNextColor = EOF_COLOR;
}
项目:drebin    文件:BinderRecyclerViewAdapter.java   
public BinderRecyclerViewAdapter(Context context, List<?> items, BinderEnvironment environment, BinderSelectorMapper mapper, StableIdsResolver stableIdsResolver) {
  mContext = context;
  mEnvironment = environment;
  mBinderCache = new SparseArrayCompat<>();
  mItems = items;
  mMapper = mapper;
  mIdResolver = stableIdsResolver;
  setHasStableIds(mIdResolver != null);
}
项目:truth-android    文件:SparseArrayCompatSubject.java   
public static <E> SubjectFactory<SparseArrayCompatSubject<E>, SparseArrayCompat<E>> type() {
  return new SubjectFactory<SparseArrayCompatSubject<E>, SparseArrayCompat<E>>() {
    @Override
    public SparseArrayCompatSubject<E> getSubject(FailureStrategy fs, SparseArrayCompat<E> that) {
      return new SparseArrayCompatSubject<E>(fs, that);
    }
  };
}