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;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@ -12,31 +13,32 @@ import it.integry.integrywmsnative.databinding.DialogAskShouldPrintBinding;
|
||||
|
||||
public class DialogAskShouldPrint {
|
||||
|
||||
private AlertDialog currentAlert;
|
||||
private Dialog currentDialog;
|
||||
|
||||
public static AlertDialog make(final Context context, final String nomeEtichetta, RunnableArgs<Boolean> onDialogDismiss) {
|
||||
return new DialogAskShouldPrint(context, nomeEtichetta, onDialogDismiss).currentAlert;
|
||||
public static Dialog make(final Context context, final String nomeEtichettaEN, RunnableArgs<Boolean> onDialogDismiss) {
|
||||
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 );
|
||||
DialogAskShouldPrintBinding bindings = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_should_print, null, false);
|
||||
|
||||
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
|
||||
.setView(bindings.getRoot());
|
||||
currentDialog = new Dialog(context);
|
||||
currentDialog.setContentView(bindings.getRoot());
|
||||
|
||||
currentAlert = alertDialog.create();
|
||||
currentAlert.setCanceledOnTouchOutside(false);
|
||||
currentDialog.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 -> {
|
||||
currentAlert.dismiss();
|
||||
currentDialog.dismiss();
|
||||
onDialogDismiss.run(true);
|
||||
});
|
||||
|
||||
bindings.buttonAbort.setOnClickListener(v -> {
|
||||
currentAlert.dismiss();
|
||||
currentDialog.dismiss();
|
||||
onDialogDismiss.run(false);
|
||||
});
|
||||
|
||||
|
||||
@ -1,87 +1,177 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
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"
|
||||
android:padding="16dp"
|
||||
android:layout_gravity="center">
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
<RelativeLayout
|
||||
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:background="@color/light_blue_300"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/print_message"
|
||||
<ImageView
|
||||
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"/>
|
||||
android:src="@drawable/ic_error_white_24dp"
|
||||
android:layout_margin="24dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="8dp"
|
||||
android:gravity="bottom|center_horizontal">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="24dp"
|
||||
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
|
||||
android:id="@+id/button_abort"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Button.PrimaryOutline"
|
||||
app:icon="@drawable/ic_clear_24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="@android:string/no"/>
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
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
|
||||
android:id="@+id/button_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Button.PrimaryFull"
|
||||
app:icon="@drawable/ic_print_24dp"
|
||||
android:text="@android:string/yes"/>
|
||||
</LinearLayout>
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
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>
|
||||
|
||||
|
||||
</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>
|
||||
@ -192,4 +192,5 @@
|
||||
<string name="no">No</string>
|
||||
|
||||
<string name="placement">Posizionamento</string>
|
||||
<string name="message_print_packing_list">Verrà stampata una %s</string>
|
||||
</resources>
|
||||
@ -196,5 +196,6 @@
|
||||
<string name="no">No</string>
|
||||
|
||||
<string name="placement">Placement</string>
|
||||
<string name="message_print_packing_list">A %s will be printed</string>
|
||||
|
||||
</resources>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user