Improve layoutissue
This commit is contained in:
parent
680da146b8
commit
d9085b9775
2 changed files with 14 additions and 8 deletions
|
@ -443,7 +443,7 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
// 3. put into frame parent layout controls
|
// 3. put into frame parent layout controls
|
||||||
FrameLayout parent = (FrameLayout) view.getParent();
|
FrameLayout parent = (FrameLayout) view.getParent();
|
||||||
// status bar hides own top part
|
// status bar hides own top part
|
||||||
int topMargin = statusBar.getMeasuredHeight() - statusBarPadding.top - statusBarPadding.bottom;
|
int topMargin = statusBar.getMeasuredHeight() - statusBarPadding.top - statusBarPadding.bottom ;
|
||||||
// we want that status bar lays over map stack controls
|
// we want that status bar lays over map stack controls
|
||||||
topMargin -= topRectPadding.top;
|
topMargin -= topRectPadding.top;
|
||||||
|
|
||||||
|
|
|
@ -152,8 +152,9 @@ public class MapStackControl extends ViewGroup {
|
||||||
c.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
|
c.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
|
||||||
w = Math.max(w, c.getMeasuredWidth());
|
w = Math.max(w, c.getMeasuredWidth());
|
||||||
if (h > 0) {
|
if (h > 0) {
|
||||||
h -= c.getPaddingTop();
|
|
||||||
h -= prevBot;
|
h -= prevBot;
|
||||||
|
} else {
|
||||||
|
h += c.getPaddingTop();
|
||||||
}
|
}
|
||||||
h += c.getMeasuredHeight();
|
h += c.getMeasuredHeight();
|
||||||
prevBot = c.getPaddingBottom();
|
prevBot = c.getPaddingBottom();
|
||||||
|
@ -171,7 +172,6 @@ public class MapStackControl extends ViewGroup {
|
||||||
w = Math.max(w, c.getMeasuredWidth());
|
w = Math.max(w, c.getMeasuredWidth());
|
||||||
h -= c.getPaddingBottom();
|
h -= c.getPaddingBottom();
|
||||||
if (h > 0) {
|
if (h > 0) {
|
||||||
h -= c.getPaddingTop();
|
|
||||||
h -= prevBot;
|
h -= prevBot;
|
||||||
}
|
}
|
||||||
h += c.getMeasuredHeight();
|
h += c.getMeasuredHeight();
|
||||||
|
@ -187,7 +187,6 @@ public class MapStackControl extends ViewGroup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isCollapsible) {
|
if (isCollapsible) {
|
||||||
// h -= prevBot;
|
|
||||||
h += expandView.getDrawable().getMinimumHeight();
|
h += expandView.getDrawable().getMinimumHeight();
|
||||||
w = Math.max(w, expandView.getDrawable().getMinimumWidth());
|
w = Math.max(w, expandView.getDrawable().getMinimumWidth());
|
||||||
}
|
}
|
||||||
|
@ -195,14 +194,18 @@ public class MapStackControl extends ViewGroup {
|
||||||
setMeasuredDimension(w, h);
|
setMeasuredDimension(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final static int MAGIC_CONSTANT_STACK = 3;
|
||||||
@Override
|
@Override
|
||||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int cw = right - left;
|
int cw = right - left;
|
||||||
for (View c : stackViews) {
|
for (View c : stackViews) {
|
||||||
if (c.getVisibility() != View.GONE) {
|
if (c.getVisibility() != View.GONE) {
|
||||||
if (y > 0) {
|
if (y == 0) {
|
||||||
y -= c.getPaddingTop();
|
y += c.getPaddingTop();
|
||||||
|
} else {
|
||||||
|
// magic constant (should be removed when image will be recropped)
|
||||||
|
y -= MAGIC_CONSTANT_STACK;
|
||||||
}
|
}
|
||||||
c.layout(0, y, cw, y + c.getMeasuredHeight());
|
c.layout(0, y, cw, y + c.getMeasuredHeight());
|
||||||
y += c.getMeasuredHeight();
|
y += c.getMeasuredHeight();
|
||||||
|
@ -213,8 +216,11 @@ public class MapStackControl extends ViewGroup {
|
||||||
for (View c : collapsedViews) {
|
for (View c : collapsedViews) {
|
||||||
if (!isCollapsed) {
|
if (!isCollapsed) {
|
||||||
if (c.getVisibility() != View.GONE) {
|
if (c.getVisibility() != View.GONE) {
|
||||||
if (y > 0) {
|
if (y == 0) {
|
||||||
y -= c.getPaddingTop();
|
y += c.getPaddingTop();
|
||||||
|
} else {
|
||||||
|
// magic constant (should be removed when image will be recropped)
|
||||||
|
y -= MAGIC_CONSTANT_STACK;
|
||||||
}
|
}
|
||||||
c.layout(0, y, cw, y + c.getMeasuredHeight());
|
c.layout(0, y, cw, y + c.getMeasuredHeight());
|
||||||
y += c.getMeasuredHeight();
|
y += c.getMeasuredHeight();
|
||||||
|
|
Loading…
Reference in a new issue