/** Ends the effect and then executes the runnable after the effect is finished. */ public void end(final Runnable runnableOnODone) { // Cancel the tooltip if it's still showing. if ((tooltip != null) && (tooltip.getView().getParent() != null)) { tooltip.cancel(); tooltip = null; } // End tool editing by canceling unfinished touch events. toolKit.cancel(); // Output the pushed filter if it wasn't outputted. if (pushedFilter && disableFilterOutput) { outputFilter(); } // Wait till last output callback is done before finishing. if ((lastFilterChangedCallback == null) || lastFilterChangedCallback.done) { finish(runnableOnODone); } else { lastFilterChangedCallback.runnableOnReady = new Runnable() { @Override public void run() { finish(runnableOnODone); } }; } }
private void finish(Runnable runnableOnDone) { toolKit.close(); pushedFilter = false; disableFilterOutput = false; lastFilterChangedCallback = null; runnableOnDone.run(); }