@@ -9598,10 +9598,19 @@ private void resolveLayoutDirectionIfNeeded() {
95989598
95999599 // Set to resolved
96009600 mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED;
9601+ onResolvedLayoutDirectionChanged();
96019602 }
96029603
96039604 /**
9604- * Force padding depending on layout direction.
9605+ * Called when layout direction has been resolved.
9606+ *
9607+ * The default implementation does nothing.
9608+ */
9609+ public void onResolvedLayoutDirectionChanged() {
9610+ }
9611+
9612+ /**
9613+ * Resolve padding depending on layout direction.
96059614 */
96069615 public void resolvePadding() {
96079616 // If the user specified the absolute padding (either with android:padding or
@@ -9645,7 +9654,7 @@ public void resolvePadding() {
96459654 mUserPaddingBottom = (mUserPaddingBottom >= 0) ? mUserPaddingBottom : mPaddingBottom;
96469655
96479656 recomputePadding();
9648- onResolvePadding (resolvedLayoutDirection);
9657+ onPaddingChanged (resolvedLayoutDirection);
96499658 }
96509659
96519660 /**
@@ -9656,7 +9665,7 @@ public void resolvePadding() {
96569665 * @param layoutDirection the direction of the layout
96579666 *
96589667 */
9659- public void onResolvePadding (int layoutDirection) {
9668+ public void onPaddingChanged (int layoutDirection) {
96609669 }
96619670
96629671 /**
@@ -9674,19 +9683,28 @@ public boolean canResolveLayoutDirection() {
96749683 }
96759684
96769685 /**
9677- * Reset the resolved layout direction.
9678- *
9679- * Subclasses need to override this method to clear cached information that depends on the
9680- * resolved layout direction, or to inform child views that inherit their layout direction.
9681- * Overrides must also call the superclass implementation at the start of their implementation.
9686+ * Reset the resolved layout direction. Will call {@link View#onResolvedLayoutDirectionReset}
9687+ * when reset is done.
96829688 */
96839689 public void resetResolvedLayoutDirection() {
96849690 // Reset the current View resolution
96859691 mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED;
9692+ onResolvedLayoutDirectionReset();
96869693 // Reset also the text direction
96879694 resetResolvedTextDirection();
96889695 }
96899696
9697+ /**
9698+ * Called during reset of resolved layout direction.
9699+ *
9700+ * Subclasses need to override this method to clear cached information that depends on the
9701+ * resolved layout direction, or to inform child views that inherit their layout direction.
9702+ *
9703+ * The default implementation does nothing.
9704+ */
9705+ public void onResolvedLayoutDirectionReset() {
9706+ }
9707+
96909708 /**
96919709 * Check if a Locale uses an RTL script.
96929710 *
@@ -14137,8 +14155,8 @@ public int getResolvedTextDirection() {
1413714155 }
1413814156
1413914157 /**
14140- * Resolve the text direction. Will call {@link View#onResolveTextDirection() } when resolution
14141- * is done.
14158+ * Resolve the text direction. Will call {@link View#onResolvedTextDirectionChanged } when
14159+ * resolution is done.
1414214160 */
1414314161 public void resolveTextDirection() {
1414414162 if (mResolvedTextDirection != TEXT_DIRECTION_INHERIT) {
@@ -14152,32 +14170,34 @@ public void resolveTextDirection() {
1415214170 } else {
1415314171 mResolvedTextDirection = TEXT_DIRECTION_FIRST_STRONG;
1415414172 }
14155- onResolveTextDirection ();
14173+ onResolvedTextDirectionChanged ();
1415614174 }
1415714175
1415814176 /**
1415914177 * Called when text direction has been resolved. Subclasses that care about text direction
14160- * resolution should override this method. The default implementation does nothing.
14178+ * resolution should override this method.
14179+ *
14180+ * The default implementation does nothing.
1416114181 */
14162- public void onResolveTextDirection () {
14182+ public void onResolvedTextDirectionChanged () {
1416314183 }
1416414184
1416514185 /**
1416614186 * Reset resolved text direction. Text direction can be resolved with a call to
14167- * getResolvedTextDirection(). Will call {@link View#onResetResolvedTextDirection() } when
14187+ * getResolvedTextDirection(). Will call {@link View#onResolvedTextDirectionReset } when
1416814188 * reset is done.
1416914189 */
1417014190 public void resetResolvedTextDirection() {
1417114191 mResolvedTextDirection = TEXT_DIRECTION_INHERIT;
14172- onResetResolvedTextDirection ();
14192+ onResolvedTextDirectionReset ();
1417314193 }
1417414194
1417514195 /**
1417614196 * Called when text direction is reset. Subclasses that care about text direction reset should
1417714197 * override this method and do a reset of the text direction of their children. The default
1417814198 * implementation does nothing.
1417914199 */
14180- public void onResetResolvedTextDirection () {
14200+ public void onResolvedTextDirectionReset () {
1418114201 }
1418214202
1418314203 //
0 commit comments