This commit is contained in:
Dmitry Donskoy 2019-04-12 14:07:49 +03:00 committed by Aleksandr Zatsepin
parent 278a1bb7be
commit e2e563267b
24 changed files with 197 additions and 85 deletions

BIN
android/res/drawable-hdpi/ic_avoid_ferry.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
android/res/drawable-hdpi/ic_avoid_tolls.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
android/res/drawable-hdpi/ic_avoid_unpaved.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
android/res/drawable-mdpi/ic_avoid_ferry.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 594 B

After

Width:  |  Height:  |  Size: 702 B

BIN
android/res/drawable-mdpi/ic_avoid_tolls.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 707 B

After

Width:  |  Height:  |  Size: 791 B

BIN
android/res/drawable-mdpi/ic_avoid_unpaved.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 677 B

After

Width:  |  Height:  |  Size: 759 B

BIN
android/res/drawable-xhdpi/ic_avoid_ferry.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
android/res/drawable-xhdpi/ic_avoid_tolls.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
android/res/drawable-xhdpi/ic_avoid_unpaved.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
android/res/drawable-xxhdpi/ic_avoid_ferry.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
android/res/drawable-xxhdpi/ic_avoid_tolls.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
android/res/drawable-xxhdpi/ic_avoid_unpaved.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
android/res/drawable-xxxhdpi/ic_avoid_ferry.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
android/res/drawable-xxxhdpi/ic_avoid_tolls.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
android/res/drawable-xxxhdpi/ic_avoid_unpaved.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -86,6 +86,7 @@ import com.mapswithme.maps.routing.RoutePointInfo;
import com.mapswithme.maps.routing.RoutingBottomMenuListener;
import com.mapswithme.maps.routing.RoutingController;
import com.mapswithme.maps.routing.RoutingErrorDialogFragment;
import com.mapswithme.maps.routing.RoutingOptions;
import com.mapswithme.maps.routing.RoutingPlanFragment;
import com.mapswithme.maps.routing.RoutingPlanInplaceController;
import com.mapswithme.maps.search.BookingFilterParams;
@ -99,6 +100,7 @@ import com.mapswithme.maps.search.SearchFilterController;
import com.mapswithme.maps.search.SearchFragment;
import com.mapswithme.maps.search.SearchResult;
import com.mapswithme.maps.settings.DrivingOptionsActivity;
import com.mapswithme.maps.settings.RoadType;
import com.mapswithme.maps.settings.SettingsActivity;
import com.mapswithme.maps.settings.StoragePathManager;
import com.mapswithme.maps.settings.UnitLocale;
@ -115,6 +117,7 @@ import com.mapswithme.maps.widget.menu.MainMenu;
import com.mapswithme.maps.widget.menu.MyPositionButton;
import com.mapswithme.maps.widget.placepage.BottomSheetPlacePageController;
import com.mapswithme.maps.widget.placepage.PlacePageController;
import com.mapswithme.maps.widget.placepage.RoutingModeListener;
import com.mapswithme.util.Counters;
import com.mapswithme.util.InputUtils;
import com.mapswithme.util.PermissionsUtils;
@ -158,7 +161,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
AdsRemovalPurchaseControllerProvider,
AdsRemovalActivationCallback,
PlacePageController.SlideListener,
AlertDialogCallback
AlertDialogCallback, RoutingModeListener
{
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC);
private static final String TAG = MwmActivity.class.getSimpleName();
@ -485,7 +488,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
setContentView(R.layout.activity_map);
mPlacePageController = new BottomSheetPlacePageController(this, this, this);
mPlacePageController = new BottomSheetPlacePageController(this, this, this,
this);
mPlacePageController.initialize();
mIsLaunchByDeepLink = getIntent().getBooleanExtra(EXTRA_LAUNCH_BY_DEEP_LINK, false);
@ -912,16 +916,28 @@ public class MwmActivity extends BaseMwmFragmentActivity
}
private void rebuildLastRoute()
{
RoutingController.get().attach(this);
rebuildLastRouteInternal();
}
private void rebuildLastRouteInternal()
{
if (mRoutingPlanInplaceController == null)
return;
mRoutingPlanInplaceController.hideDrivingOptionsView();
mPlacePageController.close();
RoutingController.get().attach(this);
RoutingController.get().prepare();
}
@Override
public void toggleRouteSettings(@NonNull RoadType roadType)
{
mPlacePageController.close();
RoutingOptions.removeOption(roadType);
rebuildLastRouteInternal();
}
private void handleDownloadedCategoryResult(@NonNull Intent data)
{
BookmarkCategory category = data.getParcelableExtra(BookmarksCatalogActivity.EXTRA_DOWNLOADED_CATEGORY);

View file

@ -13,7 +13,6 @@ import com.mapswithme.maps.routing.RoutePointInfo;
import com.mapswithme.maps.search.HotelsFilter;
import com.mapswithme.maps.search.Popularity;
import com.mapswithme.maps.search.PriceFilterView;
import com.mapswithme.maps.settings.RoadWarningMarkType;
import com.mapswithme.maps.ugc.UGC;
import com.mapswithme.util.Constants;

View file

@ -14,7 +14,6 @@ import com.mapswithme.maps.search.HotelsFilter;
import com.mapswithme.maps.search.Popularity;
import com.mapswithme.maps.search.PopularityProvider;
import com.mapswithme.maps.search.PriceFilterView;
import com.mapswithme.maps.settings.RoadWarningMarkType;
import com.mapswithme.maps.taxi.TaxiType;
import com.mapswithme.maps.ugc.UGC;
@ -487,6 +486,7 @@ public class MapObject implements Parcelable, PopularityProvider
dest.writeInt(mPriceRate);
dest.writeParcelable(mPopularity, 0);
dest.writeString(mDescription);
dest.writeInt(getRoadWarningMarkType().ordinal());
// All collections are deserialized AFTER non-collection and primitive type objects,
// so collections must be always serialized at the end.
dest.writeTypedList(mBanners);

View file

@ -1,4 +1,4 @@
package com.mapswithme.maps.settings;
package com.mapswithme.maps.bookmarks.data;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

View file

@ -103,9 +103,9 @@ public class RoutingPlanController extends ToolbarController
mRoutingBottomMenuController = RoutingBottomMenuController.newInstance(getActivity(), mFrame, listener);
mDrivingOptionsBtnContainer = activity.findViewById(R.id.driving_options_btn_container);
mDrivingOptionsBtnContainer = mFrame.findViewById(R.id.driving_options_btn_container);
View btn = mDrivingOptionsBtnContainer.findViewById(R.id.driving_options_btn);
mDrivingOptionsImage = activity.findViewById(R.id.driving_options_btn_img);
mDrivingOptionsImage = mFrame.findViewById(R.id.driving_options_btn_img);
btn.setOnClickListener(v -> DrivingOptionsActivity.start(getActivity()));
mDriverOptionsLayoutListener = new SelfTerminatedDrivingOptionsLayoutListener();

View file

@ -30,7 +30,7 @@ import com.mapswithme.maps.bookmarks.data.MapObject;
import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.maps.location.LocationListener;
import com.mapswithme.maps.purchase.AdsRemovalPurchaseControllerProvider;
import com.mapswithme.maps.settings.RoadWarningMarkType;
import com.mapswithme.maps.bookmarks.data.RoadWarningMarkType;
import com.mapswithme.util.Graphics;
import com.mapswithme.util.NetworkPolicy;
import com.mapswithme.util.UiUtils;
@ -88,6 +88,8 @@ public class BottomSheetPlacePageController implements PlacePageController, Loca
private final SlideListener mSlideListener;
@NonNull
private final GestureDetectorCompat mGestureDetector;
@Nullable
private final RoutingModeListener mRoutingModeListener;
@NonNull
private final AnchorBottomSheetBehavior.BottomSheetCallback mSheetCallback
= new AnchorBottomSheetBehavior.BottomSheetCallback()
@ -218,12 +220,14 @@ public class BottomSheetPlacePageController implements PlacePageController, Loca
public BottomSheetPlacePageController(@NonNull Activity activity,
@NonNull AdsRemovalPurchaseControllerProvider provider,
@NonNull SlideListener listener)
@NonNull SlideListener listener,
@Nullable RoutingModeListener routingModeListener)
{
mActivity = activity;
mPurchaseControllerProvider = provider;
mSlideListener = listener;
mGestureDetector = new GestureDetectorCompat(activity, new PlacePageGestureListener());
mRoutingModeListener = routingModeListener;
}
@SuppressLint("ClickableViewAccessibility")
@ -243,6 +247,7 @@ public class BottomSheetPlacePageController implements PlacePageController, Loca
mPlacePage.setOnTouchListener((v, event) -> mGestureDetector.onTouchEvent(event));
mPlacePage.addOnLayoutChangeListener(this);
mPlacePage.addClosable(this);
mPlacePage.setRoutingModeListener(mRoutingModeListener);
ViewGroup bannerContainer = mPlacePage.findViewById(R.id.banner_container);
DefaultAdTracker tracker = new DefaultAdTracker();

View file

@ -139,7 +139,9 @@ public final class PlacePageButtons
ROUTE_TO,
ROUTE_ADD,
ROUTE_REMOVE,
ROUTE_AVOID,
ROUTE_AVOID_TOLL,
ROUTE_AVOID_FERRY,
ROUTE_AVOID_UNPAVED,
SHARE,
MORE,
CALL
@ -325,17 +327,17 @@ public final class PlacePageButtons
ROUTE_AVOID_TOLL(
R.string.avoid_toll_roads_placepage,
new ImageResources(R.drawable.ic_avoid_tolls),
ButtonType.ROUTE_AVOID),
ButtonType.ROUTE_AVOID_TOLL),
ROUTE_AVOID_UNPAVED(
R.string.avoid_unpaved_roads_placepage,
new ImageResources(R.drawable.ic_avoid_unpaved),
ButtonType.ROUTE_AVOID),
ButtonType.ROUTE_AVOID_UNPAVED),
ROUTE_AVOID_FERRY(
R.string.avoid_ferry_crossing_placepage,
new ImageResources(R.drawable.ic_avoid_ferry),
ButtonType.ROUTE_AVOID),
ButtonType.ROUTE_AVOID_FERRY),
SHARE(
R.string.share,

View file

@ -67,8 +67,8 @@ import com.mapswithme.maps.routing.RoutingController;
import com.mapswithme.maps.search.FilterUtils;
import com.mapswithme.maps.search.HotelsFilter;
import com.mapswithme.maps.search.Popularity;
import com.mapswithme.maps.settings.DrivingOptionsActivity;
import com.mapswithme.maps.settings.RoadWarningMarkType;
import com.mapswithme.maps.settings.RoadType;
import com.mapswithme.maps.bookmarks.data.RoadWarningMarkType;
import com.mapswithme.maps.taxi.TaxiType;
import com.mapswithme.maps.ugc.Impress;
import com.mapswithme.maps.ugc.UGCController;
@ -313,6 +313,9 @@ public class PlacePageView extends NestedScrollView
@Nullable
private Closable mClosable;
@Nullable
private RoutingModeListener mRoutingModeListener;
void setScrollable(boolean scrollable)
{
mScrollable = scrollable;
@ -530,87 +533,45 @@ public class PlacePageView extends NestedScrollView
switch (item.getType())
{
case BOOKMARK:
if (mMapObject == null)
{
LOGGER.e(TAG, "Bookmark cannot be managed, mMapObject is null!");
return;
}
Statistics.INSTANCE.trackEvent(Statistics.EventName.PP_BOOKMARK);
AlohaHelper.logClick(AlohaHelper.PP_BOOKMARK);
toggleIsBookmark(mMapObject);
mPlacePageButtonsListener.onBookmarkSet(mBookmarkSet);
onBookmarkBtnClicked();
break;
case SHARE:
if (mMapObject == null)
{
LOGGER.e(TAG, "A map object cannot be shared, it's null!");
return;
}
Statistics.INSTANCE.trackEvent(Statistics.EventName.PP_SHARE);
AlohaHelper.logClick(AlohaHelper.PP_SHARE);
ShareOption.ANY.shareMapObject(getActivity(), mMapObject, mSponsored);
onShareBtnClicked();
break;
case BACK:
if (mMapObject == null)
{
LOGGER.e(TAG, "A mwm request cannot be handled, mMapObject is null!");
getActivity().finish();
return;
}
if (ParsedMwmRequest.hasRequest())
{
ParsedMwmRequest request = ParsedMwmRequest.getCurrentRequest();
if (ParsedMwmRequest.isPickPointMode())
request.setPointData(mMapObject.getLat(), mMapObject.getLon(), mMapObject.getTitle(), "");
request.sendResponseAndFinish(getActivity(), true);
}
else
getActivity().finish();
onBackBtnClicked();
break;
case ROUTE_FROM:
RoutingController controller = RoutingController.get();
if (!controller.isPlanning())
{
controller.prepare(mMapObject, null);
close();
}
else if (controller.setStartPoint(mMapObject))
{
close();
}
onRouteFromBtnClicked();
break;
case ROUTE_TO:
if (RoutingController.get().isPlanning())
{
RoutingController.get().setEndPoint(mMapObject);
close();
}
else
{
getActivity().startLocationToPoint(getMapObject(), true);
}
onRouteToBtnClicked();
break;
case ROUTE_ADD:
if (mMapObject != null)
RoutingController.get().addStop(mMapObject);
onRouteAddBtnClicked();
break;
case ROUTE_REMOVE:
if (mMapObject != null)
RoutingController.get().removeStop(mMapObject);
onRouteRemoveBtnClicked();
break;
case ROUTE_AVOID:
onAvoidBtnClicked();
case ROUTE_AVOID_TOLL:
onAvoidTollBtnClicked();
break;
case ROUTE_AVOID_UNPAVED:
onAvoidUnpavedBtnClicked();
break;
case ROUTE_AVOID_FERRY:
onAvoidFerryBtnClicked();
break;
case BOOKING:
case OPENTABLE:
// -----------------------------------------------------------------------------------------
@ -630,24 +591,143 @@ public class PlacePageView extends NestedScrollView
break;
case BOOKING_SEARCH:
if (mMapObject != null && !TextUtils.isEmpty(mMapObject.getBookingSearchUrl()))
{
Statistics.INSTANCE.trackBookingSearchEvent(mMapObject);
Utils.openUrl(getContext(), mMapObject.getBookingSearchUrl());
}
onBookingSearchBtnClicked();
break;
case CALL:
Utils.callPhone(getContext(), mTvPhone.getText().toString());
onCallBtnClicked();
break;
}
}
});
}
private void onAvoidBtnClicked()
private void onBookmarkBtnClicked()
{
DrivingOptionsActivity.start(getActivity());
if (mMapObject == null)
{
LOGGER.e(TAG, "Bookmark cannot be managed, mMapObject is null!");
return;
}
Statistics.INSTANCE.trackEvent(Statistics.EventName.PP_BOOKMARK);
AlohaHelper.logClick(AlohaHelper.PP_BOOKMARK);
toggleIsBookmark(mMapObject);
mPlacePageButtonsListener.onBookmarkSet(mBookmarkSet);
}
private void onShareBtnClicked()
{
if (mMapObject == null)
{
LOGGER.e(TAG, "A map object cannot be shared, it's null!");
return;
}
Statistics.INSTANCE.trackEvent(Statistics.EventName.PP_SHARE);
AlohaHelper.logClick(AlohaHelper.PP_SHARE);
ShareOption.ANY.shareMapObject(getActivity(), mMapObject, mSponsored);
}
private void onBackBtnClicked()
{
if (mMapObject == null)
{
LOGGER.e(TAG, "A mwm request cannot be handled, mMapObject is null!");
getActivity().finish();
return;
}
if (ParsedMwmRequest.hasRequest())
{
ParsedMwmRequest request = ParsedMwmRequest.getCurrentRequest();
if (ParsedMwmRequest.isPickPointMode())
request.setPointData(mMapObject.getLat(), mMapObject.getLon(), mMapObject.getTitle(), "");
request.sendResponseAndFinish(getActivity(), true);
}
else
getActivity().finish();
}
private void onRouteFromBtnClicked()
{
RoutingController controller = RoutingController.get();
if (!controller.isPlanning())
{
controller.prepare(mMapObject, null);
close();
}
else if (controller.setStartPoint(mMapObject))
{
close();
}
}
private void onRouteToBtnClicked()
{
if (RoutingController.get().isPlanning())
{
RoutingController.get().setEndPoint(mMapObject);
close();
}
else
{
getActivity().startLocationToPoint(getMapObject(), true);
}
}
private void onRouteAddBtnClicked()
{
if (mMapObject != null)
RoutingController.get().addStop(mMapObject);
}
private void onRouteRemoveBtnClicked()
{
if (mMapObject != null)
RoutingController.get().removeStop(mMapObject);
}
private void onCallBtnClicked()
{
Utils.callPhone(getContext(), mTvPhone.getText().toString());
}
private void onBookingSearchBtnClicked()
{
if (mMapObject != null && !TextUtils.isEmpty(mMapObject.getBookingSearchUrl()))
{
Statistics.INSTANCE.trackBookingSearchEvent(mMapObject);
Utils.openUrl(getContext(), mMapObject.getBookingSearchUrl());
}
}
public void setRoutingModeListener(@Nullable RoutingModeListener routingModeListener)
{
mRoutingModeListener = routingModeListener;
}
private void onAvoidUnpavedBtnClicked()
{
onAvoidBtnClicked(RoadType.DIRTY);
}
private void onAvoidFerryBtnClicked()
{
onAvoidBtnClicked(RoadType.FERRY);
}
private void onAvoidTollBtnClicked()
{
onAvoidBtnClicked(RoadType.TOLL);
}
private void onAvoidBtnClicked(@NonNull RoadType roadType)
{
if (mRoutingModeListener == null)
return;
mRoutingModeListener.toggleRouteSettings(roadType);
}
private void initPlaceDescriptionView()

View file

@ -0,0 +1,10 @@
package com.mapswithme.maps.widget.placepage;
import android.support.annotation.NonNull;
import com.mapswithme.maps.settings.RoadType;
public interface RoutingModeListener
{
void toggleRouteSettings(@NonNull RoadType roadType);
}