Move padding dimensions to sizes.xml

This commit is contained in:
PavelRatushnyi 2017-10-14 14:15:20 +03:00
parent 6db6cc0daf
commit b625ab4d81
6 changed files with 12 additions and 11 deletions

View file

@ -123,5 +123,8 @@
<dimen name="measurement_tool_bottom_divider_margin_start">96dp</dimen>
<dimen name="bottom_sheet_image_text_margin_start">15dp</dimen>
<dimen name="bottom_sheet_selected_item_title_height">84dp</dimen>
<dimen name="map_markers_recycler_view_padding_bottom">78dp</dimen>
<dimen name="map_markers_recycler_view_padding_top">15dp</dimen>
</resources>

View file

@ -188,4 +188,7 @@
<dimen name="measurement_tool_bottom_divider_margin_start">64dp</dimen>
<dimen name="bottom_sheet_image_text_margin_start">10dp</dimen>
<dimen name="bottom_sheet_selected_item_title_height">56dp</dimen>
<dimen name="map_markers_recycler_view_padding_bottom">52dp</dimen>
<dimen name="map_markers_recycler_view_padding_top">10dp</dimen>
</resources>

View file

@ -11,7 +11,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.data.LatLon;
import net.osmand.plus.MapMarkersHelper.MapMarker;
@ -19,6 +18,7 @@ import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.dashboard.DashLocationFragment;
@ -40,8 +40,7 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final RecyclerView recyclerView = new RecyclerView(getContext());
final MapActivity mapActivity = (MapActivity) getActivity();
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 52 : 78));
recyclerView.setPadding(0, 0, 0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom));
recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

View file

@ -20,7 +20,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.data.LatLon;
import net.osmand.plus.MapMarkersHelper;
@ -56,8 +55,7 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
final MapActivity mapActivity = (MapActivity) getActivity();
final boolean night = !mapActivity.getMyApplication().getSettings().isLightContent();
final RecyclerView recyclerView = new RecyclerView(getContext());
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 52 : 78));
recyclerView.setPadding(0, 0, 0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom));
recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

View file

@ -20,7 +20,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmandApplication;
@ -75,8 +74,7 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
}
final RecyclerView recyclerView = new RecyclerView(getContext());
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 52 : 78));
recyclerView.setPadding(0, 0, 0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom));
recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

View file

@ -345,8 +345,8 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
}
}
});
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
markersRv.setPadding(0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 10 : 15), 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 52 : 78));
markersRv.setPadding(0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_top),
0, (int) mapActivity.getResources().getDimension(R.dimen.map_markers_recycler_view_padding_bottom));
markersRv.setClipToPadding(false);
markersRv.setLayoutManager(new LinearLayoutManager(getContext()));
markersRv.setAdapter(adapter);