From 2f32ac85abbf97b1bbf32add494a6957418d8974 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 3 Nov 2017 13:15:28 +0200 Subject: [PATCH] Fix points list in measurement tool --- .../plus/measurementtool/MeasurementToolFragment.java | 6 +++++- .../plus/measurementtool/RecyclerViewFragment.java | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 9008611dd9..2cb6bbba16 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -5,6 +5,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.AsyncTask; +import android.os.Build; import android.os.Bundle; import android.support.annotation.DrawableRes; import android.support.annotation.Nullable; @@ -1041,11 +1042,14 @@ public class MeasurementToolFragment extends Fragment { private void showPointsListFragment() { MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { - int screenHeight = AndroidUtils.getScreenHeight(mapActivity) - AndroidUtils.getStatusBarHeight(mapActivity); + boolean transparentStatusBar = Build.VERSION.SDK_INT >= 21; + int statusBarHeight = transparentStatusBar ? 0 : AndroidUtils.getStatusBarHeight(mapActivity); + int screenHeight = AndroidUtils.getScreenHeight(mapActivity) - statusBarHeight; RecyclerViewFragment fragment = new RecyclerViewFragment(); fragment.setRecyclerView(pointsRv); fragment.setWidth(upDownRow.getWidth()); fragment.setHeight(screenHeight - upDownRow.getHeight()); + fragment.setTransparentStatusBar(transparentStatusBar); mapActivity.getSupportFragmentManager().beginTransaction() .add(R.id.fragmentContainer, fragment, RecyclerViewFragment.TAG) .commitAllowingStateLoss(); diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/RecyclerViewFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/RecyclerViewFragment.java index 0160f67aaf..d5933d1968 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/RecyclerViewFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/RecyclerViewFragment.java @@ -25,6 +25,7 @@ public class RecyclerViewFragment extends Fragment { private RecyclerView rv; private int height; private int width; + private boolean transparentStatusBar; private FrameLayout parent; private FrameLayout mainView; @@ -40,6 +41,10 @@ public class RecyclerViewFragment extends Fragment { this.width = width; } + public void setTransparentStatusBar(boolean transparentStatusBar) { + this.transparentStatusBar = transparentStatusBar; + } + @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { @@ -68,6 +73,11 @@ public class RecyclerViewFragment extends Fragment { shadow.setScaleType(ImageView.ScaleType.FIT_XY); shadow.setImageResource(R.drawable.bg_shadow_onmap); + if (transparentStatusBar) { + AndroidUtils.addStatusBarPadding21v(getActivity(), rv); + rv.setClipToPadding(false); + } + mainView.addView(rv); mainView.addView(shadow); parent.addView(mainView);