From 5e542c4314223ff2c31016878447394aa8588ec3 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 27 Nov 2011 18:12:42 +0100 Subject: [PATCH] Update icons --- .../res/drawable-hdpi/box_top_pressed.9.png | Bin 1556 -> 1359 bytes OsmAnd/res/drawable-hdpi/box_top_simple.9.png | Bin 1541 -> 1225 bytes OsmAnd/res/drawable/box_top_pressed.9.png | Bin 1270 -> 1359 bytes OsmAnd/res/drawable/box_top_simple.9.png | Bin 1226 -> 1225 bytes .../net/osmand/plus/views/MapInfoLayer.java | 163 +++++++++--------- 5 files changed, 86 insertions(+), 77 deletions(-) diff --git a/OsmAnd/res/drawable-hdpi/box_top_pressed.9.png b/OsmAnd/res/drawable-hdpi/box_top_pressed.9.png index d0370015ee81ab5d8326af0f126f1c24e0b563c7..98dab3351c8d15b321ddab898b40d375a6150107 100644 GIT binary patch literal 1359 zcmV-V1+e;wP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipr9 z5IQQR(Gwg100hrTL_t(&-rZSCODjnf{;Il@^u0c~5u%a^f=IkNNLIQK+=$EB=s(ce ziHIwIK-R8Z2!hBchzqk295=!s!{FS7iz|j0jF0Jn&ud~d#!6M!EbL_3n8aN1k$9j; zIO(L%SKm3`In@E)-sC&n6U6df1wa8f0o2#j)corA`+uX93Y59o?RIrzV`FDwVPP7; zcK|;C+|13*iM6#g%+Jq5E%pOK++&ndmNihrFkl$QsO!p0YXUL-6|&&LgbCn;*%u-tprAkm0rn=R&tGI{6&FEDYL5*8MVg#A!<}r)hC&L zlF>qnRtc$Vjs3&)QLFIeQ{xX&qlMzLvRqP)mb(=yuiP4yIWzC0oho-RdJ#sgV^pOv zYW02SK3Z~nsies$pXyruYN7hfq^xy}s>I2tSnA438yND$Crcd|WF@6;PS$0+NFhe0 zg-uy$BcK_hwBmS*Q3HTM2r+WcbY*VBTn~U2t5E|02XF@hU|8S)?igbifj}ToU0waR z$K#Pg2!(S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z!p!pv4~FW*3j78T7gy70&t;l@%Qq7xy?NB_$cdT6#uC#+SEEdV2a7si~=-Yqi=$ zHnKcoa+ItBImWN`FW}7tAbD`hg8%>k07*qoM6N<$f{1QTH~;_u diff --git a/OsmAnd/res/drawable/box_top_simple.9.png b/OsmAnd/res/drawable/box_top_simple.9.png index cfb3c3a98fff2f19194a55999ebe06f682a88c2d..8e509ead8955a37e1a063d6c49935d91f979ace5 100644 GIT binary patch delta 1205 zcmV;m1WNnL3CRhNB!7@eL_t(|+U=QZNTgL5#~tV5?AEAdvA9GryVZ21=pt#j3)|;P zYK5?bqFBH5A^M_1rXWI;Eci(f5yZR=>3Esf9B(OJK^+{&+wsi2c^7YZzh9>RkuxwX zJ2k$mcAyUYJ`J36e&>1K=Q;DfK|z;4JVF2R2nK2p3XE#C`hR1a&Gwte<8cDJ;0(;q z&$oq#hku2=n?MB6av#5F~_{e2=bh<_@bnwnBBT3cItD!RM7OGM`A=!i~COehzvsi~20TJqM`77>}fy*=u7 zyOoPtEEehD;6UEk*dQXav$I1nl#5nWR7f~2d2MZth|K2ZCLJ3aQ!Z*Yo2BjTZFyy7 zg^0}R>M9)>8Tm(1k3Z4!@^Wc?eO+EySRf*^yu3_@hJS{Xi~vwfm?BLamD@p{eO0JbddJ;c42|2oSvRukAFSiWseTX*GH^+iznA9h2OW5ty&u(TwO=MDC;!pa)g?DI zH4za(5Zvev1L&d2*z;Q;5?t{KoZqhlYM%yub^Q_5o49pC(xPUIVX#&!VHF%Pkhm7)rRyYPAv(u-R-BhwqM$k7v&& zdqe*=cm_P?@5S}QhKA=k%lCJ{J;+v+l$4BO0atZ(HDOd$Rb4u4T||*qR#uKBBqTJU z(*B73z0X=AueLg$A{5XECml}%R>j@}-+!Pum8GVp_L&g`#O;wgafge=@b>X4 z&#*{-G0^)+svhM7v3CLupEQ)8VkD2Uk)JGE{P}a{Cg%oU>pFiH!+EM|AGjEt+wi8d zj!R$VSH@6I*g4~!*TCC`p0BMwOD<(S59weZ)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ayer = layer; @@ -166,15 +161,11 @@ public class MapInfoLayer extends OsmandMapLayer { fillRed.setColor(Color.RED); fillRed.setAntiAlias(true); - boundsForSpeed = new RectF(35, 32, 110, 64); boundsForMiniRoute = new RectF(0, 64, 96, 196); - boundsForLeftTime = new RectF(0, 0, 75, 32); // Scale to have proper view - scaleRect(boundsForSpeed); scaleRect(boundsForMiniRoute); - scaleRect(boundsForLeftTime); centerMiniRouteX = (int) (boundsForMiniRoute.width()/2); centerMiniRouteY= (int) (boundsForMiniRoute.top + 3 * boundsForMiniRoute.height() /4); @@ -190,6 +181,19 @@ public class MapInfoLayer extends OsmandMapLayer { LEFT_MARGIN = (int) (LEFT_MARGIN * scaleCoefficient); compassControl = createCompassControl(R.drawable.box_top); zoomControl = new TextInfoControl(R.drawable.box_top, paintText, paintSubText); + speedControl = new TextInfoControl(R.drawable.box_top, paintText, paintSubText); + leftTimeControl = new TextInfoControl(R.drawable.box_top, paintText, paintSubText) { + @Override + public boolean isClickable() { + return true; + } + @Override + public void click() { + showArrivalTime = !showArrivalTime; + view.getSettings().SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME.set(showArrivalTime); + view.refreshMap(); + } + }; distanceControl = new TextInfoControl(R.drawable.box_top, paintText, paintSubText) { @Override public boolean isClickable() { @@ -209,6 +213,8 @@ public class MapInfoLayer extends OsmandMapLayer { leftControls.add(compassControl); leftControls.add(zoomControl); leftControls.add(distanceControl); + leftControls.add(speedControl); + leftControls.add(leftTimeControl); relayoutLeftControls(compassControl); showArrivalTime = view.getSettings().SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME.get(); @@ -232,7 +238,6 @@ public class MapInfoLayer extends OsmandMapLayer { for(MapInfoControl c : leftControls) { c.layout(w, c.getHeight()); } - } public boolean distChanged(int oldDist, int dist){ @@ -266,13 +271,13 @@ public class MapInfoLayer extends OsmandMapLayer { } else { distanceControl.setText(ds.substring(0, ls), ds.substring(ls + 1)); } - - relayoutLeftControls(distanceControl); } + relayoutLeftControls(distanceControl); } - } else { + } else if(cachedMeters != 0){ cachedMeters = 0; distanceControl.setText(null, null); + relayoutLeftControls(distanceControl); } } @@ -280,29 +285,18 @@ public class MapInfoLayer extends OsmandMapLayer { public void onDraw(Canvas canvas, RectF latlonBounds, RectF tilesRect, boolean nightMode) { // prepare data (left distance, speed) updateDistanceToGo(); + updateSpeedInfo(); + updateTimeLeftInfo(); if(view.getZoom() != cachedZoom){ zoomControl.setText(view.getZoom()+"", "zm"); relayoutLeftControls(zoomControl); } - // draw speed - if(map.getLastKnownLocation() != null && map.getLastKnownLocation().hasSpeed()){ - if(Math.abs(map.getLastKnownLocation().getSpeed() - cachedSpeed) > .3f){ - cachedSpeed = map.getLastKnownLocation().getSpeed(); - cachedSpeedString = OsmAndFormatter.getFormattedSpeed(cachedSpeed, map); - float right = paintBlack.measureText(cachedSpeedString) + 8 * scaleCoefficient + boundsForSpeed.left; - boundsForSpeed.right = right; - } - if(cachedSpeed > 0){ - canvas.drawRoundRect(boundsForSpeed, roundCorner, roundCorner, paintAlphaGray); - canvas.drawRoundRect(boundsForSpeed, roundCorner, roundCorner, paintBlack); - canvas.drawText(cachedSpeedString, boundsForSpeed.left + 8 * scaleCoefficient, boundsForSpeed.bottom - 9f * scaleCoefficient, paintBlack); - } - } // draw route information drawRouteInfo(canvas); + // draw left controls int h = 0; for(int i=0; i .3f){ + cachedSpeed = map.getLastKnownLocation().getSpeed(); + String ds = OsmAndFormatter.getFormattedSpeed(cachedSpeed, map); + int ls = ds.lastIndexOf(' '); + if(ls == -1) { + speedControl.setText(ds, null); + } else { + speedControl.setText(ds.substring(0, ls), ds.substring(ls + 1)); + } + relayoutLeftControls(speedControl); + } + } else if(cachedSpeed != 0) { + cachedSpeed = 0; + speedControl.setText(null, null); + relayoutLeftControls(speedControl); + } + } + } + + private void updateTimeLeftInfo() { + int time = 0; + if (routeLayer != null && routeLayer.getHelper().isRouterEnabled()) { + boolean followingMode = routeLayer.getHelper().isFollowingMode(); + time = routeLayer.getHelper().getLeftTime(); + if (time != 0) { + if (followingMode && showArrivalTime) { + long toFindTime = time * 1000 + System.currentTimeMillis(); + if (Math.abs(toFindTime - cachedLeftTime) > 30000) { + cachedLeftTime = toFindTime; + if (DateFormat.is24HourFormat(map)) { + leftTimeControl.setText(DateFormat.format("kk:mm", toFindTime).toString(), null); //$NON-NLS-1$ + } else { + leftTimeControl.setText(DateFormat.format("k:mm aa", toFindTime).toString(), null); //$NON-NLS-1$ + } + relayoutLeftControls(leftTimeControl); + } + } else { + if (Math.abs(time - cachedLeftTime) > 30) { + cachedLeftTime = time; + int hours = time / (60 * 60); + int minutes = (time / 60) % 60; + leftTimeControl.setText(String.format("%d:%02d", hours, minutes), null); //$NON-NLS-1$ + } + relayoutLeftControls(leftTimeControl); + } + } + } + if (time == 0 && cachedLeftTime != 0) { + cachedLeftTime = 0; + leftTimeControl.setText(null, null); + relayoutLeftControls(leftTimeControl); + } + } private void drawRouteInfo(Canvas canvas) { @@ -362,43 +414,6 @@ public class MapInfoLayer extends OsmandMapLayer { } } } - - boolean followingMode = routeLayer.getHelper().isFollowingMode(); - int time = routeLayer.getHelper().getLeftTime(); - if(time == 0){ - cachedLeftTime = 0; - cachedLeftTimeString = null; - } else { - if(followingMode && showArrivalTime){ - long toFindTime = time * 1000 + System.currentTimeMillis(); - if(Math.abs(toFindTime - cachedLeftTime) > 30000){ - cachedLeftTime = toFindTime; - if(DateFormat.is24HourFormat(map)){ - cachedLeftTimeString = DateFormat.format("kk:mm",toFindTime).toString(); //$NON-NLS-1$ - } else { - cachedLeftTimeString = DateFormat.format("k:mm aa",toFindTime).toString(); //$NON-NLS-1$ - } - boundsForLeftTime.left = - paintBlack.measureText(cachedLeftTimeString) - 10 * scaleCoefficient + boundsForLeftTime.right; - } - } else { - if(Math.abs(time - cachedLeftTime) > 30){ - cachedLeftTime = time; - int hours = time / (60 * 60); - int minutes = (time / 60) % 60; - cachedLeftTimeString = String.format("%d:%02d", hours, minutes); //$NON-NLS-1$ - boundsForLeftTime.left = - paintBlack.measureText(cachedLeftTimeString) - 10 * scaleCoefficient + boundsForLeftTime.right; - } - } - } - if(cachedLeftTimeString != null) { - int w = (int) (boundsForLeftTime.right - boundsForLeftTime.left); - boundsForLeftTime.right = view.getWidth(); - boundsForLeftTime.left = view.getWidth() - w; - canvas.drawRoundRect(boundsForLeftTime, roundCorner, roundCorner, paintAlphaGray); - canvas.drawRoundRect(boundsForLeftTime, roundCorner, roundCorner, paintBlack); - canvas.drawText(cachedLeftTimeString, boundsForLeftTime.left + 5 * scaleCoefficient, boundsForLeftTime.bottom - 9 * scaleCoefficient, paintBlack); - - } } } @@ -440,12 +455,6 @@ public class MapInfoLayer extends OsmandMapLayer { view.refreshMap(); return true; } - if (boundsForLeftTime.contains(point.x, point.y) && routeLayer.getHelper().isFollowingMode()) { - showArrivalTime = !showArrivalTime; - view.getSettings().SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME.set(showArrivalTime); - view.refreshMap(); - return true; - } } MapInfoControl control = detectLeftControl((int)point.x, (int)point.y); if (control != null && control.isClickable()) { @@ -600,9 +609,9 @@ public class MapInfoLayer extends OsmandMapLayer { public int getMeasuredWidth() { int w = 0; if(text != null) { - w += textPaint.measureText(text) + 3 * scaleCoefficient; + w += textPaint.measureText(text) + 2 * scaleCoefficient; if(subtext != null) { - w += textPaint.measureText(subtext) + 4 * scaleCoefficient; + w += subtextPaint.measureText(subtext) + 2 * scaleCoefficient; } } return w; @@ -612,10 +621,10 @@ public class MapInfoLayer extends OsmandMapLayer { void onDraw(Canvas cv) { super.onDraw(cv); if(isVisible()) { - cv.drawText(text, 3 * scaleCoefficient, getHeight() - scaleCoefficient, + cv.drawText(text, 2 * scaleCoefficient, getHeight() - scaleCoefficient, textPaint); if(subtext != null) { - cv.drawText(subtext, 7 * scaleCoefficient + textPaint.measureText(text), + cv.drawText(subtext, 4 * scaleCoefficient + textPaint.measureText(text), getHeight() - scaleCoefficient, subtextPaint); } }