当前位置: 首页>>代码示例>>Java>>正文


Java SparseArray.size方法代码示例

本文整理汇总了Java中android.util.SparseArray.size方法的典型用法代码示例。如果您正苦于以下问题:Java SparseArray.size方法的具体用法?Java SparseArray.size怎么用?Java SparseArray.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.util.SparseArray的用法示例。


在下文中一共展示了SparseArray.size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: detectTextBlocks

import android.util.SparseArray; //导入方法依赖的package包/类
List<TextBlock> detectTextBlocks(UQI uqi) {
    List<TextBlock> result = new ArrayList<>();
    Bitmap bitmap = this.getBitmap(uqi);
    if (bitmap == null) return result;
    TextRecognizer textRecognizer = new TextRecognizer.Builder(uqi.getContext()).build();
    if (!textRecognizer.isOperational()) {
        Logging.warn("TextRecognizer is not operational");
        textRecognizer.release();
        return result;
    }
    Frame imageFrame = new Frame.Builder().setBitmap(bitmap).build();
    SparseArray<TextBlock> textBlocks = textRecognizer.detect(imageFrame);
    for (int i = 0; i < textBlocks.size(); i++) {
        TextBlock textBlock = textBlocks.get(textBlocks.keyAt(i));
        result.add(textBlock);
    }
    textRecognizer.release();
    return result;
}
 
开发者ID:PrivacyStreams,项目名称:PrivacyStreams,代码行数:20,代码来源:ImageData.java

示例2: getNextFragmentRun

import android.util.SparseArray; //导入方法依赖的package包/类
/**
 * Returns the {@link TrackBundle} whose fragment run has the earliest file position out of those
 * yet to be consumed, or null if all have been consumed.
 */
private static TrackBundle getNextFragmentRun(SparseArray<TrackBundle> trackBundles) {
  TrackBundle nextTrackBundle = null;
  long nextTrackRunOffset = Long.MAX_VALUE;

  int trackBundlesSize = trackBundles.size();
  for (int i = 0; i < trackBundlesSize; i++) {
    TrackBundle trackBundle = trackBundles.valueAt(i);
    if (trackBundle.currentSampleIndex == trackBundle.fragment.length) {
      // This track fragment contains no more runs in the next mdat box.
    } else {
      long trunOffset = trackBundle.fragment.dataPosition;
      if (trunOffset < nextTrackRunOffset) {
        nextTrackBundle = trackBundle;
        nextTrackRunOffset = trunOffset;
      }
    }
  }
  return nextTrackBundle;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:24,代码来源:FragmentedMp4Extractor.java

示例3: receiveDetections

import android.util.SparseArray; //导入方法依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:BrandonVargas,项目名称:AndroidOCRFforID,代码行数:26,代码来源:OcrDetectorProcessor.java

示例4: beginTransition

import android.util.SparseArray; //导入方法依赖的package包/类
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, state, isBack, firstOutFragments, lastInFragments)) {
            anyTransitionStarted = true;
        }
    }
    if (anyTransitionStarted) {
        return state;
    }
    return null;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:BackStackRecord.java

示例5: cleanHuaWeiNotifications

import android.util.SparseArray; //导入方法依赖的package包/类
@Override
public boolean cleanHuaWeiNotifications() {
    Context context = DemoCache.getContext();
    NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    if (manager != null) {
        manager.cancelAll();
        SparseArray<Notification> nos = DemoCache.getNotifications();
        if (nos != null) {
            int key = 0;
            for (int i = 0; i < nos.size(); i++) {
                key = nos.keyAt(i);
                manager.notify(key, nos.get(key));
            }
        }
    }
    return true;
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:18,代码来源:DemoMixPushMessageHandler.java

示例6: retrieveFromScrap

import android.util.SparseArray; //导入方法依赖的package包/类
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;
  }
}
 
开发者ID:LineChen,项目名称:Month_Calendar,代码行数:21,代码来源:RecycleBin.java

示例7: getActiveList

import android.util.SparseArray; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static List<Fragment> getActiveList(SparseArray<Fragment> active) {
    if (active == null) {
        return Collections.EMPTY_LIST;
    }
    final int count = active.size();
    ArrayList<Fragment> fragments = new ArrayList<>(count);
    for (int i = 0; i < count; i++) {
        fragments.add(active.valueAt(i));
    }
    return fragments;
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:13,代码来源:FragmentationHack.java

示例8: ensureFragmentsAreInitialized

import android.util.SparseArray; //导入方法依赖的package包/类
private void ensureFragmentsAreInitialized(SparseArray<Fragment> lastInFragments) {
    int count = lastInFragments.size();
    for (int i = 0; i < count; i++) {
        Fragment fragment = (Fragment) lastInFragments.valueAt(i);
        if (fragment.mState < 1) {
            this.mManager.makeActive(fragment);
            this.mManager.moveToState(fragment, 1, 0, 0, false);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:11,代码来源:BackStackRecord.java

示例9: addToHistogram

import android.util.SparseArray; //导入方法依赖的package包/类
private void addToHistogram(
    SparseArray<Integer> histogram,
    DiskStorage.DiskDumpInfoEntry entry) {
  for (int i = 0; i < histogram.size(); i++) {
    int key = histogram.keyAt(i);
    if (entry.size / KB < key) {
      histogram.put(key, histogram.get(key) + 1);
      return;
    }
  }
  // big
  histogram.put((int) (entry.size / KB), 1);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:BaseFrescoStethoPlugin.java

示例10: getSortOrderEntries

import android.util.SparseArray; //导入方法依赖的package包/类
static protected CharSequence[] getSortOrderEntries(Context context, SparseArray<MoviesSortOrderEntry> indexer) {
    List<CharSequence> entries = new ArrayList<>();
    for (int index=0; index<indexer.size(); index++) {
        entries.add(context.getResources().getString(indexer.get(index).mId));
    }
    return entries.toArray(new CharSequence[entries.size()]);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:8,代码来源:MoviesSortOrderEntry.java

示例11: didReceivedNotification

import android.util.SparseArray; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void didReceivedNotification(int id, Object... args) {
    if (id == NotificationCenter.messagesDeleted) {
        if (currentMessageObject == null) {
            return;
        }
        int channelId = (Integer) args[1];
        if (channelId != 0) {
            return;
        }
        ArrayList<Integer> markAsDeletedMessages = (ArrayList<Integer>)args[0];
        if (markAsDeletedMessages.contains(currentMessageObject.getId())) {
            closePhoto();
        }
    } else if (id == NotificationCenter.didCreatedNewDeleteTask) {
        if (currentMessageObject == null || secretDeleteTimer == null) {
            return;
        }
        SparseArray<ArrayList<Integer>> mids = (SparseArray<ArrayList<Integer>>)args[0];
        for(int i = 0; i < mids.size(); i++) {
            int key = mids.keyAt(i);
            ArrayList<Integer> arr = mids.get(key);
            for (Integer mid : arr) {
                if (currentMessageObject.getId() == mid) {
                    currentMessageObject.messageOwner.destroyTime = key;
                    secretDeleteTimer.invalidate();
                    return;
                }
            }
        }
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:34,代码来源:SecretPhotoViewer.java

示例12: updateDialogsWithReadMessages

import android.util.SparseArray; //导入方法依赖的package包/类
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, inbox, outbox);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:16,代码来源:MessagesStorage.java

示例13: resetPayloadReaders

import android.util.SparseArray; //导入方法依赖的package包/类
private void resetPayloadReaders() {
  trackIds.clear();
  tsPayloadReaders.clear();
  SparseArray<TsPayloadReader> initialPayloadReaders =
      payloadReaderFactory.createInitialPayloadReaders();
  int initialPayloadReadersSize = initialPayloadReaders.size();
  for (int i = 0; i < initialPayloadReadersSize; i++) {
    tsPayloadReaders.put(initialPayloadReaders.keyAt(i), initialPayloadReaders.valueAt(i));
  }
  tsPayloadReaders.put(TS_PAT_PID, new SectionReader(new PatReader()));
  id3Reader = null;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:13,代码来源:TsExtractor.java

示例14: addViewsInSection

import android.util.SparseArray; //导入方法依赖的package包/类
private void addViewsInSection(SparseArray<View> items, LinearLayout parent, int itemWidth) {

            for (int i = 0; i < items.size(); i++) {
                View itemView = items.get(i);
                setItemWidth(itemView, itemWidth);
                parent.addView(itemView);
            }
        }
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:9,代码来源:QMUIBottomSheet.java

示例15: getSessionCount

import android.util.SparseArray; //导入方法依赖的package包/类
private static int getSessionCount(SparseArray<PackageInstallerSession> sessions,
                                   int installerUid) {
    int count = 0;
    final int size = sessions.size();
    for (int i = 0; i < size; i++) {
        final PackageInstallerSession session = sessions.valueAt(i);
        if (session.installerUid == installerUid) {
            count++;
        }
    }
    return count;
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:13,代码来源:VPackageInstallerService.java


注:本文中的android.util.SparseArray.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。