Merge branch 'master' of ssh://github.com/osmandapp/Osmand into alex_fixes

This commit is contained in:
Alexander Sytnyk 2017-07-17 16:50:08 +03:00
commit e006ebc216
19 changed files with 588 additions and 255 deletions

View file

@ -2,9 +2,9 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<item android:drawable="@color/map_background_color_light"/>
<item android:top="@dimen/splash_screen_logo_top">
<item>
<bitmap
android:gravity="center_horizontal|top"
android:gravity="center"
android:src="@drawable/ic_logo_splash_osmand"/>
</item>
</layer-list>

View file

@ -2,9 +2,9 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<item android:drawable="@color/map_background_color_light"/>
<item android:top="@dimen/splash_screen_logo_top">
<item>
<bitmap
android:gravity="center_horizontal|top"
android:gravity="center"
android:src="@drawable/ic_logo_splash_osmand"/>
</item>
</layer-list>

View file

@ -2,9 +2,9 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<item android:drawable="@color/map_background_color_light"/>
<item android:top="@dimen/splash_screen_logo_top">
<item>
<bitmap
android:gravity="center_horizontal|top"
android:gravity="center"
android:src="@drawable/ic_logo_splash_osmand_plus"/>
</item>
</layer-list>

View file

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:padding="16dp"
android:text="@string/quick_action_start_stop_navigation_descr"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:scaleType="fitXY"
android:src="@drawable/bg_shadow_list_bottom"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginTop="16dp"
android:scaleType="fitXY"
android:src="@drawable/bg_shadow_list_top"/>
<LinearLayout
android:id="@+id/show_dialog_row"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="?attr/bg_color"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:padding="16dp"
android:text="@string/quick_action_show_navigation_finish_dialog"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/show_dialog_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"/>
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:scaleType="fitXY"
android:src="@drawable/bg_shadow_list_bottom"/>
</LinearLayout>

View file

@ -276,8 +276,8 @@
<string name="rendering_attr_lessDetailed_name">Mjenje detailow</string>
<string name="osmo_auth_error_short">Awtorizacija njewuspěšna</string>
<string name="sort_by_name">Po mjenje sortować</string>
<string name="gpx_info_average_speed">"Přerězna spěšnosć: %1$s "</string>
<string name="gpx_info_maximum_speed">"Maksimalna spěšnosć: %1$s "</string>
<string name="gpx_info_average_speed">Přerězna spěšnosć: %1$s</string>
<string name="gpx_info_maximum_speed">Maksimalna spěšnosć: %1$s</string>
<string name="gpx_info_avg_altitude">Přerězna wysokosć: %1$s</string>
<string name="osmo_sign_in">Přizjewić</string>
<string name="osmo_user_name">Wužiwar</string>
@ -381,7 +381,7 @@
<string name="speak_street_names">Dróhowe mjena (TTS)</string>
<string name="speak_cameras">Błyskače</string>
<string name="speak_traffic_warnings">Wobchadne warnowanja</string>
<string name="route_descr_map_location">"Karta: "</string>
<string name="route_descr_map_location">Karta:</string>
<string name="route_descr_lat_lon">šěr %1$.3f, doł %2$.3f</string>
<string name="route_descr_destination">Cil</string>
<string name="route_to">do:</string>
@ -603,7 +603,7 @@
<string name="search_position_map_view">Tuchwilne srjedźišćo karty</string>
<string name="select_search_position">Wuchadźišćo:</string>
<string name="context_menu_item_search">We wokolinje pytać</string>
<string name="filename_input">"Mjeno dataje: "</string>
<string name="filename_input">Mjeno dataje:</string>
<string name="file_with_name_already_exist">Dataja ze samsnym mjenom hižo eksistuje.</string>
<string name="favorite_home_category">Doma</string>
<string name="favorite_friends_category">Přećeljo</string>

View file

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><resources><string name="speak_pedestrian">Piešachodnyja pierachody</string>
<?xml version='1.0' encoding='UTF-8'?>
<resources><string name="speak_pedestrian">Piešachodnyja pierachody</string>
<string name="rendering_attr_roadStyle_name">Styl aŭtadaroh</string>
<string name="rendering_value_default_name">Pa zmoŭčańnі</string>
<string name="rendering_value_orange_name">Aranžavy</string>
@ -2749,4 +2750,14 @@ U vypadku, kali vy lubіcie OsmAnd і OSM і chočacie padtrymać jaho, heta іd
<string name="range_min_max">Adliehlasć = Min./Maks.</string>
<string name="min_max">Min./Maks.</string>
</resources>
<string name="release_2_7">\\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</string>
<string name="rendering_value_translucent_pink_name">Paŭprazrysty ružovy</string>
</resources>

View file

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><resources><string name="auto_zoom_none">Без аўтаматычнага маштабаваньня</string>
<?xml version='1.0' encoding='UTF-8'?>
<resources><string name="auto_zoom_none">Без аўтаматычнага маштабаваньня</string>
<string name="auto_zoom_close">Буйней</string>
<string name="auto_zoom_far">Для сярэдняга маштаба</string>
<string name="auto_zoom_farthest">Драбней</string>
@ -238,10 +239,10 @@
<string name="new_destination_point_dialog">Вы ўжо абралі пункт прызначэньня:</string>
<string name="target_points">Пункты прызначэньня</string>
<string name="intermediate_point_too_far">Прамежкавы пункт прызначэньня %1$s занадта далёка ад бліжэйшай дарогі.</string>
<string name="arrived_at_intermediate_point">Вы дасягнулі прамежкавага пункта прызначэньня</string>
<string name="arrived_at_intermediate_point">Вы дасягнулі прамежкавага пункта</string>
<string name="context_menu_item_intermediate_point">Дадаць прамежкавым пунктам прызначэньня</string>
<string name="map_widget_intermediate_distance">Прамежкавы пункт прызначэньня</string>
<string name="ending_point_too_far">Канцавы пункт занадта далёка ад найбліжэйшай дарогі.</string>
<string name="ending_point_too_far">Канцавы пункт занадта далёка ад бліжэйшай дарогі.</string>
<string name="add_tag">Дадаць тэг</string>
<string name="btn_advanced_mode">Пашыраны рэжым…</string>
<string name="poi_filter_parking">Паркоўка</string>
@ -380,7 +381,7 @@
Прапарцыйнай памяці %4$s МБ (Абмежаваньне Android %5$s МБ, Dalvik %6$s МБ).</string>
<string name="native_app_allocated_memory">Усяго фізічнай памяці</string>
<string name="starting_point_too_far">Пачатковы пункт занадта далёка ад найбліжэйшай дарогі.</string>
<string name="starting_point_too_far">Пачатковы пункт занадта далёка ад бліжэйшай дарогі.</string>
<string name="shared_location">Агульныя месцы</string>
<string name="osmand_parking_event">Забраць машыну са стаянкі</string>
<string name="osmand_parking_warning">Папярэджаньне</string>
@ -2798,4 +2799,14 @@
<string name="range_min_max">Адлегласць = Мін./Макс.</string>
<string name="min_max">Мін./Макс.</string>
</resources>
<string name="rendering_value_translucent_pink_name">Паўпразрысты ружовы</string>
<string name="release_2_7">\\022 Дадатак Mapillary з вулічнымі выявамі
\n
\n • Віджэт-лінейка для вымярэнняў дыстанцый
\n
\n • Раздзеленыя GPX-інтэрвалы з падрабязнай інфармацыяй аб вашым трэку
\n
\n • Іншыя паляпшэнні і выпраўленні хібаў
\n
\n</string>
</resources>

View file

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><resources>
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<string name="asap">Швидко</string>
<string name="route_roundabout">Круговий рух : %1$d з’їзд</string>
@ -2933,4 +2934,14 @@
<string name="max_min">Макс./мін.</string>
<string name="min_max">Мін/макс</string>
</resources>
<string name="release_2_7">\\022 Втулок Mapillary з вуличними зображеннями
\n
\n • Віджет-лінійка для вимірювання дистанцій
\n
\n • Розділені GPX-інтервали з докладною інформацією про Ваш трек
\n
\n • Інші поліпшення й виправлення помилок
\n
\n</string>
<string name="rendering_value_translucent_pink_name">Напівпрозорий рожевий</string>
</resources>

View file

@ -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
-->
<string name="quick_action_resume_pause_navigation">Resume/Pause Navigation</string>
<string name="quick_action_resume_pause_navigation_descr">Press this button to pause the navigation, or to resume it if it was already paused.</string>
<string name="quick_action_show_navigation_finish_dialog">Show Finish navigation dialog</string>
<string name="quick_action_start_stop_navigation">Start/Finish Navigation</string>
<string name="quick_action_start_stop_navigation_descr">Press this button to start the navigation, or to stop it if it was already started.</string>
<string name="store_tracks_in_monthly_directories">Store recorded tracks in monthly folders</string>
<string name="store_tracks_in_monthly_directories_descrp">Store recorded tracks in sub-folders per recording month (like 2017-01).</string>
<string name="shared_string_reset">Reset</string>

View file

@ -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;
@ -20,7 +22,14 @@ 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 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");
@ -68,24 +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);
@ -100,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();
}
@ -123,32 +134,36 @@ public class SecondSplashScreenFragment extends Fragment {
return view;
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
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
}
getActivity().getSupportFragmentManager().beginTransaction().remove(SecondSplashScreenFragment.this).commitAllowingStateLoss();
}
}, SECOND_SPLASH_TIME_OUT);
}
@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() {
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
}
}
activity.getSupportFragmentManager().beginTransaction().remove(SecondSplashScreenFragment.this).commitAllowingStateLoss();
}
}, SECOND_SPLASH_TIME_OUT);
}
}
@Override
public void onPause() {
super.onPause();
((MapActivity)getActivity()).enableDrawer();
if (activity instanceof MapActivity) {
((MapActivity) activity).enableDrawer();
}
}
}

View file

@ -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();

View file

@ -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));

View file

@ -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;
}

View file

@ -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<QuickAction> 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;
}
}
}

View file

@ -254,6 +254,10 @@ public class QuickActionsWidget extends LinearLayout {
}
});
}
if (!action.isActionEnable(application)) {
view.setEnabled(false);
view.setAlpha(0.5f);
}
}
if (land) {

View file

@ -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();
}
}

View file

@ -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);
}
}

View file

@ -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) {

View file

@ -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();