forked from organicmaps/organicmaps
[android] Don’t cancel routing when building status code NEED_MORE_MAPS
This commit is contained in:
parent
a613b2e59f
commit
56755fd80a
4 changed files with 20 additions and 6 deletions
|
@ -41,6 +41,7 @@ abstract class BaseRoutingErrorDialogFragment extends BaseMwmDialogFragment
|
|||
|
||||
private boolean mCancelRoute = true;
|
||||
boolean mCancelled;
|
||||
boolean mNeedMoreMaps;
|
||||
|
||||
void beforeDialogCreated(AlertDialog.Builder builder) {}
|
||||
void bindGroup(View view) {}
|
||||
|
@ -85,9 +86,12 @@ abstract class BaseRoutingErrorDialogFragment extends BaseMwmDialogFragment
|
|||
@Override
|
||||
public void onDismiss(DialogInterface dialog)
|
||||
{
|
||||
if (mCancelled && mCancelRoute)
|
||||
if (!mNeedMoreMaps && mCancelled && mCancelRoute)
|
||||
RoutingController.get().cancel();
|
||||
|
||||
if (mNeedMoreMaps && mCancelled)
|
||||
RoutingController.get().finishBuild();
|
||||
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
|
|
|
@ -111,4 +111,9 @@ class ResultCodesHelper
|
|||
resultCode == NEED_MORE_MAPS ||
|
||||
(resultCode == ROUTE_NOT_FOUND && missingCount > 0));
|
||||
}
|
||||
|
||||
static boolean isNeedMoreMaps(int resultCode)
|
||||
{
|
||||
return resultCode == NEED_MORE_MAPS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,11 +123,7 @@ public class RoutingController
|
|||
mContainsCachedResult = true;
|
||||
|
||||
if (mLastResultCode == ResultCodesHelper.NO_ERROR)
|
||||
{
|
||||
mCachedRoutingInfo = Framework.nativeGetRouteFollowingInfo();
|
||||
setBuildState(BuildState.BUILT);
|
||||
mLastBuildProgress = 100;
|
||||
}
|
||||
finishBuild();
|
||||
|
||||
processRoutingEvent();
|
||||
}
|
||||
|
@ -135,6 +131,13 @@ public class RoutingController
|
|||
}
|
||||
};
|
||||
|
||||
void finishBuild()
|
||||
{
|
||||
mCachedRoutingInfo = Framework.nativeGetRouteFollowingInfo();
|
||||
setBuildState(BuildState.BUILT);
|
||||
mLastBuildProgress = 100;
|
||||
}
|
||||
|
||||
@SuppressWarnings("FieldCanBeLocal")
|
||||
private final Framework.RoutingProgressListener mRoutingProgressListener = new Framework.RoutingProgressListener()
|
||||
{
|
||||
|
|
|
@ -34,6 +34,8 @@ public class RoutingErrorDialogFragment extends BaseRoutingErrorDialogFragment
|
|||
|
||||
if (ResultCodesHelper.isDownloadable(mResultCode, mMissingMaps.size()))
|
||||
builder.setPositiveButton(R.string.download, null);
|
||||
|
||||
mNeedMoreMaps = ResultCodesHelper.isNeedMoreMaps(mResultCode);
|
||||
}
|
||||
|
||||
private View addMessage(View frame)
|
||||
|
|
Loading…
Add table
Reference in a new issue