Fix displaying of tunnel length
This commit is contained in:
parent
6482818892
commit
6a7b30e33d
5 changed files with 41 additions and 3 deletions
|
@ -43,6 +43,17 @@
|
|||
android:textSize="@dimen/map_alarm_text_size"
|
||||
android:textStyle="bold"
|
||||
tools:text="60"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/map_alarm_warning_text_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_marginBottom="@dimen/map_alarm_bottom_text_margin"
|
||||
android:textSize="@dimen/map_alarm_bottom_text_size"
|
||||
android:textStyle="bold"
|
||||
tools:text="1.2 km"
|
||||
tools:textColor="@color/color_black"/>
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -63,6 +63,17 @@
|
|||
android:textSize="@dimen/map_alarm_text_size"
|
||||
android:textStyle="bold"
|
||||
tools:text="60"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/map_alarm_warning_text_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_marginBottom="@dimen/map_alarm_bottom_text_margin"
|
||||
android:textSize="@dimen/map_alarm_bottom_text_size"
|
||||
android:textStyle="bold"
|
||||
tools:text="1.2 km"
|
||||
tools:textColor="@color/color_black"/>
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -22,8 +22,10 @@
|
|||
<dimen name="map_button_shadow_margin">6dp</dimen>
|
||||
<dimen name="map_button_shadow_width">84dp</dimen>
|
||||
<dimen name="map_alarm_size">116dp</dimen>
|
||||
<dimen name="map_alarm_bottom_text_margin">12dp</dimen>
|
||||
<dimen name="map_alarm_text_size">35sp</dimen>
|
||||
|
||||
<dimen name="map_alarm_bottom_text_size">22sp</dimen>
|
||||
|
||||
<dimen name="map_alarm_bottom_margin">140dp</dimen>
|
||||
<dimen name="map_alarm_bottom_margin_land">81dp</dimen>
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
<dimen name="map_ruler_width">120dp</dimen>
|
||||
<dimen name="map_ruler_bottom_margin">9dp</dimen>
|
||||
<dimen name="map_alarm_size">78dp</dimen>
|
||||
<dimen name="map_alarm_bottom_text_margin">8dp</dimen>
|
||||
|
||||
|
||||
<dimen name="map_alarm_bottom_margin">87dp</dimen>
|
||||
|
@ -108,6 +109,7 @@
|
|||
<dimen name="map_widget_text_size_small">15sp</dimen>
|
||||
<dimen name="map_button_text_size">18sp</dimen>
|
||||
<dimen name="map_alarm_text_size">25sp</dimen>
|
||||
<dimen name="map_alarm_bottom_text_size">16sp</dimen>
|
||||
<dimen name="map_widget_text_bottom_margin">1sp</dimen>
|
||||
<dimen name="map_widget_text_small_bottom_margin">3sp</dimen>
|
||||
<dimen name="map_widget_icon_margin">2dp</dimen>
|
||||
|
|
|
@ -16,6 +16,7 @@ import android.graphics.drawable.Drawable;
|
|||
import android.hardware.GeomagneticField;
|
||||
import android.os.BatteryManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -1192,6 +1193,7 @@ public class RouteInfoWidgetsFactory {
|
|||
private View layout;
|
||||
private ImageView icon;
|
||||
private TextView text;
|
||||
private TextView bottomText;
|
||||
private OsmandSettings settings;
|
||||
private RoutingHelper rh;
|
||||
private MapViewTrackingUtilities trackingUtilities;
|
||||
|
@ -1199,11 +1201,13 @@ public class RouteInfoWidgetsFactory {
|
|||
private WaypointHelper wh;
|
||||
private int imgId;
|
||||
private String textString;
|
||||
private String bottomTextString;
|
||||
|
||||
public AlarmWidget(final OsmandApplication app, MapActivity ma) {
|
||||
layout = ma.findViewById(R.id.map_alarm_warning);
|
||||
icon = (ImageView) ma.findViewById(R.id.map_alarm_warning_icon);
|
||||
text = (TextView) ma.findViewById(R.id.map_alarm_warning_text);
|
||||
bottomText = (TextView) ma.findViewById(R.id.map_alarm_warning_text_bottom);
|
||||
settings = app.getSettings();
|
||||
rh = ma.getRoutingHelper();
|
||||
trackingUtilities = ma.getMapViewTrackingUtilities();
|
||||
|
@ -1234,6 +1238,7 @@ public class RouteInfoWidgetsFactory {
|
|||
if(alarm != null) {
|
||||
int locimgId = R.drawable.warnings_limit;
|
||||
String text = "";
|
||||
String bottomText = "";
|
||||
if(alarm.getType() == AlarmInfoType.SPEED_LIMIT) {
|
||||
if(settings.DRIVING_REGION.get().americanSigns){
|
||||
locimgId = R.drawable.warnings_speed_limit_us;
|
||||
|
@ -1279,9 +1284,10 @@ public class RouteInfoWidgetsFactory {
|
|||
} else {
|
||||
locimgId = R.drawable.warnings_tunnel;
|
||||
}
|
||||
text = OsmAndFormatter.getFormattedAlarmInfoDistance(settings.getContext(), alarm.getFloatValue());
|
||||
bottomText = OsmAndFormatter.getFormattedAlarmInfoDistance(settings.getContext(), alarm.getFloatValue());
|
||||
} else {
|
||||
text = null;
|
||||
bottomText = null;
|
||||
}
|
||||
visible = (text != null && text.length() > 0) || (locimgId != 0);
|
||||
if (visible) {
|
||||
|
@ -1303,7 +1309,13 @@ public class RouteInfoWidgetsFactory {
|
|||
if (!Algorithms.objectEquals(text, this.textString)) {
|
||||
textString = text;
|
||||
this.text.setText(this.textString);
|
||||
}
|
||||
}
|
||||
if (!Algorithms.objectEquals(bottomText, this.bottomTextString)) {
|
||||
bottomTextString = bottomText;
|
||||
this.bottomText.setText(this.bottomTextString);
|
||||
this.bottomText.setTextColor(ContextCompat.getColor(layout.getContext(),
|
||||
settings.DRIVING_REGION.get().americanSigns ? R.color.color_black : R.color.color_white));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue