[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 374bad18c0
commit 17e5ae84af

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;
@@ -48,7 +49,17 @@ public class AttributionDialogManager implements View.OnClickListener, DialogInt
@Override
public void onClick(View view) {
attributionSet = new AttributionBuilder(mapboxMap).build();
showAttributionDialog(getAttributionTitles());
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(getAttributionTitles());
}
}
protected void showAttributionDialog(String[] attributionTitles) {