微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.util.SparseArray的实例源码

项目:AndroidOCRFforID    文件OcrDetectorProcessor.java   
/**
 * Called by the detector to deliver detection results.
 * If your application called for it,this Could be a place to check for
 * equivalent detections by tracking TextBlocks that are similar in location and content from
 * prevIoUs frames,or reduce noise by eliminating TextBlocks that have not persisted through
 * multiple detections.
 */
@Override
public void receiveDetections(Detector.Detections<TextBlock> detections) {
    mGraphicOverlay.clear();
    SparseArray<TextBlock> items = detections.getDetectedItems();
    for (int i = 0; i < items.size(); ++i) {
        TextBlock item = items.valueAt(i);
        if (item != null && item.getValue() != null) {
            if (item.getValue().contains("INSTITUTO FEDERAL ELECTORAL")) {
                documentIdentifier.setType(Constants.IFEB);
            } else if (item.getValue().contains("INSTITUTO NACIONAL ELECTORAL")) {
                Log.d("OcrDetectorProcessor","INE E " + item.getValue());
                documentIdentifier.setType(Constants.IFEE);
            }
        }
        //Ocrgraphic graphic = new Ocrgraphic(mGraphicOverlay,item);
        //mGraphicOverlay.add(graphic);
    }
}
项目:Elements    文件ElementAdapter.java   
/**
 * Register an indefinite number of sources that will be asynchronously asked for Elements.
 * This will throw {@code IllegalArgumentException} if any circular dependency is detected.
 * @see ElementSource#dependsOn(ElementSource)
 *
 * @param sources one or more ElementSource.
 */
public void setSource(ElementSource... sources) {
    int count = sources.length;
    allSources = Arrays.asList(sources);
    sourceIdMap = new SparseArray<>(count);
    dependencyMap = new SparseArray<>(count);
    reverseDependencyMap = new SparseArray<>(count);
    groups = new ArrayList<>(count);
    for (int i = 0; i < count; i++) {
        // Assign a unique id to each source,based on its position in the input array.
        sourceIdMap.put(i,sources[i]);
        // Allocate maps for dependencies.
        dependencyMap.put(i,new HashSet<Integer>());
        reverseDependencyMap.put(i,new HashSet<Integer>());
    }

    // Initialize ordered lists.
    computeDependencies();
    computeGroups();
}
项目:fragmentnav    文件FmEnter.java   
private void printActive(){
    try {
        Field field = getFragmentManager().getClass().getDeclaredField("mActive");
        field.setAccessible(true);
        SparseArray<Fragment>  active = (SparseArray<Fragment>) field.get(getFragmentManager());
        System.out.println();


        Method method = getFragmentManager().getClass().getDeclaredMethod("getActiveFragments");
        method.setAccessible(true);
        List<Fragment> fragments = (List<Fragment>) method.invoke(getFragmentManager());
        Log.p("mActive",Utils.joinCollections(fragments,","));
    } catch (Exception e){

    }
}
项目:letv    文件BackStackRecord.java   
private TransitionState beginTransition(SparseArray<Fragment> firstOutFragments,SparseArray<Fragment> lastInFragments,boolean isBack) {
    int i;
    ensureFragmentsAreInitialized(lastInFragments);
    TransitionState state = new TransitionState();
    state.nonExistentView = new View(this.mManager.mHost.getContext());
    boolean anyTransitionStarted = false;
    for (i = 0; i < firstOutFragments.size(); i++) {
        if (configureTransitions(firstOutFragments.keyAt(i),state,isBack,firstOutFragments,lastInFragments)) {
            anyTransitionStarted = true;
        }
    }
    for (i = 0; i < lastInFragments.size(); i++) {
        int containerId = lastInFragments.keyAt(i);
        if (firstOutFragments.get(containerId) == null && configureTransitions(containerId,lastInFragments)) {
            anyTransitionStarted = true;
        }
    }
    if (anyTransitionStarted) {
        return state;
    }
    return null;
}
项目:RNLearn_Project1    文件Timing.java   
@ReactMethod
public void deleteTimer(ExecutorToken executorToken,int timerId) {
  synchronized (mTimerGuard) {
    SparseArray<Timer> timersForContext = mTimerIdsToTimers.get(executorToken);
    if (timersForContext == null) {
      return;
    }
    Timer timer = timersForContext.get(timerId);
    if (timer == null) {
      return;
    }
    // We may have already called/removed it
    timersForContext.remove(timerId);
    if (timersForContext.size() == 0) {
      mTimerIdsToTimers.remove(executorToken);
    }
    mTimers.remove(timer);
  }
}
项目:boohee_v5.6    文件BackStackRecord.java   
private TransitionState beginTransition(SparseArray<Fragment> firstOutFragments,lastInFragments)) {
            anyTransitionStarted = true;
        }
    }
    if (anyTransitionStarted) {
        return state;
    }
    return null;
}
项目:Week_Calendar    文件RecycleBin.java   
static View retrieveFromScrap(SparseArray<View> scrapViews,int position) {
  int size = scrapViews.size();
  if (size > 0) {
    // See if we still have a view for this position.
    for (int i = 0; i < size; i++) {
      int fromPosition = scrapViews.keyAt(i);
      View view = scrapViews.get(fromPosition);
      if (fromPosition == position) {
        scrapViews.remove(fromPosition);
        return view;
      }
    }
    int index = size - 1;
    View r = scrapViews.valueAt(index);
    scrapViews.remove(scrapViews.keyAt(index));
    return r;
  } else {
    return null;
  }
}
项目:LaunchEnr    文件BadgeRenderer.java   
public BadgeRenderer(Context context,int iconSizePx) {
    mContext = context;

    Resources res = context.getResources();
    mSize = (int) (SIZE_PERCENTAGE * iconSizePx);
    mCharSize = (int) (CHAR_SIZE_PERCENTAGE * iconSizePx);
    mOffset = (int) (OFFSET_PERCENTAGE * iconSizePx);
    mStackOffsetX = (int) (STACK_OFFSET_PERCENTAGE_X * iconSizePx);
    mStackOffsetY = (int) (STACK_OFFSET_PERCENTAGE_Y * iconSizePx);
    mTextPaint.setTextSize(iconSizePx * TEXT_SIZE_PERCENTAGE);
    mTextPaint.setTextAlign(Paint.Align.CENTER);
    mLargeIconDrawer = new IconDrawer(res.getDimensionPixelSize(R.dimen.badge_small_padding));
    mSmallIconDrawer = new IconDrawer(res.getDimensionPixelSize(R.dimen.badge_large_padding));
    // Measure the text height.
    Rect tempTextHeight = new Rect();
    mTextPaint.getTextBounds("0",1,tempTextHeight);
    mTextHeight = tempTextHeight.height();

    mBackgroundsWithShadow = new SparseArray<>(3);
}
项目:PlusGram    文件MessagesController.java   
public void didAddednewTask(final int minDate,final SparseArray<ArrayList<Integer>> mids) {
    Utilities.stageQueue.postRunnable(new Runnable() {
        @Override
        public void run() {
            if (currentDeletingTaskMids == null && !gettingNewDeleteTask || currentDeletingTasktime != 0 && minDate < currentDeletingTasktime) {
                getNewDeleteTask(null);
            }
        }
    });
    AndroidUtilities.runOnUIThread(new Runnable() {
        @Override
        public void run() {
            NotificationCenter.getInstance().postNotificationName(NotificationCenter.didCreatednewDeleteTask,mids);
        }
    });
}
项目:okdownload    文件BreakpointStoreOnCacheTest.java   
@Test
public void findAnotherInfoFromCompare() {
    final SparseArray<DownloadTask> unStoredTasks = new SparseArray<>();
    final SparseArray<BreakpointInfo> storedInfos = new SparseArray<>();
    storeOnCache = new BreakpointStoreOnCache(storedInfos,new HashMap<String,String>(),unStoredTasks,new ArrayList<Integer>());

    final BreakpointInfo info1 = mock(BreakpointInfo.class);
    final BreakpointInfo info2 = mock(BreakpointInfo.class);
    final DownloadTask task = mock(DownloadTask.class);

    storedInfos.put(insertedId,info1);

    doReturn(true).when(info1).isSameFrom(task);
    doReturn(false).when(info2).isSameFrom(task);

    BreakpointInfo result = storeOnCache.findAnotherInfoFromCompare(task,info1);
    assertthat(result).isNull();
    result = storeOnCache.findAnotherInfoFromCompare(task,info2);
    assertthat(result).isEqualToComparingFieldByField(info1);
}
项目:GitHub    文件BasePool.java   
/**
 * Creates a new instance of the pool.
 * @param poolParams pool parameters
 * @param poolStatsTracker
 */
public BasePool(
    MemoryTrimmableRegistry memoryTrimmableRegistry,PoolParams poolParams,PoolStatsTracker poolStatsTracker) {
  mMemoryTrimmableRegistry = Preconditions.checkNotNull(memoryTrimmableRegistry);
  mPoolParams = Preconditions.checkNotNull(poolParams);
  mPoolStatsTracker = Preconditions.checkNotNull(poolStatsTracker);

  // initialize the buckets
  mBuckets = new SparseArray<Bucket<V>>();
  initBuckets(new SparseIntArray(0));

  mInUseValues = Sets.newIdentityHashSet();

  mFree = new Counter();
  mUsed = new Counter();
}
项目:PlusGram    文件NumberPicker.java   
private void ensureCachedScrollSelectorValue(int selectorIndex) {
    SparseArray<String> cache = mSelectorIndexToStringCache;
    String scrollSelectorValue = cache.get(selectorIndex);
    if (scrollSelectorValue != null) {
        return;
    }
    if (selectorIndex < mMinValue || selectorIndex > mMaxValue) {
        scrollSelectorValue = "";
    } else {
        if (mdisplayedValues != null) {
            int displayedValueIndex = selectorIndex - mMinValue;
            scrollSelectorValue = mdisplayedValues[displayedValueIndex];
        } else {
            scrollSelectorValue = formatNumber(selectorIndex);
        }
    }
    cache.put(selectorIndex,scrollSelectorValue);
}
项目:CSipSimple    文件MenuBuilder.java   
private void dispatchSaveInstanceState(Bundle outState) {
    if (mPresenters.isEmpty()) return;

    SparseArray<Parcelable> presenterStates = new SparseArray<Parcelable>();

    for (WeakReference<MenuPresenter> ref : mPresenters) {
        final MenuPresenter presenter = ref.get();
        if (presenter == null) {
            mPresenters.remove(ref);
        } else {
            final int id = presenter.getId();
            if (id > 0) {
                final Parcelable state = presenter.onSaveInstanceState();
                if (state != null) {
                    presenterStates.put(id,state);
                }
            }
        }
    }

    outState.putSparseParcelableArray(PRESENTER_KEY,presenterStates);
}
项目:chromium-for-android-56-debug-video    文件DocumentTabModelImpl.java   
/**
 * Construct a DocumentTabModel.
 * @param activityDelegate Delegate to use for accessing the ActivityManager.
 * @param storageDelegate Delegate to use for accessing persistent storage.
 * @param tabCreatorManager Used to create Tabs.
 * @param isIncognito Whether or not the TabList is managing incognito tabs.
 * @param prioritizedTabId ID of the tab to prioritize when loading.
 * @param context Context to use for accessing SharedPreferences.
 */
public DocumentTabModelImpl(ActivityDelegate activityDelegate,StorageDelegate storageDelegate,TabCreatorManager tabCreatorManager,boolean isIncognito,int prioritizedTabId,Context context) {
    super(isIncognito,false);
    mActivityDelegate = activityDelegate;
    mStorageDelegate = storageDelegate;
    mContext = context;

    mCurrentState = STATE_UNINITIALIZED;
    mTabIdList = new ArrayList<Integer>();
    mEntryMap = new SparseArray<Entry>();
    mHistoricalTabs = new ArrayList<Integer>();

    mLastShownTabId = DocumentUtils.getLastShownTabIdFromPrefs(mContext,isIncognito());

    // Restore the tab list.
    setCurrentState(STATE_READ_RECENT_TASKS_START);
    mStorageDelegate.restoreTabEntries(
            isIncognito,activityDelegate,mEntryMap,mTabIdList,mHistoricalTabs);
    setCurrentState(STATE_READ_RECENT_TASKS_END);
}
项目:AndroidMuseumBleManager    文件AdRecordStore.java   
/**
 * Instantiates a new Bluetooth LE device Ad Record Store.
 *
 * @param adRecords the ad records
 */
public AdRecordStore(final SparseArray<AdRecord> adRecords) {
    mAdRecords = adRecords;

    mLocalNameComplete = AdRecordUtils.getRecordDataAsstring(
            mAdRecords.get(AdRecord.TYPE_LOCAL_NAME_COMPLETE));

    mLocalNameShort = AdRecordUtils.getRecordDataAsstring(
            mAdRecords.get(AdRecord.TYPE_LOCAL_NAME_SHORT));

}
项目:fragmentnav    文件FmTest.java   
private void printActive(){
    try {
        Field field = getFragmentManager().getClass().getDeclaredField("mActive");
        field.setAccessible(true);
        SparseArray<Fragment>  active = (SparseArray<Fragment>) field.get(getFragmentManager());
        System.out.println();


        Method method = getFragmentManager().getClass().getDeclaredMethod("getActiveFragments");
        method.setAccessible(true);
        List<Fragment> fragments = (List<Fragment>) method.invoke(getFragmentManager());
        Log.p("mActive","));
    } catch (Exception e){

    }
}
项目:YCBaseAdapter    文件BaseViewHolder.java   
public BaseViewHolder(View itemView) {
    super(itemView);
    this.mItemView = itemView;
    itemView.setonClickListener(this);
    itemView.setonLongClickListener(this);
    viewSparseArray = new SparseArray<>();
}
项目:simple-share-android    文件DirectoryFragment.java   
@Override
public void onStop() {
    super.onStop();

    // Remember last scroll location
    final SparseArray<Parcelable> container = new SparseArray<Parcelable>();
    getView().saveHierarchyState(container);
    final State state = getdisplayState(this);
    state.dirstate.put(mStateKey,container);
}
项目:Elements    文件ElementPresenter.java   
private Holder(View itemView,int elementType,List<ViewReference> views) {
    super(itemView);
    this.elementType = elementType;
    this.root = itemView;
    this.views = new SparseArray<>();
    if (views != null) {
        for (ViewReference reference : views) {
            reference.find(root);
            this.views.put(reference.id,reference);
        }
    }
}
项目:aos-Video    文件NonScrapedSortOrderEntry.java   
static protected int sortOrder2Item(String sortOrder,SparseArray<NonScrapedSortOrderEntry> indexer) {
    int item = -1;
    for (int i=0 ; i<indexer.size(); i++) {
        if (indexer.get(i).mSortOrder.equals(sortOrder)) {
            item = indexer.keyAt(i);
            break;
        }
    }
    return Math.max(item,0);
}
项目:Toodoo    文件OcrDetectorProcessor.java   
/**
 * Called by the detector to deliver detection results.
 * If your application called for it,or reduce noise by eliminating TextBlocks that have not persisted through
 * multiple detections.
 */
@Override
public void receiveDetections(Detector.Detections<TextBlock> detections) {
    mGraphicOverlay.clear();
    final SparseArray<TextBlock> items = detections.getDetectedItems();
    for (int i = 0; i < items.size(); ++i) {
        TextBlock item = items.valueAt(i);
        if (item != null && item.getValue() != null) {
            Log.d("OcrDetectorProcessor","Text detected! " + item.getValue());
        }
        Ocrgraphic graphic = new Ocrgraphic(mGraphicOverlay,item);
        mGraphicOverlay.add(graphic);
    }

}
项目:PlusGram    文件Messagesstorage.java   
public void updateDialogsWithReadMessages(final SparseArray<Long> inBox,final SparseArray<Long> outBox,boolean useQueue) {
    if (inBox.size() == 0) {
        return;
    }
    if (useQueue) {
        storageQueue.postRunnable(new Runnable() {
            @Override
            public void run() {
                updateDialogsWithReadMessagesInternal(null,inBox,outBox);
            }
        });
    } else {
        updateDialogsWithReadMessagesInternal(null,outBox);
    }
}
项目:XFrame    文件XEmptyUtils.java   
/**
 * 判断对象是否为null或长度数量为0
 *
 * @param obj 对象
 * @return {@code true}: 为空<br>{@code false}: 不为空
 */
public static boolean isEmpty(Object obj) {
    if (obj == null) {
        return true;
    }
    if (obj instanceof String && obj.toString().length() == 0) {
        return true;
    }
    if (obj.getClass().isArray() && Array.getLength(obj) == 0) {
        return true;
    }
    if (obj instanceof Collection && ((Collection) obj).isEmpty()) {
        return true;
    }
    if (obj instanceof Map && ((Map) obj).isEmpty()) {
        return true;
    }
    if (obj instanceof SparseArray && ((SparseArray) obj).size() == 0) {
        return true;
    }
    if (obj instanceof SparseBooleanArray && ((SparseBooleanArray) obj).size() == 0) {
        return true;
    }
    if (obj instanceof SparseIntArray && ((SparseIntArray) obj).size() == 0) {
        return true;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        if (obj instanceof SparseLongArray && ((SparseLongArray) obj).size() == 0) {
            return true;
        }
    }
    return false;
}
项目:youtube_background_android    文件BackgroundAudioService.java   
/**
 * Extracts link from youtube video ID,so mediaPlayer can play it
 */
private void extractUrlAndplay() {
    String youtubeLink = Config.YOUTUBE_BASE_URL + videoItem.getId();
    deviceBandwidthSampler.startSampling();

    new YouTubeExtractor(this) {
        @Override
        protected void onExtractionComplete(SparseArray<YtFile> ytFiles,VideoMeta videoMeta) {
            if (ytFiles == null) {
                // Something went wrong we got no urls. Always check this.
                Toast.makeText(YTApplication.getAppContext(),R.string.Failed_playback,Toast.LENGTH_SHORT).show();
                extractUrlAndplay();

            } else {
                deviceBandwidthSampler.stopSampling();
                YtFile ytFile = getBestStream(ytFiles);
                try {
                    if (mMediaPlayer != null) {
                        mMediaPlayer.reset();
                        mMediaPlayer.setDataSource(ytFile.getUrl());
                        mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
                        mMediaPlayer.prepare();
                        mMediaPlayer.start();
                        handleSeekBarChange(videoItem.getId());
                        sendbroadcast(videoItem.getDuration());
                    }
                } catch (IOException io) {
                    io.printstacktrace();
                }
            }
        }
    }.execute(youtubeLink);
}
项目:QuanMinTV    文件MediaPlayer.java   
private void selectOrdeselectBandTrack(int index,boolean select) {
    if (mOutOfBandTracks != null) {
        SparseArray<MediaFormat> mediaSparse = mOutOfBandTracks.getTrackInfoArray();
        int trackIndex = mediaSparse.keyAt(0);
        MediaFormat mediaFormat = mediaSparse.valueAt(0);
    if (index == trackIndex  && select) {
        addTimedTextSource(mediaFormat.getString(MediaFormat.KEY_PATH));
        return;
    }
    }
    selectOrdeselectTrack(index,select);
}
项目:IO_Classic_WatchFace    文件IOClassicWatchFaceService.java   
/**
 * Init watch face complications components
 */
private void initializeComplications() {
    Log.d(TAG,"Init complications");
    mActiveComplicationDataSparseArray = new SparseArray<>(COMPLICATION_IDS.length);
    mComplicationDrawableSparseArray = new SparseArray<>(COMPLICATION_IDS.length);

    //create a complication for each complicationId
    for (int COMPLICATION_ID : COMPLICATION_IDS) {
        createComplication(COMPLICATION_ID);
    }

    setActiveComplications(COMPLICATION_IDS);
}
项目:Hitalk    文件ChatRoomActivity.java   
public static void start(Context c,AVIMConversation conversation) {
    SparseArray sparseArray = new SparseArray();
    sparseArray.put(Constants.ParamsKey.Chat.TO_CONVERSATION,conversation);
    int key = sparseArray.hashCode();
    ParamsPool.$().put(key,sparseArray);
    start(c,key);
}
项目:Mybilibili    文件RecycleBin.java   
/** Move all views remaining in activeViews to scrapViews. */
void scrapActiveViews() {
  final View[] activeViews = this.activeViews;
  final int[] activeViewTypes = this.activeViewTypes;
  final boolean multipleScraps = viewTypeCount > 1;

  SparseArray<View> scrapViews = currentScrapViews;
  final int count = activeViews.length;
  for (int i = count - 1; i >= 0; i--) {
    final View victim = activeViews[i];
    if (victim != null) {
      int whichScrap = activeViewTypes[i];

      activeViews[i] = null;
      activeViewTypes[i] = -1;

      if (!shouldRecycleViewType(whichScrap)) {
        continue;
      }

      if (multipleScraps) {
        scrapViews = this.scrapViews[whichScrap];
      }
      scrapViews.put(i,victim);

      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        victim.setAccessibilityDelegate(null);
      }
    }
  }

  prunescrapViews();
}
项目:JD-Test    文件BaseViewHolder.java   
public BaseViewHolder(final View view) {
    super(view);
    this.views = new SparseArray<View>();
    this.childClickViewIds = new LinkedHashSet<>();
    this.itemChildLongClickViewIds = new LinkedHashSet<>();
    this.nestViews = new HashSet<>();
    convertView = view;


}
项目:a_whattobuy    文件ItemService.java   
private ItemService() {
    items = new ArrayList<>();
    assignedItems = new SparseArray<>();

    for (Item i : MainService.getInstance().getDb().getItemsInList(1)) {
        rawAdd(i);
    }
}
项目:TableView    文件ColumnLayoutManager.java   
public int getCacheWidth(int p_nPosition) {
    int nYPosition = getRowPosition();

    SparseArray<Integer> cellRowCaches = m_aCachedWidthList.get(nYPosition);
    if (cellRowCaches != null) {
        Integer nCachedWidth = cellRowCaches.get(p_nPosition);
        if (nCachedWidth != null) {
            return cellRowCaches.get(p_nPosition);
        }
    }

    return -1;
}
项目:Month_Calendar    文件RecycleBin.java   
/**
 * Makes sure that the size of scrapViews does not exceed the size of activeViews.
 * (This can happen if an adapter does not recycle its views).
 */
private void prunescrapViews() {
  final int maxViews = activeViews.length;
  final int viewTypeCount = this.viewTypeCount;
  final SparseArray<View>[] scrapViews = this.scrapViews;
  for (int i = 0; i < viewTypeCount; ++i) {
    final SparseArray<View> scrapPile = scrapViews[i];
    int size = scrapPile.size();
    final int extras = size - maxViews;
    size--;
    for (int j = 0; j < extras; j++) {
      scrapPile.remove(scrapPile.keyAt(size--));
    }
  }
}
项目:boohee_v5.6    文件BackStackRecord.java   
private static void setFirstOut(SparseArray<Fragment> firstOutFragments,Fragment fragment) {
    if (fragment != null) {
        int containerId = fragment.mContainerId;
        if (containerId != 0 && !fragment.isHidden()) {
            if (fragment.isAdded() && fragment.getView() != null && firstOutFragments.get(containerId) == null) {
                firstOutFragments.put(containerId,fragment);
            }
            if (lastInFragments.get(containerId) == fragment) {
                lastInFragments.remove(containerId);
            }
        }
    }
}
项目:RLibrary    文件ViewHolder.java   
public ViewHolder(View itemView,int itemViewType) {
    super(itemView,itemViewType);
    if (itemView == null) {
        throw new IllegalArgumentException("itemView may not be null");
    }
    this.itemView = itemView;
    this.itemViewType = itemViewType;
    mChilds = new SparseArray<>();
}
项目:FileDownloader-master    文件FileDownloadNotificationHelper.java   
/**
 * Clear and cancel all notifications which inside this helper {@link #notificationArray}.
 */
public void clear() {
    @SuppressWarnings("unchecked") SparseArray<BaseNotificationItem> cloneArray =
            (SparseArray<BaseNotificationItem>) notificationArray.clone();
    notificationArray.clear();

    for (int i = 0; i < cloneArray.size(); i++) {
        final BaseNotificationItem n = cloneArray.get(cloneArray.keyAt(i));
        n.cancel();
    }

}
项目:RNLearn_Project1    文件NativeViewHierarchyManager.java   
public NativeViewHierarchyManager(ViewManagerRegistry viewManagers,RootViewManager manager) {
  mAnimationRegistry = new AnimationRegistry();
  mViewManagers = viewManagers;
  mTagsToViews = new SparseArray<>();
  mTagsToViewManagers = new SparseArray<>();
  mRoottags = new SparseBooleanArray();
  mRootViewManager = manager;
}
项目: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);
        }
    }

}
项目:TestChat    文件ShareMultipleLayoutAdapter.java   
/**
         * 这里添加所需要的布局id  map
         *
         * @return
         */
        @Override
        protected SparseArray<Integer> getLayoutIdMap() {
                SparseArray<Integer> sparseArray = new SparseArray<>();
//                每个view类型都是一样的布局,只是在需要的时候通过view_stub加载成自己的布局view
                sparseArray.put(Constant.MSG_TYPE_SHARE_MESSAGE_TEXT,R.layout.share_fragment_item_main_layout);
                sparseArray.put(Constant.MSG_TYPE_SHARE_MESSAGE_LINK,R.layout.share_fragment_item_main_layout);
                sparseArray.put(Constant.MSG_TYPE_SHARE_MESSAGE_VIDEO,R.layout.share_fragment_item_main_layout);
                sparseArray.put(Constant.MSG_TYPE_SHARE_MESSAGE_IMAGE,R.layout.share_fragment_item_main_layout);
                return sparseArray;
        }
项目:GitHub    文件BaseViewHolder.java   
public BaseViewHolder(final View view) {
    super(view);
    this.views = new SparseArray<>();
    this.childClickViewIds = new LinkedHashSet<>();
    this.itemChildLongClickViewIds = new LinkedHashSet<>();
    this.nestViews = new HashSet<>();
    convertView = view;


}
项目:LJFramework    文件EmptyUtils.java   
/**
 * 判断对象是否为空
 *
 * @param obj 对象
 * @return {@code true}: 为空<br>{@code false}: 不为空
 */
public static boolean isEmpty(Object obj) {
    if (obj == null) {
        return true;
    }
    if (obj instanceof String && obj.toString().length() == 0) {
        return true;
    }
    if (obj.getClass().isArray() && Array.getLength(obj) == 0) {
        return true;
    }
    if (obj instanceof Collection && ((Collection) obj).isEmpty()) {
        return true;
    }
    if (obj instanceof Map && ((Map) obj).isEmpty()) {
        return true;
    }
    if (obj instanceof SparseArray && ((SparseArray) obj).size() == 0) {
        return true;
    }
    if (obj instanceof SparseBooleanArray &&
            ((SparseBooleanArray) obj).size() == 0) {
        return true;
    }
    if (obj instanceof SparseIntArray &&
            ((SparseIntArray) obj).size() == 0) {
        return true;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        if (obj instanceof SparseLongArray &&
                ((SparseLongArray) obj).size() == 0) {
            return true;
        }
    }
    return false;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。