Completata utilityFocus e dialog ask livello in Versamento
This commit is contained in:
parent
79d7f11eb5
commit
4f44148eee
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
3
app/fabric.properties
Normal file
3
app/fabric.properties
Normal 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
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -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);
|
||||
|
||||
@ -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<MtbDepoPosizione> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
new DialogAskLivelloPosizione(context, mtbDepoPosizione, onComplete, onFailed).mAlert.show();
|
||||
private boolean completedFLow = false;
|
||||
|
||||
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;
|
||||
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();
|
||||
}
|
||||
|
||||
38
app/src/main/res/layout/dialog_ask_livello_of_position.xml
Normal file
38
app/src/main/res/layout/dialog_ask_livello_of_position.xml
Normal 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>
|
||||
@ -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"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user