Update icons
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 5.8 KiB |
BIN
OsmAnd/res/drawable-hdpi/info_time_to_go.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 5.8 KiB |
BIN
OsmAnd/res/drawable-large/info_time_to_go.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 3.9 KiB |
BIN
OsmAnd/res/drawable/info_time_to_go.png
Normal file
After Width: | Height: | Size: 4 KiB |
|
@ -184,7 +184,7 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
private TextInfoControl createSpeedControl(){
|
||||
final TextInfoControl speedControl = new TextInfoControl(map, R.drawable.box_top, null, 0, paintText, paintSubText) {
|
||||
final TextInfoControl speedControl = new TextInfoControl(map, R.drawable.box_top, 0, paintText, paintSubText) {
|
||||
private float cachedSpeed = 0;
|
||||
|
||||
@Override
|
||||
|
@ -215,9 +215,10 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
private TextInfoControl createTimeControl(){
|
||||
Drawable time = view.getResources().getDrawable(R.drawable.info_time);
|
||||
final Drawable time = view.getResources().getDrawable(R.drawable.info_time);
|
||||
final Drawable timeToGo = view.getResources().getDrawable(R.drawable.info_time_to_go);
|
||||
showArrivalTime = view.getSettings().SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME.get();
|
||||
TextInfoControl leftTimeControl = new TextInfoControl(map, R.drawable.box_top, time, 0, paintText, paintSubText) {
|
||||
final TextInfoControl leftTimeControl = new TextInfoControl(map, R.drawable.box_top, 0, paintText, paintSubText) {
|
||||
private long cachedLeftTime = 0;
|
||||
|
||||
@Override
|
||||
|
@ -262,18 +263,19 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
showArrivalTime = !showArrivalTime;
|
||||
leftTimeControl.setImageDrawable(showArrivalTime? time : timeToGo);
|
||||
view.getSettings().SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME.set(showArrivalTime);
|
||||
view.refreshMap();
|
||||
}
|
||||
|
||||
});
|
||||
leftTimeControl.setText(null, null);
|
||||
leftTimeControl.setImageDrawable(showArrivalTime? time : timeToGo);
|
||||
return leftTimeControl;
|
||||
}
|
||||
|
||||
private TextInfoControl createDistanceControl() {
|
||||
TextInfoControl distanceControl = new TextInfoControl(map, R.drawable.box_top, view.getResources().getDrawable(R.drawable.info_target), 0, paintText,
|
||||
paintSubText) {
|
||||
TextInfoControl distanceControl = new TextInfoControl(map, R.drawable.box_top, 0, paintText, paintSubText) {
|
||||
private float[] calculations = new float[1];
|
||||
private int cachedMeters = 0;
|
||||
|
||||
|
@ -325,6 +327,7 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
}
|
||||
});
|
||||
distanceControl.setText(null, null);
|
||||
distanceControl.setImageDrawable(view.getResources().getDrawable(R.drawable.info_target));
|
||||
return distanceControl;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,15 +15,22 @@ public class TextInfoControl extends MapInfoControl {
|
|||
private Drawable imageDrawable;
|
||||
private float scaleCoefficient;
|
||||
|
||||
public TextInfoControl(Context ctx, int background, Drawable drawable, int leftMargin, Paint textPaint, Paint subtextPaint) {
|
||||
public TextInfoControl(Context ctx, int background, int leftMargin, Paint textPaint, Paint subtextPaint) {
|
||||
super(ctx, background);
|
||||
scaleCoefficient = MapInfoLayer.scaleCoefficient;
|
||||
this.leftMargin = leftMargin;
|
||||
this.imageDrawable = drawable;
|
||||
this.textPaint = textPaint;
|
||||
this.subtextPaint = subtextPaint;
|
||||
}
|
||||
|
||||
public void setImageDrawable(Drawable imageDrawable) {
|
||||
this.imageDrawable = imageDrawable;
|
||||
}
|
||||
|
||||
public Drawable getImageDrawable() {
|
||||
return imageDrawable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onWLayout(int w, int h) {
|
||||
if (imageDrawable != null) {
|
||||
|
@ -48,7 +55,7 @@ public class TextInfoControl extends MapInfoControl {
|
|||
int h = 0;
|
||||
if (text != null) {
|
||||
if (imageDrawable != null) {
|
||||
w += imageDrawable.getMinimumWidth();
|
||||
w += imageDrawable.getMinimumWidth() + 2 * scaleCoefficient;
|
||||
}
|
||||
w += leftMargin;
|
||||
w += textPaint.measureText(text);
|
||||
|
@ -71,7 +78,7 @@ public class TextInfoControl extends MapInfoControl {
|
|||
int margin = 0;
|
||||
if (imageDrawable != null) {
|
||||
imageDrawable.draw(cv);
|
||||
margin = imageDrawable.getBounds().width();
|
||||
margin = (int) (imageDrawable.getBounds().width() + 2 * scaleCoefficient);
|
||||
}
|
||||
margin += leftMargin;
|
||||
cv.drawText(text, margin, getWHeight() - 3 * scaleCoefficient, textPaint);
|
||||
|
|