Do not create another dialog with the same custom view - reuse the old one (#3097)

* Clear parent from customView if parent is not null

* Do not create a new dialog when a dialog with a custom view already exists on resume

* remove debug code from dialog custom view parent investigation

* Add rest file

* Didn't mean to add that test file
This commit is contained in:
Alicia 2019-11-21 08:55:21 -05:00 committed by neslihanturan
parent d62afa141f
commit 0c98f5958a

View file

@ -116,6 +116,13 @@ public class DialogUtil {
final Runnable onNegativeBtnClick,
View customView,
boolean cancelable) {
// If the custom view already has a parent, there is already a dialog showing with the view
// This happens for on resume - return to avoid creating a second dialog - the first one
// will still show
if (customView != null && customView.getParent() != null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(title);
builder.setMessage(message);