Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Yunitsky <yunik@mapswithme.com>2015-09-07 16:18:42 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:03:58 +0300
commit26ab3d260deb16b1da9e94395e2134cf62e7746f (patch)
tree1863012f8611ffc72b13376cbd645081d8f90da3 /android
parenta4cbcbc9d98e7cba4707721e0d685da05b14b586 (diff)
[android] Display arrival time.
Diffstat (limited to 'android')
-rw-r--r--android/res/layout/layout_turn_instructions.xml7
-rw-r--r--android/src/com/mapswithme/maps/widget/RoutingLayout.java35
2 files changed, 25 insertions, 17 deletions
diff --git a/android/res/layout/layout_turn_instructions.xml b/android/res/layout/layout_turn_instructions.xml
index 3c6321bd40..1e338ee0da 100644
--- a/android/res/layout/layout_turn_instructions.xml
+++ b/android/res/layout/layout_turn_instructions.xml
@@ -46,7 +46,7 @@
tools:text="1,5 min"/>
<TextView
- android:id="@+id/tv__left_time"
+ android:id="@+id/tv__arrival_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/margin_base_plus"
@@ -89,7 +89,6 @@
android:layout_below="@id/tv__turn_distance"
android:textAppearance="@style/MwmTextAppearance.Body2"
android:textSize="@dimen/text_size_title"
- android:visibility="gone"
tools:text="Oxford str."
tools:visibility="visible"/>
</RelativeLayout>
@@ -99,11 +98,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/time_distance"
- android:visibility="gone"
app:headRadius="0dp"
app:progressColor="#757575"
app:progressThickness="4dp"
app:secondaryProgressColor="@color/base_black_divider"
- app:secondaryProgressThickness="2dp"
- tools:visibility="visible"/>
+ app:secondaryProgressThickness="2dp"/>
</RelativeLayout> \ No newline at end of file
diff --git a/android/src/com/mapswithme/maps/widget/RoutingLayout.java b/android/src/com/mapswithme/maps/widget/RoutingLayout.java
index 4d52a92795..fed5f57524 100644
--- a/android/src/com/mapswithme/maps/widget/RoutingLayout.java
+++ b/android/src/com/mapswithme/maps/widget/RoutingLayout.java
@@ -31,6 +31,7 @@ import com.mapswithme.maps.routing.RoutingResultCodesProcessor;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.statistics.AlohaHelper;
+import java.util.Calendar;
import java.util.concurrent.TimeUnit;
/**
@@ -55,7 +56,8 @@ public class RoutingLayout extends FrameLayout implements View.OnClickListener
private View mBtnStart;
private FlatProgressView mFpRouteProgress;
private RadioGroup mRgRouterType;
- private TextView mTvNextStreen;
+ private TextView mTvNextStreet;
+ private TextView mTvArrivalTime;
private double mNorth;
private RoutingInfo mCachedRoutingInfo;
@@ -127,25 +129,26 @@ public class RoutingLayout extends FrameLayout implements View.OnClickListener
mLayoutSetupRouting = findViewById(R.id.layout__routing_setup);
mWvProgress = (WheelProgressView) mLayoutSetupRouting.findViewById(R.id.wp__routing_progress);
mWvProgress.setOnClickListener(this);
- mTvPlanning = (android.widget.TextView) mLayoutSetupRouting.findViewById(R.id.tv__planning_route);
+ mTvPlanning = (TextView) mLayoutSetupRouting.findViewById(R.id.tv__planning_route);
mRgRouterType = (RadioGroup) mLayoutSetupRouting.findViewById(R.id.rg__router);
mRgRouterType.findViewById(R.id.rb__vehicle).setOnClickListener(this);
mRgRouterType.findViewById(R.id.rb__pedestrian).setOnClickListener(this);
mIvCancelRouteBuild = mLayoutSetupRouting.findViewById(R.id.iv__routing_close);
mIvCancelRouteBuild.setOnClickListener(this);
- mTvPrepareDistance = (android.widget.TextView) mLayoutSetupRouting.findViewById(R.id.tv__routing_distance);
- mTvPrepareTime = (android.widget.TextView) mLayoutSetupRouting.findViewById(R.id.tv__routing_time);
+ mTvPrepareDistance = (TextView) mLayoutSetupRouting.findViewById(R.id.tv__routing_distance);
+ mTvPrepareTime = (TextView) mLayoutSetupRouting.findViewById(R.id.tv__routing_time);
mBtnStart = mLayoutSetupRouting.findViewById(R.id.btn__start_routing);
mBtnStart.setOnClickListener(this);
mLayoutTurnInstructions = findViewById(R.id.layout__turn_instructions);
- mTvTotalDistance = (android.widget.TextView) mLayoutTurnInstructions.findViewById(R.id.tv__total_distance);
- mTvTotalTime = (android.widget.TextView) mLayoutTurnInstructions.findViewById(R.id.tv__total_time);
+ mTvTotalDistance = (TextView) mLayoutTurnInstructions.findViewById(R.id.tv__total_distance);
+ mTvTotalTime = (TextView) mLayoutTurnInstructions.findViewById(R.id.tv__total_time);
+ mTvArrivalTime = (TextView) mLayoutTurnInstructions.findViewById(R.id.tv__arrival_time);
mIvTurn = (ImageView) mLayoutTurnInstructions.findViewById(R.id.iv__turn);
- mTvTurnDistance = (android.widget.TextView) mLayoutTurnInstructions.findViewById(R.id.tv__turn_distance);
+ mTvTurnDistance = (TextView) mLayoutTurnInstructions.findViewById(R.id.tv__turn_distance);
mLayoutTurnInstructions.findViewById(R.id.btn__close).setOnClickListener(this);
mFpRouteProgress = (FlatProgressView) mLayoutTurnInstructions.findViewById(R.id.fp__route_progress);
- mTvNextStreen = (TextView) mLayoutTurnInstructions.findViewById(R.id.tv__next_street);
+ mTvNextStreet = (TextView) mLayoutTurnInstructions.findViewById(R.id.tv__next_street);
}
@Override
@@ -290,9 +293,10 @@ public class RoutingLayout extends FrameLayout implements View.OnClickListener
else
refreshPedestrianAzimutAndDistance(mCachedRoutingInfo);
- mTvTotalTime.setText(formatTime(mCachedRoutingInfo.totalTimeInSeconds));
+ mTvTotalTime.setText(formatRoutingTime(mCachedRoutingInfo.totalTimeInSeconds));
mTvTotalDistance.setText(mCachedRoutingInfo.distToTarget + " " + mCachedRoutingInfo.targetUnits);
- UiUtils.setTextAndHideIfEmpty(mTvNextStreen, mCachedRoutingInfo.nextStreet);
+ mTvArrivalTime.setText(formatArrivalTime(mCachedRoutingInfo.totalTimeInSeconds));
+ UiUtils.setTextAndHideIfEmpty(mTvNextStreet, mCachedRoutingInfo.nextStreet);
mFpRouteProgress.setProgress((int) mCachedRoutingInfo.completionPercent);
}
@@ -317,7 +321,7 @@ public class RoutingLayout extends FrameLayout implements View.OnClickListener
return;
mTvPrepareDistance.setText(mCachedRoutingInfo.distToTarget + " " + mCachedRoutingInfo.targetUnits.toUpperCase());
- mTvPrepareTime.setText(formatTime(mCachedRoutingInfo.totalTimeInSeconds));
+ mTvPrepareTime.setText(formatRoutingTime(mCachedRoutingInfo.totalTimeInSeconds));
}
private static SpannableStringBuilder getSpannedDistance(int distTextSize, int unitsTextSize, String distToTarget, String units)
@@ -329,7 +333,7 @@ public class RoutingLayout extends FrameLayout implements View.OnClickListener
return builder;
}
- private static String formatTime(int seconds)
+ private static String formatRoutingTime(int seconds)
{
long minutes = TimeUnit.SECONDS.toMinutes(seconds);
long hours = TimeUnit.MINUTES.toHours(minutes);
@@ -340,6 +344,13 @@ public class RoutingLayout extends FrameLayout implements View.OnClickListener
return String.format("%d:%02d", hours, minutes - TimeUnit.HOURS.toMinutes(hours));
}
+ private static String formatArrivalTime(int seconds)
+ {
+ Calendar current = Calendar.getInstance();
+ current.add(Calendar.SECOND, seconds);
+ return String.format("%d:%02d", current.get(Calendar.HOUR_OF_DAY), current.get(Calendar.MINUTE));
+ }
+
private void buildRoute()
{
if (!MwmApplication.get().nativeGetBoolean(IS_ROUTING_DISCLAIMER_APPROVED, false))