public synchronized void increase(boolean flag) { if (flag) { mSuccessCount++; } else { mFailedCount++; } Log.d( LOG_TAG, "Counter: " + mName + ", total count: " + mTotalCount + ", failed count: " + mFailedCount + ", success count: " + mSuccessCount); if (mSuccessCount + mFailedCount == mTotalCount) { boolean success = (mFailedCount == 0) ? true : false; mListener.done(success); } }
public void finish(String reason) { Log.d(LOG_TAG, "Counter: " + mName + " finished: " + reason); if (mListener != null) { mListener.done(false); } }