@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); if (localName.equals("repo")) { String pk = attributes.getValue("", "pubkey"); if (pk != null) pubkey = pk; } else if (localName.equals("application") && curapp == null) { curapp = new DB.App(); curapp.detail_Populated = true; Bundle progressData = createProgressData(repo.address); progressCounter++; progressListener.onProgress( new ProgressListener.Event( RepoXMLHandler.PROGRESS_TYPE_PROCESS_XML, progressCounter, totalAppCount, progressData)); } else if (localName.equals("package") && curapp != null && curapk == null) { curapk = new DB.Apk(); curapk.id = curapp.id; curapk.repo = repo.id; hashType = null; } else if (localName.equals("hash") && curapk != null) { hashType = attributes.getValue("", "type"); } curchars.setLength(0); }
public void trimAllThreads(int length, ProgressListener listener) { Cursor cursor = null; int threadCount = 0; int complete = 0; try { cursor = this.getConversationList(); if (cursor != null) threadCount = cursor.getCount(); while (cursor != null && cursor.moveToNext()) { long threadId = cursor.getLong(cursor.getColumnIndexOrThrow(ID)); trimThread(threadId, length); listener.onProgress(++complete, threadCount); } } finally { if (cursor != null) cursor.close(); } }
void fire_progress(long v) { if (listener != null) listener.onProgress(v, length); }