Add displaying the count of selected markers; extract variables
This commit is contained in:
parent
978d5316de
commit
e871dc064d
5 changed files with 91 additions and 44 deletions
|
@ -51,33 +51,53 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/markers_distance_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
|
||||
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
|
||||
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
|
||||
android:layout_marginStart="@dimen/measurement_tool_text_margin"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
tools:text="1.39 km,"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/markers_time_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="~ 45 min."/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/markers_distance_text_view"
|
||||
android:id="@+id/markers_count_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
|
||||
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
|
||||
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
|
||||
android:layout_marginStart="@dimen/measurement_tool_text_margin"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
tools:text="1.39 km,"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/markers_time_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="~ 45 min."/>
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
tools:text="3 markers"/>
|
||||
</LinearLayout>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
|
|
|
@ -46,33 +46,53 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/markers_distance_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
|
||||
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
|
||||
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
|
||||
android:layout_marginStart="@dimen/measurement_tool_text_margin"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
tools:text="1.39 km,"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/markers_time_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="~ 45 min."/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/markers_distance_text_view"
|
||||
android:id="@+id/markers_count_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
|
||||
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
|
||||
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
|
||||
android:layout_marginStart="@dimen/measurement_tool_text_margin"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
tools:text="1.39 km,"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/markers_time_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="~ 45 min."/>
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
tools:text="3 markers"/>
|
||||
</LinearLayout>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="shared_string_markers">Markers</string>
|
||||
<string name="coordinates_format">Coordinates format</string>
|
||||
<string name="use_system_keyboard">Use system keyboard</string>
|
||||
<string name="fast_coordinates_input_descr">Choose coordinate format before start. You can always change it by tapping Options.</string>
|
||||
|
|
|
@ -78,6 +78,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
|
|||
private ImageView upDownIconIv;
|
||||
private TextView distanceTv;
|
||||
private TextView timeTv;
|
||||
private TextView countTv;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -113,6 +114,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
|
|||
|
||||
distanceTv = (TextView) mainView.findViewById(R.id.markers_distance_text_view);
|
||||
timeTv = (TextView) mainView.findViewById(R.id.markers_time_text_view);
|
||||
countTv = (TextView) mainView.findViewById(R.id.markers_count_text_view);
|
||||
|
||||
enterPlanRouteMode();
|
||||
|
||||
|
@ -459,6 +461,8 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
|
|||
int seconds = (int) (dist / appMode.getDefaultSpeed());
|
||||
timeTv.setText("~ " + OsmAndFormatter.getFormattedDuration(seconds, mapActivity.getMyApplication()));
|
||||
}
|
||||
|
||||
countTv.setText(mapActivity.getString(R.string.shared_string_markers) + ": " + selectedCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,18 +65,20 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
|
|||
public void onBindViewHolder(final MapMarkerItemViewHolder holder, int pos) {
|
||||
boolean night = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
|
||||
MapMarker marker = pos == 0 ? null : getItem(pos);
|
||||
|
||||
int firstMarkerPos = 1;
|
||||
int lastMarkerPos = getItemCount() - 1;
|
||||
boolean locationItem = pos == 0;
|
||||
boolean firstMarkerItem = pos == 1;
|
||||
boolean lastMarkerItem = pos == getItemCount() - 1;
|
||||
|
||||
MapMarker marker = locationItem ? null : getItem(pos);
|
||||
|
||||
holder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.bg_color_dark : R.color.bg_color_light));
|
||||
holder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.color_white : R.color.color_black));
|
||||
holder.title.setText(pos == 0 ? mapActivity.getString(R.string.shared_string_my_location) : marker.getName(mapActivity));
|
||||
holder.title.setText(locationItem ? mapActivity.getString(R.string.shared_string_my_location) : marker.getName(mapActivity));
|
||||
holder.iconDirection.setVisibility(View.GONE);
|
||||
holder.optionsBtn.setVisibility(View.GONE);
|
||||
holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.actionbar_dark_color : R.color.dashboard_divider_light));
|
||||
holder.divider.setVisibility(pos == lastMarkerPos ? View.GONE : View.VISIBLE);
|
||||
holder.divider.setVisibility(lastMarkerItem ? View.GONE : View.VISIBLE);
|
||||
holder.checkBox.setVisibility(View.VISIBLE);
|
||||
holder.checkBox.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -84,16 +86,16 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
|
|||
listener.onItemClick(holder.itemView);
|
||||
}
|
||||
});
|
||||
holder.bottomShadow.setVisibility(pos == lastMarkerPos ? View.VISIBLE : View.GONE);
|
||||
holder.bottomShadow.setVisibility(lastMarkerItem ? View.VISIBLE : View.GONE);
|
||||
|
||||
holder.firstDescription.setVisibility((pos == firstMarkerPos || pos == lastMarkerPos) ? View.VISIBLE : View.GONE);
|
||||
if (pos == firstMarkerPos) {
|
||||
holder.firstDescription.setVisibility((firstMarkerItem || lastMarkerItem) ? View.VISIBLE : View.GONE);
|
||||
if (firstMarkerItem) {
|
||||
holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_control_start) + " • ");
|
||||
} else if (pos == lastMarkerPos) {
|
||||
} else if (lastMarkerItem) {
|
||||
holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_finish) + " • ");
|
||||
}
|
||||
|
||||
if (pos == 0) {
|
||||
if (locationItem) {
|
||||
holder.topDivider.setVisibility(View.VISIBLE);
|
||||
holder.flagIconLeftSpace.setVisibility(View.VISIBLE);
|
||||
holder.icon.setImageDrawable(ContextCompat.getDrawable(mapActivity, R.drawable.map_pedestrian_location));
|
||||
|
|
Loading…
Reference in a new issue