Implementata nuova UI su dialog di stampa etichette.
This commit is contained in:
parent
4862e1356f
commit
3fca04605c
@ -1,10 +1,11 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.ask_should_print;
|
package it.integry.integrywmsnative.view.dialogs.ask_should_print;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
@ -12,31 +13,32 @@ import it.integry.integrywmsnative.databinding.DialogAskShouldPrintBinding;
|
|||||||
|
|
||||||
public class DialogAskShouldPrint {
|
public class DialogAskShouldPrint {
|
||||||
|
|
||||||
private AlertDialog currentAlert;
|
private Dialog currentDialog;
|
||||||
|
|
||||||
public static AlertDialog make(final Context context, final String nomeEtichetta, RunnableArgs<Boolean> onDialogDismiss) {
|
public static Dialog make(final Context context, final String nomeEtichettaEN, RunnableArgs<Boolean> onDialogDismiss) {
|
||||||
return new DialogAskShouldPrint(context, nomeEtichetta, onDialogDismiss).currentAlert;
|
return new DialogAskShouldPrint(context, nomeEtichettaEN, onDialogDismiss).currentDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DialogAskShouldPrint(Context context, String nomeEtichetta, RunnableArgs<Boolean> onDialogDismiss) {
|
private DialogAskShouldPrint(Context context, String nomeEtichettaEN, RunnableArgs<Boolean> onDialogDismiss) {
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||||
DialogAskShouldPrintBinding bindings = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_should_print, null, false);
|
DialogAskShouldPrintBinding bindings = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_should_print, null, false);
|
||||||
|
|
||||||
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
|
currentDialog = new Dialog(context);
|
||||||
.setView(bindings.getRoot());
|
currentDialog.setContentView(bindings.getRoot());
|
||||||
|
|
||||||
currentAlert = alertDialog.create();
|
currentDialog.setCanceledOnTouchOutside(false);
|
||||||
currentAlert.setCanceledOnTouchOutside(false);
|
currentDialog.setCancelable(false);
|
||||||
|
currentDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
bindings.printMessage.setText("La procedura stamperà una " + nomeEtichetta);
|
bindings.descriptionText.setText(String.format(context.getResources().getString(R.string.message_print_packing_list), nomeEtichettaEN));
|
||||||
|
|
||||||
bindings.buttonConfirm.setOnClickListener(v -> {
|
bindings.buttonConfirm.setOnClickListener(v -> {
|
||||||
currentAlert.dismiss();
|
currentDialog.dismiss();
|
||||||
onDialogDismiss.run(true);
|
onDialogDismiss.run(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
bindings.buttonAbort.setOnClickListener(v -> {
|
bindings.buttonAbort.setOnClickListener(v -> {
|
||||||
currentAlert.dismiss();
|
currentDialog.dismiss();
|
||||||
onDialogDismiss.run(false);
|
onDialogDismiss.run(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,87 +1,177 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<layout>
|
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
android:orientation="vertical" android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
android:layout_gravity="center_horizontal"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
app:cardCornerRadius="12dp"
|
||||||
|
app:cardElevation="0dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
android:padding="16dp"
|
|
||||||
android:layout_gravity="center">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/action_print"
|
android:background="@color/light_blue_300"
|
||||||
style="@style/TextViewMaterial.DialogTitle"
|
|
||||||
android:gravity="center_horizontal"/>
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:gravity="center_horizontal">
|
android:gravity="center_horizontal">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<ImageView
|
||||||
android:id="@+id/print_message"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="16dp"
|
android:src="@drawable/ic_error_white_24dp"
|
||||||
style="@style/TextInputLayout.OutlinePrimary"
|
android:layout_margin="24dp"/>
|
||||||
android:textColor="#5F6368"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
tools:text="La procedura stamperà una packing list"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="vertical"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="24dp"
|
||||||
android:gravity="bottom|center_horizontal">
|
android:paddingLeft="24dp"
|
||||||
|
android:paddingRight="24dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/TextViewMaterial.DialogTitle"
|
||||||
|
android:text="@string/action_print"
|
||||||
|
android:gravity="center_horizontal"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/description_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/TextViewMaterial"
|
||||||
|
android:text="@string/message_print_packing_list"
|
||||||
|
android:gravity="left"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginBottom="16dp" />
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Guideline
|
||||||
|
android:id="@+id/center_buttons_guideline"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintGuide_percent="0.5"/>
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/button_abort"
|
android:id="@+id/button_abort"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/Button.PrimaryOutline"
|
style="@style/Button.PrimaryOutline"
|
||||||
app:icon="@drawable/ic_clear_24dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginRight="8dp"
|
||||||
android:text="@android:string/no"/>
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/center_buttons_guideline"
|
||||||
|
android:text="@string/no"/>
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/button_confirm"
|
android:id="@+id/button_confirm"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/Button.PrimaryFull"
|
style="@style/Button.PrimaryFull"
|
||||||
app:icon="@drawable/ic_print_24dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:text="@android:string/yes"/>
|
android:layout_marginRight="8dp"
|
||||||
</LinearLayout>
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/center_buttons_guideline"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:text="@string/yes"/>
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<!--<androidx.appcompat.widget.AppCompatTextView-->
|
||||||
|
<!--android:layout_width="match_parent"-->
|
||||||
|
<!--android:layout_height="wrap_content"-->
|
||||||
|
<!--android:text="@string/action_print"-->
|
||||||
|
<!--style="@style/TextViewMaterial.DialogTitle"-->
|
||||||
|
<!--android:gravity="center_horizontal"/>-->
|
||||||
|
|
||||||
|
|
||||||
|
<!--<LinearLayout-->
|
||||||
|
<!--android:orientation="vertical"-->
|
||||||
|
<!--android:layout_width="match_parent"-->
|
||||||
|
<!--android:layout_height="match_parent"-->
|
||||||
|
<!--android:padding="16dp">-->
|
||||||
|
|
||||||
|
<!--<LinearLayout-->
|
||||||
|
<!--android:layout_width="match_parent"-->
|
||||||
|
<!--android:layout_height="match_parent"-->
|
||||||
|
<!--android:orientation="horizontal"-->
|
||||||
|
<!--android:gravity="center_horizontal">-->
|
||||||
|
|
||||||
|
<!--<androidx.appcompat.widget.AppCompatTextView-->
|
||||||
|
<!--android:id="@+id/print_message"-->
|
||||||
|
<!--android:layout_width="wrap_content"-->
|
||||||
|
<!--android:layout_height="wrap_content"-->
|
||||||
|
<!--android:layout_margin="16dp"-->
|
||||||
|
<!--style="@style/TextInputLayout.OutlinePrimary"-->
|
||||||
|
<!--android:textColor="#5F6368"-->
|
||||||
|
<!--android:textSize="16sp"-->
|
||||||
|
<!--android:layout_gravity="center"-->
|
||||||
|
<!--android:gravity="center_horizontal"-->
|
||||||
|
<!--tools:text="La procedura stamperà una packing list"/>-->
|
||||||
|
|
||||||
|
<!--</LinearLayout>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--<LinearLayout-->
|
||||||
|
<!--android:layout_width="match_parent"-->
|
||||||
|
<!--android:layout_height="match_parent"-->
|
||||||
|
<!--android:orientation="horizontal"-->
|
||||||
|
<!--android:paddingTop="8dp"-->
|
||||||
|
<!--android:gravity="bottom|center_horizontal">-->
|
||||||
|
|
||||||
|
|
||||||
|
<!--<com.google.android.material.button.MaterialButton-->
|
||||||
|
<!--android:id="@+id/button_abort"-->
|
||||||
|
<!--android:layout_width="wrap_content"-->
|
||||||
|
<!--android:layout_height="wrap_content"-->
|
||||||
|
<!--style="@style/Button.PrimaryOutline"-->
|
||||||
|
<!--app:icon="@drawable/ic_clear_24dp"-->
|
||||||
|
<!--android:layout_marginEnd="8dp"-->
|
||||||
|
<!--android:text="@android:string/no"/>-->
|
||||||
|
|
||||||
|
|
||||||
|
<!--<com.google.android.material.button.MaterialButton-->
|
||||||
|
<!--android:id="@+id/button_confirm"-->
|
||||||
|
<!--android:layout_width="wrap_content"-->
|
||||||
|
<!--android:layout_height="wrap_content"-->
|
||||||
|
<!--style="@style/Button.PrimaryFull"-->
|
||||||
|
<!--app:icon="@drawable/ic_print_24dp"-->
|
||||||
|
<!--android:text="@android:string/yes"/>-->
|
||||||
|
<!--</LinearLayout>-->
|
||||||
|
|
||||||
|
<!--</LinearLayout>-->
|
||||||
|
|
||||||
|
<!--</LinearLayout>-->
|
||||||
|
<!--</androidx.cardview.widget.CardView>-->
|
||||||
|
|
||||||
</layout>
|
</layout>
|
||||||
@ -192,4 +192,5 @@
|
|||||||
<string name="no">No</string>
|
<string name="no">No</string>
|
||||||
|
|
||||||
<string name="placement">Posizionamento</string>
|
<string name="placement">Posizionamento</string>
|
||||||
|
<string name="message_print_packing_list">Verrà stampata una %s</string>
|
||||||
</resources>
|
</resources>
|
||||||
@ -196,5 +196,6 @@
|
|||||||
<string name="no">No</string>
|
<string name="no">No</string>
|
||||||
|
|
||||||
<string name="placement">Placement</string>
|
<string name="placement">Placement</string>
|
||||||
|
<string name="message_print_packing_list">A %s will be printed</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user