Skip to content

Commit

Permalink
feat(android): expanded layout constructors so they can be instantiat…
Browse files Browse the repository at this point in the history
…ed within android layouts(#10444)
  • Loading branch information
farfromrefug committed Jan 19, 2024
1 parent 1d04493 commit ca886b9
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 7 deletions.
Expand Up @@ -5,6 +5,7 @@

import android.content.Context;
import android.view.View;
import android.util.AttributeSet;

/**
* @author hhristov
Expand All @@ -13,7 +14,13 @@
public class AbsoluteLayout extends LayoutBase {

public AbsoluteLayout(Context context) {
super(context);
this(context, null);
}
public AbsoluteLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public AbsoluteLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

@Override
Expand Down
Expand Up @@ -5,6 +5,7 @@

import android.content.Context;
import android.view.View;
import android.util.AttributeSet;

/**
* @author hhristov
Expand All @@ -13,7 +14,13 @@
public class ContentLayout extends LayoutBase {

public ContentLayout(Context context) {
super(context);
this(context, null);
}
public ContentLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public ContentLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

@Override
Expand Down
Expand Up @@ -5,6 +5,7 @@

import android.content.Context;
import android.view.View;
import android.util.AttributeSet;

/**
* @author hhristov
Expand All @@ -15,7 +16,13 @@ public class DockLayout extends LayoutBase {
private boolean _stretchLastChild = true;

public DockLayout(Context context) {
super(context);
this(context, null);
}
public DockLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public DockLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

public boolean getStretchLastChild() {
Expand Down
Expand Up @@ -4,6 +4,7 @@
import android.view.Gravity;
import android.view.View;
import android.view.View.MeasureSpec;
import android.util.AttributeSet;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -22,7 +23,13 @@ public class GridLayout extends LayoutBase {
private final HashMap<View, MeasureSpecs> map = new HashMap<>();

public GridLayout(Context context) {
super(context);
this(context, (AttributeSet)null);
}
public GridLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public GridLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

private static void validateItemSpec(ItemSpec itemSpec) {
Expand Down
Expand Up @@ -5,6 +5,7 @@
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.util.AttributeSet;

/**
* @author hhristov
Expand All @@ -15,7 +16,13 @@ public class StackLayout extends LayoutBase {
private Orientation _orientation = Orientation.vertical;

public StackLayout(Context context) {
super(context);
this(context, null);
}
public StackLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public StackLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

public Orientation getOrientation() {
Expand Down
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;
import android.view.View;
import android.util.AttributeSet;

import java.util.ArrayList;

Expand All @@ -16,9 +17,14 @@ public class WrapLayout extends LayoutBase {
private final ArrayList<Integer> _lengths = new ArrayList<>();

public WrapLayout(Context context) {
super(context);
this(context, null);
}
public WrapLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public WrapLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

public Orientation getOrientation() {
return this._orientation;
}
Expand Down

0 comments on commit ca886b9

Please sign in to comment.