protected boolean informComplete(InputStream is) { if (!result_informed) { for (int i = 0; i < listeners.size(); i++) { try { if (!((ResourceDownloaderListener) listeners.get(i)).completed(this, is)) { return (false); } } catch (Throwable e) { Debug.printStackTrace(e); return (false); } } result_informed = true; result_informed_data = is; } return (true); }
protected void informActivity(String activity) { for (int i = 0; i < listeners.size(); i++) { try { ((ResourceDownloaderListener) listeners.get(i)).reportActivity(this, activity); } catch (Throwable e) { Debug.printStackTrace(e); } } }
protected void informPercentDone(int percentage) { for (int i = 0; i < listeners.size(); i++) { try { ((ResourceDownloaderListener) listeners.get(i)).reportPercentComplete(this, percentage); } catch (Throwable e) { Debug.printStackTrace(e); } } }
protected void informFailed(ResourceDownloaderException e) { if (!result_informed) { result_informed = true; result_informed_data = e; for (int i = 0; i < listeners.size(); i++) { try { ((ResourceDownloaderListener) listeners.get(i)).failed(this, e); } catch (Throwable f) { Debug.printStackTrace(f); } } } }
protected void informAmountComplete(long amount) { for (int i = 0; i < listeners.size(); i++) { try { ((ResourceDownloaderListener) listeners.get(i)).reportAmountComplete(this, amount); } catch (NoSuchMethodError e) { // handle addition of this new method with old impls } catch (AbstractMethodError e) { // handle addition of this new method with old impls } catch (Throwable e) { Debug.printStackTrace(e); } } }