private ArrayList<PTZPreset> removeSystemPresetsFrom(ArrayList<PTZPreset> allPresets) { ArrayList<PTZPreset> customPresets = new ArrayList<>(); if (allPresets.size() > 0) { // Exclude presets with token >= 33 and only keep those user defined presets for (PTZPreset preset : allPresets) { int tokenInt = Integer.valueOf(preset.getToken()); if (tokenInt < 33) { customPresets.add(preset); } } } return customPresets; }
@Override protected Void doInBackground(Void... params) { try { ArrayList<PTZPreset> allPresets = PTZPreset.getAllPresets(cameraId); getVideoActivity().presetList = allPresets; ArrayList<PTZPreset> customPresets = removeSystemPresetsFrom(allPresets); if (customPresets.size() > 0) { getVideoActivity().presetList = customPresets; } } catch (PTZException e) { e.printStackTrace(); } return null; }