private boolean updateItemNodeList() { boolean updateFlag = false; // Checking Deleted Items int nContents = getNContentNodes(); ContentNode cnode[] = new ContentNode[nContents]; for (int n = 0; n < nContents; n++) cnode[n] = getContentNode(n); for (int n = 0; n < nContents; n++) { if ((cnode[n] instanceof FileItemNode) == false) continue; FileItemNode itemNode = (FileItemNode) cnode[n]; File itemFile = itemNode.getFile(); if (itemFile == null) continue; if (itemFile.exists() == false) { removeContentNode(cnode[n]); updateFlag = true; } } // Checking Added or Updated Items FileItemNodeList itemNodeList = createItemNodeList(); int itemNodeCnt = itemNodeList.size(); for (int n = 0; n < itemNodeCnt; n++) { FileItemNode itemNode = itemNodeList.getFileItemNode(n); if (updateItemNodeList(itemNode, mImages.get(n)) == true) updateFlag = true; } return updateFlag; }
@SuppressWarnings("unchecked") private FileItemNodeList createItemNodeList() { if (mImages == null) { return null; } FileItemNodeList nodeList = new FileItemNodeList(); for (PhotoItem info : mImages) { File file = new File(info.filePath); // when we detect file not exists,remove it if (!file.exists()) { System.out.println("ashare file not exist path=" + info.filePath); continue; } FileItemNode itemNode = createCompareItemNode(file); if (itemNode == null) { continue; } nodeList.add(itemNode); } return nodeList; }
@SuppressWarnings("unchecked") private FileItemNodeList createItemNodeList() { if (mFileList == null) { return null; } FileItemNodeList nodeList = new FileItemNodeList(); for (MusicItem info : mFileList) { File file = new File(info.filePath); if (!file.exists()) { Log.d(TAG, "dms file not exist path=" + info.filePath); continue; } FileItemNode itemNode = createCompareItemNode(file); if (itemNode == null) { Log.d(TAG, "dms create music Item node is null...." + info.filePath); continue; } nodeList.add(itemNode); } return nodeList; }