Add ele and speed to selected point menu

This commit is contained in:
PavelRatushnyi 2017-08-26 18:40:48 +03:00
parent eaff1b8c7a
commit 74f3da881b
2 changed files with 48 additions and 8 deletions

View file

@ -52,15 +52,42 @@
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Point 2"/>
<TextView
android:id="@+id/selected_point_distance"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="386 m"/>
android:layout_height="wrap_content">
<TextView
android:id="@+id/selected_point_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="386 m"/>
<android.support.v7.widget.AppCompatTextView
android:maxLines="1"
android:id="@+id/selected_point_ele"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
tools:text="Altitude: 345 m"/>
<android.support.v7.widget.AppCompatTextView
android:maxLines="1"
android:id="@+id/selected_point_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="Speed: 45 km/h"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -143,6 +143,19 @@ public class SelectedPointBottomSheetDialogFragment extends BottomSheetDialogFra
((TextView) mainView.findViewById(R.id.selected_point_distance)).setText(OsmAndFormatter.getFormattedDistance(dist, mapActivity.getMyApplication()));
}
}
NewGpxData newGpxData = measurementLayer.getEditingCtx().getNewGpxData();
if (newGpxData != null && newGpxData.getActionType() == ActionType.EDIT_SEGMENT) {
double elevation = pt.ele;
if (!Double.isNaN(elevation)) {
String eleStr = (mapActivity.getString(R.string.altitude)).substring(0, 1);
((TextView) mainView.findViewById(R.id.selected_point_ele)).setText(eleStr + ": " + OsmAndFormatter.getFormattedAlt(elevation, mapActivity.getMyApplication()));
}
float speed = (float) pt.speed;
if (speed != 0) {
String speedStr = (mapActivity.getString(R.string.map_widget_speed)).substring(0, 1);
((TextView) mainView.findViewById(R.id.selected_point_speed)).setText(speedStr + ": " + OsmAndFormatter.getFormattedSpeed(speed, mapActivity.getMyApplication()));
}
}
final int screenHeight = AndroidUtils.getScreenHeight(getActivity());
final int statusBarHeight = AndroidUtils.getStatusBarHeight(getActivity());