Implementato nuovo dialog per la creazione/apertura di una UL
This commit is contained in:
parent
d26483aa3e
commit
d433d1a22c
@ -1,9 +1,13 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.scan_or_create_lu;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.text.SpannableString;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -33,7 +37,7 @@ public class DialogScanOrCreateLU {
|
||||
|
||||
private Context currentContext;
|
||||
|
||||
private AlertDialog currentAlert;
|
||||
private Dialog mDialog;
|
||||
|
||||
private DialogScanOrCreateLuBinding mBinding;
|
||||
|
||||
@ -42,12 +46,12 @@ public class DialogScanOrCreateLU {
|
||||
private MtbColt currentMtbColt;
|
||||
|
||||
|
||||
public static AlertDialog make(final Context context, RunnableArgs<MtbColt> onDialogDismiss) {
|
||||
return new DialogScanOrCreateLU(context, false, onDialogDismiss).currentAlert;
|
||||
public static Dialog make(final Context context, RunnableArgs<MtbColt> onDialogDismiss) {
|
||||
return new DialogScanOrCreateLU(context, false, onDialogDismiss).mDialog;
|
||||
}
|
||||
|
||||
public static AlertDialog make(final Context context, boolean disableCreation, RunnableArgs<MtbColt> onDialogDismiss) {
|
||||
return new DialogScanOrCreateLU(context, disableCreation, onDialogDismiss).currentAlert;
|
||||
public static Dialog make(final Context context, boolean disableCreation, RunnableArgs<MtbColt> onDialogDismiss) {
|
||||
return new DialogScanOrCreateLU(context, disableCreation, onDialogDismiss).mDialog;
|
||||
}
|
||||
|
||||
private DialogScanOrCreateLU(Context context, boolean disableCreation, RunnableArgs<MtbColt> onDialogDismiss) {
|
||||
@ -62,11 +66,11 @@ public class DialogScanOrCreateLU {
|
||||
|
||||
if(disableCreation) mBinding.dialogScanOrCreateLuCreationLayout.setVisibility(View.GONE);
|
||||
|
||||
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
|
||||
.setView(mBinding.getRoot());
|
||||
|
||||
currentAlert = alertDialog.create();
|
||||
currentAlert.setCanceledOnTouchOutside(false);
|
||||
mDialog = new Dialog(context);
|
||||
mDialog.setContentView(mBinding.getRoot());
|
||||
mDialog.setCanceledOnTouchOutside(false);
|
||||
// mDialog.setCancelable(false);
|
||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
init(onDialogDismiss);
|
||||
initBarcode(context);
|
||||
@ -93,7 +97,7 @@ public class DialogScanOrCreateLU {
|
||||
.setOnScanSuccessfull(onScanSuccessfull)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(context, ex, false)));
|
||||
|
||||
currentAlert.setOnDismissListener(dialog -> {
|
||||
mDialog.setOnDismissListener(dialog -> {
|
||||
BarcodeManager.removeCallback(barcodeIstanceID);
|
||||
BarcodeManager.enable();
|
||||
if(currentMtbColt == null) {
|
||||
@ -244,7 +248,7 @@ public class DialogScanOrCreateLU {
|
||||
private void sendMtbColt(MtbColt mtbColtToSend, ProgressDialog progressDialog) {
|
||||
currentMtbColt = mtbColtToSend;
|
||||
progressDialog.dismiss();
|
||||
currentAlert.dismiss();
|
||||
mDialog.dismiss();
|
||||
mOnDialogDismiss.run(mtbColtToSend);
|
||||
}
|
||||
|
||||
|
||||
@ -1,16 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layout>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/base_root"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
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:id="@+id/title_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/light_blue_300"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/title_icon"
|
||||
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:layout_margin="16dp">
|
||||
android:padding="24dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/TextViewMaterial.DialogTitle"
|
||||
android:text="@string/title_open_lu"
|
||||
android:gravity="center_horizontal"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -42,27 +85,54 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="OPPURE"
|
||||
tools:text="OPPURE"/>
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="OPPURE" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/create_new_lu_button"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/ok_left_buttons_guideline"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="Crea nuova UL"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/white"
|
||||
android:backgroundTint="@color/blue_700"/>
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.15"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/ok_right_buttons_guideline"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.85"/>
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/create_new_lu_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
style="@style/Button.PrimaryFull"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
app:layout_constraintHeight_default="wrap"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/ok_left_buttons_guideline"
|
||||
app:layout_constraintEnd_toEndOf="@id/ok_right_buttons_guideline"
|
||||
android:text="@string/button_create_new_ul"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@ -193,4 +193,6 @@
|
||||
|
||||
<string name="placement">Posizionamento</string>
|
||||
<string name="message_print_packing_list">Verrà stampata una %s</string>
|
||||
<string name="button_create_new_ul">Crea nuova UL</string>
|
||||
<string name="title_open_lu">Apri UL</string>
|
||||
</resources>
|
||||
@ -197,5 +197,7 @@
|
||||
|
||||
<string name="placement">Placement</string>
|
||||
<string name="message_print_packing_list">A %s will be printed</string>
|
||||
<string name="button_create_new_ul">Create new LU</string>
|
||||
<string name="title_open_lu">Open LU</string>
|
||||
|
||||
</resources>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user