diff --git a/android/res/layout/fragment_bookmark_list.xml b/android/res/layout/fragment_bookmark_list.xml
index 69245fba74..7286e670ee 100644
--- a/android/res/layout/fragment_bookmark_list.xml
+++ b/android/res/layout/fragment_bookmark_list.xml
@@ -17,6 +17,7 @@
mapsme:layout_constraintRight_toRightOf="parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:gravity="center_horizontal"
android:paddingLeft="@dimen/margin_double_and_half"
android:paddingRight="@dimen/margin_double_and_half"
android:paddingTop="@dimen/placeholder_margin_top"
diff --git a/android/res/layout/fragment_catalog_bookmark_categories.xml b/android/res/layout/fragment_catalog_bookmark_categories.xml
index 150dee0d5d..8e5193dd8c 100644
--- a/android/res/layout/fragment_catalog_bookmark_categories.xml
+++ b/android/res/layout/fragment_catalog_bookmark_categories.xml
@@ -74,18 +74,18 @@
android:paddingLeft="@dimen/margin_double_and_half"
android:paddingRight="@dimen/margin_double_and_half"
android:paddingTop="@dimen/placeholder_margin_top"
+ android:paddingBottom="@dimen/placeholder_margin_top"
mapsme:imgSrcDefault="@drawable/img_empty_bookmarks"
mapsme:titleDefault="@string/cached_bookmarks_placeholder_title"
- mapsme:subTitleDefault="@string/cached_bookmarks_placeholder_subtitle"/>
-
+ mapsme:subTitleDefault="@string/cached_bookmarks_placeholder_subtitle">
+
+
+
diff --git a/android/res/layout/fragment_search_base.xml b/android/res/layout/fragment_search_base.xml
index e6746a9ab4..b3e9617942 100644
--- a/android/res/layout/fragment_search_base.xml
+++ b/android/res/layout/fragment_search_base.xml
@@ -10,6 +10,7 @@
android:id="@+id/placeholder"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:gravity="center_horizontal"
android:paddingLeft="@dimen/margin_double_and_half"
android:paddingRight="@dimen/margin_double_and_half"
android:paddingTop="@dimen/placeholder_margin_top"
diff --git a/android/src/com/mapswithme/maps/widget/PlaceholderView.java b/android/src/com/mapswithme/maps/widget/PlaceholderView.java
index 4697f7696a..4f5c297ddd 100644
--- a/android/src/com/mapswithme/maps/widget/PlaceholderView.java
+++ b/android/src/com/mapswithme/maps/widget/PlaceholderView.java
@@ -20,6 +20,7 @@ import android.widget.ScrollView;
import android.widget.TextView;
import com.mapswithme.maps.R;
+import com.mapswithme.util.MathUtils;
import com.mapswithme.util.UiUtils;
public class PlaceholderView extends LinearLayout
@@ -152,21 +153,40 @@ public class PlaceholderView extends LinearLayout
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
- UiUtils.show(mImage);
- int childrenTotalHeight = calcTotalTextChildrenHeight(widthMeasureSpec, heightMeasureSpec);
+ int childrenTextTotalHeight = calcTotalTextChildrenHeight(widthMeasureSpec, heightMeasureSpec);
final int defHeight = getDefaultSize(getSuggestedMinimumWidth(), heightMeasureSpec);
final int defWidth = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec);
- boolean isImageSpaceAllowed = defHeight > childrenTotalHeight + mImgMaxHeight;
+
+ MarginLayoutParams imgParams = (MarginLayoutParams) mImage.getLayoutParams();
+ int potentialHeight =
+ defHeight - getPaddingBottom() - getPaddingTop() - childrenTextTotalHeight -
+ imgParams.bottomMargin - imgParams.topMargin;
+
+
+ int imgSpaceRaw = Math.min(mImgMaxHeight, potentialHeight);
+ imgParams.height = imgSpaceRaw;
+ imgParams.width = imgSpaceRaw;
+ measureChildWithMargins(mImage, widthMeasureSpec, 0, heightMeasureSpec, 0);
+
+ boolean isImageSpaceAllowed = imgSpaceRaw > mImgMinHeight;
UiUtils.showIf(isImageSpaceAllowed, mImage);
- measureChildWithMargins(mImage, widthMeasureSpec, 0, heightMeasureSpec, childrenTotalHeight);
- childrenTotalHeight += isImageSpaceAllowed ? calcHeightWithMargins(mImage) : 0;
+ int childrenTotalHeight = childrenTextTotalHeight + calcImageSpace(isImageSpaceAllowed,
+ imgParams, imgSpaceRaw);
- final int height = childrenTotalHeight + getPaddingTop() + getPaddingBottom();
+ final int height = childrenTotalHeight + getPaddingTop() + getPaddingBottom();
setMeasuredDimension(defWidth, height);
}
+ private int calcImageSpace(boolean isImageSpaceAllowed, @NonNull MarginLayoutParams imgParams,
+ int imgSpaceRaw)
+ {
+ return isImageSpaceAllowed
+ ? MathUtils.sum(imgSpaceRaw, imgParams.bottomMargin, imgParams.topMargin)
+ : 0;
+ }
+
private int calcTotalTextChildrenHeight(int widthMeasureSpec, int heightMeasureSpec)
{
int totalHeight = 0;
@@ -175,7 +195,7 @@ public class PlaceholderView extends LinearLayout
View child = getChildAt(index);
if (child.getVisibility() == VISIBLE && child != mImage)
{
- measureChildWithMargins(child, widthMeasureSpec , 0, heightMeasureSpec, totalHeight);
+ measureChildWithMargins(child, widthMeasureSpec , 0, heightMeasureSpec, 0);
totalHeight += calcHeightWithMargins(child);
}
}
diff --git a/android/src/com/mapswithme/util/MathUtils.java b/android/src/com/mapswithme/util/MathUtils.java
index 676f13c1aa..bf250236ae 100644
--- a/android/src/com/mapswithme/util/MathUtils.java
+++ b/android/src/com/mapswithme/util/MathUtils.java
@@ -11,4 +11,13 @@ public class MathUtils
return sum / vals.length;
}
+ public static int sum(int... values)
+ {
+ int total = 0;
+ for (int each : values)
+ {
+ total += each;
+ }
+ return total;
+ }
}