Home | History | Annotate | Download | only in layout

Lines Matching refs:gravity

33 /** Helper class for looking up the gravity masks of gravity attributes */
39 /** Bitmask for a gravity which includes left */
43 /** Bitmask for a gravity which includes right */
46 /** Bitmask for a gravity which includes center horizontal */
49 /** Bitmask for a gravity which includes fill horizontal */
52 /** Bitmask for a gravity which includes center vertical */
55 /** Bitmask for a gravity which includes fill vertical */
58 /** Bitmask for a gravity which includes top */
61 /** Bitmask for a gravity which includes bottom */
64 /** Bitmask for a gravity which includes start */
67 /** Bitmask for a gravity which includes end */
70 /** Bitmask for a gravity which includes any horizontal constraint */
74 /** Bitmask for a gravity which any vertical constraint */
79 * Returns the gravity of the given element
81 * @param element the element to look up the gravity for
90 * Returns the gravity bitmask for the given gravity string description
92 * @param gravityString the gravity string description
94 * @return a bitmask corresponding to the gravity description
97 int gravity = defaultMask;
102 gravity = GRAVITY_CENTER_HORIZ | GRAVITY_CENTER_VERT;
104 gravity = GRAVITY_FILL_HORIZ | GRAVITY_FILL_VERT;
106 gravity = (gravity & GRAVITY_HORIZ_MASK) | GRAVITY_CENTER_VERT;
108 gravity = (gravity & GRAVITY_VERT_MASK) | GRAVITY_CENTER_HORIZ;
110 gravity = (gravity & GRAVITY_HORIZ_MASK) | GRAVITY_FILL_VERT;
112 gravity = (gravity & GRAVITY_VERT_MASK) | GRAVITY_FILL_HORIZ;
114 gravity = (gravity & GRAVITY_HORIZ_MASK) | GRAVITY_TOP;
116 gravity = (gravity & GRAVITY_HORIZ_MASK) | GRAVITY_BOTTOM;
118 gravity = (gravity & (GRAVITY_VERT_MASK|GRAVITY_START)) | GRAVITY_LEFT;
120 gravity = (gravity & (GRAVITY_VERT_MASK|GRAVITY_END)) | GRAVITY_RIGHT;
122 gravity = (gravity & (GRAVITY_VERT_MASK|GRAVITY_LEFT)) | GRAVITY_START;
124 gravity = (gravity & (GRAVITY_VERT_MASK|GRAVITY_RIGHT)) | GRAVITY_END;
129 return gravity;
133 * Returns true if the given gravity bitmask is constrained horizontally
135 * @param gravity the gravity bitmask
136 * @return true if the given gravity bitmask is constrained horizontally
138 public static boolean isConstrainedHorizontally(int gravity) {
139 return (gravity & GRAVITY_HORIZ_MASK) != 0;
143 * Returns true if the given gravity bitmask is constrained vertically
145 * @param gravity the gravity bitmask
146 * @return true if the given gravity bitmask is constrained vertically
148 public static boolean isConstrainedVertically(int gravity) {
149 return (gravity & GRAVITY_VERT_MASK) != 0;
153 * Returns true if the given gravity bitmask is left aligned
155 * @param gravity the gravity bitmask
156 * @return true if the given gravity bitmask is left aligned
158 public static boolean isLeftAligned(int gravity) {
159 return (gravity & (GRAVITY_LEFT|GRAVITY_START)) != 0;
163 * Returns true if the given gravity bitmask is top aligned
165 * @param gravity the gravity bitmask
166 * @return true if the given gravity bitmask is aligned
168 public static boolean isTopAligned(int gravity) {
169 return (gravity & GRAVITY_TOP) != 0;
172 /** Returns a gravity value string from the given gravity bitmask
174 * @param gravity the gravity bitmask
175 * @return the corresponding gravity string suitable as an XML attribute value
177 public static String getGravity(int gravity) {
178 if (gravity == 0) {
182 if ((gravity & (GRAVITY_CENTER_HORIZ | GRAVITY_CENTER_VERT)) ==
188 int horizontal = gravity & GRAVITY_HORIZ_MASK;
189 int vertical = gravity & GRAVITY_VERT_MASK;