[Documenti interni]
gestito annullamento selezione righe da modificare
This commit is contained in:
parent
28501c5509
commit
ab6eeb91a6
@ -26,7 +26,9 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.databinding.DialogSelectDocRowsBinding;
|
||||
import it.integry.integrywmsnative.databinding.DialogSelectDocRowsItemModelBinding;
|
||||
|
||||
/** @noinspection rawtypes*/
|
||||
/**
|
||||
* @noinspection rawtypes
|
||||
*/
|
||||
public class DialogSelectDocRowsView extends BaseDialogFragment {
|
||||
|
||||
|
||||
@ -76,8 +78,16 @@ public class DialogSelectDocRowsView extends BaseDialogFragment {
|
||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(isCancelable())
|
||||
.setPositiveButton(R.string.confirm, null)
|
||||
.setNegativeButton(R.string.abort, null)
|
||||
.setPositiveButton(R.string.confirm, (dialog, which) -> {
|
||||
final DialogSelectDocRowsItemListModel<Object> selectedItem = Stream.of(listArts)
|
||||
.filter(x -> x.getChecked().get())
|
||||
.findFirstOrElse(null);
|
||||
if (selectedItem != null)
|
||||
this.onConfirm.run(selectedItem);
|
||||
})
|
||||
.setNegativeButton(R.string.abort, (dialog, which) -> {
|
||||
if (this.onAbort != null) this.onAbort.run();
|
||||
})
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||
@ -93,19 +103,6 @@ public class DialogSelectDocRowsView extends BaseDialogFragment {
|
||||
this.initRecyclerView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
|
||||
final DialogSelectDocRowsItemListModel<Object> selectedItem = Stream.of(listArts)
|
||||
.filter(x -> x.getChecked().get())
|
||||
.findFirstOrElse(null);
|
||||
|
||||
if(selectedItem != null)
|
||||
this.onConfirm.run(selectedItem);
|
||||
else this.onAbort.run();
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
var itemType = new Type<DialogSelectDocRowsItemListModel, DialogSelectDocRowsItemModelBinding>(R.layout.dialog_select_doc_rows__item_model, BR.row);
|
||||
// itemType.areItemSame((oldItem, newItem) -> Objects.equals(oldItem.getId(), newItem.getId()));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user