* commit 'f7a3e979a7ab3be4715408b6328f27e56a7c9326': Fix bug #6427629 Clean up layout direction APIs
This commit is contained in:
@ -24953,7 +24953,6 @@ package android.view {
|
|||||||
method public android.view.ViewParent getParentForAccessibility();
|
method public android.view.ViewParent getParentForAccessibility();
|
||||||
method public float getPivotX();
|
method public float getPivotX();
|
||||||
method public float getPivotY();
|
method public float getPivotY();
|
||||||
method public int getResolvedTextAlignment();
|
|
||||||
method public android.content.res.Resources getResources();
|
method public android.content.res.Resources getResources();
|
||||||
method public final int getRight();
|
method public final int getRight();
|
||||||
method protected float getRightFadingEdgeStrength();
|
method protected float getRightFadingEdgeStrength();
|
||||||
|
@ -16668,6 +16668,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
* {@link #TEXT_ALIGNMENT_TEXT_END},
|
* {@link #TEXT_ALIGNMENT_TEXT_END},
|
||||||
* {@link #TEXT_ALIGNMENT_VIEW_START},
|
* {@link #TEXT_ALIGNMENT_VIEW_START},
|
||||||
* {@link #TEXT_ALIGNMENT_VIEW_END}
|
* {@link #TEXT_ALIGNMENT_VIEW_END}
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
@ViewDebug.ExportedProperty(category = "text", mapping = {
|
@ViewDebug.ExportedProperty(category = "text", mapping = {
|
||||||
@ViewDebug.IntToString(from = TEXT_ALIGNMENT_INHERIT, to = "INHERIT"),
|
@ViewDebug.IntToString(from = TEXT_ALIGNMENT_INHERIT, to = "INHERIT"),
|
||||||
@ -16678,7 +16680,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
@ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_START, to = "VIEW_START"),
|
@ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_START, to = "VIEW_START"),
|
||||||
@ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_END, to = "VIEW_END")
|
@ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_END, to = "VIEW_END")
|
||||||
})
|
})
|
||||||
public int getTextAlignment() {
|
public int getRawTextAlignment() {
|
||||||
return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_MASK) >> PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT;
|
return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_MASK) >> PFLAG2_TEXT_ALIGNMENT_MASK_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16698,7 +16700,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
* @attr ref android.R.styleable#View_textAlignment
|
* @attr ref android.R.styleable#View_textAlignment
|
||||||
*/
|
*/
|
||||||
public void setTextAlignment(int textAlignment) {
|
public void setTextAlignment(int textAlignment) {
|
||||||
if (textAlignment != getTextAlignment()) {
|
if (textAlignment != getRawTextAlignment()) {
|
||||||
// Reset the current and resolved text alignment
|
// Reset the current and resolved text alignment
|
||||||
mPrivateFlags2 &= ~PFLAG2_TEXT_ALIGNMENT_MASK;
|
mPrivateFlags2 &= ~PFLAG2_TEXT_ALIGNMENT_MASK;
|
||||||
resetResolvedTextAlignment();
|
resetResolvedTextAlignment();
|
||||||
@ -16737,7 +16739,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
@ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_START, to = "VIEW_START"),
|
@ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_START, to = "VIEW_START"),
|
||||||
@ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_END, to = "VIEW_END")
|
@ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_END, to = "VIEW_END")
|
||||||
})
|
})
|
||||||
public int getResolvedTextAlignment() {
|
public int getTextAlignment() {
|
||||||
// If text alignment is not resolved, then resolve it
|
// If text alignment is not resolved, then resolve it
|
||||||
if ((mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) != PFLAG2_TEXT_ALIGNMENT_RESOLVED) {
|
if ((mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) != PFLAG2_TEXT_ALIGNMENT_RESOLVED) {
|
||||||
resolveTextAlignment();
|
resolveTextAlignment();
|
||||||
@ -16756,14 +16758,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
|
|
||||||
if (hasRtlSupport()) {
|
if (hasRtlSupport()) {
|
||||||
// Set resolved text alignment flag depending on text alignment flag
|
// Set resolved text alignment flag depending on text alignment flag
|
||||||
final int textAlignment = getTextAlignment();
|
final int textAlignment = getRawTextAlignment();
|
||||||
switch (textAlignment) {
|
switch (textAlignment) {
|
||||||
case TEXT_ALIGNMENT_INHERIT:
|
case TEXT_ALIGNMENT_INHERIT:
|
||||||
// Check if we can resolve the text alignment
|
// Check if we can resolve the text alignment
|
||||||
if (canResolveTextAlignment() && mParent instanceof View) {
|
if (canResolveTextAlignment() && mParent instanceof View) {
|
||||||
View view = (View) mParent;
|
View view = (View) mParent;
|
||||||
|
|
||||||
final int parentResolvedTextAlignment = view.getResolvedTextAlignment();
|
final int parentResolvedTextAlignment = view.getTextAlignment();
|
||||||
switch (parentResolvedTextAlignment) {
|
switch (parentResolvedTextAlignment) {
|
||||||
case TEXT_ALIGNMENT_GRAVITY:
|
case TEXT_ALIGNMENT_GRAVITY:
|
||||||
case TEXT_ALIGNMENT_TEXT_START:
|
case TEXT_ALIGNMENT_TEXT_START:
|
||||||
@ -16814,7 +16816,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
* @return true if text alignment resolution can be done otherwise return false.
|
* @return true if text alignment resolution can be done otherwise return false.
|
||||||
*/
|
*/
|
||||||
private boolean canResolveTextAlignment() {
|
private boolean canResolveTextAlignment() {
|
||||||
switch (getTextAlignment()) {
|
switch (getRawTextAlignment()) {
|
||||||
case TEXT_DIRECTION_INHERIT:
|
case TEXT_DIRECTION_INHERIT:
|
||||||
return (mParent != null);
|
return (mParent != null);
|
||||||
default:
|
default:
|
||||||
@ -16832,6 +16834,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
mPrivateFlags2 &= ~(PFLAG2_TEXT_ALIGNMENT_RESOLVED | PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK);
|
mPrivateFlags2 &= ~(PFLAG2_TEXT_ALIGNMENT_RESOLVED | PFLAG2_TEXT_ALIGNMENT_RESOLVED_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean isTextAlignmentInherited() {
|
||||||
|
return (getRawTextAlignment() == TEXT_ALIGNMENT_INHERIT);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a value suitable for use in {@link #setId(int)}.
|
* Generate a value suitable for use in {@link #setId(int)}.
|
||||||
* This value will not collide with ID values generated at build time by aapt for R.id.
|
* This value will not collide with ID values generated at build time by aapt for R.id.
|
||||||
|
@ -5274,7 +5274,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
if (child.isTextDirectionInherited()) {
|
if (child.isTextDirectionInherited()) {
|
||||||
child.resetResolvedTextDirection();
|
child.resetResolvedTextDirection();
|
||||||
}
|
}
|
||||||
if (child.getTextAlignment() == TEXT_ALIGNMENT_INHERIT) {
|
if (child.isTextAlignmentInherited()) {
|
||||||
child.resetResolvedTextAlignment();
|
child.resetResolvedTextAlignment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5646,7 +5646,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
|
|
||||||
private Layout.Alignment getLayoutAlignment() {
|
private Layout.Alignment getLayoutAlignment() {
|
||||||
if (mLayoutAlignment == null) {
|
if (mLayoutAlignment == null) {
|
||||||
mResolvedTextAlignment = getResolvedTextAlignment();
|
mResolvedTextAlignment = getTextAlignment();
|
||||||
switch (mResolvedTextAlignment) {
|
switch (mResolvedTextAlignment) {
|
||||||
case TEXT_ALIGNMENT_GRAVITY:
|
case TEXT_ALIGNMENT_GRAVITY:
|
||||||
switch (mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) {
|
switch (mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) {
|
||||||
|
Reference in New Issue
Block a user