diff --git a/android/res/layout-land/layout_nav_bottom_numbers.xml b/android/res/layout-land/layout_nav_bottom_numbers.xml
index 5317389f67..55dab1452d 100644
--- a/android/res/layout-land/layout_nav_bottom_numbers.xml
+++ b/android/res/layout-land/layout_nav_bottom_numbers.xml
@@ -6,8 +6,11 @@
android:layout_height="@dimen/nav_menu_height"
android:orientation="horizontal"
android:paddingLeft="@dimen/nav_numbers_margin"
+ android:paddingStart="@dimen/nav_numbers_margin"
android:layout_marginRight="@dimen/nav_toggle"
- tools:background="#3000FF00">
+ android:layout_marginEnd="@dimen/nav_toggle"
+ tools:background="#3000FF00"
+ tools:ignore="RtlSymmetry">
+
+
+ android:clickable="true"
+ android:src="@drawable/ic_menu_close"/>
+
+
+
+
+
\ No newline at end of file
diff --git a/android/res/layout/layout_nav_bottom_numbers.xml b/android/res/layout/layout_nav_bottom_numbers.xml
index 22e243d2aa..83673c4eaf 100644
--- a/android/res/layout/layout_nav_bottom_numbers.xml
+++ b/android/res/layout/layout_nav_bottom_numbers.xml
@@ -6,8 +6,11 @@
android:layout_height="@dimen/nav_menu_height"
android:orientation="horizontal"
android:paddingLeft="@dimen/nav_numbers_margin"
+ android:paddingStart="@dimen/nav_numbers_margin"
android:layout_marginRight="@dimen/nav_toggle"
- tools:background="#3000FF00">
+ android:layout_marginEnd="@dimen/nav_toggle"
+ tools:background="#3000FF00"
+ tools:ignore="RtlSymmetry">
@@ -101,7 +105,8 @@
android:id="@+id/dot_estimate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginRight="8dp"
+ android:layout_marginRight="@dimen/margin_half"
+ android:layout_marginEnd="@dimen/margin_half"
tools:src="@drawable/news_marker_active"/>
+
diff --git a/android/res/values/themes-base.xml b/android/res/values/themes-base.xml
index 6db324b378..cad7bd0925 100644
--- a/android/res/values/themes-base.xml
+++ b/android/res/values/themes-base.xml
@@ -65,6 +65,7 @@
- @style/MwmTheme.NavButtons
- @style/MwmTheme.Downloader
+ - @style/MwmTheme.Navigation
- @drawable/ic_fab_add
@@ -134,6 +135,7 @@
- @style/MwmTheme.NavButtons.Night
- @style/MwmTheme.Downloader.Night
+ - @style/MwmTheme.Navigation.Night
- @drawable/ic_fab_add_night
diff --git a/android/res/values/themes.xml b/android/res/values/themes.xml
index 01c5b52e77..09dc5aab27 100644
--- a/android/res/values/themes.xml
+++ b/android/res/values/themes.xml
@@ -139,6 +139,7 @@
- @drawable/zoom_in
- @drawable/zoom_out
- @drawable/zoom_in
+ - @android:color/white
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java
index 8fcf232493..866a3094ee 100644
--- a/android/src/com/mapswithme/maps/MwmActivity.java
+++ b/android/src/com/mapswithme/maps/MwmActivity.java
@@ -22,6 +22,9 @@ import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.ImageButton;
+import java.io.Serializable;
+import java.util.Stack;
+
import com.mapswithme.maps.Framework.MapObjectListener;
import com.mapswithme.maps.activity.CustomNavigateUpListener;
import com.mapswithme.maps.ads.LikesManager;
@@ -83,9 +86,6 @@ import com.mapswithme.util.statistics.Statistics;
import ru.mail.android.mytarget.nativeads.NativeAppwallAd;
import ru.mail.android.mytarget.nativeads.banners.NativeAppwallBanner;
-import java.io.Serializable;
-import java.util.Stack;
-
public class MwmActivity extends BaseMwmFragmentActivity
implements MapObjectListener,
View.OnTouchListener,
@@ -745,6 +745,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
}
});
mOnmapDownloader.onResume();
+ mNavigationController.getNavMenu().onResume(null);
}
@Override
@@ -994,6 +995,11 @@ public class MwmActivity extends BaseMwmFragmentActivity
private void setFullscreen(boolean isFullscreen)
{
+ if (RoutingController.get().isNavigating()
+ || RoutingController.get().isBuilding()
+ || RoutingController.get().isPlanning())
+ return;
+
mIsFullscreen = isFullscreen;
final BaseMenu menu = getCurrentMenu();
@@ -1061,7 +1067,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
Framework.nativeDeactivatePopup();
mPlacePage.saveBookmarkTitle();
mPlacePage.setMapObject(null, false);
- mMainMenu.show(true);
}
}
diff --git a/android/src/com/mapswithme/maps/routing/NavigationController.java b/android/src/com/mapswithme/maps/routing/NavigationController.java
index 3f65110797..766b92bb7a 100644
--- a/android/src/com/mapswithme/maps/routing/NavigationController.java
+++ b/android/src/com/mapswithme/maps/routing/NavigationController.java
@@ -1,25 +1,37 @@
package com.mapswithme.maps.routing;
import android.app.Activity;
+import android.content.Intent;
import android.location.Location;
import android.os.Build;
import android.text.TextUtils;
+import android.util.Pair;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
+import java.util.concurrent.TimeUnit;
+
import com.mapswithme.maps.Framework;
+import com.mapswithme.maps.MwmActivity;
import com.mapswithme.maps.R;
import com.mapswithme.maps.bookmarks.data.DistanceAndAzimut;
import com.mapswithme.maps.location.LocationHelper;
+import com.mapswithme.maps.settings.SettingsActivity;
+import com.mapswithme.maps.sound.TtsPlayer;
+import com.mapswithme.maps.widget.FlatProgressView;
import com.mapswithme.maps.widget.menu.NavMenu;
+import com.mapswithme.util.StringUtils;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.Utils;
+import com.mapswithme.util.statistics.AlohaHelper;
+import com.mapswithme.util.statistics.Statistics;
public class NavigationController
{
private final View mFrame;
private final View mTopFrame;
+ private final View mBottomFrame;
private final NavMenu mNavMenu;
private final ImageView mNextTurnImage;
@@ -32,12 +44,15 @@ public class NavigationController
private final View mStreetFrame;
private final TextView mNextStreet;
-// private final TextView mDistanceTotal;
-// private final TextView mTimeTotal;
-// private final ImageView mTurnDirection;
-//
-// private final FlatProgressView mRouteProgress;
-// private final TextView mTimeArrival;
+ private final TextView mSpeedValue;
+ private final TextView mSpeedUnits;
+ private final TextView mTimeHourValue;
+ private final TextView mTimeHourUnits;
+ private final TextView mTimeMinuteValue;
+ private final TextView mTimeMinuteUnits;
+ private final TextView mDistanceValue;
+ private final TextView mDistanceUnits;
+ private final FlatProgressView mRouteProgress;
private double mNorth;
@@ -45,7 +60,9 @@ public class NavigationController
{
mFrame = activity.findViewById(R.id.navigation_frame);
mTopFrame = mFrame.findViewById(R.id.nav_top_frame);
+ mBottomFrame = mFrame.findViewById(R.id.nav_bottom_frame);
mNavMenu = createNavMenu();
+ mNavMenu.refreshTts();
// Top frame
View turnFrame = mTopFrame.findViewById(R.id.nav_next_turn_frame);
@@ -61,32 +78,50 @@ public class NavigationController
View shadow = mTopFrame.findViewById(R.id.shadow_top);
UiUtils.showIf(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP, shadow);
- // TODO (trashkalmar): Bottom frame
-// mDistanceTotal = (TextView) mFrame.findViewById(R.id.tv__total_distance);
-// mTimeTotal = (TextView) mFrame.findViewById(R.id.tv__total_time);
-// mTimeArrival = (TextView) mFrame.findViewById(R.id.tv__arrival_time);
-// mTurnDirection = (ImageView) mFrame.findViewById(R.id.iv__turn);
-//
-// mRouteProgress = (FlatProgressView) mFrame.findViewById(R.id.fp__route_progress);
-//
-// mFrame.findViewById(R.id.btn__close).setOnClickListener(new View.OnClickListener()
-// {
-// @Override
-// public void onClick(View v)
-// {
-// AlohaHelper.logClick(AlohaHelper.ROUTING_CLOSE);
-// Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_CLOSE);
-// RoutingController.get().cancel();
-// }
-// });
+ // Bottom frame
+ mSpeedValue = (TextView) mBottomFrame.findViewById(R.id.speed_value);
+ mSpeedUnits = (TextView) mBottomFrame.findViewById(R.id.speed_dimen);
+ mTimeHourValue = (TextView) mBottomFrame.findViewById(R.id.time_hour_value);
+ mTimeHourUnits = (TextView) mBottomFrame.findViewById(R.id.time_hour_dimen);
+ mTimeMinuteValue = (TextView) mBottomFrame.findViewById(R.id.time_minute_value);
+ mTimeMinuteUnits = (TextView) mBottomFrame.findViewById(R.id.time_minute_dimen);
+ mDistanceValue = (TextView) mBottomFrame.findViewById(R.id.distance_value);
+ mDistanceUnits = (TextView) mBottomFrame.findViewById(R.id.distance_dimen);
+ mRouteProgress = (FlatProgressView) mBottomFrame.findViewById(R.id.navigation_progress);
}
- private NavMenu createNavMenu() {
- return new NavMenu(mFrame.findViewById(R.id.nav_bottom_frame), new NavMenu.ItemClickListener() {
+ private NavMenu createNavMenu()
+ {
+ return new NavMenu(mBottomFrame, new NavMenu.ItemClickListener()
+ {
@Override
public void onItemClick(NavMenu.Item item)
{
-
+ switch (item)
+ {
+ case STOP:
+ RoutingController.get().cancel();
+ Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_CLOSE);
+ AlohaHelper.logClick(AlohaHelper.ROUTING_CLOSE);
+ break;
+ case SETTINGS:
+ final MwmActivity parent = ((MwmActivity) mFrame.getContext());
+ parent.closeMenu(Statistics.EventName.ROUTING_SETTINGS, AlohaHelper.MENU_SETTINGS, new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ parent.startActivity(new Intent(parent, SettingsActivity.class));
+ }
+ });
+ break;
+ case TTS_VOLUME:
+ TtsPlayer.setEnabled(!TtsPlayer.isEnabled());
+ mNavMenu.refreshTts();
+ Statistics.INSTANCE.trackEvent(Statistics.EventName.ROUTING_CLOSE);
+ AlohaHelper.logClick(AlohaHelper.ROUTING_CLOSE);
+ break;
+ }
}
});
}
@@ -150,22 +185,40 @@ public class NavigationController
if (!TextUtils.isEmpty(info.nextStreet))
mNextStreet.setText(info.nextStreet);
- /*
- mTimeTotal.setText(RoutingController.formatRoutingTime(mFrame.getContext(),
- info.totalTimeInSeconds,
- R.dimen.text_size_routing_dimension));
- mDistanceTotal.setText(Utils.formatUnitsText(mFrame.getContext(),
- R.dimen.text_size_routing_number,
- R.dimen.text_size_routing_dimension,
- info.distToTarget,
- info.targetUnits));
- mTimeArrival.setText(RoutingController.formatArrivalTime(info.totalTimeInSeconds));
- mRouteProgress.setProgress((int) info.completionPercent);*/
+ final Location last = LocationHelper.INSTANCE.getLastKnownLocation();
+ if (last != null)
+ {
+ Pair speedAndUnits = StringUtils.nativeFormatSpeedAndUnits(last.getSpeed());
+ mSpeedValue.setText(speedAndUnits.first);
+ mSpeedUnits.setText(speedAndUnits.second);
+ }
+ updateTime(info.totalTimeInSeconds);
+ mDistanceValue.setText(info.distToTarget);
+ mDistanceUnits.setText(info.targetUnits);
+ mRouteProgress.setProgress((int) info.completionPercent);
+ }
+
+ private void updateTime(int seconds)
+ {
+ final long hours = TimeUnit.SECONDS.toHours(seconds);
+ final long minutes = TimeUnit.MINUTES.toMinutes(seconds) % 60;
+ mTimeMinuteValue.setText(String.valueOf(minutes));
+ // TODO set localized text
+ mTimeMinuteUnits.setText("m");
+ if (hours == 0)
+ {
+ UiUtils.hide(mTimeHourUnits, mTimeHourValue);
+ return;
+ }
+ mTimeHourValue.setText(String.valueOf(hours));
+ // TODO set localized text
+ mTimeHourUnits.setText("h");
}
public void show(boolean show)
{
UiUtils.showIf(show, mFrame);
+ mNavMenu.show(show);
}
public NavMenu getNavMenu()
diff --git a/android/src/com/mapswithme/maps/routing/RoutingController.java b/android/src/com/mapswithme/maps/routing/RoutingController.java
index 8a085f3303..2d2a94d60b 100644
--- a/android/src/com/mapswithme/maps/routing/RoutingController.java
+++ b/android/src/com/mapswithme/maps/routing/RoutingController.java
@@ -14,6 +14,9 @@ import android.view.View;
import android.widget.Button;
import android.widget.TextView;
+import java.util.Calendar;
+import java.util.concurrent.TimeUnit;
+
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.R;
@@ -31,9 +34,6 @@ import com.mapswithme.util.log.Logger;
import com.mapswithme.util.statistics.AlohaHelper;
import com.mapswithme.util.statistics.Statistics;
-import java.util.Calendar;
-import java.util.concurrent.TimeUnit;
-
@android.support.annotation.UiThread
public class RoutingController
{
diff --git a/android/src/com/mapswithme/maps/sound/TtsPlayer.java b/android/src/com/mapswithme/maps/sound/TtsPlayer.java
index 204b5e8034..1dda174c80 100644
--- a/android/src/com/mapswithme/maps/sound/TtsPlayer.java
+++ b/android/src/com/mapswithme/maps/sound/TtsPlayer.java
@@ -158,9 +158,9 @@ public enum TtsPlayer
});
}
- public boolean isReady()
+ private static boolean isReady()
{
- return (mTts != null && !mUnavailable && !mInitializing);
+ return (INSTANCE.mTts != null && !INSTANCE.mUnavailable && !INSTANCE.mInitializing);
}
private void speak(String textToSpeak)
@@ -202,7 +202,7 @@ public enum TtsPlayer
}
}
- public boolean isEnabled()
+ public static boolean isEnabled()
{
return (isReady() && nativeAreTurnNotificationsEnabled());
}
diff --git a/android/src/com/mapswithme/maps/widget/menu/BaseMenu.java b/android/src/com/mapswithme/maps/widget/menu/BaseMenu.java
index 67784d554f..864cf25ca0 100644
--- a/android/src/com/mapswithme/maps/widget/menu/BaseMenu.java
+++ b/android/src/com/mapswithme/maps/widget/menu/BaseMenu.java
@@ -3,6 +3,7 @@ package com.mapswithme.maps.widget.menu;
import android.animation.Animator;
import android.support.annotation.DimenRes;
import android.support.annotation.IdRes;
+import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
@@ -76,12 +77,13 @@ public abstract class BaseMenu
: R.attr.menuBackground));
}
- void afterLayoutCorrected(Runnable procAfterCorrection)
+ void afterLayoutCorrected(@Nullable Runnable procAfterCorrection)
{
- procAfterCorrection.run();
+ if (procAfterCorrection != null)
+ procAfterCorrection.run();
}
- private void correctLayout(final Runnable procAfterCorrection)
+ private void correctLayout(@Nullable final Runnable procAfterCorrection)
{
if (mLayoutCorrected)
return;
@@ -100,13 +102,13 @@ public abstract class BaseMenu
});
}
- public void onResume(Runnable procAfterCorrection)
+ public void onResume(@Nullable Runnable procAfterCorrection)
{
correctLayout(procAfterCorrection);
updateMarker();
}
- BaseMenu(View frame, ItemClickListener extends Item> itemClickListener)
+ BaseMenu(@NonNull View frame, @NonNull ItemClickListener extends Item> itemClickListener)
{
mFrame = frame;
mItemClickListener = itemClickListener;
diff --git a/android/src/com/mapswithme/maps/widget/menu/NavMenu.java b/android/src/com/mapswithme/maps/widget/menu/NavMenu.java
index 5b125a8a61..7bfae4399f 100644
--- a/android/src/com/mapswithme/maps/widget/menu/NavMenu.java
+++ b/android/src/com/mapswithme/maps/widget/menu/NavMenu.java
@@ -1,23 +1,26 @@
package com.mapswithme.maps.widget.menu;
import android.animation.ValueAnimator;
+import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import com.mapswithme.maps.R;
+import com.mapswithme.maps.sound.TtsPlayer;
import com.mapswithme.maps.widget.RotateDrawable;
public class NavMenu extends BaseMenu
{
private final ImageView mToggle;
private final RotateDrawable mToggleImage = new RotateDrawable(R.drawable.ic_menu_close);
+ private final ImageView mTts;
public enum Item implements BaseMenu.Item
{
TOGGLE(R.id.toggle),
- TTS_VOLUME(R.id.toggle),
- STOP(R.id.toggle),
- //OVERVIEW(R.id.toggle), TODO
+ TTS_VOLUME(R.id.tts_volume),
+ STOP(R.id.stop),
+ //OVERVIEW(R.id.), TODO
SETTINGS(R.id.settings);
private final int mViewId;
@@ -39,7 +42,7 @@ public class NavMenu extends BaseMenu
super(frame, listener);
mToggle = (ImageView) mLineFrame.findViewById(R.id.toggle);
- mToggle.setImageDrawable(mToggleImage);
+// mToggle.setImageDrawable(mToggleImage);
mToggle.setOnClickListener(new View.OnClickListener()
{
@Override
@@ -49,7 +52,24 @@ public class NavMenu extends BaseMenu
}
});
- setToggleState(false, false);
+// setToggleState(false, false);
+
+ mapItem(Item.STOP, mFrame);
+ mapItem(Item.SETTINGS, mFrame);
+ mTts = (ImageView) mapItem(Item.TTS_VOLUME, mFrame);
+ }
+
+ @Override
+ public void onResume(@Nullable Runnable procAfterCorrection)
+ {
+ super.onResume(procAfterCorrection);
+ refreshTts();
+ }
+
+ public void refreshTts()
+ {
+ mTts.setImageResource(TtsPlayer.isEnabled() ? R.drawable.ic_voice_on
+ : R.drawable.ic_voice_off);
}
@Override
@@ -57,7 +77,7 @@ public class NavMenu extends BaseMenu
{
if (!animate)
{
- mToggleImage.setAngle(open ? -90.0f : 90.0f);
+// mToggleImage.setAngle(open ? -90.0f : 90.0f);
return;
}
diff --git a/android/src/com/mapswithme/util/statistics/AlohaHelper.java b/android/src/com/mapswithme/util/statistics/AlohaHelper.java
index 7802839195..cc4a3bf9e2 100644
--- a/android/src/com/mapswithme/util/statistics/AlohaHelper.java
+++ b/android/src/com/mapswithme/util/statistics/AlohaHelper.java
@@ -78,6 +78,7 @@ public class AlohaHelper
public static final String ROUTING_SWAP_POINTS = "routeSwapPoints";
public static final String ROUTING_TOGGLE = "routeToggle";
public static final String ROUTING_SEARCH_POINT = "routSearchPoint";
+ public static final String ROUTING_SETTINGS = "routingSettings";
// search
public static final String SEARCH_CANCEL = "searchCancel";
// installation
diff --git a/android/src/com/mapswithme/util/statistics/Statistics.java b/android/src/com/mapswithme/util/statistics/Statistics.java
index 180f739767..e96c26ddb9 100644
--- a/android/src/com/mapswithme/util/statistics/Statistics.java
+++ b/android/src/com/mapswithme/util/statistics/Statistics.java
@@ -116,6 +116,8 @@ public enum Statistics
public static final String ROUTING_SWAP_POINTS = "Routing. Swap points";
public static final String ROUTING_TOGGLE = "Routing. Toggle";
public static final String ROUTING_SEARCH_POINT = "Routing. Search point";
+ public static final String ROUTING_SETTINGS = "Routing. Settings";
+ public static final String ROUTING_TTS_SWITCH = "Routing. Switch tts";
// editor
public static final String EDITOR_START_CREATE = "Editor_Add_start";
public static final String EDITOR_ADD_CLICK = "Editor_Add_click";