Fix points list in measurement tool

This commit is contained in:
Alexander Sytnyk 2017-11-03 13:15:28 +02:00
parent c14fd73393
commit 2f32ac85ab
2 changed files with 15 additions and 1 deletions

View file

@ -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();

View file

@ -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);