Fix su DialogProgressView.
Aggiunto barcodeUl nel caso venga battezzata un'etichetta anonima in DialogScanOrCreateLU.
This commit is contained in:
parent
dc38311125
commit
fe3a9d84d5
@ -3,6 +3,8 @@ package it.integry.integrywmsnative.view.dialogs;
|
||||
import android.app.Dialog;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@ -28,6 +30,9 @@ public class DialogProgressView extends DialogFragment {
|
||||
|
||||
private boolean progressOpened;
|
||||
|
||||
private final Handler handler = new Handler(Looper.getMainLooper());
|
||||
private boolean isPending = false;
|
||||
|
||||
public static DialogProgressView newInstance(String title, String subtitle, boolean indeterminate) {
|
||||
return new DialogProgressView(title, subtitle, indeterminate);
|
||||
}
|
||||
@ -50,8 +55,6 @@ public class DialogProgressView extends DialogFragment {
|
||||
mBindings.setTitle(UtilityString.isNullOrEmpty(title) ? requireContext().getString(R.string.loading) : title);
|
||||
if (!UtilityString.isNullOrEmpty(subtitle)) mBindings.setSubtitle(subtitle);
|
||||
|
||||
mBindings.progressBar.setIndeterminate(isIndeterminateProgress());
|
||||
if (!isIndeterminateProgress()) mBindings.progressBar.setMax(100);
|
||||
|
||||
var alertDialog = new MaterialAlertDialogBuilder(requireContext())
|
||||
.setView(mBindings.getRoot())
|
||||
@ -64,18 +67,31 @@ public class DialogProgressView extends DialogFragment {
|
||||
}
|
||||
|
||||
public void show(@NonNull FragmentManager manager) {
|
||||
if (!progressOpened && !isAdded() && !isInLayout()) {
|
||||
this.progressOpened = true;
|
||||
super.show(manager, "loading-dialog");
|
||||
if (isPending) return;
|
||||
|
||||
isPending = true;
|
||||
handler.postDelayed(() -> {
|
||||
try {
|
||||
if (!manager.isDestroyed() && !isAdded()) {
|
||||
manager.executePendingTransactions();
|
||||
showNow(manager, "loading-dialog");
|
||||
|
||||
mBindings.progressBar.setIndeterminate(isIndeterminateProgress());
|
||||
if (!isIndeterminateProgress()) mBindings.progressBar.setMax(100);
|
||||
}
|
||||
} finally {
|
||||
isPending = false;
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void dismiss() {
|
||||
if (isAdded() || isInLayout() || progressOpened) {
|
||||
this.progressOpened = false;
|
||||
super.dismissAllowingStateLoss();
|
||||
handler.post(() -> {
|
||||
if (isAdded()) {
|
||||
dismissAllowingStateLoss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
|
||||
@ -124,6 +124,7 @@ public class DialogScanOrCreateLUViewModel {
|
||||
}
|
||||
|
||||
var createUdcRequest = new CreateUDCRequestDTO()
|
||||
.setBarcodeUl(barcodeScanDTO.getStringValue())
|
||||
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep())
|
||||
.setNumCollo(customNumCollo)
|
||||
.setSerCollo(CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user