You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
implement LayoutParams.resolveLayoutDirection() callback
This is needed to make androidx ConstraintLayout behave correctly
This commit is contained in:
@@ -153,6 +153,7 @@ public class LayoutInflater {
|
||||
|
||||
// Create layout params that match root, if supplied
|
||||
params = root.generateLayoutParams(attrs);
|
||||
params.resolveLayoutDirection(root.getLayoutDirection());
|
||||
if (!attachToRoot) {
|
||||
// Set the layout params for temp if we are not
|
||||
// attaching. (If we are, we use addView, below)
|
||||
@@ -219,6 +220,7 @@ public class LayoutInflater {
|
||||
final View view = createViewFromTag(parent, name, attrs);
|
||||
final ViewGroup viewGroup = (ViewGroup)parent;
|
||||
final ViewGroup.LayoutParams params = viewGroup.generateLayoutParams(attrs);
|
||||
params.resolveLayoutDirection(viewGroup.getLayoutDirection());
|
||||
rInflate(parser, view, attrs, true);
|
||||
viewGroup.addView(view, params);
|
||||
}
|
||||
@@ -261,6 +263,7 @@ public class LayoutInflater {
|
||||
if (params == null) {
|
||||
params = group.generateLayoutParams(childAttrs);
|
||||
}
|
||||
params.resolveLayoutDirection(group.getLayoutDirection());
|
||||
view.setLayoutParams(params);
|
||||
// Inflate all children.
|
||||
rInflate(childParser, view, childAttrs, true);
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
public int id;
|
||||
public ArrayList<View> children;
|
||||
|
||||
public ViewGroup(Context context) {
|
||||
@@ -336,6 +335,8 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
public void resolveLayoutDirection(int layoutDirection) {}
|
||||
|
||||
/**
|
||||
* Used to animate layouts.
|
||||
*/
|
||||
@@ -397,6 +398,8 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
public void setMarginEnd(int marginEnd) {
|
||||
rightMargin = marginEnd;
|
||||
}
|
||||
|
||||
public int getLayoutDirection() { return LAYOUT_DIRECTION_LTR; }
|
||||
}
|
||||
|
||||
public interface OnHierarchyChangeListener {
|
||||
|
||||
Reference in New Issue
Block a user