@@ -16668,6 +16668,8 @@ public boolean isTextDirectionInherited() {
1666816668 * {@link #TEXT_ALIGNMENT_TEXT_END},
1666916669 * {@link #TEXT_ALIGNMENT_VIEW_START},
1667016670 * {@link #TEXT_ALIGNMENT_VIEW_END}
16671+ *
16672+ * @hide
1667116673 */
1667216674 @ViewDebug.ExportedProperty(category = "text", mapping = {
1667316675 @ViewDebug.IntToString(from = TEXT_ALIGNMENT_INHERIT, to = "INHERIT"),
@@ -16678,7 +16680,7 @@ public boolean isTextDirectionInherited() {
1667816680 @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_START, to = "VIEW_START"),
1667916681 @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_END, to = "VIEW_END")
1668016682 })
16681- public int getTextAlignment () {
16683+ public int getRawTextAlignment () {
1668216684 return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_MASK) >> PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT;
1668316685 }
1668416686
@@ -16698,7 +16700,7 @@ public int getTextAlignment() {
1669816700 * @attr ref android.R.styleable#View_textAlignment
1669916701 */
1670016702 public void setTextAlignment(int textAlignment) {
16701- if (textAlignment != getTextAlignment ()) {
16703+ if (textAlignment != getRawTextAlignment ()) {
1670216704 // Reset the current and resolved text alignment
1670316705 mPrivateFlags2 &= ~PFLAG2_TEXT_ALIGNMENT_MASK;
1670416706 resetResolvedTextAlignment();
@@ -16737,7 +16739,7 @@ public void setTextAlignment(int textAlignment) {
1673716739 @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_START, to = "VIEW_START"),
1673816740 @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_END, to = "VIEW_END")
1673916741 })
16740- public int getResolvedTextAlignment () {
16742+ public int getTextAlignment () {
1674116743 // If text alignment is not resolved, then resolve it
1674216744 if ((mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) != PFLAG2_TEXT_ALIGNMENT_RESOLVED) {
1674316745 resolveTextAlignment();
@@ -16756,14 +16758,14 @@ public void resolveTextAlignment() {
1675616758
1675716759 if (hasRtlSupport()) {
1675816760 // Set resolved text alignment flag depending on text alignment flag
16759- final int textAlignment = getTextAlignment ();
16761+ final int textAlignment = getRawTextAlignment ();
1676016762 switch (textAlignment) {
1676116763 case TEXT_ALIGNMENT_INHERIT:
1676216764 // Check if we can resolve the text alignment
1676316765 if (canResolveTextAlignment() && mParent instanceof View) {
1676416766 View view = (View) mParent;
1676516767
16766- final int parentResolvedTextAlignment = view.getResolvedTextAlignment ();
16768+ final int parentResolvedTextAlignment = view.getTextAlignment ();
1676716769 switch (parentResolvedTextAlignment) {
1676816770 case TEXT_ALIGNMENT_GRAVITY:
1676916771 case TEXT_ALIGNMENT_TEXT_START:
@@ -16814,7 +16816,7 @@ public void resolveTextAlignment() {
1681416816 * @return true if text alignment resolution can be done otherwise return false.
1681516817 */
1681616818 private boolean canResolveTextAlignment() {
16817- switch (getTextAlignment ()) {
16819+ switch (getRawTextAlignment ()) {
1681816820 case TEXT_DIRECTION_INHERIT:
1681916821 return (mParent != null);
1682016822 default:
@@ -16832,6 +16834,13 @@ public void resetResolvedTextAlignment() {
1683216834 mPrivateFlags2 &= ~(PFLAG2_TEXT_ALIGNMENT_RESOLVED | PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK);
1683316835 }
1683416836
16837+ /**
16838+ * @hide
16839+ */
16840+ public boolean isTextAlignmentInherited() {
16841+ return (getRawTextAlignment() == TEXT_ALIGNMENT_INHERIT);
16842+ }
16843+
1683516844 /**
1683616845 * Generate a value suitable for use in {@link #setId(int)}.
1683716846 * This value will not collide with ID values generated at build time by aapt for R.id.
0 commit comments