mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
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:
parent
d62afa141f
commit
0c98f5958a
1 changed files with 7 additions and 0 deletions
|
|
@ -116,6 +116,13 @@ public class DialogUtil {
|
||||||
final Runnable onNegativeBtnClick,
|
final Runnable onNegativeBtnClick,
|
||||||
View customView,
|
View customView,
|
||||||
boolean cancelable) {
|
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);
|
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||||
builder.setTitle(title);
|
builder.setTitle(title);
|
||||||
builder.setMessage(message);
|
builder.setMessage(message);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue