mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(android): expanded layout constructors so they can be instantiated within android layouts(#10444)
This commit is contained in:
@@ -5,6 +5,7 @@ package org.nativescript.widgets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
/**
|
||||
* @author hhristov
|
||||
@@ -13,7 +14,13 @@ import android.view.View;
|
||||
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
|
||||
|
||||
@@ -5,6 +5,7 @@ package org.nativescript.widgets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
/**
|
||||
* @author hhristov
|
||||
@@ -13,7 +14,13 @@ import android.view.View;
|
||||
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
|
||||
|
||||
@@ -5,6 +5,7 @@ package org.nativescript.widgets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
/**
|
||||
* @author hhristov
|
||||
@@ -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() {
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
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;
|
||||
@@ -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) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
/**
|
||||
* @author hhristov
|
||||
@@ -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() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nativescript.widgets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user