forked from organicmaps/organicmaps
[android] Fix a crash on rotation when location dialog is displayed
Closes #4570 Signed-off-by: Roman Tsisyk <roman@tsisyk.com>
This commit is contained in:
parent
e49708808e
commit
d4bf7a73da
2 changed files with 10 additions and 4 deletions
|
@ -1028,6 +1028,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
||||||
if (mOnmapDownloader != null)
|
if (mOnmapDownloader != null)
|
||||||
mOnmapDownloader.onPause();
|
mOnmapDownloader.onPause();
|
||||||
mNavigationController.onActivityPaused(this);
|
mNavigationController.onActivityPaused(this);
|
||||||
|
LocationHelper.INSTANCE.closeLocationDialog();
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,13 @@ public enum LocationHelper implements Initializable<Context>, AppBackgroundTrack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void closeLocationDialog()
|
||||||
|
{
|
||||||
|
if (mErrorDialog != null && mErrorDialog.isShowing())
|
||||||
|
mErrorDialog.dismiss();
|
||||||
|
mErrorDialog = null;
|
||||||
|
}
|
||||||
|
|
||||||
void notifyCompassUpdated(double north)
|
void notifyCompassUpdated(double north)
|
||||||
{
|
{
|
||||||
mSavedNorth = north;
|
mSavedNorth = north;
|
||||||
|
@ -179,8 +186,7 @@ public enum LocationHelper implements Initializable<Context>, AppBackgroundTrack
|
||||||
if (mSavedLocation == null)
|
if (mSavedLocation == null)
|
||||||
throw new IllegalStateException("No saved location");
|
throw new IllegalStateException("No saved location");
|
||||||
|
|
||||||
if (mErrorDialog != null && mErrorDialog.isShowing())
|
closeLocationDialog();
|
||||||
mErrorDialog.dismiss();
|
|
||||||
|
|
||||||
for (LocationListener listener : mListeners)
|
for (LocationListener listener : mListeners)
|
||||||
listener.onLocationUpdated(mSavedLocation);
|
listener.onLocationUpdated(mSavedLocation);
|
||||||
|
@ -250,8 +256,7 @@ public enum LocationHelper implements Initializable<Context>, AppBackgroundTrack
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel our dialog in favor of system dialog.
|
// Cancel our dialog in favor of system dialog.
|
||||||
if (mErrorDialog != null && mErrorDialog.isShowing())
|
closeLocationDialog();
|
||||||
mErrorDialog.dismiss();
|
|
||||||
|
|
||||||
// Launch system permission resolution dialog.
|
// Launch system permission resolution dialog.
|
||||||
IntentSenderRequest intentSenderRequest = new IntentSenderRequest.Builder(pendingIntent.getIntentSender())
|
IntentSenderRequest intentSenderRequest = new IntentSenderRequest.Builder(pendingIntent.getIntentSender())
|
||||||
|
|
Loading…
Add table
Reference in a new issue