/** * Maps an int to a specific mode. This is needed when saving state, or inflating the view from * XML where the mode is given through a attr int. * * @param modeInt - int to map a Mode to * @return Mode that modeInt maps to, or PULL_FROM_START by default. */ static SlideMode mapIntToValue(final int modeInt) { for (SlideMode value : SlideMode.values()) { if (modeInt == value.getIntValue()) { return value; } } // If not, return default return getDefault(); }