Add dividers

This commit is contained in:
Alexander Sytnyk 2017-09-26 18:29:36 +03:00
parent 3297dc90e4
commit 8f36889cd0
4 changed files with 18 additions and 3 deletions

View file

@ -7,6 +7,12 @@
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<include
android:id="@+id/top_divider"
layout="@layout/list_item_divider"
android:visibility="gone"
tools:visibility="visible"/>
<LinearLayout
android:id="@+id/main_layout"
android:layout_width="match_parent"

View file

@ -205,6 +205,9 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
}
}
});
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
markersRv.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108));
markersRv.setClipToPadding(false);
markersRv.setLayoutManager(new LinearLayoutManager(getContext()));
markersRv.setAdapter(adapter);

View file

@ -12,6 +12,7 @@ import net.osmand.plus.R;
public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
final View mainLayout;
final View topDivider;
final ImageView iconDirection;
final ImageView iconReorder;
final ImageView icon;
@ -31,6 +32,7 @@ public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
public MapMarkerItemViewHolder(View view) {
super(view);
mainLayout = view.findViewById(R.id.main_layout);
topDivider = view.findViewById(R.id.top_divider);
iconDirection = (ImageView) view.findViewById(R.id.map_marker_direction_icon);
iconReorder = (ImageView) view.findViewById(R.id.map_marker_reorder_icon);
icon = (ImageView) view.findViewById(R.id.map_marker_icon);

View file

@ -86,11 +86,15 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
if (pos == 0 || pos == getItemCount() - 1) {
holder.firstDescription.setVisibility(View.VISIBLE);
holder.firstDescription.setText(pos == 0
? mapActivity.getString(R.string.shared_string_control_start) + ""
: mapActivity.getString(R.string.shared_string_finish) + "");
if (pos == 0) {
holder.topDivider.setVisibility(View.VISIBLE);
holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_control_start) + "");
} else {
holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_finish) + "");
}
} else {
holder.firstDescription.setVisibility(View.GONE);
holder.topDivider.setVisibility(View.GONE);
}
if (pos == getItemCount() - 1) {