Skip to content

Commit

Permalink
dismiss listener bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
VirtCode committed Sep 21, 2021
1 parent c649b8e commit 3321318
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {

created();
});
dialog.setOnDismissListener(dismissListener);

return dialog;
}
Expand All @@ -106,8 +105,9 @@ public void onDismiss(@NonNull DialogInterface dialog) {
if (bluetoothHandler.getDiscoverer().isScanning()) bluetoothHandler.getDiscoverer().stopDiscovery();

super.onDismiss(dialog);
}

dismissListener.onDismiss(dialog);
}

/**
* This method gets called when the dialog is shown.
Expand Down Expand Up @@ -281,6 +281,7 @@ public void onNext(){
case SUCCESS_STATE:
case ALREADY_STATE:
dismiss();
onDismiss(getDialog());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ public void setOnDismissListener(DialogInterface.OnDismissListener dismissListen
this.dismissListener = dismissListener;
}

@Override
public void onDismiss(@NonNull DialogInterface dialog) {
super.onDismiss(dialog);

dismissListener.onDismiss(dialog);
}

@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
Expand All @@ -78,7 +85,6 @@ public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {

Dialog dialog = builder.create();
dialog.setTitle(R.string.dialog_info_title);
dialog.setOnDismissListener(dismissListener);

return dialog;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.view.LayoutInflater;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
Expand Down Expand Up @@ -83,8 +84,13 @@ public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
created();
});

dialog.setOnDismissListener(finishedListener);

return dialog;
}

@Override
public void onDismiss(@NonNull DialogInterface dialog) {
super.onDismiss(dialog);

finishedListener.onDismiss(dialog);
}
}

0 comments on commit 3321318

Please sign in to comment.