[android] Added remove/add stop point buttons.
Before Width: | Height: | Size: 720 B After Width: | Height: | Size: 389 B |
BIN
android/res/drawable-hdpi/ic_place_page_phone.png
Normal file
After Width: | Height: | Size: 577 B |
BIN
android/res/drawable-hdpi/ic_route_remove.png
Normal file
After Width: | Height: | Size: 161 B |
BIN
android/res/drawable-hdpi/ic_route_via.png
Normal file
After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 477 B After Width: | Height: | Size: 266 B |
BIN
android/res/drawable-mdpi/ic_place_page_phone.png
Normal file
After Width: | Height: | Size: 398 B |
BIN
android/res/drawable-mdpi/ic_route_remove.png
Normal file
After Width: | Height: | Size: 125 B |
BIN
android/res/drawable-mdpi/ic_route_via.png
Normal file
After Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 508 B |
BIN
android/res/drawable-xhdpi/ic_place_page_phone.png
Normal file
After Width: | Height: | Size: 732 B |
BIN
android/res/drawable-xhdpi/ic_route_remove.png
Normal file
After Width: | Height: | Size: 175 B |
BIN
android/res/drawable-xhdpi/ic_route_via.png
Normal file
After Width: | Height: | Size: 289 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 793 B |
BIN
android/res/drawable-xxhdpi/ic_place_page_phone.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
android/res/drawable-xxhdpi/ic_route_remove.png
Normal file
After Width: | Height: | Size: 245 B |
BIN
android/res/drawable-xxhdpi/ic_route_via.png
Normal file
After Width: | Height: | Size: 514 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
android/res/drawable-xxxhdpi/ic_place_page_phone.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
android/res/drawable-xxxhdpi/ic_route_remove.png
Normal file
After Width: | Height: | Size: 289 B |
BIN
android/res/drawable-xxxhdpi/ic_route_via.png
Normal file
After Width: | Height: | Size: 644 B |
|
@ -317,6 +317,28 @@ public class MapObject implements Parcelable
|
|||
dest.writeTypedList(mBanners);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
MapObject mapObject = (MapObject) o;
|
||||
|
||||
if (mMwmVersion != mapObject.mMwmVersion) return false;
|
||||
if (mFeatureIndex != mapObject.mFeatureIndex) return false;
|
||||
return mMwmName.equals(mapObject.mMwmName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int result = mMwmName.hashCode();
|
||||
result = 31 * result + (int) (mMwmVersion ^ (mMwmVersion >>> 32));
|
||||
result = 31 * result + mFeatureIndex;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static final Creator<MapObject> CREATOR = new Creator<MapObject>()
|
||||
{
|
||||
@Override
|
||||
|
|
|
@ -93,6 +93,8 @@ public class RoutingController
|
|||
private MapObject mStartPoint;
|
||||
@Nullable
|
||||
private MapObject mEndPoint;
|
||||
@Nullable
|
||||
private MapObject mStopPoint;
|
||||
|
||||
private int mLastBuildProgress;
|
||||
@Framework.RouterType
|
||||
|
@ -433,6 +435,28 @@ public class RoutingController
|
|||
LocationHelper.INSTANCE.restart();
|
||||
}
|
||||
|
||||
public void addStop(@NonNull MapObject mapObject)
|
||||
{
|
||||
mStopPoint = mapObject;
|
||||
// TODO call api method
|
||||
}
|
||||
|
||||
public void removeStop()
|
||||
{
|
||||
mStopPoint = null;
|
||||
// TODO call api method
|
||||
}
|
||||
|
||||
public boolean hasStopPoint()
|
||||
{
|
||||
return mStopPoint != null;
|
||||
}
|
||||
|
||||
public boolean isStopPoint(@NonNull MapObject mapObject)
|
||||
{
|
||||
return mStopPoint != null && mStopPoint.equals(mapObject);
|
||||
}
|
||||
|
||||
private void suggestRebuildRoute()
|
||||
{
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(mContainer.getActivity())
|
||||
|
@ -484,6 +508,7 @@ public class RoutingController
|
|||
|
||||
mStartPoint = null;
|
||||
mEndPoint = null;
|
||||
mStopPoint = null;
|
||||
setPointsInternal();
|
||||
mWaitingPoiPickSlot = NO_SLOT;
|
||||
mUberRequestHandled = false;
|
||||
|
|
|
@ -138,6 +138,36 @@ final class PlacePageButtons
|
|||
}
|
||||
},
|
||||
|
||||
ROUTE_ADD
|
||||
{
|
||||
@Override
|
||||
int getTitle()
|
||||
{
|
||||
return R.string.p2p_add_stop;
|
||||
}
|
||||
|
||||
@Override
|
||||
int getIcon()
|
||||
{
|
||||
return R.drawable.ic_route_via;
|
||||
}
|
||||
},
|
||||
|
||||
ROUTE_REMOVE
|
||||
{
|
||||
@Override
|
||||
int getTitle()
|
||||
{
|
||||
return R.string.p2p_remove_stop;
|
||||
}
|
||||
|
||||
@Override
|
||||
int getIcon()
|
||||
{
|
||||
return R.drawable.ic_route_remove;
|
||||
}
|
||||
},
|
||||
|
||||
SHARE
|
||||
{
|
||||
@Override
|
||||
|
@ -179,7 +209,7 @@ final class PlacePageButtons
|
|||
@Override
|
||||
int getIcon()
|
||||
{
|
||||
return R.drawable.ic_phone;
|
||||
return R.drawable.ic_place_page_phone;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -212,10 +242,18 @@ final class PlacePageButtons
|
|||
int from = res.indexOf(Item.ROUTE_FROM);
|
||||
if (from > -1)
|
||||
{
|
||||
int addStop = res.indexOf(Item.ROUTE_ADD);
|
||||
int to = res.indexOf(Item.ROUTE_TO);
|
||||
if (to > from && to >= MAX_BUTTONS)
|
||||
if ((to > from && to >= MAX_BUTTONS) || (to > from && addStop >= MAX_BUTTONS))
|
||||
Collections.swap(res, from, to);
|
||||
|
||||
if (addStop >= MAX_BUTTONS)
|
||||
{
|
||||
from = res.indexOf(Item.ROUTE_FROM);
|
||||
if (addStop > from)
|
||||
Collections.swap(res, from, addStop);
|
||||
}
|
||||
|
||||
preserveRoutingButtons(res, Item.CALL);
|
||||
preserveRoutingButtons(res, Item.BOOKING);
|
||||
preserveRoutingButtons(res, Item.BOOKING_SEARCH);
|
||||
|
@ -235,8 +273,18 @@ final class PlacePageButtons
|
|||
items.remove(pos);
|
||||
items.add(MAX_BUTTONS, itemToShift);
|
||||
int to = items.indexOf(Item.ROUTE_TO);
|
||||
items.remove(Item.ROUTE_FROM);
|
||||
items.add(to + 1, Item.ROUTE_FROM);
|
||||
if (items.indexOf(Item.ROUTE_ADD) > -1)
|
||||
{
|
||||
items.remove(Item.ROUTE_ADD);
|
||||
items.remove(Item.ROUTE_FROM);
|
||||
items.add(to + 1, Item.ROUTE_ADD);
|
||||
items.add(MAX_BUTTONS, Item.ROUTE_FROM);
|
||||
}
|
||||
else
|
||||
{
|
||||
items.remove(Item.ROUTE_FROM);
|
||||
items.add(to + 1, Item.ROUTE_FROM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -522,6 +522,20 @@ public class PlacePageView extends RelativeLayout
|
|||
}
|
||||
break;
|
||||
|
||||
case ROUTE_ADD:
|
||||
if (mMapObject != null
|
||||
&& (RoutingController.get().isPlanning() || RoutingController.get().isNavigating()))
|
||||
{
|
||||
RoutingController.get().addStop(mMapObject);
|
||||
setMapObject(mMapObject, true, null);
|
||||
}
|
||||
break;
|
||||
|
||||
case ROUTE_REMOVE:
|
||||
RoutingController.get().removeStop();
|
||||
setMapObject(mMapObject, true, null);
|
||||
break;
|
||||
|
||||
case BOOKING:
|
||||
case OPENTABLE:
|
||||
onSponsoredClick(true /* book */, false);
|
||||
|
@ -1388,6 +1402,12 @@ public class PlacePageView extends RelativeLayout
|
|||
private void setButtons(@NonNull MapObject mapObject, boolean showBackButton, boolean showRoutingButton)
|
||||
{
|
||||
List<PlacePageButtons.Item> buttons = new ArrayList<>();
|
||||
if (RoutingController.get().isStopPoint(mapObject))
|
||||
{
|
||||
buttons.add(PlacePageButtons.Item.ROUTE_REMOVE);
|
||||
mButtons.setItems(buttons);
|
||||
return;
|
||||
}
|
||||
|
||||
if (showBackButton || ParsedMwmRequest.isPickPointMode())
|
||||
buttons.add(PlacePageButtons.Item.BACK);
|
||||
|
@ -1421,6 +1441,8 @@ public class PlacePageView extends RelativeLayout
|
|||
{
|
||||
buttons.add(PlacePageButtons.Item.ROUTE_FROM);
|
||||
buttons.add(PlacePageButtons.Item.ROUTE_TO);
|
||||
if (RoutingController.get().isBuilt() && !RoutingController.get().hasStopPoint())
|
||||
buttons.add(PlacePageButtons.Item.ROUTE_ADD);
|
||||
}
|
||||
|
||||
buttons.add(PlacePageButtons.Item.SHARE);
|
||||
|
|