* TODO: Consider better names. FillPolicy? Stretchiness? */ public enum FillPreference { /** This view does not want to fill */ NONE, /** This view wants to always fill both horizontal and vertical */ BOTH, /** This view wants to fill horizontally but not vertically */ WIDTH, /** This view wants to fill vertically but not horizontally */ HEIGHT, /** * This view wants to fill in the opposite dimension of the context, e.g. in a * vertical context it wants to fill horizontally, and vice versa */ OPPOSITE, /** This view wants to fill horizontally, but only in a vertical context */ WIDTH_IN_VERTICAL, /** This view wants to fill vertically, but only in a horizontal context */ HEIGHT_IN_HORIZONTAL; /** * Returns true if this view wants to fill horizontally, if the context is * vertical or horizontal as indicated by the parameter. * * @param verticalContext If true, the context is vertical, otherwise it is * horizontal. * @return true if this view wants to fill horizontally */ public boolean fillHorizontally(boolean verticalContext) { return (this == BOTH || this == WIDTH || (verticalContext && (this == OPPOSITE || this == WIDTH_IN_VERTICAL))); } /** * Returns true if this view wants to fill vertically, if the context is * vertical or horizontal as indicated by the parameter. * * @param verticalContext If true, the context is vertical, otherwise it is * horizontal. * @return true if this view wants to fill vertically */ public boolean fillVertically(boolean verticalContext) { return (this == BOTH || this == HEIGHT || (!verticalContext && (this == OPPOSITE || this == HEIGHT_IN_HORIZONTAL))); } } }