Completata utilityFocus e dialog ask livello in Versamento

This commit is contained in:
Gius95 2018-12-14 18:38:03 +01:00
parent 79d7f11eb5
commit 4f44148eee
7 changed files with 78 additions and 6 deletions

Binary file not shown.

3
app/fabric.properties Normal file
View File

@ -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

View File

@ -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);
}
}

View File

@ -210,7 +210,7 @@ public class VersamentoMerceViewModel {
private void updatePosizione(MtbDepoPosizione mtbDepoPosizione, boolean shouldAskLivello, ProgressDialog progressDialog) { private void updatePosizione(MtbDepoPosizione mtbDepoPosizione, boolean shouldAskLivello, ProgressDialog progressDialog) {
if(shouldAskLivello) { if(shouldAskLivello) {
DialogAskLivelloPosizione.make(mContext, mtbDepoPosizione, newPosizione -> { DialogAskLivelloPosizione.make(mContext, mtbDepoPosizione, false, newPosizione -> {
if(newPosizione == null) { if(newPosizione == null) {
updatePosizione(mtbDepoPosizione, shouldAskLivello, progressDialog); updatePosizione(mtbDepoPosizione, shouldAskLivello, progressDialog);

View File

@ -3,6 +3,7 @@ package it.integry.integrywmsnative.view.dialogs;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -14,6 +15,7 @@ import com.google.android.material.textfield.TextInputLayout;
import it.integry.integrywmsnative.R; import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbDepoPosizione; import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.utility.UtilityFocus;
import it.integry.integrywmsnative.core.utility.UtilityPosizione; import it.integry.integrywmsnative.core.utility.UtilityPosizione;
public class DialogAskLivelloPosizione { public class DialogAskLivelloPosizione {
@ -29,27 +31,36 @@ public class DialogAskLivelloPosizione {
private TextInputLayout livelloTextInputLayout; private TextInputLayout livelloTextInputLayout;
public static void make(Context context, MtbDepoPosizione mtbDepoPosizione, RunnableArgs<MtbDepoPosizione> onComplete, RunnableArgs<Exception> onFailed) { private boolean completedFLow = false;
new DialogAskLivelloPosizione(context, mtbDepoPosizione, onComplete, onFailed).mAlert.show();
public static void make(Context context, MtbDepoPosizione mtbDepoPosizione, boolean canAbort, RunnableArgs<MtbDepoPosizione> onComplete, RunnableArgs<Exception> onFailed) {
new DialogAskLivelloPosizione(context, mtbDepoPosizione, canAbort, onComplete, onFailed).mAlert.show();
} }
public DialogAskLivelloPosizione(Context context, MtbDepoPosizione mtbDepoPosizione, RunnableArgs<MtbDepoPosizione> onComplete, RunnableArgs<Exception> onFailed) { public DialogAskLivelloPosizione(Context context, MtbDepoPosizione mtbDepoPosizione, boolean canAbort, RunnableArgs<MtbDepoPosizione> onComplete, RunnableArgs<Exception> onFailed) {
mContext = context; mContext = context;
this.mtbDepoPosizione = mtbDepoPosizione; this.mtbDepoPosizione = mtbDepoPosizione;
this.onComplete = onComplete; this.onComplete = onComplete;
this.onFailed = onFailed; this.onFailed = onFailed;
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE ); 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 = new Dialog(mContext);
mAlert.setContentView(currentView); mAlert.setContentView(currentView);
mAlert.setCanceledOnTouchOutside(false); mAlert.setCanceledOnTouchOutside(false);
mAlert.setOnDismissListener(dialog -> {
if(!completedFLow) onComplete.run(null);
});
mAlert.setOnShowListener(dialog -> { mAlert.setOnShowListener(dialog -> {
if(!canAbort) currentView.findViewById(R.id.button_abort).setVisibility(View.GONE);
currentView.findViewById(R.id.button_confirm).setOnClickListener(v -> { currentView.findViewById(R.id.button_confirm).setOnClickListener(v -> {
String levelNumber = ((TextView)currentView.findViewById(R.id.level_number)).getText().toString(); String levelNumber = ((TextView)currentView.findViewById(R.id.level_number)).getText().toString();
onLevelConfirm(levelNumber); onLevelConfirm(levelNumber);
@ -61,6 +72,8 @@ public class DialogAskLivelloPosizione {
livelloTextInputLayout = currentView.findViewById(R.id.level_number_layout); livelloTextInputLayout = currentView.findViewById(R.id.level_number_layout);
UtilityFocus.focusTextBox(mContext, livelloTextInputLayout.getEditText());
livelloTextInputLayout.getEditText().addTextChangedListener(new TextWatcher() { livelloTextInputLayout.getEditText().addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -96,6 +109,7 @@ public class DialogAskLivelloPosizione {
if(foundPosizione != null) { if(foundPosizione != null) {
resetLevelError(); resetLevelError();
completedFLow = true;
onComplete.run(foundPosizione); onComplete.run(foundPosizione);
mAlert.dismiss(); mAlert.dismiss();
@ -126,6 +140,7 @@ public class DialogAskLivelloPosizione {
private void onLevelAbort() { private void onLevelAbort() {
completedFLow = true;
onComplete.run(null); onComplete.run(null);
mAlert.dismiss(); mAlert.dismiss();
} }

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="android.text.Html" />
<import type="it.integry.integrywmsnative.R" />
<variable
name="mContext"
type="android.content.Context" />
</data>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
android:layout_gravity="center">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Posizionamento"
style="@style/TextViewMaterial.DialogTitle"
android:gravity="center_horizontal"/>
<include
layout="@layout/dialog_ask_position_of_lu__page2" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</layout>

View File

@ -39,6 +39,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/Button.PrimaryOutline" style="@style/Button.PrimaryOutline"
app:icon="@drawable/ic_clear_24dp" app:icon="@drawable/ic_clear_24dp"
android:layout_marginEnd="8dp"
android:text="Annulla"/> android:text="Annulla"/>
@ -48,7 +49,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/Button.PrimaryFull" style="@style/Button.PrimaryFull"
app:icon="@drawable/ic_save_24dp" app:icon="@drawable/ic_save_24dp"
android:layout_marginStart="8dp"
android:text="Salva"/> android:text="Salva"/>
</LinearLayout> </LinearLayout>