xuxiuxi
2017-08-01 21e08324c323d0c5d1e7cedc36323c554857a239
VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/util/SurveillanceQueryItemUtil.java
@@ -40,6 +40,7 @@
            addItem(returnItem, requestItem, cameraInOrOut);
        }
        removeTimeoutItemAndShow();
        limitItemsToN();
    }
    public void addItem(SurveillanceQueryItem returnItem, SurveillanceQueryItem requestItem, String cameraInOrOut) {
@@ -57,6 +58,44 @@
        allItems.add(0, returnItem);
    }
    private void limitItemsToN() {
        int max = 25;
        int unRegisters = 0;
        int checkIns = 0;
        int attenderEnter = 0;
        int attenderExit = 0;
        List<SurveillanceQueryItem> itemsToRemove = new ArrayList<>();
        for (int i = 0; i < allItems.size(); i++) {
            SurveillanceQueryItem item = allItems.get(i);
            int type = item.getRegisterOrCheckIn();
            if (type == CommonVariables.Surveillance.VISIT_REGISTER_ITEM_TYPE) {
                unRegisters++;
                if (unRegisters > max) {
                    itemsToRemove.add(item);
                }
            }
            if (type == CommonVariables.Surveillance.VISIT_CHECK_IN_ITEM_TYPE) {
                checkIns++;
                if (checkIns > max) {
                    itemsToRemove.add(item);
                }
            }
            if (type == CommonVariables.Surveillance.VISIT_ATTENDANCE_IN) {
                attenderEnter++;
                if (attenderEnter > max) {
                    itemsToRemove.add(item);
                }
            }
            if (type == CommonVariables.Surveillance.VISIT_ATTENDANCE_OUT) {
                attenderExit++;
                if (attenderExit > max) {
                    itemsToRemove.add(item);
                }
            }
        }
        allItems.removeAll(itemsToRemove);
    }
    public List getVisitorTwoRows() {
        visitorTwoRows.clear();
        for (SurveillanceQueryItem item : allItems) {