Has result

This commit is contained in:
M66B 2021-12-27 08:40:22 +01:00
parent 00052d727d
commit af4afe82ab
1 changed files with 6 additions and 5 deletions

View File

@ -35,9 +35,10 @@ import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleRegistry; import androidx.lifecycle.LifecycleRegistry;
import static android.app.Activity.RESULT_CANCELED; import static android.app.Activity.RESULT_CANCELED;
import static android.app.Activity.RESULT_OK;
public class FragmentDialogBase extends DialogFragment { public class FragmentDialogBase extends DialogFragment {
private boolean once = false; private boolean hasResult = false;
private LifecycleOwner owner; private LifecycleOwner owner;
private LifecycleRegistry registry; private LifecycleRegistry registry;
private String targetRequestKey; private String targetRequestKey;
@ -179,7 +180,7 @@ public class FragmentDialogBase extends DialogFragment {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
once = false; hasResult = false;
targetRequestCode = requestCode; targetRequestCode = requestCode;
} }
@ -187,10 +188,10 @@ public class FragmentDialogBase extends DialogFragment {
EntityLog.log(getContext(), "Sending key=" + targetRequestKey + EntityLog.log(getContext(), "Sending key=" + targetRequestKey +
" request=" + targetRequestCode + " request=" + targetRequestCode +
" result=" + resultCode + " result=" + resultCode +
" once=" + once); " has=" + hasResult);
if (!once) { if (!hasResult || resultCode == RESULT_OK) {
once = true; hasResult = true;
if (targetRequestKey != null) { if (targetRequestKey != null) {
Bundle args = getArguments(); Bundle args = getArguments();