* commit '239e430578fd2d3bd38a646595a82bca95359bd7': Fix bug #6427629 Clean up layout direction APIs
This commit is contained in:
@ -24954,7 +24954,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 getResolvedLayoutDirection();
|
|
||||||
method public int getResolvedTextAlignment();
|
method public int getResolvedTextAlignment();
|
||||||
method public int getResolvedTextDirection();
|
method public int getResolvedTextDirection();
|
||||||
method public android.content.res.Resources getResources();
|
method public android.content.res.Resources getResources();
|
||||||
|
@ -3927,7 +3927,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply layout direction to the new Drawables if needed
|
// Apply layout direction to the new Drawables if needed
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
if (track != null) {
|
if (track != null) {
|
||||||
track.setLayoutDirection(layoutDirection);
|
track.setLayoutDirection(layoutDirection);
|
||||||
}
|
}
|
||||||
@ -5779,7 +5779,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
@ViewDebug.IntToString(from = LAYOUT_DIRECTION_INHERIT, to = "INHERIT"),
|
@ViewDebug.IntToString(from = LAYOUT_DIRECTION_INHERIT, to = "INHERIT"),
|
||||||
@ViewDebug.IntToString(from = LAYOUT_DIRECTION_LOCALE, to = "LOCALE")
|
@ViewDebug.IntToString(from = LAYOUT_DIRECTION_LOCALE, to = "LOCALE")
|
||||||
})
|
})
|
||||||
public int getLayoutDirection() {
|
private int getRawLayoutDirection() {
|
||||||
return (mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_MASK) >> PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT;
|
return (mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_MASK) >> PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5796,7 +5796,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
*/
|
*/
|
||||||
@RemotableViewMethod
|
@RemotableViewMethod
|
||||||
public void setLayoutDirection(int layoutDirection) {
|
public void setLayoutDirection(int layoutDirection) {
|
||||||
if (getLayoutDirection() != layoutDirection) {
|
if (getRawLayoutDirection() != layoutDirection) {
|
||||||
// Reset the current layout direction and the resolved one
|
// Reset the current layout direction and the resolved one
|
||||||
mPrivateFlags2 &= ~PFLAG2_LAYOUT_DIRECTION_MASK;
|
mPrivateFlags2 &= ~PFLAG2_LAYOUT_DIRECTION_MASK;
|
||||||
resetRtlProperties();
|
resetRtlProperties();
|
||||||
@ -5821,7 +5821,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
@ViewDebug.IntToString(from = LAYOUT_DIRECTION_LTR, to = "RESOLVED_DIRECTION_LTR"),
|
@ViewDebug.IntToString(from = LAYOUT_DIRECTION_LTR, to = "RESOLVED_DIRECTION_LTR"),
|
||||||
@ViewDebug.IntToString(from = LAYOUT_DIRECTION_RTL, to = "RESOLVED_DIRECTION_RTL")
|
@ViewDebug.IntToString(from = LAYOUT_DIRECTION_RTL, to = "RESOLVED_DIRECTION_RTL")
|
||||||
})
|
})
|
||||||
public int getResolvedLayoutDirection() {
|
public int getLayoutDirection() {
|
||||||
final int targetSdkVersion = getContext().getApplicationInfo().targetSdkVersion;
|
final int targetSdkVersion = getContext().getApplicationInfo().targetSdkVersion;
|
||||||
if (targetSdkVersion < JELLY_BEAN_MR1) {
|
if (targetSdkVersion < JELLY_BEAN_MR1) {
|
||||||
mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED;
|
mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED;
|
||||||
@ -5843,7 +5843,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
*/
|
*/
|
||||||
@ViewDebug.ExportedProperty(category = "layout")
|
@ViewDebug.ExportedProperty(category = "layout")
|
||||||
public boolean isLayoutRtl() {
|
public boolean isLayoutRtl() {
|
||||||
return (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL);
|
return (getLayoutDirection() == LAYOUT_DIRECTION_RTL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9936,7 +9936,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
*/
|
*/
|
||||||
private void resolveLayoutParams() {
|
private void resolveLayoutParams() {
|
||||||
if (mLayoutParams != null) {
|
if (mLayoutParams != null) {
|
||||||
mLayoutParams.onResolveLayoutDirection(getResolvedLayoutDirection());
|
mLayoutParams.onResolveLayoutDirection(getLayoutDirection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11561,7 +11561,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
|
|
||||||
if (hasRtlSupport()) {
|
if (hasRtlSupport()) {
|
||||||
// Set resolved depending on layout direction
|
// Set resolved depending on layout direction
|
||||||
switch (getLayoutDirection()) {
|
switch ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_MASK) >>
|
||||||
|
PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) {
|
||||||
case LAYOUT_DIRECTION_INHERIT:
|
case LAYOUT_DIRECTION_INHERIT:
|
||||||
// We cannot resolve yet. LTR is by default and let the resolution happen again
|
// We cannot resolve yet. LTR is by default and let the resolution happen again
|
||||||
// later to get the correct resolved value
|
// later to get the correct resolved value
|
||||||
@ -11573,7 +11574,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
// resolution happen again later
|
// resolution happen again later
|
||||||
if (!viewGroup.canResolveLayoutDirection()) return;
|
if (!viewGroup.canResolveLayoutDirection()) return;
|
||||||
|
|
||||||
if (viewGroup.getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) {
|
if (viewGroup.getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
|
||||||
mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
|
mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -11603,7 +11604,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public boolean canResolveLayoutDirection() {
|
public boolean canResolveLayoutDirection() {
|
||||||
switch (getLayoutDirection()) {
|
switch ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_MASK) >>
|
||||||
|
PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) {
|
||||||
case LAYOUT_DIRECTION_INHERIT:
|
case LAYOUT_DIRECTION_INHERIT:
|
||||||
return (mParent != null) && (mParent instanceof ViewGroup);
|
return (mParent != null) && (mParent instanceof ViewGroup);
|
||||||
default:
|
default:
|
||||||
@ -11621,6 +11623,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
mPrivateFlags2 &= ~PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK;
|
mPrivateFlags2 &= ~PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean isLayoutDirectionInherited() {
|
||||||
|
return (getRawLayoutDirection() == LAYOUT_DIRECTION_INHERIT);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return if padding has been resolved
|
* Return if padding has been resolved
|
||||||
*
|
*
|
||||||
@ -11660,7 +11669,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
// If start / end padding are defined, they will be resolved (hence overriding) to
|
// If start / end padding are defined, they will be resolved (hence overriding) to
|
||||||
// left / right or right / left depending on the resolved layout direction.
|
// left / right or right / left depending on the resolved layout direction.
|
||||||
// If start / end padding are not defined, use the left / right ones.
|
// If start / end padding are not defined, use the left / right ones.
|
||||||
int resolvedLayoutDirection = getResolvedLayoutDirection();
|
int resolvedLayoutDirection = getLayoutDirection();
|
||||||
// Set user padding to initial values ...
|
// Set user padding to initial values ...
|
||||||
mUserPaddingLeft = (mUserPaddingLeftInitial == UNDEFINED_PADDING) ?
|
mUserPaddingLeft = (mUserPaddingLeftInitial == UNDEFINED_PADDING) ?
|
||||||
0 : mUserPaddingLeftInitial;
|
0 : mUserPaddingLeftInitial;
|
||||||
@ -14105,9 +14114,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
*/
|
*/
|
||||||
public void resolveDrawables() {
|
public void resolveDrawables() {
|
||||||
if (mBackground != null) {
|
if (mBackground != null) {
|
||||||
mBackground.setLayoutDirection(getResolvedLayoutDirection());
|
mBackground.setLayoutDirection(getLayoutDirection());
|
||||||
}
|
}
|
||||||
onResolveDrawables(getResolvedLayoutDirection());
|
onResolveDrawables(getLayoutDirection());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14394,7 +14403,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
padding = new Rect();
|
padding = new Rect();
|
||||||
sThreadLocal.set(padding);
|
sThreadLocal.set(padding);
|
||||||
}
|
}
|
||||||
background.setLayoutDirection(getResolvedLayoutDirection());
|
background.setLayoutDirection(getLayoutDirection());
|
||||||
if (background.getPadding(padding)) {
|
if (background.getPadding(padding)) {
|
||||||
resetResolvedPadding();
|
resetResolvedPadding();
|
||||||
switch (background.getLayoutDirection()) {
|
switch (background.getLayoutDirection()) {
|
||||||
@ -14591,7 +14600,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
mUserPaddingStart = start;
|
mUserPaddingStart = start;
|
||||||
mUserPaddingEnd = end;
|
mUserPaddingEnd = end;
|
||||||
|
|
||||||
switch(getResolvedLayoutDirection()) {
|
switch(getLayoutDirection()) {
|
||||||
case LAYOUT_DIRECTION_RTL:
|
case LAYOUT_DIRECTION_RTL:
|
||||||
mUserPaddingLeftInitial = end;
|
mUserPaddingLeftInitial = end;
|
||||||
mUserPaddingRightInitial = start;
|
mUserPaddingRightInitial = start;
|
||||||
@ -14650,7 +14659,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
if (!isPaddingResolved()) {
|
if (!isPaddingResolved()) {
|
||||||
resolvePadding();
|
resolvePadding();
|
||||||
}
|
}
|
||||||
return (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) ?
|
return (getLayoutDirection() == LAYOUT_DIRECTION_RTL) ?
|
||||||
mPaddingRight : mPaddingLeft;
|
mPaddingRight : mPaddingLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14679,7 +14688,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
if (!isPaddingResolved()) {
|
if (!isPaddingResolved()) {
|
||||||
resolvePadding();
|
resolvePadding();
|
||||||
}
|
}
|
||||||
return (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) ?
|
return (getLayoutDirection() == LAYOUT_DIRECTION_RTL) ?
|
||||||
mPaddingLeft : mPaddingRight;
|
mPaddingLeft : mPaddingRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3392,7 +3392,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
childHasTransientStateChanged(child, true);
|
childHasTransientStateChanged(child, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child.getLayoutDirection() == View.LAYOUT_DIRECTION_INHERIT) {
|
if (child.isLayoutDirectionInherited()) {
|
||||||
child.resetResolvedLayoutDirection();
|
child.resetResolvedLayoutDirection();
|
||||||
child.resolveRtlProperties();
|
child.resolveRtlProperties();
|
||||||
}
|
}
|
||||||
@ -5268,7 +5268,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
int count = getChildCount();
|
int count = getChildCount();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
final View child = getChildAt(i);
|
final View child = getChildAt(i);
|
||||||
if (child.getLayoutDirection() == LAYOUT_DIRECTION_INHERIT) {
|
if (child.isLayoutDirectionInherited()) {
|
||||||
child.resetResolvedLayoutDirection();
|
child.resetResolvedLayoutDirection();
|
||||||
}
|
}
|
||||||
if (child.getTextDirection() == TEXT_DIRECTION_INHERIT) {
|
if (child.getTextDirection() == TEXT_DIRECTION_INHERIT) {
|
||||||
@ -6155,7 +6155,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
view.getDrawingRect(viewLocation);
|
view.getDrawingRect(viewLocation);
|
||||||
root.offsetDescendantRectToMyCoords(view, viewLocation);
|
root.offsetDescendantRectToMyCoords(view, viewLocation);
|
||||||
mView = view;
|
mView = view;
|
||||||
mLayoutDirection = root.getResolvedLayoutDirection();
|
mLayoutDirection = root.getLayoutDirection();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clear() {
|
private void clear() {
|
||||||
|
@ -108,7 +108,7 @@ public abstract class AbsSeekBar extends ProgressBar {
|
|||||||
if (thumb != null) {
|
if (thumb != null) {
|
||||||
thumb.setCallback(this);
|
thumb.setCallback(this);
|
||||||
if (canResolveLayoutDirection()) {
|
if (canResolveLayoutDirection()) {
|
||||||
thumb.setLayoutDirection(getResolvedLayoutDirection());
|
thumb.setLayoutDirection(getLayoutDirection());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assuming the thumb drawable is symmetric, set the thumb offset
|
// Assuming the thumb drawable is symmetric, set the thumb offset
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package android.widget;
|
package android.widget;
|
||||||
|
|
||||||
import android.app.SearchManager.OnDismissListener;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.database.DataSetObserver;
|
import android.database.DataSetObserver;
|
||||||
@ -1094,7 +1093,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
|
|||||||
mPopup.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NEEDED);
|
mPopup.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NEEDED);
|
||||||
mPopup.setListItemExpandMax(EXPAND_MAX);
|
mPopup.setListItemExpandMax(EXPAND_MAX);
|
||||||
}
|
}
|
||||||
mPopup.setLayoutDirection(getResolvedLayoutDirection());
|
mPopup.setLayoutDirection(getLayoutDirection());
|
||||||
mPopup.show();
|
mPopup.show();
|
||||||
mPopup.getListView().setOverScrollMode(View.OVER_SCROLL_ALWAYS);
|
mPopup.getListView().setOverScrollMode(View.OVER_SCROLL_ALWAYS);
|
||||||
}
|
}
|
||||||
|
@ -88,9 +88,6 @@ import android.view.inputmethod.ExtractedTextRequest;
|
|||||||
import android.view.inputmethod.InputConnection;
|
import android.view.inputmethod.InputConnection;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.Editor.InputContentType;
|
|
||||||
import android.widget.Editor.InputMethodState;
|
|
||||||
import android.widget.Editor.SelectionModifierCursorController;
|
|
||||||
import android.widget.TextView.Drawables;
|
import android.widget.TextView.Drawables;
|
||||||
import android.widget.TextView.OnEditorActionListener;
|
import android.widget.TextView.OnEditorActionListener;
|
||||||
|
|
||||||
@ -292,7 +289,7 @@ public class Editor {
|
|||||||
mErrorWasChanged = true;
|
mErrorWasChanged = true;
|
||||||
final Drawables dr = mTextView.mDrawables;
|
final Drawables dr = mTextView.mDrawables;
|
||||||
if (dr != null) {
|
if (dr != null) {
|
||||||
switch (mTextView.getResolvedLayoutDirection()) {
|
switch (mTextView.getLayoutDirection()) {
|
||||||
default:
|
default:
|
||||||
case View.LAYOUT_DIRECTION_LTR:
|
case View.LAYOUT_DIRECTION_LTR:
|
||||||
mTextView.setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon,
|
mTextView.setCompoundDrawables(dr.mDrawableLeft, dr.mDrawableTop, icon,
|
||||||
|
@ -411,7 +411,7 @@ public class FrameLayout extends ViewGroup {
|
|||||||
gravity = DEFAULT_CHILD_GRAVITY;
|
gravity = DEFAULT_CHILD_GRAVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
final int absoluteGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection);
|
final int absoluteGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection);
|
||||||
final int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;
|
final int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ public class FrameLayout extends ViewGroup {
|
|||||||
selfBounds.set(mPaddingLeft, mPaddingTop, w - mPaddingRight, h - mPaddingBottom);
|
selfBounds.set(mPaddingLeft, mPaddingTop, w - mPaddingRight, h - mPaddingBottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
Gravity.apply(mForegroundGravity, foreground.getIntrinsicWidth(),
|
Gravity.apply(mForegroundGravity, foreground.getIntrinsicWidth(),
|
||||||
foreground.getIntrinsicHeight(), selfBounds, overlayBounds,
|
foreground.getIntrinsicHeight(), selfBounds, overlayBounds,
|
||||||
layoutDirection);
|
layoutDirection);
|
||||||
|
@ -1425,7 +1425,7 @@ public class GridView extends AbsListView {
|
|||||||
int childLeft;
|
int childLeft;
|
||||||
final int childTop = flow ? y : y - h;
|
final int childTop = flow ? y : y - h;
|
||||||
|
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
||||||
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
||||||
case Gravity.LEFT:
|
case Gravity.LEFT:
|
||||||
|
@ -680,7 +680,7 @@ public class ImageView extends View {
|
|||||||
d.setState(getDrawableState());
|
d.setState(getDrawableState());
|
||||||
}
|
}
|
||||||
d.setLevel(mLevel);
|
d.setLevel(mLevel);
|
||||||
d.setLayoutDirection(getResolvedLayoutDirection());
|
d.setLayoutDirection(getLayoutDirection());
|
||||||
mDrawableWidth = d.getIntrinsicWidth();
|
mDrawableWidth = d.getIntrinsicWidth();
|
||||||
mDrawableHeight = d.getIntrinsicHeight();
|
mDrawableHeight = d.getIntrinsicHeight();
|
||||||
applyColorMod();
|
applyColorMod();
|
||||||
|
@ -1495,7 +1495,7 @@ public class LinearLayout extends ViewGroup {
|
|||||||
if (gravity < 0) {
|
if (gravity < 0) {
|
||||||
gravity = minorGravity;
|
gravity = minorGravity;
|
||||||
}
|
}
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
final int absoluteGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection);
|
final int absoluteGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection);
|
||||||
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
||||||
case Gravity.CENTER_HORIZONTAL:
|
case Gravity.CENTER_HORIZONTAL:
|
||||||
@ -1559,7 +1559,7 @@ public class LinearLayout extends ViewGroup {
|
|||||||
final int[] maxAscent = mMaxAscent;
|
final int[] maxAscent = mMaxAscent;
|
||||||
final int[] maxDescent = mMaxDescent;
|
final int[] maxDescent = mMaxDescent;
|
||||||
|
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
switch (Gravity.getAbsoluteGravity(majorGravity, layoutDirection)) {
|
switch (Gravity.getAbsoluteGravity(majorGravity, layoutDirection)) {
|
||||||
case Gravity.RIGHT:
|
case Gravity.RIGHT:
|
||||||
// mTotalLength contains the padding already
|
// mTotalLength contains the padding already
|
||||||
|
@ -479,7 +479,7 @@ public class ProgressBar extends View {
|
|||||||
}
|
}
|
||||||
mIndeterminateDrawable = d;
|
mIndeterminateDrawable = d;
|
||||||
if (mIndeterminateDrawable != null && canResolveLayoutDirection()) {
|
if (mIndeterminateDrawable != null && canResolveLayoutDirection()) {
|
||||||
mIndeterminateDrawable.setLayoutDirection(getResolvedLayoutDirection());
|
mIndeterminateDrawable.setLayoutDirection(getLayoutDirection());
|
||||||
}
|
}
|
||||||
if (mIndeterminate) {
|
if (mIndeterminate) {
|
||||||
mCurrentDrawable = d;
|
mCurrentDrawable = d;
|
||||||
@ -521,7 +521,7 @@ public class ProgressBar extends View {
|
|||||||
if (d != null) {
|
if (d != null) {
|
||||||
d.setCallback(this);
|
d.setCallback(this);
|
||||||
if (canResolveLayoutDirection()) {
|
if (canResolveLayoutDirection()) {
|
||||||
d.setLayoutDirection(getResolvedLayoutDirection());
|
d.setLayoutDirection(getLayoutDirection());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the ProgressBar is always tall enough
|
// Make sure the ProgressBar is always tall enough
|
||||||
@ -672,7 +672,7 @@ public class ProgressBar extends View {
|
|||||||
if (d instanceof LayerDrawable) {
|
if (d instanceof LayerDrawable) {
|
||||||
progressDrawable = ((LayerDrawable) d).findDrawableByLayerId(id);
|
progressDrawable = ((LayerDrawable) d).findDrawableByLayerId(id);
|
||||||
if (progressDrawable != null && canResolveLayoutDirection()) {
|
if (progressDrawable != null && canResolveLayoutDirection()) {
|
||||||
progressDrawable.setLayoutDirection(getResolvedLayoutDirection());
|
progressDrawable.setLayoutDirection(getLayoutDirection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ public class RelativeLayout extends ViewGroup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
|
|
||||||
if (isWrapContentWidth) {
|
if (isWrapContentWidth) {
|
||||||
// Width already has left padding in it since it was calculated by looking at
|
// Width already has left padding in it since it was calculated by looking at
|
||||||
@ -578,7 +578,7 @@ public class RelativeLayout extends ViewGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void alignBaseline(View child, LayoutParams params) {
|
private void alignBaseline(View child, LayoutParams params) {
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
int[] rules = params.getRules(layoutDirection);
|
int[] rules = params.getRules(layoutDirection);
|
||||||
int anchorBaseline = getRelatedViewBaseline(rules, ALIGN_BASELINE);
|
int anchorBaseline = getRelatedViewBaseline(rules, ALIGN_BASELINE);
|
||||||
|
|
||||||
@ -727,7 +727,7 @@ public class RelativeLayout extends ViewGroup {
|
|||||||
private boolean positionChildHorizontal(View child, LayoutParams params, int myWidth,
|
private boolean positionChildHorizontal(View child, LayoutParams params, int myWidth,
|
||||||
boolean wrapContent) {
|
boolean wrapContent) {
|
||||||
|
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
int[] rules = params.getRules(layoutDirection);
|
int[] rules = params.getRules(layoutDirection);
|
||||||
params.onResolveLayoutDirection(layoutDirection);
|
params.onResolveLayoutDirection(layoutDirection);
|
||||||
|
|
||||||
@ -792,7 +792,7 @@ public class RelativeLayout extends ViewGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void applyHorizontalSizeRules(LayoutParams childParams, int myWidth) {
|
private void applyHorizontalSizeRules(LayoutParams childParams, int myWidth) {
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
int[] rules = childParams.getRules(layoutDirection);
|
int[] rules = childParams.getRules(layoutDirection);
|
||||||
RelativeLayout.LayoutParams anchorParams;
|
RelativeLayout.LayoutParams anchorParams;
|
||||||
|
|
||||||
@ -983,7 +983,7 @@ public class RelativeLayout extends ViewGroup {
|
|||||||
if (child.getVisibility() != GONE) {
|
if (child.getVisibility() != GONE) {
|
||||||
RelativeLayout.LayoutParams st =
|
RelativeLayout.LayoutParams st =
|
||||||
(RelativeLayout.LayoutParams) child.getLayoutParams();
|
(RelativeLayout.LayoutParams) child.getLayoutParams();
|
||||||
st.onResolveLayoutDirection(getResolvedLayoutDirection());
|
st.onResolveLayoutDirection(getLayoutDirection());
|
||||||
child.layout(st.mLeft, st.mTop, st.mRight, st.mBottom);
|
child.layout(st.mLeft, st.mTop, st.mRight, st.mBottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1355,7 +1355,7 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRtlPropertiesChanged() {
|
public void onRtlPropertiesChanged() {
|
||||||
mQueryTextView.setLayoutDirection(getResolvedLayoutDirection());
|
mQueryTextView.setLayoutDirection(getLayoutDirection());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -492,7 +492,7 @@ public class Spinner extends AbsSpinner implements OnClickListener {
|
|||||||
View sel = makeAndAddView(mSelectedPosition);
|
View sel = makeAndAddView(mSelectedPosition);
|
||||||
int width = sel.getMeasuredWidth();
|
int width = sel.getMeasuredWidth();
|
||||||
int selectedOffset = childrenLeft;
|
int selectedOffset = childrenLeft;
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
||||||
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
||||||
case Gravity.CENTER_HORIZONTAL:
|
case Gravity.CENTER_HORIZONTAL:
|
||||||
|
@ -226,7 +226,7 @@ public class TableRow extends LinearLayout {
|
|||||||
final int childWidth = child.getMeasuredWidth();
|
final int childWidth = child.getMeasuredWidth();
|
||||||
lp.mOffset[LayoutParams.LOCATION_NEXT] = columnWidth - childWidth;
|
lp.mOffset[LayoutParams.LOCATION_NEXT] = columnWidth - childWidth;
|
||||||
|
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
final int absoluteGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection);
|
final int absoluteGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection);
|
||||||
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
||||||
case Gravity.LEFT:
|
case Gravity.LEFT:
|
||||||
|
@ -1546,7 +1546,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
*/
|
*/
|
||||||
public int getCompoundPaddingStart() {
|
public int getCompoundPaddingStart() {
|
||||||
resolveDrawables();
|
resolveDrawables();
|
||||||
switch(getResolvedLayoutDirection()) {
|
switch(getLayoutDirection()) {
|
||||||
default:
|
default:
|
||||||
case LAYOUT_DIRECTION_LTR:
|
case LAYOUT_DIRECTION_LTR:
|
||||||
return getCompoundPaddingLeft();
|
return getCompoundPaddingLeft();
|
||||||
@ -1561,7 +1561,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
*/
|
*/
|
||||||
public int getCompoundPaddingEnd() {
|
public int getCompoundPaddingEnd() {
|
||||||
resolveDrawables();
|
resolveDrawables();
|
||||||
switch(getResolvedLayoutDirection()) {
|
switch(getLayoutDirection()) {
|
||||||
default:
|
default:
|
||||||
case LAYOUT_DIRECTION_LTR:
|
case LAYOUT_DIRECTION_LTR:
|
||||||
return getCompoundPaddingRight();
|
return getCompoundPaddingRight();
|
||||||
@ -4858,7 +4858,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
|
|
||||||
final boolean isLayoutRtl = isLayoutRtl();
|
final boolean isLayoutRtl = isLayoutRtl();
|
||||||
|
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
||||||
if (mEllipsize == TextUtils.TruncateAt.MARQUEE &&
|
if (mEllipsize == TextUtils.TruncateAt.MARQUEE &&
|
||||||
mMarqueeFadeMode != MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {
|
mMarqueeFadeMode != MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {
|
||||||
@ -5680,11 +5680,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
mLayoutAlignment = Layout.Alignment.ALIGN_CENTER;
|
mLayoutAlignment = Layout.Alignment.ALIGN_CENTER;
|
||||||
break;
|
break;
|
||||||
case TEXT_ALIGNMENT_VIEW_START:
|
case TEXT_ALIGNMENT_VIEW_START:
|
||||||
mLayoutAlignment = (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) ?
|
mLayoutAlignment = (getLayoutDirection() == LAYOUT_DIRECTION_RTL) ?
|
||||||
Layout.Alignment.ALIGN_RIGHT : Layout.Alignment.ALIGN_LEFT;
|
Layout.Alignment.ALIGN_RIGHT : Layout.Alignment.ALIGN_LEFT;
|
||||||
break;
|
break;
|
||||||
case TEXT_ALIGNMENT_VIEW_END:
|
case TEXT_ALIGNMENT_VIEW_END:
|
||||||
mLayoutAlignment = (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) ?
|
mLayoutAlignment = (getLayoutDirection() == LAYOUT_DIRECTION_RTL) ?
|
||||||
Layout.Alignment.ALIGN_LEFT : Layout.Alignment.ALIGN_RIGHT;
|
Layout.Alignment.ALIGN_LEFT : Layout.Alignment.ALIGN_RIGHT;
|
||||||
break;
|
break;
|
||||||
case TEXT_ALIGNMENT_INHERIT:
|
case TEXT_ALIGNMENT_INHERIT:
|
||||||
@ -7485,7 +7485,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
} else if (getLineCount() == 1) {
|
} else if (getLineCount() == 1) {
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
||||||
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
||||||
case Gravity.LEFT:
|
case Gravity.LEFT:
|
||||||
@ -7512,7 +7512,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
final float scroll = marquee.getScroll();
|
final float scroll = marquee.getScroll();
|
||||||
return (maxFadeScroll - scroll) / getHorizontalFadingEdgeLength();
|
return (maxFadeScroll - scroll) / getHorizontalFadingEdgeLength();
|
||||||
} else if (getLineCount() == 1) {
|
} else if (getLineCount() == 1) {
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
||||||
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
||||||
case Gravity.LEFT:
|
case Gravity.LEFT:
|
||||||
@ -8189,7 +8189,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Always need to resolve layout direction first
|
// Always need to resolve layout direction first
|
||||||
final boolean defaultIsRtl = (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL);
|
final boolean defaultIsRtl = (getLayoutDirection() == LAYOUT_DIRECTION_RTL);
|
||||||
|
|
||||||
// Now, we can select the heuristic
|
// Now, we can select the heuristic
|
||||||
int textDir = getResolvedTextDirection();
|
int textDir = getResolvedTextDirection();
|
||||||
|
@ -281,7 +281,7 @@ public final class IconMenuItemView extends TextView implements MenuView.ItemVie
|
|||||||
Rect tmpRect = mPositionIconOutput;
|
Rect tmpRect = mPositionIconOutput;
|
||||||
getLineBounds(0, tmpRect);
|
getLineBounds(0, tmpRect);
|
||||||
mPositionIconAvailable.set(0, 0, getWidth(), tmpRect.top);
|
mPositionIconAvailable.set(0, 0, getWidth(), tmpRect.top);
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
Gravity.apply(Gravity.CENTER_VERTICAL | Gravity.START, mIcon.getIntrinsicWidth(), mIcon
|
Gravity.apply(Gravity.CENTER_VERTICAL | Gravity.START, mIcon.getIntrinsicWidth(), mIcon
|
||||||
.getIntrinsicHeight(), mPositionIconAvailable, mPositionIconOutput,
|
.getIntrinsicHeight(), mPositionIconAvailable, mPositionIconOutput,
|
||||||
layoutDirection);
|
layoutDirection);
|
||||||
|
@ -1088,7 +1088,7 @@ public class ActionBarView extends AbsActionBarView {
|
|||||||
customView = mCustomNavView;
|
customView = mCustomNavView;
|
||||||
}
|
}
|
||||||
if (customView != null) {
|
if (customView != null) {
|
||||||
final int resolvedLayoutDirection = getResolvedLayoutDirection();
|
final int resolvedLayoutDirection = getLayoutDirection();
|
||||||
ViewGroup.LayoutParams lp = customView.getLayoutParams();
|
ViewGroup.LayoutParams lp = customView.getLayoutParams();
|
||||||
lp.onResolveLayoutDirection(resolvedLayoutDirection);
|
lp.onResolveLayoutDirection(resolvedLayoutDirection);
|
||||||
final ActionBar.LayoutParams ablp = lp instanceof ActionBar.LayoutParams ?
|
final ActionBar.LayoutParams ablp = lp instanceof ActionBar.LayoutParams ?
|
||||||
@ -1372,7 +1372,7 @@ public class ActionBarView extends AbsActionBarView {
|
|||||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||||
final int vCenter = (b - t) / 2;
|
final int vCenter = (b - t) / 2;
|
||||||
final boolean isLayoutRtl = isLayoutRtl();
|
final boolean isLayoutRtl = isLayoutRtl();
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
final int width = getWidth();
|
final int width = getWidth();
|
||||||
int upOffset = 0;
|
int upOffset = 0;
|
||||||
if (mUpView.getVisibility() != GONE) {
|
if (mUpView.getVisibility() != GONE) {
|
||||||
|
@ -39,7 +39,6 @@ import android.util.TypedValue;
|
|||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
|
||||||
import com.android.internal.R;
|
import com.android.internal.R;
|
||||||
@ -957,7 +956,7 @@ public class GlowPadView extends View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void computeInsets(int dx, int dy) {
|
private void computeInsets(int dx, int dy) {
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
||||||
|
|
||||||
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
||||||
|
@ -19,7 +19,6 @@ package com.android.internal.widget.multiwaveview;
|
|||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.Animator.AnimatorListener;
|
import android.animation.Animator.AnimatorListener;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.ObjectAnimator;
|
|
||||||
import android.animation.TimeInterpolator;
|
import android.animation.TimeInterpolator;
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.animation.ValueAnimator.AnimatorUpdateListener;
|
import android.animation.ValueAnimator.AnimatorUpdateListener;
|
||||||
@ -970,7 +969,7 @@ public class MultiWaveView extends View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void computeInsets(int dx, int dy) {
|
private void computeInsets(int dx, int dy) {
|
||||||
final int layoutDirection = getResolvedLayoutDirection();
|
final int layoutDirection = getLayoutDirection();
|
||||||
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
|
||||||
|
|
||||||
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
||||||
|
Reference in New Issue
Block a user