Add ruler widget
This commit is contained in:
parent
c316d23c0c
commit
f157388b60
2 changed files with 15 additions and 1 deletions
|
@ -193,6 +193,8 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
registerSideWidget(plainTime, R.drawable.ic_action_time, R.string.map_widget_plain_time, "plain_time", false, 41);
|
registerSideWidget(plainTime, R.drawable.ic_action_time, R.string.map_widget_plain_time, "plain_time", false, 41);
|
||||||
TextInfoWidget battery = ric.createBatteryControl(map);
|
TextInfoWidget battery = ric.createBatteryControl(map);
|
||||||
registerSideWidget(battery, R.drawable.ic_action_battery, R.string.map_widget_battery, "battery", false, 42);
|
registerSideWidget(battery, R.drawable.ic_action_battery, R.string.map_widget_battery, "battery", false, 42);
|
||||||
|
TextInfoWidget ruler = ric.createRulerControl(map);
|
||||||
|
registerSideWidget(ruler, R.drawable.ic_action_ruler, R.string.map_widget_show_ruler, "ruler", false, 43);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recreateControls() {
|
public void recreateControls() {
|
||||||
|
|
|
@ -25,6 +25,7 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.binary.RouteDataObject;
|
import net.osmand.binary.RouteDataObject;
|
||||||
|
@ -57,7 +58,6 @@ import net.osmand.plus.views.mapwidgets.MapWidgetRegistry.WidgetState;
|
||||||
import net.osmand.router.RouteResultPreparation;
|
import net.osmand.router.RouteResultPreparation;
|
||||||
import net.osmand.router.TurnType;
|
import net.osmand.router.TurnType;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.MapUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -375,6 +375,18 @@ public class RouteInfoWidgetsFactory {
|
||||||
return batteryControl;
|
return batteryControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TextInfoWidget createRulerControl(final MapActivity map) {
|
||||||
|
final TextInfoWidget rulerControl = new TextInfoWidget(map);
|
||||||
|
rulerControl.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Toast.makeText(map, "Ruler Test", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
rulerControl.setIcons(R.drawable.widget_distance_day, R.drawable.widget_distance_night);
|
||||||
|
return rulerControl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public TextInfoWidget createMaxSpeedControl(final MapActivity map) {
|
public TextInfoWidget createMaxSpeedControl(final MapActivity map) {
|
||||||
final RoutingHelper rh = map.getMyApplication().getRoutingHelper();
|
final RoutingHelper rh = map.getMyApplication().getRoutingHelper();
|
||||||
|
|
Loading…
Reference in a new issue