From 4f44148eee002455e6d1007e0fb35c5be4c973e9 Mon Sep 17 00:00:00 2001 From: Gius95 Date: Fri, 14 Dec 2018 18:38:03 +0100 Subject: [PATCH] Completata utilityFocus e dialog ask livello in Versamento --- .idea/caches/build_file_checksums.ser | Bin 728 -> 728 bytes app/fabric.properties | 3 ++ .../core/utility/UtilityFocus.java | 16 ++++++++ .../viewmodel/VersamentoMerceViewModel.java | 2 +- .../dialogs/DialogAskLivelloPosizione.java | 23 +++++++++-- .../layout/dialog_ask_livello_of_position.xml | 38 ++++++++++++++++++ .../dialog_ask_position_of_lu__page2.xml | 2 +- 7 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 app/fabric.properties create mode 100644 app/src/main/java/it/integry/integrywmsnative/core/utility/UtilityFocus.java create mode 100644 app/src/main/res/layout/dialog_ask_livello_of_position.xml diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 8fcff77447642535cca8c675dfc1619215853d98..2da3dea5c38916c524fe351bb0412598ea3b6bf0 100644 GIT binary patch delta 14 Wcmcb?dV_VsOy { + 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"/>