Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -27,6 +27,8 @@
public class AutoFrameLayout extends FrameLayout
{
private final AutoLayoutHelper mHelper = new AutoLayoutHelper(this);
private Context mContext;
private AttributeSet mAttrs;

public AutoFrameLayout(Context context)
{
@@ -51,6 +53,8 @@ public AutoFrameLayout(Context context, AttributeSet attrs, int defStyleAttr, in
@Override
public LayoutParams generateLayoutParams(AttributeSet attrs)
{
this.mContext = getContext();
this.mAttrs = attrs;
return new LayoutParams(getContext(), attrs);
}

@@ -59,7 +63,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
if (!isInEditMode())
{
mHelper.adjustChildren();
mHelper.adjustChildren(mContext,mAttrs);
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@ public class AutoLinearLayout extends LinearLayout
{

private AutoLayoutHelper mHelper = new AutoLayoutHelper(this);
private Context mContext;
private AttributeSet mAttrs;

public AutoLinearLayout(Context context) {
super(context);
@@ -39,7 +41,7 @@ public AutoLinearLayout(Context context, AttributeSet attrs, int defStyleAttr, i
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
if (!isInEditMode())
mHelper.adjustChildren();
mHelper.adjustChildren(mContext,mAttrs);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

@@ -54,6 +56,8 @@ protected void onLayout(boolean changed, int l, int t, int r, int b)
@Override
public LayoutParams generateLayoutParams(AttributeSet attrs)
{
this.mContext = getContext();
this.mAttrs = attrs;
return new AutoLinearLayout.LayoutParams(getContext(), attrs);
}

Original file line number Diff line number Diff line change
@@ -28,6 +28,8 @@
public class AutoRelativeLayout extends RelativeLayout
{
private final AutoLayoutHelper mHelper = new AutoLayoutHelper(this);
private Context mContext;
private AttributeSet mAttrs;

public AutoRelativeLayout(Context context)
{
@@ -52,14 +54,16 @@ public AutoRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr,
@Override
public LayoutParams generateLayoutParams(AttributeSet attrs)
{
this.mContext = getContext();
this.mAttrs = attrs;
return new LayoutParams(getContext(), attrs);
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
if (!isInEditMode())
mHelper.adjustChildren();
mHelper.adjustChildren(mContext,mAttrs);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

Original file line number Diff line number Diff line change
@@ -112,7 +112,8 @@ private void initAutoLayoutConfig(ViewGroup host)
}


public void adjustChildren()
public void adjustChildren(Context context,
AttributeSet attrs)
{
AutoLayoutConifg.getInstance().checkParams();

@@ -123,8 +124,8 @@ public void adjustChildren()

if (params instanceof AutoLayoutParams)
{
AutoLayoutInfo info =
((AutoLayoutParams) params).getAutoLayoutInfo();
// AutoLayoutInfo info =((AutoLayoutParams) params).getAutoLayoutInfo();
AutoLayoutInfo info =getAutoLayoutInfo(context,attrs);
if (info != null)
{
info.fillAttrs(view);
Original file line number Diff line number Diff line change
@@ -25,6 +25,8 @@ public class MetroLayout extends ViewGroup
{

private final AutoLayoutHelper mHelper = new AutoLayoutHelper(this);
private Context mContext;
private AttributeSet mAttrs;

private static class MetroBlock
{
@@ -54,7 +56,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
randomColor();

if (!isInEditMode())
mHelper.adjustChildren();
mHelper.adjustChildren(mContext,mAttrs);

measureChildren(widthMeasureSpec, heightMeasureSpec);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
@@ -186,6 +188,8 @@ private MetroBlock findAvailablePos(View view)
@Override
public MetroLayout.LayoutParams generateLayoutParams(AttributeSet attrs)
{
this.mContext = getContext();
this.mAttrs = attrs;
return new LayoutParams(getContext(), attrs);
}