Methods Summary |
---|
public void | addLastDecrementRunnable(java.lang.Runnable r)Adds a runnable to the last-decrement runnables list.
// To ensure that the last decrement always calls, we increment and decrement after setting
// the last decrement runnable
boolean ensureLastDecrement = (mCount == 0);
if (ensureLastDecrement) increment();
mLastDecRunnables.add(r);
if (ensureLastDecrement) decrement();
|
public void | decrement()Decrements the ref count
mCount--;
if (mCount == 0 && !mLastDecRunnables.isEmpty()) {
int numRunnables = mLastDecRunnables.size();
for (int i = 0; i < numRunnables; i++) {
mLastDecRunnables.get(i).run();
}
} else if (mCount < 0) {
if (mErrorRunnable != null) {
mErrorRunnable.run();
} else {
new Throwable("Invalid ref count").printStackTrace();
Console.logError(mContext, "Invalid ref count");
}
}
|
public java.lang.Runnable | decrementAsRunnable()Convenience method to decrement this trigger as a runnable.
return mDecrementRunnable;
|
public Animator.AnimatorListener | decrementOnAnimationEnd()Convenience method to decrement this trigger as a animator listener.
return new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
decrement();
}
};
|
public int | getCount()Returns the current ref count
return mCount;
|
public void | increment()Increments the ref count
if (mCount == 0 && !mFirstIncRunnables.isEmpty()) {
int numRunnables = mFirstIncRunnables.size();
for (int i = 0; i < numRunnables; i++) {
mFirstIncRunnables.get(i).run();
}
}
mCount++;
|
public java.lang.Runnable | incrementAsRunnable()Convenience method to increment this trigger as a runnable
return mIncrementRunnable;
|