diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java index a26b08d76f..0a45d5c2c2 100644 --- a/android/src/com/mapswithme/maps/MwmActivity.java +++ b/android/src/com/mapswithme/maps/MwmActivity.java @@ -576,6 +576,9 @@ public class MwmActivity extends BaseMwmFragmentActivity outState.putParcelable(STATE_MAP_OBJECT, mPlacePage.getMapObject()); } + if (!mIsFragmentContainer && RoutingController.get().isPlanning()) + mRoutingPlanInplaceController.onSaveState(outState); + super.onSaveInstanceState(outState); } @@ -589,6 +592,9 @@ public class MwmActivity extends BaseMwmFragmentActivity mPlacePage.setMapObject((MapObject) savedInstanceState.getParcelable(STATE_MAP_OBJECT)); mPlacePage.setState(State.PREVIEW); } + + if (!mIsFragmentContainer && RoutingController.get().isPlanning()) + mRoutingPlanInplaceController.restoreState(savedInstanceState); } @Override diff --git a/android/src/com/mapswithme/maps/routing/RoutingPlanController.java b/android/src/com/mapswithme/maps/routing/RoutingPlanController.java index e338d31a1b..f94626abbf 100644 --- a/android/src/com/mapswithme/maps/routing/RoutingPlanController.java +++ b/android/src/com/mapswithme/maps/routing/RoutingPlanController.java @@ -8,6 +8,7 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.RadioGroup; import android.widget.TextView; + import com.mapswithme.maps.Framework; import com.mapswithme.maps.MwmApplication; import com.mapswithme.maps.R; @@ -246,4 +247,9 @@ public class RoutingPlanController extends ToolbarController UiUtils.hide(mToggle); showSlots(true, false); } + + public boolean isOpen() + { + return mOpen; + } } diff --git a/android/src/com/mapswithme/maps/routing/RoutingPlanInplaceController.java b/android/src/com/mapswithme/maps/routing/RoutingPlanInplaceController.java index 5b305b68d2..71b3f1d352 100644 --- a/android/src/com/mapswithme/maps/routing/RoutingPlanInplaceController.java +++ b/android/src/com/mapswithme/maps/routing/RoutingPlanInplaceController.java @@ -1,5 +1,6 @@ package com.mapswithme.maps.routing; +import android.os.Bundle; import android.view.View; import android.widget.Button; @@ -12,6 +13,10 @@ import com.mapswithme.util.statistics.Statistics; public class RoutingPlanInplaceController extends RoutingPlanController { + private static final String STATE_OPEN = "slots panel open"; + + private Boolean mSlotsRestoredState; + public RoutingPlanInplaceController(MwmActivity activity) { super(activity.findViewById(R.id.routing_plan_frame), activity); @@ -24,8 +29,11 @@ public class RoutingPlanInplaceController extends RoutingPlanController if (show) { - showSlots(!(RoutingController.get().getStartPoint() instanceof MapObject.MyPosition) || (RoutingController.get().getEndPoint() == null), - false); + boolean open = (mSlotsRestoredState == null ? !(RoutingController.get().getStartPoint() instanceof MapObject.MyPosition) || + (RoutingController.get().getEndPoint() == null) + : mSlotsRestoredState); + showSlots(open, false); + mSlotsRestoredState = null; } UiUtils.showIf(show, mFrame); @@ -55,4 +63,15 @@ public class RoutingPlanInplaceController extends RoutingPlanController } }); } + + public void onSaveState(Bundle outState) + { + outState.putBoolean(STATE_OPEN, isOpen()); + } + + public void restoreState(Bundle state) + { + if (state.containsKey(STATE_OPEN)) + mSlotsRestoredState = state.getBoolean(STATE_OPEN); + } }