@@ -16664,6 +16664,8 @@ public boolean isTextDirectionInherited() {
1666416664 * {@link #TEXT_ALIGNMENT_TEXT_END},
1666516665 * {@link #TEXT_ALIGNMENT_VIEW_START},
1666616666 * {@link #TEXT_ALIGNMENT_VIEW_END}
16667+ *
16668+ * @hide
1666716669 */
1666816670 @ViewDebug.ExportedProperty(category = "text", mapping = {
1666916671 @ViewDebug.IntToString(from = TEXT_ALIGNMENT_INHERIT, to = "INHERIT"),
@@ -16674,7 +16676,7 @@ public boolean isTextDirectionInherited() {
1667416676 @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_START, to = "VIEW_START"),
1667516677 @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_END, to = "VIEW_END")
1667616678 })
16677- public int getTextAlignment () {
16679+ public int getRawTextAlignment () {
1667816680 return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_MASK) >> PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT;
1667916681 }
1668016682
@@ -16694,7 +16696,7 @@ public int getTextAlignment() {
1669416696 * @attr ref android.R.styleable#View_textAlignment
1669516697 */
1669616698 public void setTextAlignment(int textAlignment) {
16697- if (textAlignment != getTextAlignment ()) {
16699+ if (textAlignment != getRawTextAlignment ()) {
1669816700 // Reset the current and resolved text alignment
1669916701 mPrivateFlags2 &= ~PFLAG2_TEXT_ALIGNMENT_MASK;
1670016702 resetResolvedTextAlignment();
@@ -16733,7 +16735,7 @@ public void setTextAlignment(int textAlignment) {
1673316735 @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_START, to = "VIEW_START"),
1673416736 @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_END, to = "VIEW_END")
1673516737 })
16736- public int getResolvedTextAlignment () {
16738+ public int getTextAlignment () {
1673716739 // If text alignment is not resolved, then resolve it
1673816740 if ((mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) != PFLAG2_TEXT_ALIGNMENT_RESOLVED) {
1673916741 resolveTextAlignment();
@@ -16752,14 +16754,14 @@ public void resolveTextAlignment() {
1675216754
1675316755 if (hasRtlSupport()) {
1675416756 // Set resolved text alignment flag depending on text alignment flag
16755- final int textAlignment = getTextAlignment ();
16757+ final int textAlignment = getRawTextAlignment ();
1675616758 switch (textAlignment) {
1675716759 case TEXT_ALIGNMENT_INHERIT:
1675816760 // Check if we can resolve the text alignment
1675916761 if (canResolveTextAlignment() && mParent instanceof View) {
1676016762 View view = (View) mParent;
1676116763
16762- final int parentResolvedTextAlignment = view.getResolvedTextAlignment ();
16764+ final int parentResolvedTextAlignment = view.getTextAlignment ();
1676316765 switch (parentResolvedTextAlignment) {
1676416766 case TEXT_ALIGNMENT_GRAVITY:
1676516767 case TEXT_ALIGNMENT_TEXT_START:
@@ -16810,7 +16812,7 @@ public void resolveTextAlignment() {
1681016812 * @return true if text alignment resolution can be done otherwise return false.
1681116813 */
1681216814 private boolean canResolveTextAlignment() {
16813- switch (getTextAlignment ()) {
16815+ switch (getRawTextAlignment ()) {
1681416816 case TEXT_DIRECTION_INHERIT:
1681516817 return (mParent != null);
1681616818 default:
@@ -16828,6 +16830,13 @@ public void resetResolvedTextAlignment() {
1682816830 mPrivateFlags2 &= ~(PFLAG2_TEXT_ALIGNMENT_RESOLVED | PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK);
1682916831 }
1683016832
16833+ /**
16834+ * @hide
16835+ */
16836+ public boolean isTextAlignmentInherited() {
16837+ return (getRawTextAlignment() == TEXT_ALIGNMENT_INHERIT);
16838+ }
16839+
1683116840 /**
1683216841 * Generate a value suitable for use in {@link #setId(int)}.
1683316842 * This value will not collide with ID values generated at build time by aapt for R.id.
0 commit comments