Migliorata UI altri dialog.
This commit is contained in:
parent
bffa291cc6
commit
6ad55eef33
@ -315,6 +315,9 @@ public class VersamentoMerceViewModel {
|
||||
saveLUs(clonedSourceTestata, clonedDestTestata);
|
||||
}
|
||||
|
||||
}, () -> {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
}, () -> {
|
||||
@ -324,7 +327,7 @@ public class VersamentoMerceViewModel {
|
||||
}
|
||||
|
||||
|
||||
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete){
|
||||
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete, Runnable onAbort){
|
||||
|
||||
if(sourceMtbColrs.hasNext()){
|
||||
|
||||
@ -332,15 +335,15 @@ public class VersamentoMerceViewModel {
|
||||
|
||||
|
||||
destMtbColr.add(mtbColr);
|
||||
askQuantities(sourceMtbColrs, destMtbColr, onComplete);
|
||||
});
|
||||
askQuantities(sourceMtbColrs, destMtbColr, onComplete, onAbort);
|
||||
}, onAbort);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete) {
|
||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete, Runnable onAbort) {
|
||||
DialogInputQuantity.DTO dto = new DialogInputQuantity.DTO()
|
||||
.setBatchLot(mtbColr.getPartitaMag())
|
||||
.setDataScad(mtbColr.getDataScadPartitaD())
|
||||
@ -361,7 +364,7 @@ public class VersamentoMerceViewModel {
|
||||
.setDatetimeRow(new Date());
|
||||
|
||||
onComplete.run(mtbColr);
|
||||
}, null).show();
|
||||
}, onAbort).show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import java.util.List;
|
||||
@ -20,14 +24,14 @@ public class DialogChooseArtFromListaArts {
|
||||
|
||||
|
||||
private Context currentContext;
|
||||
private AlertDialog currentAlert;
|
||||
private Dialog mDialog;
|
||||
|
||||
private DialogChooseArtFromListaArtsAdapter currentAdapter;
|
||||
|
||||
private RunnableArgs<MtbAart> mOnItemChoosed;
|
||||
|
||||
public static AlertDialog make(final Context context, List<MtbAart> listaArts, RunnableArgs<MtbAart> onItemChoosed) {
|
||||
return new DialogChooseArtFromListaArts(context, listaArts, onItemChoosed).currentAlert;
|
||||
public static Dialog make(final Context context, List<MtbAart> listaArts, RunnableArgs<MtbAart> onItemChoosed) {
|
||||
return new DialogChooseArtFromListaArts(context, listaArts, onItemChoosed).mDialog;
|
||||
}
|
||||
|
||||
|
||||
@ -36,18 +40,16 @@ public class DialogChooseArtFromListaArts {
|
||||
mOnItemChoosed = onItemChoosed;
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||
DialogChooseArtFromListaArtBinding binding = DataBindingUtil.inflate(inflater, R.layout.dialog_choose_art_from_lista_art, null, false);
|
||||
DialogChooseArtFromListaArtBinding bindings = DataBindingUtil.inflate(inflater, R.layout.dialog_choose_art_from_lista_art, null, false);
|
||||
|
||||
mDialog = new Dialog(context);
|
||||
|
||||
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
|
||||
.setView(binding.getRoot())
|
||||
.setPositiveButton(context.getText(R.string.confirm), null)
|
||||
.setNegativeButton(context.getText(R.string.abort), null);
|
||||
mDialog.setContentView(bindings.getRoot());
|
||||
|
||||
currentAlert = alertDialog.create();
|
||||
currentAlert.setCanceledOnTouchOutside(false);
|
||||
mDialog.setCanceledOnTouchOutside(false);
|
||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
initRecyclerView(binding, listaArts);
|
||||
initRecyclerView(bindings, listaArts);
|
||||
}
|
||||
|
||||
private void initRecyclerView(DialogChooseArtFromListaArtBinding binding, List<MtbAart> dataset) {
|
||||
@ -70,7 +72,7 @@ public class DialogChooseArtFromListaArts {
|
||||
mOnItemChoosed.run(item);
|
||||
}
|
||||
|
||||
currentAlert.dismiss();
|
||||
mDialog.dismiss();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
@ -7,6 +8,9 @@ import androidx.core.content.ContextCompat;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
@ -21,15 +25,15 @@ import it.integry.integrywmsnative.databinding.DialogChooseArtsFromListaArtsLayo
|
||||
public class DialogChooseArtsFromListaArts {
|
||||
|
||||
private Context currentContext;
|
||||
private AlertDialog currentAlert;
|
||||
private Dialog mDialog;
|
||||
|
||||
private DialogChooseArtsFromListaArtsAdapter currentAdapter;
|
||||
|
||||
private RunnableArgs<List<MtbColr>> mOnItemsChoosed;
|
||||
private Runnable mOnAbort;
|
||||
|
||||
public static AlertDialog make(final Context context, List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
return new DialogChooseArtsFromListaArts(context, listaMtbColr, onItemsChoosed, onAbort).currentAlert;
|
||||
public static Dialog make(final Context context, List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
return new DialogChooseArtsFromListaArts(context, listaMtbColr, onItemsChoosed, onAbort).mDialog;
|
||||
}
|
||||
|
||||
|
||||
@ -51,17 +55,22 @@ public class DialogChooseArtsFromListaArts {
|
||||
|
||||
binding.emptyView.setVisibility(listaMtbColr != null && listaMtbColr.size() > 0 ? View.GONE : View.VISIBLE);
|
||||
|
||||
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
|
||||
.setView(binding.getRoot())
|
||||
.setPositiveButton(context.getText(R.string.confirm), (dialogInterface, i) -> {
|
||||
onPositiveClick();
|
||||
})
|
||||
.setNegativeButton(context.getText(R.string.abort), ((dialogInterface, i) -> {
|
||||
onNegativeClick();
|
||||
}));
|
||||
|
||||
currentAlert = alertDialog.create();
|
||||
currentAlert.setCanceledOnTouchOutside(false);
|
||||
mDialog = new Dialog(context);
|
||||
mDialog.setContentView(binding.getRoot());
|
||||
mDialog.setCanceledOnTouchOutside(false);
|
||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
|
||||
binding.positiveButton.setOnClickListener(v -> {
|
||||
mDialog.dismiss();
|
||||
onPositiveClick();
|
||||
});
|
||||
|
||||
binding.negativeButton.setOnClickListener(v -> {
|
||||
mDialog.dismiss();
|
||||
onNegativeClick();
|
||||
});
|
||||
|
||||
initRecyclerView(binding, listaMtbColr);
|
||||
}
|
||||
|
||||
@ -2,34 +2,65 @@
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/base_root"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
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:layout_margin="16dp">
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="22sp"
|
||||
android:text="@string/dialog_choose_art_from_lista_art"
|
||||
android:textStyle="normal"
|
||||
android:textColor="@android:color/black"
|
||||
android:layout_marginBottom="12dp"/>
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/dialog_choose_art_from_lista_art__main_list"
|
||||
<RelativeLayout
|
||||
android:id="@+id/title_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="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: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/dialog_choose_art_from_lista_art"
|
||||
android:gravity="center_horizontal"/>
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/dialog_choose_art_from_lista_art__main_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</layout>
|
||||
@ -23,7 +23,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:checked="@{checkableMtbColr.checked}"/>
|
||||
|
||||
@ -93,7 +92,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
@ -2,64 +2,135 @@
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/base_root"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
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:layout_margin="16dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="22sp"
|
||||
android:text="@string/dialog_choose_arts_from_lista_art"
|
||||
android:textStyle="normal"
|
||||
android:textColor="@android:color/black"
|
||||
android:layout_marginBottom="12dp"/>
|
||||
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/title_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/light_blue_300"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/empty_view"
|
||||
android:layout_width="match_parent"
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/title_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no_item_to_pick_text"
|
||||
android:textSize="20sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/empty_view_gray"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/dialog_choose_arts_from_lista_art__main_list"
|
||||
android:layout_width="match_parent"
|
||||
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: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/dialog_choose_arts_from_lista_art"
|
||||
android:gravity="center_horizontal"/>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/empty_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no_item_to_pick_text"
|
||||
android:textSize="20sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/empty_view_gray"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/dialog_choose_arts_from_lista_art__main_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<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_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/negative_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Button.PrimaryOutline"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
||||
android:text="@string/abort"/>
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/positive_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Button.PrimaryFull"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/center_guideline"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:text="@string/confirm"/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</layout>
|
||||
@ -119,11 +119,11 @@
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/create_new_lu_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Button.PrimaryFull"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
app:layout_constraintHeight_default="wrap"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/ok_left_buttons_guideline"
|
||||
app:layout_constraintEnd_toEndOf="@id/ok_right_buttons_guideline"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user