Home | History | Annotate | Download | only in view

Lines Matching defs:Gravity

24 public class Gravity
26 /** Constant indicating that no gravity has been set **/
29 /** Raw bit indicating the gravity for an axis has been specified. */
37 * container, based on the gravity direction being applied. */
90 * Binary mask to get the absolute horizontal gravity of a gravity.
95 * Binary mask to get the vertical gravity of a gravity.
121 * Binary mask for the horizontal gravity and script specific direction bit.
126 * Apply a gravity constant to an object. This suppose that the layout direction is LTR.
128 * @param gravity The desired placement of the object, as defined by the
138 public static void apply(int gravity, int w, int h, Rect container, Rect outRect) {
139 apply(gravity, w, h, container, 0, 0, outRect);
143 * Apply a gravity constant to an object and take care if layout direction is RTL or not.
145 * @param gravity The desired placement of the object, as defined by the
159 public static void apply(int gravity, int w, int h, Rect container,
161 int absGravity = getAbsoluteGravity(gravity, layoutDirection);
166 * Apply a gravity constant to an object.
168 * @param gravity The desired placement of the object, as defined by the
175 * @param xAdj Offset to apply to the X axis. If gravity is LEFT this
176 * pushes it to the right; if gravity is RIGHT it pushes it to
177 * the left; if gravity is CENTER_HORIZONTAL it pushes it to the
179 * @param yAdj Offset to apply to the Y axis. If gravity is TOP this pushes
180 * it down; if gravity is BOTTOM it pushes it up; if gravity is
186 public static void apply(int gravity, int w, int h, Rect container,
188 switch (gravity&((AXIS_PULL_BEFORE|AXIS_PULL_AFTER)<<AXIS_X_SHIFT)) {
193 if ((gravity&(AXIS_CLIP<<AXIS_X_SHIFT))
206 if ((gravity&(AXIS_CLIP<<AXIS_X_SHIFT))
216 if ((gravity&(AXIS_CLIP<<AXIS_X_SHIFT))
229 switch (gravity&((AXIS_PULL_BEFORE|AXIS_PULL_AFTER)<<AXIS_Y_SHIFT)) {
234 if ((gravity&(AXIS_CLIP<<AXIS_Y_SHIFT))
247 if ((gravity&(AXIS_CLIP<<AXIS_Y_SHIFT))
257 if ((gravity&(AXIS_CLIP<<AXIS_Y_SHIFT))
272 * Apply a gravity constant to an object.
274 * @param gravity The desired placement of the object, as defined by the
281 * @param xAdj Offset to apply to the X axis. If gravity is LEFT this
282 * pushes it to the right; if gravity is RIGHT it pushes it to
283 * the left; if gravity is CENTER_HORIZONTAL it pushes it to the
285 * @param yAdj Offset to apply to the Y axis. If gravity is TOP this pushes
286 * it down; if gravity is BOTTOM it pushes it up; if gravity is
296 public static void apply(int gravity, int w, int h, Rect container,
298 int absGravity = getAbsoluteGravity(gravity, layoutDirection);
303 * Apply additional gravity behavior based on the overall "display" that an
307 * to be visible in the display; the gravity flags
311 * @param gravity Gravity constants to modify the placement within the
318 public static void applyDisplay(int gravity, Rect display, Rect inoutObj) {
319 if ((gravity&DISPLAY_CLIP_VERTICAL) != 0) {
337 if ((gravity&DISPLAY_CLIP_HORIZONTAL) != 0) {
357 * Apply additional gravity behavior based on the overall "display" that an
361 * to be visible in the display; the gravity flags
365 * @param gravity Gravity constants to modify the placement within the
376 public static void applyDisplay(int gravity, Rect display, Rect inoutObj, int layoutDirection) {
377 int absGravity = getAbsoluteGravity(gravity, layoutDirection);
382 * <p>Indicate whether the supplied gravity has a vertical pull.</p>
384 * @param gravity the gravity to check for vertical pull
385 * @return true if the supplied gravity has a vertical pull
387 public static boolean isVertical(int gravity) {
388 return gravity > 0 && (gravity & VERTICAL_GRAVITY_MASK) != 0;
392 * <p>Indicate whether the supplied gravity has an horizontal pull.</p>
394 * @param gravity the gravity to check for horizontal pull
395 * @return true if the supplied gravity has an horizontal pull
397 public static boolean isHorizontal(int gravity) {
398 return gravity > 0 && (gravity & RELATIVE_HORIZONTAL_GRAVITY_MASK) != 0;
402 * <p>Convert script specific gravity to absolute horizontal value.</p>
408 * @param gravity The gravity to convert to absolute (horizontal) values.
410 * @return gravity converted to absolute (horizontal) values.
412 public static int getAbsoluteGravity(int gravity, int layoutDirection) {
413 int result = gravity;
414 // If layout is script specific and gravity is horizontal relative (START or END)
416 if ((result & Gravity.START) == Gravity.START) {
426 } else if ((result & Gravity.END) == Gravity.END) {