diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 8fcff774..2da3dea5 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/app/fabric.properties b/app/fabric.properties new file mode 100644 index 00000000..a5ea8df3 --- /dev/null +++ b/app/fabric.properties @@ -0,0 +1,3 @@ +#Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public. +#Fri Dec 14 18:24:49 CET 2018 +apiSecret=694052ca79122b4f8c307250f3b0df47afec8483f87957b0c73ec32a21b24516 diff --git a/app/src/main/java/it/integry/integrywmsnative/core/utility/UtilityFocus.java b/app/src/main/java/it/integry/integrywmsnative/core/utility/UtilityFocus.java new file mode 100644 index 00000000..93d47c27 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/core/utility/UtilityFocus.java @@ -0,0 +1,16 @@ +package it.integry.integrywmsnative.core.utility; + +import android.content.Context; +import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; + +public class UtilityFocus { + + public static void focusTextBox(Context context, EditText editTextToFocus) { + editTextToFocus.requestFocus(); + + InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.showSoftInput(editTextToFocus, InputMethodManager.SHOW_IMPLICIT); + } + +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/versamento_merce/viewmodel/VersamentoMerceViewModel.java b/app/src/main/java/it/integry/integrywmsnative/gest/versamento_merce/viewmodel/VersamentoMerceViewModel.java index fa015eac..3a761688 100644 --- a/app/src/main/java/it/integry/integrywmsnative/gest/versamento_merce/viewmodel/VersamentoMerceViewModel.java +++ b/app/src/main/java/it/integry/integrywmsnative/gest/versamento_merce/viewmodel/VersamentoMerceViewModel.java @@ -210,7 +210,7 @@ public class VersamentoMerceViewModel { private void updatePosizione(MtbDepoPosizione mtbDepoPosizione, boolean shouldAskLivello, ProgressDialog progressDialog) { if(shouldAskLivello) { - DialogAskLivelloPosizione.make(mContext, mtbDepoPosizione, newPosizione -> { + DialogAskLivelloPosizione.make(mContext, mtbDepoPosizione, false, newPosizione -> { if(newPosizione == null) { updatePosizione(mtbDepoPosizione, shouldAskLivello, progressDialog); diff --git a/app/src/main/java/it/integry/integrywmsnative/view/dialogs/DialogAskLivelloPosizione.java b/app/src/main/java/it/integry/integrywmsnative/view/dialogs/DialogAskLivelloPosizione.java index 764d53ea..ef2f27c7 100644 --- a/app/src/main/java/it/integry/integrywmsnative/view/dialogs/DialogAskLivelloPosizione.java +++ b/app/src/main/java/it/integry/integrywmsnative/view/dialogs/DialogAskLivelloPosizione.java @@ -3,6 +3,7 @@ package it.integry.integrywmsnative.view.dialogs; import android.app.Dialog; import android.content.Context; +import android.content.DialogInterface; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; @@ -14,6 +15,7 @@ import com.google.android.material.textfield.TextInputLayout; import it.integry.integrywmsnative.R; import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.model.MtbDepoPosizione; +import it.integry.integrywmsnative.core.utility.UtilityFocus; import it.integry.integrywmsnative.core.utility.UtilityPosizione; public class DialogAskLivelloPosizione { @@ -29,27 +31,36 @@ public class DialogAskLivelloPosizione { private TextInputLayout livelloTextInputLayout; - public static void make(Context context, MtbDepoPosizione mtbDepoPosizione, RunnableArgs onComplete, RunnableArgs onFailed) { - new DialogAskLivelloPosizione(context, mtbDepoPosizione, onComplete, onFailed).mAlert.show(); + private boolean completedFLow = false; + + public static void make(Context context, MtbDepoPosizione mtbDepoPosizione, boolean canAbort, RunnableArgs onComplete, RunnableArgs onFailed) { + new DialogAskLivelloPosizione(context, mtbDepoPosizione, canAbort, onComplete, onFailed).mAlert.show(); } - public DialogAskLivelloPosizione(Context context, MtbDepoPosizione mtbDepoPosizione, RunnableArgs onComplete, RunnableArgs onFailed) { + public DialogAskLivelloPosizione(Context context, MtbDepoPosizione mtbDepoPosizione, boolean canAbort, RunnableArgs onComplete, RunnableArgs onFailed) { mContext = context; this.mtbDepoPosizione = mtbDepoPosizione; this.onComplete = onComplete; this.onFailed = onFailed; LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE ); - View currentView = inflater.inflate(R.layout.dialog_ask_position_of_lu__page2, null, false); + View currentView = inflater.inflate(R.layout.dialog_ask_livello_of_position, null, false); mAlert = new Dialog(mContext); mAlert.setContentView(currentView); mAlert.setCanceledOnTouchOutside(false); + mAlert.setOnDismissListener(dialog -> { + if(!completedFLow) onComplete.run(null); + }); + mAlert.setOnShowListener(dialog -> { + if(!canAbort) currentView.findViewById(R.id.button_abort).setVisibility(View.GONE); + + currentView.findViewById(R.id.button_confirm).setOnClickListener(v -> { String levelNumber = ((TextView)currentView.findViewById(R.id.level_number)).getText().toString(); onLevelConfirm(levelNumber); @@ -61,6 +72,8 @@ public class DialogAskLivelloPosizione { livelloTextInputLayout = currentView.findViewById(R.id.level_number_layout); + + UtilityFocus.focusTextBox(mContext, livelloTextInputLayout.getEditText()); livelloTextInputLayout.getEditText().addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -96,6 +109,7 @@ public class DialogAskLivelloPosizione { if(foundPosizione != null) { resetLevelError(); + completedFLow = true; onComplete.run(foundPosizione); mAlert.dismiss(); @@ -126,6 +140,7 @@ public class DialogAskLivelloPosizione { private void onLevelAbort() { + completedFLow = true; onComplete.run(null); mAlert.dismiss(); } diff --git a/app/src/main/res/layout/dialog_ask_livello_of_position.xml b/app/src/main/res/layout/dialog_ask_livello_of_position.xml new file mode 100644 index 00000000..4b7705d1 --- /dev/null +++ b/app/src/main/res/layout/dialog_ask_livello_of_position.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_ask_position_of_lu__page2.xml b/app/src/main/res/layout/dialog_ask_position_of_lu__page2.xml index 3de83695..e421bc3e 100644 --- a/app/src/main/res/layout/dialog_ask_position_of_lu__page2.xml +++ b/app/src/main/res/layout/dialog_ask_position_of_lu__page2.xml @@ -39,6 +39,7 @@ android:layout_height="wrap_content" style="@style/Button.PrimaryOutline" app:icon="@drawable/ic_clear_24dp" + android:layout_marginEnd="8dp" android:text="Annulla"/> @@ -48,7 +49,6 @@ android:layout_height="wrap_content" style="@style/Button.PrimaryFull" app:icon="@drawable/ic_save_24dp" - android:layout_marginStart="8dp" android:text="Salva"/>