/** * Resets to initial state (min zoom, position according to gravity). Reset will only occur * when image and viewport sizes are known, otherwise reset will occur sometime in the future * when {@link #updateState(State)} method will be called. * * @param state State to be reset * @return {@code true} if reset was completed or {@code false} if reset is scheduled for future */ boolean resetState(State state) { isResetRequired = true; return updateState(state); }
/** * Applies state restrictions and notifies {@link OnStateChangeListener} listeners. */ public void updateState() { // Applying zoom patch (needed in case if image size is changed) stateController.applyZoomPatch(state); stateController.applyZoomPatch(prevState); stateController.applyZoomPatch(stateStart); stateController.applyZoomPatch(stateEnd); exitController.applyZoomPatch(); boolean reset = stateController.updateState(state); if (reset) { notifyStateReset(); } else { notifyStateUpdated(); } }