From 9a63d07c21ee6be8b827b1d626ff0994be589c76 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 14 Jul 2017 14:27:02 +0300 Subject: [PATCH 1/8] Add delay for 5 seconds --- .../osmand/SecondSplashScreenFragment.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java b/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java index e71254190a..d60362454b 100644 --- a/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java +++ b/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java @@ -20,7 +20,7 @@ import net.osmand.plus.helpers.AndroidUiHelper; public class SecondSplashScreenFragment extends Fragment { public static final String TAG = "SecondSplashScreenFragment"; public static boolean SHOW = true; - private static final int SECOND_SPLASH_TIME_OUT = 2000; + private static final int SECOND_SPLASH_TIME_OUT = 5000; private boolean hasNavBar() { int id = getResources().getIdentifier("config_showNavigationBar", "bool", "android"); @@ -124,28 +124,25 @@ public class SecondSplashScreenFragment extends Fragment { } @Override - public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); + public void onResume() { + super.onResume(); + ((MapActivity)getActivity()).disableDrawer(); new Handler().postDelayed(new Runnable() { @Override public void run() { - getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); - if (((MapActivity)getActivity()).getMyApplication().getSettings().MAP_SCREEN_ORIENTATION.get() != getActivity().getRequestedOrientation()) { - getActivity().setRequestedOrientation(((MapActivity)getActivity()).getMyApplication().getSettings().MAP_SCREEN_ORIENTATION.get()); - // can't return from this method we are not sure if activity will be recreated or not + if ((MapActivity)getActivity() != null) { + ((MapActivity)getActivity()).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); + if (((MapActivity)getActivity()).getMyApplication().getSettings().MAP_SCREEN_ORIENTATION.get() != getActivity().getRequestedOrientation()) { + getActivity().setRequestedOrientation(((MapActivity)getActivity()).getMyApplication().getSettings().MAP_SCREEN_ORIENTATION.get()); + // can't return from this method we are not sure if activity will be recreated or not + } + ((MapActivity)getActivity()).getSupportFragmentManager().beginTransaction().remove(SecondSplashScreenFragment.this).commitAllowingStateLoss(); } - getActivity().getSupportFragmentManager().beginTransaction().remove(SecondSplashScreenFragment.this).commitAllowingStateLoss(); } }, SECOND_SPLASH_TIME_OUT); } - @Override - public void onResume() { - super.onResume(); - ((MapActivity)getActivity()).disableDrawer(); - } - @Override public void onPause() { super.onPause(); From 465e42448802f601c966cf8d69f18816f664b621 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 14 Jul 2017 15:31:29 +0300 Subject: [PATCH 2/8] First splash on center --- OsmAnd/res/drawable/first_splash_screen_free.xml | 4 ++-- .../res/drawable/first_splash_screen_free_dev.xml | 4 ++-- OsmAnd/res/drawable/first_splash_screen_plus.xml | 4 ++-- .../net/osmand/SecondSplashScreenFragment.java | 15 +++++++++------ 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/OsmAnd/res/drawable/first_splash_screen_free.xml b/OsmAnd/res/drawable/first_splash_screen_free.xml index b3d6f99388..aec9198e4d 100644 --- a/OsmAnd/res/drawable/first_splash_screen_free.xml +++ b/OsmAnd/res/drawable/first_splash_screen_free.xml @@ -2,9 +2,9 @@ - + \ No newline at end of file diff --git a/OsmAnd/res/drawable/first_splash_screen_free_dev.xml b/OsmAnd/res/drawable/first_splash_screen_free_dev.xml index b3d6f99388..aec9198e4d 100644 --- a/OsmAnd/res/drawable/first_splash_screen_free_dev.xml +++ b/OsmAnd/res/drawable/first_splash_screen_free_dev.xml @@ -2,9 +2,9 @@ - + \ No newline at end of file diff --git a/OsmAnd/res/drawable/first_splash_screen_plus.xml b/OsmAnd/res/drawable/first_splash_screen_plus.xml index 1dc65ed611..278da90a36 100644 --- a/OsmAnd/res/drawable/first_splash_screen_plus.xml +++ b/OsmAnd/res/drawable/first_splash_screen_plus.xml @@ -2,9 +2,9 @@ - + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java b/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java index d60362454b..7f598417a7 100644 --- a/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java +++ b/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java @@ -21,6 +21,7 @@ public class SecondSplashScreenFragment extends Fragment { public static final String TAG = "SecondSplashScreenFragment"; public static boolean SHOW = true; private static final int SECOND_SPLASH_TIME_OUT = 5000; + private boolean started = false; private boolean hasNavBar() { int id = getResources().getIdentifier("config_showNavigationBar", "bool", "android"); @@ -69,6 +70,7 @@ public class SecondSplashScreenFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { RelativeLayout view = new RelativeLayout(getActivity()); + view.setOnClickListener(null); view.setBackgroundColor(getResources().getColor(R.color.map_background_color_light)); ImageView logo = new ImageView(getContext()); @@ -127,11 +129,12 @@ public class SecondSplashScreenFragment extends Fragment { public void onResume() { super.onResume(); ((MapActivity)getActivity()).disableDrawer(); - new Handler().postDelayed(new Runnable() { + if (!started) { + started = true; + new Handler().postDelayed(new Runnable() { - @Override - public void run() { - if ((MapActivity)getActivity() != null) { + @Override + public void run() { ((MapActivity)getActivity()).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); if (((MapActivity)getActivity()).getMyApplication().getSettings().MAP_SCREEN_ORIENTATION.get() != getActivity().getRequestedOrientation()) { getActivity().setRequestedOrientation(((MapActivity)getActivity()).getMyApplication().getSettings().MAP_SCREEN_ORIENTATION.get()); @@ -139,8 +142,8 @@ public class SecondSplashScreenFragment extends Fragment { } ((MapActivity)getActivity()).getSupportFragmentManager().beginTransaction().remove(SecondSplashScreenFragment.this).commitAllowingStateLoss(); } - } - }, SECOND_SPLASH_TIME_OUT); + }, SECOND_SPLASH_TIME_OUT); + } } @Override From b00ecf93063a9c8757a155bd1c851914375b52b4 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Mon, 17 Jul 2017 13:12:15 +0300 Subject: [PATCH 3/8] Fix adding variables --- .../osmand/SecondSplashScreenFragment.java | 49 ++++++++++++------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java b/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java index 7f598417a7..76b01d9d78 100644 --- a/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java +++ b/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java @@ -6,12 +6,14 @@ import android.os.Bundle; import android.os.Handler; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.RelativeLayout; +import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.Version; import net.osmand.plus.activities.MapActivity; @@ -22,6 +24,12 @@ public class SecondSplashScreenFragment extends Fragment { public static boolean SHOW = true; private static final int SECOND_SPLASH_TIME_OUT = 5000; private boolean started = false; + private FragmentActivity activity; + private OsmandApplication app; + + public OsmandApplication getMyApplication() { + return ((OsmandApplication) activity.getApplication()); + } private boolean hasNavBar() { int id = getResources().getIdentifier("config_showNavigationBar", "bool", "android"); @@ -69,25 +77,26 @@ public class SecondSplashScreenFragment extends Fragment { @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - RelativeLayout view = new RelativeLayout(getActivity()); + activity = getActivity(); + app = getMyApplication(); + + RelativeLayout view = new RelativeLayout(activity); view.setOnClickListener(null); view.setBackgroundColor(getResources().getColor(R.color.map_background_color_light)); ImageView logo = new ImageView(getContext()); - if (Version.isFreeVersion(((MapActivity) getActivity()).getMyApplication())) { + if (Version.isFreeVersion(app)) { logo.setImageDrawable(getResources().getDrawable(R.drawable.ic_logo_splash_osmand)); - } else if ((Version.isPaidVersion(((MapActivity) getActivity()).getMyApplication())) || - (Version.isDeveloperVersion(((MapActivity) getActivity()).getMyApplication()))) { + } else if (Version.isPaidVersion(app) || Version.isDeveloperVersion(app)) { logo.setImageDrawable(getResources().getDrawable(R.drawable.ic_logo_splash_osmand_plus)); } RelativeLayout.LayoutParams logoLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); logoLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); logoLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL); - ImageView text = new ImageView(getActivity()); - if (Version.isFreeVersion(((MapActivity) getActivity()).getMyApplication())) { + ImageView text = new ImageView(activity); + if (Version.isFreeVersion(app)) { text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand)); - } else if ((Version.isPaidVersion(((MapActivity) getActivity()).getMyApplication())) || - (Version.isDeveloperVersion(((MapActivity) getActivity()).getMyApplication()))) { + } else if (Version.isPaidVersion(app) || Version.isDeveloperVersion(app)) { text.setImageDrawable(getResources().getDrawable(R.drawable.image_text_osmand_plus)); } RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); @@ -102,10 +111,10 @@ public class SecondSplashScreenFragment extends Fragment { int textPaddingLeft = 0; int textPaddingRight = 0; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N_MR1) { - if (AndroidUiHelper.getScreenOrientation(getActivity()) == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { + if (AndroidUiHelper.getScreenOrientation(activity) == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { logoPaddingLeft = getNavigationBarWidth(); textPaddingLeft = getNavigationBarWidth(); - } else if (AndroidUiHelper.getScreenOrientation(getActivity()) == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) { + } else if (AndroidUiHelper.getScreenOrientation(activity) == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE) { logoPaddingRight = getNavigationBarWidth(); textPaddingRight = getNavigationBarWidth(); } @@ -128,19 +137,23 @@ public class SecondSplashScreenFragment extends Fragment { @Override public void onResume() { super.onResume(); - ((MapActivity)getActivity()).disableDrawer(); + if (activity instanceof MapActivity) { + ((MapActivity) activity).disableDrawer(); + } if (!started) { started = true; new Handler().postDelayed(new Runnable() { @Override public void run() { - ((MapActivity)getActivity()).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); - if (((MapActivity)getActivity()).getMyApplication().getSettings().MAP_SCREEN_ORIENTATION.get() != getActivity().getRequestedOrientation()) { - getActivity().setRequestedOrientation(((MapActivity)getActivity()).getMyApplication().getSettings().MAP_SCREEN_ORIENTATION.get()); - // can't return from this method we are not sure if activity will be recreated or not + if (activity instanceof MapActivity) { + activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); + if (app.getSettings().MAP_SCREEN_ORIENTATION.get() != activity.getRequestedOrientation()) { + activity.setRequestedOrientation(app.getSettings().MAP_SCREEN_ORIENTATION.get()); + // can't return from this method we are not sure if activity will be recreated or not + } } - ((MapActivity)getActivity()).getSupportFragmentManager().beginTransaction().remove(SecondSplashScreenFragment.this).commitAllowingStateLoss(); + activity.getSupportFragmentManager().beginTransaction().remove(SecondSplashScreenFragment.this).commitAllowingStateLoss(); } }, SECOND_SPLASH_TIME_OUT); } @@ -149,6 +162,8 @@ public class SecondSplashScreenFragment extends Fragment { @Override public void onPause() { super.onPause(); - ((MapActivity)getActivity()).enableDrawer(); + if (activity instanceof MapActivity) { + ((MapActivity) activity).enableDrawer(); + } } } From 7dca44ddc4f67ba9fb2b00921157b67bbd7797f2 Mon Sep 17 00:00:00 2001 From: Viktar Vauchkevich Date: Mon, 17 Jul 2017 10:18:25 +0000 Subject: [PATCH 4/8] Translated using Weblate (Belarusian) Currently translated at 100.0% (2358 of 2358 strings) --- OsmAnd/res/values-be/strings.xml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/OsmAnd/res/values-be/strings.xml b/OsmAnd/res/values-be/strings.xml index 772f8de72e..733d33e73a 100644 --- a/OsmAnd/res/values-be/strings.xml +++ b/OsmAnd/res/values-be/strings.xml @@ -1,4 +1,5 @@ -Без аўтаматычнага маштабаваньня + +Без аўтаматычнага маштабаваньня Буйней Для сярэдняга маштаба Драбней @@ -238,10 +239,10 @@ Вы ўжо абралі пункт прызначэньня: Пункты прызначэньня Прамежкавы пункт прызначэньня %1$s занадта далёка ад бліжэйшай дарогі. - Вы дасягнулі прамежкавага пункта прызначэньня + Вы дасягнулі прамежкавага пункта Дадаць прамежкавым пунктам прызначэньня Прамежкавы пункт прызначэньня - Канцавы пункт занадта далёка ад найбліжэйшай дарогі. + Канцавы пункт занадта далёка ад бліжэйшай дарогі. Дадаць тэг Пашыраны рэжым… Паркоўка @@ -380,7 +381,7 @@ Прапарцыйнай памяці %4$s МБ (Абмежаваньне Android %5$s МБ, Dalvik %6$s МБ). Усяго фізічнай памяці - Пачатковы пункт занадта далёка ад найбліжэйшай дарогі. + Пачатковы пункт занадта далёка ад бліжэйшай дарогі. Агульныя месцы Забраць машыну са стаянкі Папярэджаньне @@ -2798,4 +2799,14 @@ Адлегласць = Мін./Макс. Мін./Макс. - \ No newline at end of file + Паўпразрысты ружовы + \\022 Дадатак Mapillary з вулічнымі выявамі +\n +\n • Віджэт-лінейка для вымярэнняў дыстанцый +\n +\n • Раздзеленыя GPX-інтэрвалы з падрабязнай інфармацыяй аб вашым трэку +\n +\n • Іншыя паляпшэнні і выпраўленні хібаў +\n +\n + From afe5d6097f98f7ca12674894efe6bb489ed8444a Mon Sep 17 00:00:00 2001 From: Viktar Vauchkevich Date: Mon, 17 Jul 2017 10:24:44 +0000 Subject: [PATCH 5/8] Translated using Weblate (Belarusian (latin)) Currently translated at 100.0% (2358 of 2358 strings) --- OsmAnd/res/values-be-rBY/strings.xml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-be-rBY/strings.xml b/OsmAnd/res/values-be-rBY/strings.xml index 6729afa2a6..6ee54e4e5a 100644 --- a/OsmAnd/res/values-be-rBY/strings.xml +++ b/OsmAnd/res/values-be-rBY/strings.xml @@ -1,4 +1,5 @@ -Piešachodnyja pierachody + +Piešachodnyja pierachody Styl aŭtadaroh Pa zmoŭčańnі Aranžavy @@ -2749,4 +2750,14 @@ U vypadku, kali vy lubіcie OsmAnd і OSM і chočacie padtrymać jaho, heta іd Adliehlasć = Min./Maks. Min./Maks. - \ No newline at end of file + \\022 Dadatak Mapillary z vuličnymi vyjavami +\n +\n • Vidžet-liniejka dlia vymiarenniaŭ dystancyj +\n +\n • Razdzielienyja GPX-intervaly z padrabiaznaj infarmacyjaj ab vašym treku +\n +\n • Inšyja paliapšenni i vypraŭlienni chibaŭ +\n +\n + Paŭprazrysty ružovy + From 9ff379a5ccf5061cdbf5718538f18ff7ce7568bb Mon Sep 17 00:00:00 2001 From: Michael Wolf Date: Mon, 17 Jul 2017 10:24:02 +0000 Subject: [PATCH 6/8] Translated using Weblate (Upper Sorbian) Currently translated at 36.8% (870 of 2358 strings) --- OsmAnd/res/values-b+hsb/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OsmAnd/res/values-b+hsb/strings.xml b/OsmAnd/res/values-b+hsb/strings.xml index 0c2e62def8..62fa29ee7e 100644 --- a/OsmAnd/res/values-b+hsb/strings.xml +++ b/OsmAnd/res/values-b+hsb/strings.xml @@ -276,8 +276,8 @@ Mjenje detailow Awtorizacija njewuspěšna Po mjenje sortować - "Přerězna spěšnosć: %1$s " - "Maksimalna spěšnosć: %1$s " + Přerězna spěšnosć: %1$s + Maksimalna spěšnosć: %1$s Přerězna wysokosć: %1$s Přizjewić Wužiwar @@ -381,7 +381,7 @@ Dróhowe mjena (TTS) Błyskače Wobchadne warnowanja - "Karta: " + Karta: šěr %1$.3f, doł %2$.3f Cil do: @@ -603,7 +603,7 @@ Tuchwilne srjedźišćo karty Wuchadźišćo: We wokolinje pytać - "Mjeno dataje: " + Mjeno dataje: Dataja ze samsnym mjenom hižo eksistuje. Doma Přećeljo From 01d2489c7346f9f94b090947134a69cb6b8602f1 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Mon, 17 Jul 2017 16:16:06 +0300 Subject: [PATCH 7/8] Fix #4002 --- .../quick_action_start_stop_navigation.xml | 65 +++ OsmAnd/res/values/strings.xml | 5 + .../dashboard/DashNavigationFragment.java | 3 +- .../notifications/NavigationNotification.java | 2 +- .../osmand/plus/quickaction/QuickAction.java | 4 + .../plus/quickaction/QuickActionFactory.java | 438 ++++++++++-------- .../plus/quickaction/QuickActionsWidget.java | 4 + .../actions/NavResumePauseAction.java | 77 +++ .../actions/NavStartStopAction.java | 91 ++++ .../osmand/plus/routing/RoutingHelper.java | 2 +- .../osmand/plus/views/MapControlsLayer.java | 6 +- 11 files changed, 491 insertions(+), 206 deletions(-) create mode 100644 OsmAnd/res/layout/quick_action_start_stop_navigation.xml create mode 100644 OsmAnd/src/net/osmand/plus/quickaction/actions/NavResumePauseAction.java create mode 100644 OsmAnd/src/net/osmand/plus/quickaction/actions/NavStartStopAction.java diff --git a/OsmAnd/res/layout/quick_action_start_stop_navigation.xml b/OsmAnd/res/layout/quick_action_start_stop_navigation.xml new file mode 100644 index 0000000000..d122d84d51 --- /dev/null +++ b/OsmAnd/res/layout/quick_action_start_stop_navigation.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 97f852d6e9..2e858e8342 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,11 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Resume/Pause Navigation + Press this button to pause the navigation, or to resume it if it was already paused. + Show Finish navigation dialog + Start/Finish Navigation + Press this button to start the navigation, or to stop it if it was already started. Store recorded tracks in monthly folders Store recorded tracks in sub-folders per recording month (like 2017-01). Reset diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashNavigationFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashNavigationFragment.java index 530d62163f..b988f9a3a0 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashNavigationFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashNavigationFragment.java @@ -1,7 +1,6 @@ package net.osmand.plus.dashboard; import android.content.DialogInterface; -import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AlertDialog; @@ -123,7 +122,7 @@ public class DashNavigationFragment extends DashBaseFragment { } else { routingHelper.setRoutePlanningMode(true); routingHelper.setFollowingMode(false); - routingHelper.setPauseNaviation(true); + routingHelper.setPauseNavigation(true); } updatePlayButton(routingHelper, map, play); map.getMapViewTrackingUtilities().switchToRoutePlanningMode(); diff --git a/OsmAnd/src/net/osmand/plus/notifications/NavigationNotification.java b/OsmAnd/src/net/osmand/plus/notifications/NavigationNotification.java index 6a438e6084..4e981d5822 100644 --- a/OsmAnd/src/net/osmand/plus/notifications/NavigationNotification.java +++ b/OsmAnd/src/net/osmand/plus/notifications/NavigationNotification.java @@ -64,7 +64,7 @@ public class NavigationNotification extends OsmandNotification { RoutingHelper routingHelper = app.getRoutingHelper(); routingHelper.setRoutePlanningMode(true); routingHelper.setFollowingMode(false); - routingHelper.setPauseNaviation(true); + routingHelper.setPauseNavigation(true); } }, new IntentFilter(OSMAND_PAUSE_NAVIGATION_SERVICE_ACTION)); diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickAction.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickAction.java index cbc794e94b..b7d5d87bf2 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/QuickAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickAction.java @@ -80,6 +80,10 @@ public class QuickAction { return isActionEditable; } + public boolean isActionEnable(OsmandApplication app) { + return true; + } + public String getName(Context context) { return name == null || name.isEmpty() ? nameRes > 0 ? context.getString(nameRes) : "" : name; } diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java index 9afd153cf2..cfdc8029e5 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionFactory.java @@ -28,6 +28,8 @@ import net.osmand.plus.quickaction.actions.NavAddDestinationAction; import net.osmand.plus.quickaction.actions.NavAddFirstIntermediateAction; import net.osmand.plus.quickaction.actions.NavAutoZoomMapAction; import net.osmand.plus.quickaction.actions.NavReplaceDestinationAction; +import net.osmand.plus.quickaction.actions.NavResumePauseAction; +import net.osmand.plus.quickaction.actions.NavStartStopAction; import net.osmand.plus.quickaction.actions.NavVoiceAction; import net.osmand.plus.quickaction.actions.NewAction; import net.osmand.plus.quickaction.actions.ShowHideFavoritesAction; @@ -119,6 +121,8 @@ public class QuickActionFactory { QuickAction addFirstIntermediate = new NavAddFirstIntermediateAction(); QuickAction replaceDestination = new NavReplaceDestinationAction(); QuickAction autoZoomMap = new NavAutoZoomMapAction(); + QuickAction startStopNavigation = new NavStartStopAction(); + QuickAction resumePauseNavigation = new NavResumePauseAction(); ArrayList navigationQuickActions = new ArrayList<>(); @@ -137,6 +141,12 @@ public class QuickActionFactory { if (!autoZoomMap.hasInstanceInList(active)) { navigationQuickActions.add(autoZoomMap); } + if (!startStopNavigation.hasInstanceInList(active)) { + navigationQuickActions.add(startStopNavigation); + } + if (!resumePauseNavigation.hasInstanceInList(active)) { + navigationQuickActions.add(resumePauseNavigation); + } if (navigationQuickActions.size() > 0) { quickActions.add(new QuickAction(0, R.string.quick_action_add_navigation)); @@ -150,74 +160,80 @@ public class QuickActionFactory { switch (type) { - case NewAction.TYPE: - return new NewAction(); + case NewAction.TYPE: + return new NewAction(); - case MarkerAction.TYPE: - return new MarkerAction(); + case MarkerAction.TYPE: + return new MarkerAction(); - case FavoriteAction.TYPE: - return new FavoriteAction(); + case FavoriteAction.TYPE: + return new FavoriteAction(); - case ShowHideFavoritesAction.TYPE: - return new ShowHideFavoritesAction(); + case ShowHideFavoritesAction.TYPE: + return new ShowHideFavoritesAction(); - case ShowHidePoiAction.TYPE: - return new ShowHidePoiAction(); + case ShowHidePoiAction.TYPE: + return new ShowHidePoiAction(); - case GPXAction.TYPE: - return new GPXAction(); + case GPXAction.TYPE: + return new GPXAction(); - case ParkingAction.TYPE: - return new ParkingAction(); + case ParkingAction.TYPE: + return new ParkingAction(); - case TakeAudioNoteAction.TYPE: - return new TakeAudioNoteAction(); + case TakeAudioNoteAction.TYPE: + return new TakeAudioNoteAction(); - case TakePhotoNoteAction.TYPE: - return new TakePhotoNoteAction(); + case TakePhotoNoteAction.TYPE: + return new TakePhotoNoteAction(); - case TakeVideoNoteAction.TYPE: - return new TakeVideoNoteAction(); + case TakeVideoNoteAction.TYPE: + return new TakeVideoNoteAction(); - case NavVoiceAction.TYPE: - return new NavVoiceAction(); + case NavVoiceAction.TYPE: + return new NavVoiceAction(); - case ShowHideOSMBugAction.TYPE: - return new ShowHideOSMBugAction(); + case ShowHideOSMBugAction.TYPE: + return new ShowHideOSMBugAction(); - case AddOSMBugAction.TYPE: - return new AddOSMBugAction(); + case AddOSMBugAction.TYPE: + return new AddOSMBugAction(); - case AddPOIAction.TYPE: - return new AddPOIAction(); + case AddPOIAction.TYPE: + return new AddPOIAction(); - case MapStyleAction.TYPE: - return new MapStyleAction(); + case MapStyleAction.TYPE: + return new MapStyleAction(); - case MapSourceAction.TYPE: - return new MapSourceAction(); + case MapSourceAction.TYPE: + return new MapSourceAction(); - case MapOverlayAction.TYPE: - return new MapOverlayAction(); + case MapOverlayAction.TYPE: + return new MapOverlayAction(); - case MapUnderlayAction.TYPE: - return new MapUnderlayAction(); + case MapUnderlayAction.TYPE: + return new MapUnderlayAction(); - case NavAddDestinationAction.TYPE: - return new NavAddDestinationAction(); + case NavAddDestinationAction.TYPE: + return new NavAddDestinationAction(); - case NavAddFirstIntermediateAction.TYPE: - return new NavAddFirstIntermediateAction(); + case NavAddFirstIntermediateAction.TYPE: + return new NavAddFirstIntermediateAction(); - case NavReplaceDestinationAction.TYPE: - return new NavReplaceDestinationAction(); + case NavReplaceDestinationAction.TYPE: + return new NavReplaceDestinationAction(); - case NavAutoZoomMapAction.TYPE: - return new NavAutoZoomMapAction(); + case NavAutoZoomMapAction.TYPE: + return new NavAutoZoomMapAction(); - default: - return new QuickAction(); + case NavStartStopAction.TYPE: + return new NavStartStopAction(); + + case NavResumePauseAction.TYPE: + return new NavResumePauseAction(); + + default: + return new QuickAction(); } } @@ -225,74 +241,80 @@ public class QuickActionFactory { switch (quickAction.type) { - case NewAction.TYPE: - return new NewAction(quickAction); + case NewAction.TYPE: + return new NewAction(quickAction); - case MarkerAction.TYPE: - return new MarkerAction(quickAction); + case MarkerAction.TYPE: + return new MarkerAction(quickAction); - case FavoriteAction.TYPE: - return new FavoriteAction(quickAction); + case FavoriteAction.TYPE: + return new FavoriteAction(quickAction); - case ShowHideFavoritesAction.TYPE: - return new ShowHideFavoritesAction(quickAction); + case ShowHideFavoritesAction.TYPE: + return new ShowHideFavoritesAction(quickAction); - case ShowHidePoiAction.TYPE: - return new ShowHidePoiAction(quickAction); + case ShowHidePoiAction.TYPE: + return new ShowHidePoiAction(quickAction); - case GPXAction.TYPE: - return new GPXAction(quickAction); + case GPXAction.TYPE: + return new GPXAction(quickAction); - case ParkingAction.TYPE: - return new ParkingAction(quickAction); + case ParkingAction.TYPE: + return new ParkingAction(quickAction); - case TakeAudioNoteAction.TYPE: - return new TakeAudioNoteAction(quickAction); + case TakeAudioNoteAction.TYPE: + return new TakeAudioNoteAction(quickAction); - case TakePhotoNoteAction.TYPE: - return new TakePhotoNoteAction(quickAction); + case TakePhotoNoteAction.TYPE: + return new TakePhotoNoteAction(quickAction); - case TakeVideoNoteAction.TYPE: - return new TakeVideoNoteAction(quickAction); + case TakeVideoNoteAction.TYPE: + return new TakeVideoNoteAction(quickAction); - case NavVoiceAction.TYPE: - return new NavVoiceAction(quickAction); + case NavVoiceAction.TYPE: + return new NavVoiceAction(quickAction); - case ShowHideOSMBugAction.TYPE: - return new ShowHideOSMBugAction(quickAction); + case ShowHideOSMBugAction.TYPE: + return new ShowHideOSMBugAction(quickAction); - case AddOSMBugAction.TYPE: - return new AddOSMBugAction(quickAction); + case AddOSMBugAction.TYPE: + return new AddOSMBugAction(quickAction); - case AddPOIAction.TYPE: - return new AddPOIAction(quickAction); + case AddPOIAction.TYPE: + return new AddPOIAction(quickAction); - case MapStyleAction.TYPE: - return new MapStyleAction(quickAction); + case MapStyleAction.TYPE: + return new MapStyleAction(quickAction); - case MapSourceAction.TYPE: - return new MapSourceAction(quickAction); + case MapSourceAction.TYPE: + return new MapSourceAction(quickAction); - case MapOverlayAction.TYPE: - return new MapOverlayAction(quickAction); + case MapOverlayAction.TYPE: + return new MapOverlayAction(quickAction); - case MapUnderlayAction.TYPE: - return new MapUnderlayAction(quickAction); + case MapUnderlayAction.TYPE: + return new MapUnderlayAction(quickAction); - case NavAddDestinationAction.TYPE: - return new NavAddDestinationAction(quickAction); + case NavAddDestinationAction.TYPE: + return new NavAddDestinationAction(quickAction); - case NavAddFirstIntermediateAction.TYPE: - return new NavAddFirstIntermediateAction(quickAction); + case NavAddFirstIntermediateAction.TYPE: + return new NavAddFirstIntermediateAction(quickAction); - case NavReplaceDestinationAction.TYPE: - return new NavReplaceDestinationAction(quickAction); + case NavReplaceDestinationAction.TYPE: + return new NavReplaceDestinationAction(quickAction); - case NavAutoZoomMapAction.TYPE: - return new NavAutoZoomMapAction(quickAction); + case NavAutoZoomMapAction.TYPE: + return new NavAutoZoomMapAction(quickAction); - default: - return quickAction; + case NavStartStopAction.TYPE: + return new NavStartStopAction(quickAction); + + case NavResumePauseAction.TYPE: + return new NavResumePauseAction(quickAction); + + default: + return quickAction; } } @@ -300,74 +322,80 @@ public class QuickActionFactory { switch (type) { - case NewAction.TYPE: - return R.drawable.ic_action_plus; + case NewAction.TYPE: + return R.drawable.ic_action_plus; - case MarkerAction.TYPE: - return R.drawable.ic_action_flag_dark; + case MarkerAction.TYPE: + return R.drawable.ic_action_flag_dark; - case FavoriteAction.TYPE: - return R.drawable.ic_action_fav_dark; + case FavoriteAction.TYPE: + return R.drawable.ic_action_fav_dark; - case ShowHideFavoritesAction.TYPE: - return R.drawable.ic_action_fav_dark; + case ShowHideFavoritesAction.TYPE: + return R.drawable.ic_action_fav_dark; - case ShowHidePoiAction.TYPE: - return R.drawable.ic_action_gabout_dark; + case ShowHidePoiAction.TYPE: + return R.drawable.ic_action_gabout_dark; - case GPXAction.TYPE: - return R.drawable.ic_action_flag_dark; + case GPXAction.TYPE: + return R.drawable.ic_action_flag_dark; - case ParkingAction.TYPE: - return R.drawable.ic_action_parking_dark; + case ParkingAction.TYPE: + return R.drawable.ic_action_parking_dark; - case TakeAudioNoteAction.TYPE: - return R.drawable.ic_action_micro_dark; + case TakeAudioNoteAction.TYPE: + return R.drawable.ic_action_micro_dark; - case TakePhotoNoteAction.TYPE: - return R.drawable.ic_action_photo_dark; + case TakePhotoNoteAction.TYPE: + return R.drawable.ic_action_photo_dark; - case TakeVideoNoteAction.TYPE: - return R.drawable.ic_action_video_dark; + case TakeVideoNoteAction.TYPE: + return R.drawable.ic_action_video_dark; - case NavVoiceAction.TYPE: - return R.drawable.ic_action_volume_up; + case NavVoiceAction.TYPE: + return R.drawable.ic_action_volume_up; - case ShowHideOSMBugAction.TYPE: - return R.drawable.ic_action_bug_dark; + case ShowHideOSMBugAction.TYPE: + return R.drawable.ic_action_bug_dark; - case AddOSMBugAction.TYPE: - return R.drawable.ic_action_bug_dark; + case AddOSMBugAction.TYPE: + return R.drawable.ic_action_bug_dark; - case AddPOIAction.TYPE: - return R.drawable.ic_action_gabout_dark; + case AddPOIAction.TYPE: + return R.drawable.ic_action_gabout_dark; - case MapStyleAction.TYPE: - return R.drawable.ic_map; + case MapStyleAction.TYPE: + return R.drawable.ic_map; - case MapSourceAction.TYPE: - return R.drawable.ic_world_globe_dark; + case MapSourceAction.TYPE: + return R.drawable.ic_world_globe_dark; - case MapOverlayAction.TYPE: - return R.drawable.ic_layer_top_dark; + case MapOverlayAction.TYPE: + return R.drawable.ic_layer_top_dark; - case MapUnderlayAction.TYPE: - return R.drawable.ic_layer_bottom_dark; + case MapUnderlayAction.TYPE: + return R.drawable.ic_layer_bottom_dark; - case NavAddDestinationAction.TYPE: - return R.drawable.ic_action_target; + case NavAddDestinationAction.TYPE: + return R.drawable.ic_action_target; - case NavAddFirstIntermediateAction.TYPE: - return R.drawable.ic_action_intermediate; + case NavAddFirstIntermediateAction.TYPE: + return R.drawable.ic_action_intermediate; - case NavReplaceDestinationAction.TYPE: - return R.drawable.ic_action_target; + case NavReplaceDestinationAction.TYPE: + return R.drawable.ic_action_target; - case NavAutoZoomMapAction.TYPE: - return R.drawable.ic_action_search_dark; + case NavAutoZoomMapAction.TYPE: + return R.drawable.ic_action_search_dark; - default: - return R.drawable.ic_action_plus; + case NavStartStopAction.TYPE: + return R.drawable.ic_action_start_navigation; + + case NavResumePauseAction.TYPE: + return R.drawable.ic_play_dark; + + default: + return R.drawable.ic_action_plus; } } @@ -375,74 +403,80 @@ public class QuickActionFactory { switch (type) { - case NewAction.TYPE: - return R.string.quick_action_new_action; + case NewAction.TYPE: + return R.string.quick_action_new_action; - case MarkerAction.TYPE: - return R.string.quick_action_add_marker; + case MarkerAction.TYPE: + return R.string.quick_action_add_marker; - case FavoriteAction.TYPE: - return R.string.quick_action_add_favorite; + case FavoriteAction.TYPE: + return R.string.quick_action_add_favorite; - case ShowHideFavoritesAction.TYPE: - return R.string.quick_action_showhide_favorites_title; + case ShowHideFavoritesAction.TYPE: + return R.string.quick_action_showhide_favorites_title; - case ShowHidePoiAction.TYPE: - return R.string.quick_action_showhide_poi_title; + case ShowHidePoiAction.TYPE: + return R.string.quick_action_showhide_poi_title; - case GPXAction.TYPE: - return R.string.quick_action_add_gpx; + case GPXAction.TYPE: + return R.string.quick_action_add_gpx; - case ParkingAction.TYPE: - return R.string.quick_action_add_parking; + case ParkingAction.TYPE: + return R.string.quick_action_add_parking; - case TakeAudioNoteAction.TYPE: - return R.string.quick_action_take_audio_note; + case TakeAudioNoteAction.TYPE: + return R.string.quick_action_take_audio_note; - case TakePhotoNoteAction.TYPE: - return R.string.quick_action_take_photo_note; + case TakePhotoNoteAction.TYPE: + return R.string.quick_action_take_photo_note; - case TakeVideoNoteAction.TYPE: - return R.string.quick_action_take_video_note; + case TakeVideoNoteAction.TYPE: + return R.string.quick_action_take_video_note; - case NavVoiceAction.TYPE: - return R.string.quick_action_navigation_voice; + case NavVoiceAction.TYPE: + return R.string.quick_action_navigation_voice; - case ShowHideOSMBugAction.TYPE: - return R.string.quick_action_showhide_osmbugs_title; + case ShowHideOSMBugAction.TYPE: + return R.string.quick_action_showhide_osmbugs_title; - case AddOSMBugAction.TYPE: - return R.string.quick_action_add_osm_bug; + case AddOSMBugAction.TYPE: + return R.string.quick_action_add_osm_bug; - case AddPOIAction.TYPE: - return R.string.quick_action_add_poi; + case AddPOIAction.TYPE: + return R.string.quick_action_add_poi; - case MapStyleAction.TYPE: - return R.string.quick_action_map_style; + case MapStyleAction.TYPE: + return R.string.quick_action_map_style; - case MapSourceAction.TYPE: - return R.string.quick_action_map_source; + case MapSourceAction.TYPE: + return R.string.quick_action_map_source; - case MapOverlayAction.TYPE: - return R.string.quick_action_map_overlay; + case MapOverlayAction.TYPE: + return R.string.quick_action_map_overlay; - case MapUnderlayAction.TYPE: - return R.string.quick_action_map_underlay; + case MapUnderlayAction.TYPE: + return R.string.quick_action_map_underlay; - case NavAddDestinationAction.TYPE: - return R.string.quick_action_add_destination; + case NavAddDestinationAction.TYPE: + return R.string.quick_action_add_destination; - case NavAddFirstIntermediateAction.TYPE: - return R.string.quick_action_add_first_intermediate; + case NavAddFirstIntermediateAction.TYPE: + return R.string.quick_action_add_first_intermediate; - case NavReplaceDestinationAction.TYPE: - return R.string.quick_action_replace_destination; + case NavReplaceDestinationAction.TYPE: + return R.string.quick_action_replace_destination; - case NavAutoZoomMapAction.TYPE: - return R.string.quick_action_auto_zoom; + case NavAutoZoomMapAction.TYPE: + return R.string.quick_action_auto_zoom; - default: - return R.string.quick_action_new_action; + case NavStartStopAction.TYPE: + return R.string.quick_action_start_stop_navigation; + + case NavResumePauseAction.TYPE: + return R.string.quick_action_resume_pause_navigation; + + default: + return R.string.quick_action_new_action; } } @@ -450,24 +484,26 @@ public class QuickActionFactory { switch (type) { - case NewAction.TYPE: - case MarkerAction.TYPE: - case ShowHideFavoritesAction.TYPE: - case ShowHidePoiAction.TYPE: - case ParkingAction.TYPE: - case TakeAudioNoteAction.TYPE: - case TakePhotoNoteAction.TYPE: - case TakeVideoNoteAction.TYPE: - case NavVoiceAction.TYPE: - case NavAddDestinationAction.TYPE: - case NavAddFirstIntermediateAction.TYPE: - case NavReplaceDestinationAction.TYPE: - case NavAutoZoomMapAction.TYPE: - case ShowHideOSMBugAction.TYPE: - return false; + case NewAction.TYPE: + case MarkerAction.TYPE: + case ShowHideFavoritesAction.TYPE: + case ShowHidePoiAction.TYPE: + case ParkingAction.TYPE: + case TakeAudioNoteAction.TYPE: + case TakePhotoNoteAction.TYPE: + case TakeVideoNoteAction.TYPE: + case NavVoiceAction.TYPE: + case NavAddDestinationAction.TYPE: + case NavAddFirstIntermediateAction.TYPE: + case NavReplaceDestinationAction.TYPE: + case NavAutoZoomMapAction.TYPE: + case ShowHideOSMBugAction.TYPE: + case NavStartStopAction.TYPE: + case NavResumePauseAction.TYPE: + return false; - default: - return true; + default: + return true; } } } diff --git a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionsWidget.java b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionsWidget.java index f72d0052a4..944d8d3c1f 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/QuickActionsWidget.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/QuickActionsWidget.java @@ -254,6 +254,10 @@ public class QuickActionsWidget extends LinearLayout { } }); } + if (!action.isActionEnable(application)) { + view.setEnabled(false); + view.setAlpha(0.5f); + } } if (land) { diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavResumePauseAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavResumePauseAction.java new file mode 100644 index 0000000000..40d485296a --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavResumePauseAction.java @@ -0,0 +1,77 @@ +package net.osmand.plus.quickaction.actions; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.routing.RoutingHelper; + +public class NavResumePauseAction extends QuickAction { + + public static final int TYPE = 26; + + public NavResumePauseAction() { + super(TYPE); + } + + public NavResumePauseAction(QuickAction quickAction) { + super(quickAction); + } + + @Override + public void execute(MapActivity activity) { + RoutingHelper routingHelper = activity.getRoutingHelper(); + if (routingHelper.isRoutePlanningMode()) { + routingHelper.setRoutePlanningMode(false); + routingHelper.setFollowingMode(true); + } else { + routingHelper.setRoutePlanningMode(true); + routingHelper.setFollowingMode(false); + routingHelper.setPauseNavigation(true); + } + activity.getMapViewTrackingUtilities().switchToRoutePlanningMode(); + activity.refreshMap(); + } + + @Override + public void drawUI(ViewGroup parent, MapActivity activity) { + View view = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.quick_action_with_text, parent, false); + + ((TextView) view.findViewById(R.id.text)).setText(R.string.quick_action_resume_pause_navigation_descr); + + parent.addView(view); + } + + @Override + public String getActionText(OsmandApplication application) { + RoutingHelper helper = application.getRoutingHelper(); + if (!helper.isRouteCalculated() || helper.isRoutePlanningMode()) { + return application.getString(R.string.continue_navigation); + } + return application.getString(R.string.pause_navigation); + } + + @Override + public int getIconRes(Context context) { + if (context instanceof MapActivity) { + RoutingHelper helper = ((MapActivity) context).getRoutingHelper(); + if (!helper.isRouteCalculated() || helper.isRoutePlanningMode()) { + return R.drawable.ic_play_dark; + } + return R.drawable.ic_pause; + } + return super.getIconRes(context); + } + + @Override + public boolean isActionEnable(OsmandApplication app) { + return app.getRoutingHelper().isRouteCalculated(); + } +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/NavStartStopAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavStartStopAction.java new file mode 100644 index 0000000000..d1edca5ca6 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/NavStartStopAction.java @@ -0,0 +1,91 @@ +package net.osmand.plus.quickaction.actions; + +import android.content.Context; +import android.support.v7.widget.SwitchCompat; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu; +import net.osmand.plus.quickaction.QuickAction; +import net.osmand.plus.routing.RoutingHelper; + +public class NavStartStopAction extends QuickAction { + + public static final int TYPE = 25; + private static final String KEY_DIALOG = "dialog"; + + public NavStartStopAction() { + super(TYPE); + } + + public NavStartStopAction(QuickAction quickAction) { + super(quickAction); + } + + @Override + public void execute(MapActivity activity) { + RoutingHelper helper = activity.getRoutingHelper(); + if (helper.isPauseNavigation() || helper.isFollowingMode()) { + if (Boolean.valueOf(getParams().get(KEY_DIALOG))) { + DestinationReachedMenu.show(activity); + } else { + activity.getMapLayers().getMapControlsLayer().stopNavigation(); + } + } else { + activity.getMapLayers().getMapControlsLayer().doRoute(false); + } + } + + @Override + public void drawUI(ViewGroup parent, MapActivity activity) { + View view = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.quick_action_start_stop_navigation, parent, false); + + final SwitchCompat showDialogSwitch = (SwitchCompat) view.findViewById(R.id.show_dialog_switch); + + if (!getParams().isEmpty()) { + showDialogSwitch.setChecked(Boolean.valueOf(getParams().get(KEY_DIALOG))); + } + + view.findViewById(R.id.show_dialog_row).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + showDialogSwitch.setChecked(!showDialogSwitch.isChecked()); + } + }); + + parent.addView(view); + } + + @Override + public boolean fillParams(View root, MapActivity activity) { + getParams().put(KEY_DIALOG, Boolean + .toString(((SwitchCompat) root.findViewById(R.id.show_dialog_switch)).isChecked())); + return true; + } + + @Override + public String getActionText(OsmandApplication application) { + RoutingHelper helper = application.getRoutingHelper(); + if (helper.isPauseNavigation() || helper.isFollowingMode()) { + return application.getString(R.string.cancel_navigation); + } + return application.getString(R.string.follow); + } + + @Override + public int getIconRes(Context context) { + if (context instanceof MapActivity) { + RoutingHelper helper = ((MapActivity) context).getRoutingHelper(); + if (helper.isPauseNavigation() || helper.isFollowingMode()) { + return R.drawable.ic_action_target; + } + return R.drawable.ic_action_start_navigation; + } + return super.getIconRes(context); + } +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 4650b7be61..f1201150a7 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -119,7 +119,7 @@ public class RoutingHelper { return lastRouteCalcErrorShort; } - public void setPauseNaviation(boolean b) { + public void setPauseNavigation(boolean b) { this.isPauseNavigation = b; if (b) { if (app.getNavigationService() != null) { diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index bb45b710d3..25e8d787cc 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -350,7 +350,7 @@ public class MapControlsLayer extends OsmandMapLayer { } } - protected void clickRouteCancel() { + public void stopNavigation() { mapRouteInfoMenu.hide(); if (mapActivity.getRoutingHelper().isFollowingMode()) { mapActivity.getMapActions().stopNavigationActionConfirm(); @@ -359,6 +359,10 @@ public class MapControlsLayer extends OsmandMapLayer { } } + protected void clickRouteCancel() { + stopNavigation(); + } + protected void clickRouteGo() { if (app.getTargetPointsHelper().getPointToNavigate() != null) { mapRouteInfoMenu.hide(); From b90ff8f98c570297efd694bca9aa81ca7ed5f8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D1=96=D0=B9=20=D0=94=D1=83=D0=B1?= =?UTF-8?q?=D0=B8=D0=BA?= Date: Mon, 17 Jul 2017 13:31:34 +0000 Subject: [PATCH 8/8] Translated using Weblate (Ukrainian) Currently translated at 100.0% (2358 of 2358 strings) --- OsmAnd/res/values-uk/strings.xml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index 6c94963c8c..c2e529b62a 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -1,4 +1,5 @@ - + + Швидко Круговий рух : %1$d з’їзд @@ -2933,4 +2934,14 @@ Макс./мін. Мін/макс - \ No newline at end of file + \\022 Втулок Mapillary з вуличними зображеннями +\n +\n • Віджет-лінійка для вимірювання дистанцій +\n +\n • Розділені GPX-інтервали з докладною інформацією про Ваш трек +\n +\n • Інші поліпшення й виправлення помилок +\n +\n + Напівпрозорий рожевий +