Migliorata UI altri dialog.
This commit is contained in:
@@ -315,6 +315,9 @@ public class VersamentoMerceViewModel {
|
||||
saveLUs(clonedSourceTestata, clonedDestTestata);
|
||||
}
|
||||
|
||||
}, () -> {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
}, () -> {
|
||||
@@ -324,7 +327,7 @@ public class VersamentoMerceViewModel {
|
||||
}
|
||||
|
||||
|
||||
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete){
|
||||
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete, Runnable onAbort){
|
||||
|
||||
if(sourceMtbColrs.hasNext()){
|
||||
|
||||
@@ -332,15 +335,15 @@ public class VersamentoMerceViewModel {
|
||||
|
||||
|
||||
destMtbColr.add(mtbColr);
|
||||
askQuantities(sourceMtbColrs, destMtbColr, onComplete);
|
||||
});
|
||||
askQuantities(sourceMtbColrs, destMtbColr, onComplete, onAbort);
|
||||
}, onAbort);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete) {
|
||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete, Runnable onAbort) {
|
||||
DialogInputQuantity.DTO dto = new DialogInputQuantity.DTO()
|
||||
.setBatchLot(mtbColr.getPartitaMag())
|
||||
.setDataScad(mtbColr.getDataScadPartitaD())
|
||||
@@ -361,7 +364,7 @@ public class VersamentoMerceViewModel {
|
||||
.setDatetimeRow(new Date());
|
||||
|
||||
onComplete.run(mtbColr);
|
||||
}, null).show();
|
||||
}, onAbort).show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import java.util.List;
|
||||
@@ -20,14 +24,14 @@ public class DialogChooseArtFromListaArts {
|
||||
|
||||
|
||||
private Context currentContext;
|
||||
private AlertDialog currentAlert;
|
||||
private Dialog mDialog;
|
||||
|
||||
private DialogChooseArtFromListaArtsAdapter currentAdapter;
|
||||
|
||||
private RunnableArgs<MtbAart> mOnItemChoosed;
|
||||
|
||||
public static AlertDialog make(final Context context, List<MtbAart> listaArts, RunnableArgs<MtbAart> onItemChoosed) {
|
||||
return new DialogChooseArtFromListaArts(context, listaArts, onItemChoosed).currentAlert;
|
||||
public static Dialog make(final Context context, List<MtbAart> listaArts, RunnableArgs<MtbAart> onItemChoosed) {
|
||||
return new DialogChooseArtFromListaArts(context, listaArts, onItemChoosed).mDialog;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,18 +40,16 @@ public class DialogChooseArtFromListaArts {
|
||||
mOnItemChoosed = onItemChoosed;
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||
DialogChooseArtFromListaArtBinding binding = DataBindingUtil.inflate(inflater, R.layout.dialog_choose_art_from_lista_art, null, false);
|
||||
DialogChooseArtFromListaArtBinding bindings = DataBindingUtil.inflate(inflater, R.layout.dialog_choose_art_from_lista_art, null, false);
|
||||
|
||||
mDialog = new Dialog(context);
|
||||
|
||||
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
|
||||
.setView(binding.getRoot())
|
||||
.setPositiveButton(context.getText(R.string.confirm), null)
|
||||
.setNegativeButton(context.getText(R.string.abort), null);
|
||||
mDialog.setContentView(bindings.getRoot());
|
||||
|
||||
currentAlert = alertDialog.create();
|
||||
currentAlert.setCanceledOnTouchOutside(false);
|
||||
mDialog.setCanceledOnTouchOutside(false);
|
||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
initRecyclerView(binding, listaArts);
|
||||
initRecyclerView(bindings, listaArts);
|
||||
}
|
||||
|
||||
private void initRecyclerView(DialogChooseArtFromListaArtBinding binding, List<MtbAart> dataset) {
|
||||
@@ -70,7 +72,7 @@ public class DialogChooseArtFromListaArts {
|
||||
mOnItemChoosed.run(item);
|
||||
}
|
||||
|
||||
currentAlert.dismiss();
|
||||
mDialog.dismiss();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
@@ -7,6 +8,9 @@ import androidx.core.content.ContextCompat;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
@@ -21,15 +25,15 @@ import it.integry.integrywmsnative.databinding.DialogChooseArtsFromListaArtsLayo
|
||||
public class DialogChooseArtsFromListaArts {
|
||||
|
||||
private Context currentContext;
|
||||
private AlertDialog currentAlert;
|
||||
private Dialog mDialog;
|
||||
|
||||
private DialogChooseArtsFromListaArtsAdapter currentAdapter;
|
||||
|
||||
private RunnableArgs<List<MtbColr>> mOnItemsChoosed;
|
||||
private Runnable mOnAbort;
|
||||
|
||||
public static AlertDialog make(final Context context, List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
return new DialogChooseArtsFromListaArts(context, listaMtbColr, onItemsChoosed, onAbort).currentAlert;
|
||||
public static Dialog make(final Context context, List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
return new DialogChooseArtsFromListaArts(context, listaMtbColr, onItemsChoosed, onAbort).mDialog;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,17 +55,22 @@ public class DialogChooseArtsFromListaArts {
|
||||
|
||||
binding.emptyView.setVisibility(listaMtbColr != null && listaMtbColr.size() > 0 ? View.GONE : View.VISIBLE);
|
||||
|
||||
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
|
||||
.setView(binding.getRoot())
|
||||
.setPositiveButton(context.getText(R.string.confirm), (dialogInterface, i) -> {
|
||||
onPositiveClick();
|
||||
})
|
||||
.setNegativeButton(context.getText(R.string.abort), ((dialogInterface, i) -> {
|
||||
onNegativeClick();
|
||||
}));
|
||||
|
||||
currentAlert = alertDialog.create();
|
||||
currentAlert.setCanceledOnTouchOutside(false);
|
||||
mDialog = new Dialog(context);
|
||||
mDialog.setContentView(binding.getRoot());
|
||||
mDialog.setCanceledOnTouchOutside(false);
|
||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
|
||||
binding.positiveButton.setOnClickListener(v -> {
|
||||
mDialog.dismiss();
|
||||
onPositiveClick();
|
||||
});
|
||||
|
||||
binding.negativeButton.setOnClickListener(v -> {
|
||||
mDialog.dismiss();
|
||||
onNegativeClick();
|
||||
});
|
||||
|
||||
initRecyclerView(binding, listaMtbColr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user