diff --git a/OsmAnd/res/layout/navigate_point.xml b/OsmAnd/res/layout/navigate_point.xml index 51b92dd8ee..bf648881e8 100644 --- a/OsmAnd/res/layout/navigate_point.xml +++ b/OsmAnd/res/layout/navigate_point.xml @@ -1,9 +1,11 @@ - + - + android:layout_height="fill_parent" android:orientation="vertical" android:gravity="center_horizontal"> + @@ -26,6 +28,6 @@ - + \ No newline at end of file diff --git a/OsmAnd/res/layout/search_address.xml b/OsmAnd/res/layout/search_address.xml index a0d0e5c061..6259bba83c 100644 --- a/OsmAnd/res/layout/search_address.xml +++ b/OsmAnd/res/layout/search_address.xml @@ -1,49 +1,47 @@ + android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center_horizontal"> - - - + + + - + + + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/view/ExpandableButton.java b/OsmAnd/src/net/osmand/view/ExpandableButton.java index 3c009fb58e..04bc3b25b8 100644 --- a/OsmAnd/src/net/osmand/view/ExpandableButton.java +++ b/OsmAnd/src/net/osmand/view/ExpandableButton.java @@ -33,6 +33,7 @@ public class ExpandableButton extends Button { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + if(maxWidth >0){ if(MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED) { widthMeasureSpec = MeasureSpec.makeMeasureSpec((int) maxWidth, MeasureSpec.AT_MOST); } else if(MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.AT_MOST && (MeasureSpec.getSize(widthMeasureSpec)) > maxWidth){ @@ -40,10 +41,8 @@ public class ExpandableButton extends Button { } else if(MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY && (MeasureSpec.getSize(widthMeasureSpec)) > maxWidth){ widthMeasureSpec = MeasureSpec.makeMeasureSpec((int) maxWidth, MeasureSpec.EXACTLY); } + } super.onMeasure(widthMeasureSpec, heightMeasureSpec); -// if(maxWidth != 0 && getMeasuredWidth() > maxWidth) { -// setMeasuredDimension((int) maxWidth, getMeasuredHeight()); -// } } } diff --git a/OsmAnd/src/net/osmand/view/ExpandableLinearLayout.java b/OsmAnd/src/net/osmand/view/ExpandableLinearLayout.java new file mode 100644 index 0000000000..5ace4dbf32 --- /dev/null +++ b/OsmAnd/src/net/osmand/view/ExpandableLinearLayout.java @@ -0,0 +1,43 @@ +package net.osmand.view; + +import net.osmand.plus.R; +import android.content.Context; +import android.content.res.TypedArray; +import android.util.AttributeSet; +import android.widget.LinearLayout; + +public class ExpandableLinearLayout extends LinearLayout { + + private float maxWidth; + + public ExpandableLinearLayout(Context context, AttributeSet attrs) { + super(context, attrs); + if(attrs != null) { + TypedArray ar = context.obtainStyledAttributes(attrs, R.styleable.ExpandableView); + maxWidth = ar.getDimension(R.styleable.ExpandableView_maxVisibleWidth, 0); + } + } + + public ExpandableLinearLayout(Context context) { + this(context, null); + } + + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + if (maxWidth > 0) { + if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED) { + widthMeasureSpec = MeasureSpec.makeMeasureSpec((int) maxWidth, MeasureSpec.AT_MOST); + } else if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.AT_MOST && (MeasureSpec.getSize(widthMeasureSpec)) > maxWidth) { + widthMeasureSpec = MeasureSpec.makeMeasureSpec((int) maxWidth, MeasureSpec.AT_MOST); + } else if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY && (MeasureSpec.getSize(widthMeasureSpec)) > maxWidth) { + widthMeasureSpec = MeasureSpec.makeMeasureSpec((int) maxWidth, MeasureSpec.EXACTLY); + } + } + super.onMeasure(widthMeasureSpec, heightMeasureSpec); +// if(maxWidth != 0 && getMeasuredWidth() > maxWidth) { +// setMeasuredDimension((int) maxWidth, getMeasuredHeight()); +// } + } + +}