[android] - check if hosting Activity isn't finishing before showing an dialog

This commit is contained in:
Tobrun
2018-02-19 19:08:07 +01:00
committed by Tobrun
parent 0fe1219bfd
commit 54c3fcdec8

View File

@@ -1,5 +1,6 @@
package com.mapbox.mapboxsdk.maps;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
@@ -49,7 +50,17 @@ class AttributionDialogManager implements View.OnClickListener, DialogInterface.
@Override
public void onClick(View view) {
attributionSet = new AttributionBuilder(mapboxMap).build();
showAttributionDialog();
boolean isActivityFinishing = false;
if (context instanceof Activity) {
isActivityFinishing = ((Activity) context).isFinishing();
}
// check is hosting activity isn't finishing
// https://github.com/mapbox/mapbox-gl-native/issues/11238
if (!isActivityFinishing) {
showAttributionDialog();
}
}
private void showAttributionDialog() {