[SAPORI VERI]
- Implementata ricerca testuale dei codici in griglia - bug fix aggiornamento errato articoli in update da griglia - bug fix i terminali in emulazione di tastiera non funzionano perchè il deviceId = 0
This commit is contained in:
parent
a0ca2488c7
commit
b0bbea7caa
55
.idea/runConfigurations/app_base.xml
generated
Normal file
55
.idea/runConfigurations/app_base.xml
generated
Normal file
@ -0,0 +1,55 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="app_base" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
|
||||
<module name="app" />
|
||||
<option name="DEPLOY" value="true" />
|
||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||
<option name="ARTIFACT_NAME" value="" />
|
||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="dynamic_frudis,dynamic_ime,dynamic_saporiveri_pv,dynamic_vgalimenti" />
|
||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||
<option name="MODE" value="default_activity" />
|
||||
<option name="CLEAR_LOGCAT" value="true" />
|
||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
||||
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
|
||||
<option name="FORCE_STOP_RUNNING_APP" value="true" />
|
||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
|
||||
<option name="PREFERRED_AVD" value="" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||
<option name="DEBUGGER_TYPE" value="Auto" />
|
||||
<Auto>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Auto>
|
||||
<Hybrid>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Hybrid>
|
||||
<Java />
|
||||
<Native>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Native>
|
||||
<Profilers>
|
||||
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
|
||||
</Profilers>
|
||||
<option name="DEEP_LINK" value="" />
|
||||
<option name="ACTIVITY_CLASS" value="" />
|
||||
<method v="2">
|
||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
55
.idea/runConfigurations/app_frudis.xml
generated
Normal file
55
.idea/runConfigurations/app_frudis.xml
generated
Normal file
@ -0,0 +1,55 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="app_frudis" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
|
||||
<module name="app" />
|
||||
<option name="DEPLOY" value="true" />
|
||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||
<option name="ARTIFACT_NAME" value="" />
|
||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="dynamic__base,dynamic_ime,dynamic_saporiveri_pv,dynamic_vgalimenti" />
|
||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||
<option name="MODE" value="default_activity" />
|
||||
<option name="CLEAR_LOGCAT" value="true" />
|
||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
||||
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
|
||||
<option name="FORCE_STOP_RUNNING_APP" value="true" />
|
||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
|
||||
<option name="PREFERRED_AVD" value="" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||
<option name="DEBUGGER_TYPE" value="Auto" />
|
||||
<Auto>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Auto>
|
||||
<Hybrid>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Hybrid>
|
||||
<Java />
|
||||
<Native>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Native>
|
||||
<Profilers>
|
||||
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
|
||||
</Profilers>
|
||||
<option name="DEEP_LINK" value="" />
|
||||
<option name="ACTIVITY_CLASS" value="" />
|
||||
<method v="2">
|
||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
55
.idea/runConfigurations/app_ime.xml
generated
Normal file
55
.idea/runConfigurations/app_ime.xml
generated
Normal file
@ -0,0 +1,55 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="app_ime" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
|
||||
<module name="app" />
|
||||
<option name="DEPLOY" value="true" />
|
||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||
<option name="ARTIFACT_NAME" value="" />
|
||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="dynamic__base,dynamic_frudis,dynamic_saporiveri_pv,dynamic_vgalimenti" />
|
||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||
<option name="MODE" value="default_activity" />
|
||||
<option name="CLEAR_LOGCAT" value="true" />
|
||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
||||
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
|
||||
<option name="FORCE_STOP_RUNNING_APP" value="true" />
|
||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
|
||||
<option name="PREFERRED_AVD" value="" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||
<option name="DEBUGGER_TYPE" value="Auto" />
|
||||
<Auto>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Auto>
|
||||
<Hybrid>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Hybrid>
|
||||
<Java />
|
||||
<Native>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Native>
|
||||
<Profilers>
|
||||
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
|
||||
</Profilers>
|
||||
<option name="DEEP_LINK" value="" />
|
||||
<option name="ACTIVITY_CLASS" value="" />
|
||||
<method v="2">
|
||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
55
.idea/runConfigurations/app_vglimenti.xml
generated
Normal file
55
.idea/runConfigurations/app_vglimenti.xml
generated
Normal file
@ -0,0 +1,55 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="app_vglimenti" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
|
||||
<module name="app" />
|
||||
<option name="DEPLOY" value="true" />
|
||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||
<option name="ARTIFACT_NAME" value="" />
|
||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="dynamic__base,dynamic_frudis,dynamic_ime,dynamic_saporiveri_pv" />
|
||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||
<option name="MODE" value="default_activity" />
|
||||
<option name="CLEAR_LOGCAT" value="true" />
|
||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
||||
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
|
||||
<option name="FORCE_STOP_RUNNING_APP" value="true" />
|
||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
|
||||
<option name="PREFERRED_AVD" value="" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||
<option name="DEBUGGER_TYPE" value="Auto" />
|
||||
<Auto>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Auto>
|
||||
<Hybrid>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Hybrid>
|
||||
<Java />
|
||||
<Native>
|
||||
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
|
||||
<option name="SHOW_STATIC_VARS" value="true" />
|
||||
<option name="WORKING_DIR" value="" />
|
||||
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
|
||||
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
|
||||
</Native>
|
||||
<Profilers>
|
||||
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
||||
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Sample Java Methods" />
|
||||
</Profilers>
|
||||
<option name="DEEP_LINK" value="" />
|
||||
<option name="ACTIVITY_CLASS" value="" />
|
||||
<method v="2">
|
||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
@ -100,6 +100,7 @@ public class BarcodeManager {
|
||||
}
|
||||
|
||||
public static boolean onKeyDown(int keyCode, KeyEvent keyEvent){
|
||||
if (mCurrentBarcodeInterface != null)
|
||||
mCurrentBarcodeInterface.onKeyEvent(keyEvent);
|
||||
return true;
|
||||
}
|
||||
@ -152,6 +153,7 @@ public class BarcodeManager {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static boolean isKeyboardEmulator() {
|
||||
return mCurrentBarcodeInterface instanceof KeyboardEmulatorBarcodeReader;
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,4 +33,7 @@ public interface ArticoloGrigliaDao {
|
||||
|
||||
@Query("SELECT * FROM articoli_griglia WHERE (cod_mart = :scan OR bar_code =:scan )AND id_griglia = :idGriglia LIMIT 1")
|
||||
ArticoloGriglia findArticoloByScanAndGriglia(String scan, int idGriglia);
|
||||
|
||||
@Query("SELECT articolo_griglia_id FROM articoli_griglia WHERE (cod_mart = :codMart AND bar_code =:barCode )AND id_griglia = :idGriglia LIMIT 1")
|
||||
Integer getIdArticoloByGrigliaAndBarcodeAndCodMart(int idGriglia, String barCode, String codMart);
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ public class ArticoliGrigliaRepository extends Repository{
|
||||
List<ArticoloGriglia> toUpdate = new ArrayList<>();
|
||||
List<ArticoloGriglia> toInsert = new ArrayList<>();
|
||||
for (ArticoloGriglia art : articoli){
|
||||
Integer id = mRepository.getIdArticoloByGrigliaAndCodMart(art.getIdGriglia(),art.getCodMart());
|
||||
Integer id = mRepository.getIdArticoloByGrigliaAndBarcodeAndCodMart(art.getIdGriglia(),art.getBarCode(),art.getCodMart());
|
||||
if (id != null){
|
||||
art.setArticoloGrigliaId(id);
|
||||
toUpdate.add(art);
|
||||
|
||||
@ -11,11 +11,10 @@ public class BaseActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (event.getDeviceId() != -1 && event.getDeviceId() != 0) {
|
||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
@ -2,26 +2,42 @@ package it.integry.integrywmsnative.core.expansion;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.pointmobilescannerlibrary.PointMobileBarcodeReader;
|
||||
|
||||
public class BaseDialog extends Dialog {
|
||||
|
||||
private boolean mBarcodeListener = false;
|
||||
|
||||
public BaseDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()){
|
||||
setOnKeyListener((dialog, keyCode, event) -> {
|
||||
if (mBarcodeListener && event.getAction() == KeyEvent.ACTION_DOWN && !isControlKey(event)) {
|
||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (event.getDeviceId() != -1 && event.getDeviceId() != 0 && event.getAction() == KeyEvent.ACTION_DOWN){
|
||||
BarcodeManager.onKeyDown(event.getKeyCode(),event);
|
||||
return false;
|
||||
}
|
||||
return super.dispatchKeyEvent(event);
|
||||
private boolean isControlKey(KeyEvent keyEvent) {
|
||||
int keyCode = keyEvent.getKeyCode();
|
||||
return (
|
||||
keyCode == KeyEvent.KEYCODE_BACK ||
|
||||
keyCode == KeyEvent.KEYCODE_SHIFT_LEFT
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
public void setBarcodeListener(boolean listen) {
|
||||
this.mBarcodeListener = listen;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.context.MainContext;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityWindow;
|
||||
|
||||
@ -34,6 +34,7 @@ import it.integry.integrywmsnative.view.dialogs.DialogAskAction;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.EditArticoloDialog;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper.PVEditOrderHelper;
|
||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
||||
|
||||
public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
||||
@ -219,4 +220,23 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
||||
|
||||
}
|
||||
|
||||
public void manualSearch(){
|
||||
BarcodeManager.disable();
|
||||
DialogSimpleInputHelper.makeInputDialog(this,"Inserisci il codice a barre/codice articolo da cercare",codice->{
|
||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(this);
|
||||
mhelper.checkArticolo(
|
||||
mOrdine,
|
||||
codice,
|
||||
articoloOrdine -> {
|
||||
progress.dismiss();
|
||||
addArticolo(articoloOrdine);
|
||||
},
|
||||
e -> {
|
||||
progress.dismiss();
|
||||
handleException(e);
|
||||
}
|
||||
);
|
||||
}, BarcodeManager::enable).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,8 +3,10 @@ package it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
@ -26,7 +28,7 @@ public class DialogScanLisA {
|
||||
|
||||
private Activity mContext;
|
||||
|
||||
private Dialog mDialog;
|
||||
private BaseDialog mDialog;
|
||||
|
||||
private DialogScanCodiceGrigliaBinding mBinding;
|
||||
|
||||
@ -55,12 +57,15 @@ public class DialogScanLisA {
|
||||
return new DialogScanLisA(context, onDialogDismiss).mDialog;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void initBarcode() {
|
||||
|
||||
int barcodeIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessfull)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(mContext, ex, false)));
|
||||
|
||||
mDialog.setBarcodeListener(true);
|
||||
mDialog.setOnDismissListener(dialog -> {
|
||||
BarcodeManager.removeCallback(barcodeIstanceID);
|
||||
BarcodeManager.enable();
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.base;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Window;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||
import it.integry.integrywmsnative.databinding.DialogBaseBinding;
|
||||
import it.integry.integrywmsnative.databinding.DialogInputGeneralBinding;
|
||||
|
||||
/**
|
||||
* Created by GiuseppeS on 22/03/2018.
|
||||
*/
|
||||
|
||||
public class DialogSimpleInputHelper {
|
||||
|
||||
|
||||
private static Dialog makeBase(Context mContext, String titleText, RunnableArgs<String> onPositiveClick, Runnable onNegativeClick){
|
||||
Dialog dialog = new Dialog(mContext);
|
||||
DialogSimpleInputViewModel viewModel = new DialogSimpleInputViewModel(dialog);
|
||||
|
||||
|
||||
|
||||
DialogInputGeneralBinding mBinding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.dialog_input_general, null, false);
|
||||
viewModel
|
||||
.setOnPositive(()->{
|
||||
|
||||
onPositiveClick.run(mBinding.generalInput.getText().toString());
|
||||
})
|
||||
.setOnNegative(onNegativeClick);
|
||||
|
||||
mBinding.setViewmodel(viewModel);
|
||||
|
||||
//Title VIEW
|
||||
mBinding.titleText.setText(titleText);
|
||||
ColorStateList colorStateList = ColorStateList.valueOf(Color.WHITE);
|
||||
|
||||
//Content View
|
||||
dialog.setCancelable(true);
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
dialog.setContentView(mBinding.getRoot());
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
UtilityDialog.setTo90PercentSize(mContext,dialog);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
public static Dialog makeInputDialog(Context mContext, String title, RunnableArgs<String> onPositiveClick, Runnable onNegativeClick){
|
||||
|
||||
return makeBase(mContext,
|
||||
title,
|
||||
onPositiveClick,
|
||||
onNegativeClick);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.base;
|
||||
|
||||
import android.app.Dialog;
|
||||
|
||||
public class DialogSimpleInputViewModel {
|
||||
|
||||
|
||||
private Dialog mDialog;
|
||||
private Runnable onPositive;
|
||||
private Runnable onNegative;
|
||||
|
||||
|
||||
public DialogSimpleInputViewModel(Dialog dialog) {
|
||||
mDialog = dialog;
|
||||
}
|
||||
|
||||
public DialogSimpleInputViewModel setOnPositive(Runnable onPositive) {
|
||||
this.onPositive = onPositive;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DialogSimpleInputViewModel setOnNegative(Runnable onNegative) {
|
||||
this.onNegative = onNegative;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean isPositiveVisible() {
|
||||
return onPositive != null;
|
||||
}
|
||||
|
||||
|
||||
public boolean isNegativeVisible() {
|
||||
return onNegative != null;
|
||||
}
|
||||
|
||||
|
||||
public void onPositiveClick() {
|
||||
mDialog.dismiss();
|
||||
if(onPositive != null) onPositive.run();
|
||||
}
|
||||
public void onNegativeClick() {
|
||||
mDialog.dismiss();
|
||||
if(onNegative != null) onNegative.run();
|
||||
}
|
||||
}
|
||||
@ -52,13 +52,16 @@
|
||||
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
|
||||
android:layout_gravity="start" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/toolbar_tools"
|
||||
<androidx.appcompat.widget.AppCompatImageButton
|
||||
android:id="@+id/add_extra_items_toolbar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="modifica ordine"
|
||||
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
|
||||
android:layout_gravity="end" />
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="end"
|
||||
android:background="@drawable/ripple_effect"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/ic_search_black_24dp"
|
||||
android:onClick="@{()->viewModel.manualSearch()}"
|
||||
android:tint="@color/colorPrimaryGray"/>
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
</it.integry.integrywmsnative.ui.ElevatedToolbar>
|
||||
|
||||
142
app/src/main/res/layout/dialog_input_general.xml
Normal file
142
app/src/main/res/layout/dialog_input_general.xml
Normal file
@ -0,0 +1,142 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<data>
|
||||
<variable
|
||||
name="viewmodel"
|
||||
type="it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/light_blue_300"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_error_white_24dp"
|
||||
android:layout_margin="24dp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/TextViewMaterial.DialogTitle"
|
||||
tools:text="Insert here"
|
||||
android:gravity="center_horizontal"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp">
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guide_left"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.10"/>
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guide_right"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.90"/>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/level_number_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/guide_left"
|
||||
app:layout_constraintEnd_toStartOf="@id/guide_right"
|
||||
android:layout_marginBottom="16dp"
|
||||
style="@style/TextInputLayout.OutlinePrimary">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/general_input"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:hint="input here"
|
||||
style="@style/TextInputEditText.OutlinePrimary"/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:gravity="bottom|center_horizontal">
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_abort"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Button.PrimaryOutline"
|
||||
app:icon="@drawable/ic_clear_24dp"
|
||||
android:onClick="@{() -> viewmodel.onNegativeClick()}"
|
||||
app:strokeColor="@color/colorPrimary"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="@string/abort"/>
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Button.PrimaryFull"
|
||||
app:icon="@drawable/ic_save_24dp"
|
||||
android:onClick="@{() -> viewmodel.onPositiveClick()}"
|
||||
android:text="@string/confirm"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</layout>
|
||||
@ -62,7 +62,9 @@ public class KeyboardEmulatorBarcodeReader implements BarcodeReaderInterface {
|
||||
if (keyEvent.getKeyCode() != KeyEvent.KEYCODE_ENTER){
|
||||
if (keyEvent.getKeyCode() != KeyEvent.KEYCODE_SHIFT_LEFT){
|
||||
mLastCharInsertTime =keyEvent.getEventTime();
|
||||
mTextBarcode+= (char) keyEvent.getUnicodeChar();
|
||||
if (keyEvent.getUnicodeChar() > 0){
|
||||
mTextBarcode+= (char) keyEvent.getUnicodeChar();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (mTextBarcode.length() > 0){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user