Migliorie nel KeyboardEmulatorBarcodeReader
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.expansion;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
@@ -18,7 +19,7 @@ import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
|
||||
public class BaseDialogFragment extends DialogFragment {
|
||||
public class BaseDialogFragment extends DialogFragment implements DialogInterface.OnShowListener {
|
||||
|
||||
@Inject
|
||||
public DialogProgressView mCurrentProgress;
|
||||
@@ -41,20 +42,7 @@ public class BaseDialogFragment extends DialogFragment {
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
MainApplication.appComponent
|
||||
.baseDialogFragmentComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||
getDialog().setOnKeyListener((dialog, keyCode, event) -> {
|
||||
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
public void onLoadingStarted() {
|
||||
@@ -107,4 +95,24 @@ public class BaseDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
MainApplication.appComponent
|
||||
.baseDialogFragmentComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator() && getDialog() != null) {
|
||||
getDialog().setOnKeyListener((dialog, keyCode, event) -> {
|
||||
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ public class DialogAskInfoInventarioView extends BaseDialogFragment {
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(cancelable);
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,7 @@ public class DialogScanGrigliaAcquistoView extends BaseDialogFragment {
|
||||
|
||||
var alertDialog = alertDialogBuilder.create();
|
||||
alertDialog.setCanceledOnTouchOutside(true);
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public class DialogBasketLUView extends BaseDialogFragment {
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(false);
|
||||
alertDialog.setOnShowListener(this);
|
||||
this.initViewPager(alertDialog);
|
||||
|
||||
return alertDialog;
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.view.LayoutInflater;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
@@ -15,12 +14,13 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.databinding.DialogChooseArtFromListaArtBinding;
|
||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||
|
||||
public class DialogChooseArtFromListaArtsView extends DialogFragment {
|
||||
public class DialogChooseArtFromListaArtsView extends BaseDialogFragment {
|
||||
|
||||
|
||||
private final List<MtbAart> mListaArts;
|
||||
@@ -47,6 +47,7 @@ public class DialogChooseArtFromListaArtsView extends DialogFragment {
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(false);
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ public class DialogChooseArtsFromMtbAartListView extends BaseDialogFragment impl
|
||||
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
super.onShow(dialogInterface);
|
||||
this.initList();
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +144,7 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
|
||||
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
super.onShow(dialogInterface);
|
||||
this.initList();
|
||||
this.initFilter();
|
||||
this.setupBarcode();
|
||||
|
||||
@@ -90,6 +90,7 @@ public class DialogInputPesoLUView extends BaseDialogFragment {
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(cancelable);
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,11 +103,12 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
||||
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
});
|
||||
|
||||
var alertDialog = new MaterialAlertDialogBuilder(requireContext())
|
||||
var alertDialog = new MaterialAlertDialogBuilder(requireContext())
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(false)
|
||||
.create();
|
||||
alertDialog.setCanceledOnTouchOutside(false);
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user