Implementate diverse utility
This commit is contained in:
parent
08c99aaac0
commit
45acf00660
@ -12,6 +12,7 @@ import com.orhanobut.logger.Logger;
|
||||
import it.integry.integrywmsnative.core.REST.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.settings.Stash;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
||||
|
||||
public class MainApplication extends Application {
|
||||
@ -29,6 +30,8 @@ public class MainApplication extends Application {
|
||||
SettingsManager.init(this);
|
||||
ServerStatusChecker.init();
|
||||
|
||||
UtilityResources.init(this);
|
||||
|
||||
Logger.addLogAdapter(new AndroidLogAdapter());
|
||||
|
||||
res = getResources();
|
||||
|
||||
@ -14,4 +14,14 @@ public class CommonConst {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class Mail {
|
||||
|
||||
public static String[] forErrors = {
|
||||
// "syslogs@integry.it",
|
||||
"g.scorrano@integry.it"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,14 +1,21 @@
|
||||
package it.integry.integrywmsnative.core.REST.consumers;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.REST.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.REST.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.REST.model.EsitoType;
|
||||
import it.integry.integrywmsnative.core.REST.model.MailDTO;
|
||||
import it.integry.integrywmsnative.core.REST.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@ -57,4 +64,40 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void sendErrorLogMail(String message) {
|
||||
|
||||
|
||||
MailDTO mailDTO = new MailDTO()
|
||||
.setFrom("sender@integry.it")
|
||||
.setFromName("WMS Android")
|
||||
.setTo(TextUtils.join(";", CommonConst.Mail.forErrors))
|
||||
.setSubject("Bug notification")
|
||||
.setMsgText(message)
|
||||
.setHtml(true);
|
||||
|
||||
sendMail(mailDTO, null, ex -> {
|
||||
Log.e(SystemRESTConsumer.class.getName(), "", ex);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void sendMail(MailDTO mailDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||
service.sendMail(mailDTO).enqueue(new Callback<ServiceRESTResponse<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<String>> call, Response<ServiceRESTResponse<String>> response) {
|
||||
if(onComplete != null) onComplete.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<String>> call, Throwable t) {
|
||||
if(onFailed != null) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,9 +3,12 @@ package it.integry.integrywmsnative.core.REST.consumers;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.REST.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.REST.model.MailDTO;
|
||||
import it.integry.integrywmsnative.core.REST.model.ServiceRESTResponse;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface SystemRESTConsumerService {
|
||||
@ -16,4 +19,7 @@ public interface SystemRESTConsumerService {
|
||||
@GET("getAvailableCodMdepsForUser")
|
||||
Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> getAvailableCodMdeps();
|
||||
|
||||
@POST("sendEmail")
|
||||
Call<ServiceRESTResponse<String>> sendMail(@Body MailDTO mailDto);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,115 @@
|
||||
package it.integry.integrywmsnative.core.REST.model;
|
||||
|
||||
public class MailDTO {
|
||||
|
||||
private String from;
|
||||
private String fromName;
|
||||
private String to;
|
||||
private String replyTo;
|
||||
private String replyToName;
|
||||
private String cc;
|
||||
private String ccn;
|
||||
private String subject;
|
||||
private String msgText;
|
||||
private boolean isHtml = false;
|
||||
private boolean isDebug = false;
|
||||
|
||||
public String getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public MailDTO setFrom(String from) {
|
||||
this.from = from;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFromName() {
|
||||
return fromName;
|
||||
}
|
||||
|
||||
public MailDTO setFromName(String fromName) {
|
||||
this.fromName = fromName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
public MailDTO setTo(String to) {
|
||||
this.to = to;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getReplyTo() {
|
||||
return replyTo;
|
||||
}
|
||||
|
||||
public MailDTO setReplyTo(String replyTo) {
|
||||
this.replyTo = replyTo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getReplyToName() {
|
||||
return replyToName;
|
||||
}
|
||||
|
||||
public MailDTO setReplyToName(String replyToName) {
|
||||
this.replyToName = replyToName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCc() {
|
||||
return cc;
|
||||
}
|
||||
|
||||
public MailDTO setCc(String cc) {
|
||||
this.cc = cc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCcn() {
|
||||
return ccn;
|
||||
}
|
||||
|
||||
public MailDTO setCcn(String ccn) {
|
||||
this.ccn = ccn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public MailDTO setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMsgText() {
|
||||
return msgText;
|
||||
}
|
||||
|
||||
public MailDTO setMsgText(String msgText) {
|
||||
this.msgText = msgText;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isHtml() {
|
||||
return isHtml;
|
||||
}
|
||||
|
||||
public MailDTO setHtml(boolean html) {
|
||||
isHtml = html;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isDebug() {
|
||||
return isDebug;
|
||||
}
|
||||
|
||||
public MailDTO setDebug(boolean debug) {
|
||||
isDebug = debug;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.expansion;
|
||||
|
||||
public interface RunnableArgs<T> {
|
||||
|
||||
void run(T data);
|
||||
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.REST.consumers.SystemRESTConsumer;
|
||||
import okhttp3.internal.Util;
|
||||
|
||||
public class UtilityLogger {
|
||||
|
||||
public static void logMe(String message){
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void errorMe(Exception ex) {
|
||||
|
||||
String message = UtilityResources.readRawTextFile(R.raw.error_mail);
|
||||
|
||||
message = message.replace("#exception_name#", ex.getMessage());
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
ex.printStackTrace(new PrintWriter(sw));
|
||||
message = message.replace("#stacktrace#", sw.toString());
|
||||
|
||||
SystemRESTConsumer.sendErrorLogMail(message);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.RawRes;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class UtilityResources {
|
||||
|
||||
private static Context mContext;
|
||||
|
||||
public static void init(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static String readRawTextFile(@RawRes int resId) {
|
||||
InputStream inputStream = mContext.getResources().openRawResource(resId);
|
||||
|
||||
InputStreamReader inputreader = new InputStreamReader(inputStream);
|
||||
BufferedReader buffreader = new BufferedReader(inputreader);
|
||||
String line;
|
||||
StringBuilder text = new StringBuilder();
|
||||
|
||||
try {
|
||||
while (( line = buffreader.readLine()) != null) {
|
||||
text.append(line);
|
||||
text.append('\n');
|
||||
}
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
return text.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@ -20,6 +20,7 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
|
||||
public ActivityAccettazioneOrdineInevasoBinding bindings;
|
||||
private AccettazioneOnOrdineInevasoViewModel mAccettazioneOrdineInevasoViewModel;
|
||||
private ArticoliInColloBottomSheetViewModel mArticoliInColloBottomSheetViewModel;
|
||||
|
||||
|
||||
@Override
|
||||
@ -28,7 +29,7 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
|
||||
bindings = DataBindingUtil.setContentView(this, R.layout.activity_accettazione_ordine_inevaso);
|
||||
FragmentArticoliInColloBottomSheetBinding bindings = this.bindings.bottomSheetInclude;
|
||||
ArticoliInColloBottomSheetViewModel mArticoliInColloBottomSheetViewModel = new ArticoliInColloBottomSheetViewModel(this, bindings);
|
||||
mArticoliInColloBottomSheetViewModel = new ArticoliInColloBottomSheetViewModel(this, bindings);
|
||||
|
||||
List<OrdineAccettazioneDTO> orders = (ArrayList<OrdineAccettazioneDTO>)getIntent().getSerializableExtra("key");
|
||||
mAccettazioneOrdineInevasoViewModel = new AccettazioneOnOrdineInevasoViewModel(
|
||||
@ -47,6 +48,13 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if(mArticoliInColloBottomSheetViewModel.isExpanded()){
|
||||
mArticoliInColloBottomSheetViewModel.collapse();
|
||||
} else super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
|
||||
@ -3,6 +3,7 @@ package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core;
|
||||
import android.content.Context;
|
||||
import android.databinding.ObservableArrayList;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
@ -67,13 +68,11 @@ public class AccettazioneOrdineInevasoHelper {
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(codArtForns, new Comparator<String>() {
|
||||
public int compare(String str1, String str2) {
|
||||
if(str1 != null && str2 != null) {
|
||||
return str1.compareToIgnoreCase(str2);
|
||||
}
|
||||
return 0;
|
||||
Collections.sort(codArtForns, (str1, str2) -> {
|
||||
if(str1 != null && str2 != null) {
|
||||
return str1.compareToIgnoreCase(str2);
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
List<List<OrdineAccettazioneDTO.Riga>> groupedRighe = new ArrayList<>();
|
||||
@ -252,7 +251,7 @@ public class AccettazioneOrdineInevasoHelper {
|
||||
}
|
||||
|
||||
if(groupedRighe.get(i).get(0).ragSocCom != null && groupedRighe.get(i).get(0).ragSocCom.trim().length() > 0){
|
||||
itemModel.descrizioneGroup += " - " + groupedRighe.get(i).get(0).ragSocCom;
|
||||
itemModel.descrizioneGroup += " - " + groupedRighe.get(i).get(0).descrizioneCommessa;
|
||||
}
|
||||
|
||||
itemModel.rows = new ArrayList<>();
|
||||
@ -268,7 +267,7 @@ public class AccettazioneOrdineInevasoHelper {
|
||||
|
||||
rowModel.qtaRiservata = decimalFormat.format(getRigaQuantityEvasa(rowItem, mtbColrs));
|
||||
// rowModel.qtaRiservata = decimalFormat.format(rowItem.qtaRiservate);
|
||||
rowModel.qtaOrdinata = decimalFormat.format(rowItem.qtaOrd);
|
||||
rowModel.qtaOrdinata = decimalFormat.format(rowItem.qtaDaEvadere);
|
||||
|
||||
rowModel.originalModel = rowItem;
|
||||
|
||||
@ -288,13 +287,12 @@ public class AccettazioneOrdineInevasoHelper {
|
||||
if(mtbColrs != null) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
|
||||
List<MtbColr> filteredMtbColrs = Coollection.from(mtbColrs)
|
||||
.where("codMart", Coollection.eqIgnoreCase(item.mtbAart.codMart))
|
||||
.and("codJcom", Coollection.eqIgnoreCase(item.codJcom))
|
||||
.and("rigaOrd", Coollection.eq(item.rigaOrd))
|
||||
.and("numOrd", Coollection.eq(item.numOrd))
|
||||
.and("dataOrd", Coollection.eq(sdf.format(item.getDataOrd())))
|
||||
.all();
|
||||
List<MtbColr> filteredMtbColrs = Stream.of(mtbColrs).filter(
|
||||
x -> x.getCodMart().equalsIgnoreCase(item.mtbAart.codMart) &&
|
||||
(x.getCodJcom() != null && x.getCodJcom().equalsIgnoreCase(item.codJcom)) &&
|
||||
x.getRigaOrd() == item.rigaOrd &&
|
||||
x.getNumOrd() == item.numOrd &&
|
||||
x.getDataOrdS().equals(sdf.format(item.getDataOrd()))).toList();
|
||||
|
||||
|
||||
for (MtbColr mtbColr : filteredMtbColrs) {
|
||||
|
||||
@ -9,6 +9,8 @@ import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.text.SpannableString;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@ -28,6 +30,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.AccettazioneOrdineInevasoActivity;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core.AccettazioneOrdineInevasoHelper;
|
||||
@ -131,7 +134,9 @@ public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallb
|
||||
helper.updateListModel(currentOrderBy, groupedRighe, mtbColrs);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(mActivity, e.getMessage().toString(), Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(mActivity, e.getMessage(), Toast.LENGTH_LONG).show();
|
||||
|
||||
UtilityLogger.errorMe(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,18 +145,8 @@ public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallb
|
||||
|
||||
AlertDialog dialog = new AlertDialog.Builder(mActivity)
|
||||
.setTitle(mActivity.getText(R.string.action_orderBy))
|
||||
.setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, currentOrderBy.getVal(), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
currentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.fromInt(which);
|
||||
}
|
||||
})
|
||||
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
refreshOrderBy();
|
||||
}
|
||||
})
|
||||
.setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, currentOrderBy.getVal(), (dialog12, which) -> currentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.fromInt(which))
|
||||
.setPositiveButton("Ok", (dialog1, which) -> refreshOrderBy())
|
||||
.create();
|
||||
dialog.show();
|
||||
}
|
||||
@ -316,12 +311,19 @@ public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallb
|
||||
|
||||
List<MtbColr> currentMtbColrs = mArticoliInColloBottomSheetViewModel.mtbColt.get().getMtbColr();
|
||||
|
||||
List<MtbColr> filteredMtbColrs = Coollection.from(currentMtbColrs)
|
||||
.where("codMart", Coollection.eqIgnoreCase(item.mtbAart.codMart))
|
||||
.and("numOrd", Coollection.eq(item.numOrd))
|
||||
.and("codJcom", Coollection.eq(item.codJcom))
|
||||
.and("rigaOrd", Coollection.eq(item.rigaOrd))
|
||||
.all();
|
||||
List<MtbColr> filteredMtbColrs = Stream.of(currentMtbColrs).filter(
|
||||
x -> x.getCodMart().equalsIgnoreCase(item.mtbAart.codMart) &&
|
||||
x.getNumOrd() == item.numOrd &&
|
||||
(x.getCodJcom() != null && x.getCodJcom().equalsIgnoreCase(item.codJcom)) &&
|
||||
x.getRigaOrd() == item.rigaOrd
|
||||
).toList();
|
||||
|
||||
// List<MtbColr> filteredMtbColrs = Coollection.from(currentMtbColrs)
|
||||
// .where("codMart", Coollection.eqIgnoreCase(item.mtbAart.codMart))
|
||||
// .and("numOrd", Coollection.eq(item.numOrd))
|
||||
// .and("codJcom", Coollection.eq(item.codJcom))
|
||||
// .and("rigaOrd", Coollection.eq(item.rigaOrd))
|
||||
// .all();
|
||||
|
||||
float qtaEvasaInMtbColr = 0;
|
||||
for (MtbColr mtbColr : filteredMtbColrs) {
|
||||
@ -330,12 +332,7 @@ public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallb
|
||||
|
||||
float qtaEvasa = item.qtaRiservate + qtaEvasaInMtbColr;
|
||||
|
||||
DialogInputQuantity.makeBase(mActivity, item, qtaEvasa, new ISingleValueOperationCallback<QuantityDTO>() {
|
||||
@Override
|
||||
public void onResult(QuantityDTO value) {
|
||||
onOrdineRowDispatched(item, value);
|
||||
}
|
||||
}).show();
|
||||
DialogInputQuantity.makeBase(mActivity, item, qtaEvasa, value -> onOrdineRowDispatched(item, value)).show();
|
||||
|
||||
// Toast.makeText(mActivity, item.descrizioneEstesa, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
@ -361,7 +358,7 @@ public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallb
|
||||
MtbColt cloneMtbColt = (MtbColt) mArticoliInColloBottomSheetViewModel.mtbColt.get().clone();
|
||||
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
|
||||
|
||||
cloneMtbColt.setMtbColr(new ObservableArrayList<MtbColr>());
|
||||
cloneMtbColt.setMtbColr(new ObservableArrayList());
|
||||
cloneMtbColt.getMtbColr().add(mtbColr);
|
||||
|
||||
ColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, new ISimpleOperationCallback<MtbColt>() {
|
||||
|
||||
@ -47,21 +47,15 @@ public class ArticoliInColloBottomSheetHelper extends BottomSheetBehavior.Bottom
|
||||
appBarLayoutBottomSheet.setVisibility(View.INVISIBLE);
|
||||
|
||||
toolbarBottomSheet.setNavigationIcon(R.drawable.ic_close_24dp);
|
||||
toolbarBottomSheet.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(mBottomSheetBehavior.getState()==BottomSheetBehavior.STATE_EXPANDED) {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
toolbarBottomSheet.setNavigationOnClickListener(view -> {
|
||||
if(mBottomSheetBehavior.getState()==BottomSheetBehavior.STATE_EXPANDED) {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
});
|
||||
|
||||
tapActionLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(mBottomSheetBehavior.getState()==BottomSheetBehavior.STATE_COLLAPSED) {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
}
|
||||
tapActionLayout.setOnClickListener(v -> {
|
||||
if(mBottomSheetBehavior.getState()==BottomSheetBehavior.STATE_COLLAPSED) {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
}
|
||||
});
|
||||
|
||||
@ -69,14 +63,11 @@ public class ArticoliInColloBottomSheetHelper extends BottomSheetBehavior.Bottom
|
||||
mBinding.articoliInColloCloseCollo.setText(mActivity.getText(R.string.action_close_ul));
|
||||
updateRigheNumber(0);
|
||||
|
||||
mBinding.articoliInColloSheetButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (mBottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
} else {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
mBinding.articoliInColloSheetButton.setOnClickListener(view -> {
|
||||
if (mBottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
} else {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
});
|
||||
|
||||
@ -133,6 +124,18 @@ public class ArticoliInColloBottomSheetHelper extends BottomSheetBehavior.Bottom
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isExpanded() {
|
||||
return mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED;
|
||||
}
|
||||
|
||||
public void expand() {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
}
|
||||
|
||||
public void collapse() {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
|
||||
appBarLayoutBottomSheet.setAlpha(slideOffset);
|
||||
|
||||
@ -69,6 +69,17 @@ public class ArticoliInColloBottomSheetViewModel {
|
||||
if(onCloseColloCallback != null) onCloseColloCallback.onColloClosed();
|
||||
}
|
||||
|
||||
public boolean isExpanded() {
|
||||
return mArticoliInColloBottomSheetHelper.isExpanded();
|
||||
}
|
||||
|
||||
public void expand() {
|
||||
mArticoliInColloBottomSheetHelper.expand();
|
||||
}
|
||||
|
||||
public void collapse() {
|
||||
mArticoliInColloBottomSheetHelper.collapse();
|
||||
}
|
||||
|
||||
public class ArticoliInColloBottomSheetMtbColrAdapter extends BaseAdapter {
|
||||
|
||||
|
||||
@ -67,31 +67,25 @@ public class DialogInputQuantity {
|
||||
final AlertDialog alert = alertDialog.create();
|
||||
alert.setCanceledOnTouchOutside(false);
|
||||
|
||||
alert.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
alert.setOnShowListener(dialogInterface -> {
|
||||
|
||||
txlInputNumDiCnf.getEditText().requestFocus();
|
||||
//txlInputNumDiCnf.getEditText().dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN , 0, 0, 0));
|
||||
//txlInputNumDiCnf.getEditText().dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_UP , 0, 0, 0));
|
||||
txlInputNumDiCnf.getEditText().requestFocus();
|
||||
//txlInputNumDiCnf.getEditText().dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN , 0, 0, 0));
|
||||
//txlInputNumDiCnf.getEditText().dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_UP , 0, 0, 0));
|
||||
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(txlInputNumDiCnf.getEditText(), InputMethodManager.SHOW_IMPLICIT);
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(txlInputNumDiCnf.getEditText(), InputMethodManager.SHOW_IMPLICIT);
|
||||
|
||||
Button positiveButton = alert.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
Button positiveButton = alert.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
|
||||
positiveButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(quantityDTO.qtaCnf.get() <= 0 || quantityDTO.numCnf.get() <= 0 || quantityDTO.qtaTot.get() <= 0) {
|
||||
showQuantityErrorDialog(context);
|
||||
} else {
|
||||
dialogCallback.onResult(quantityDTO);
|
||||
alert.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
positiveButton.setOnClickListener(view -> {
|
||||
if(quantityDTO.qtaCnf.get() <= 0 || quantityDTO.numCnf.get() <= 0 || quantityDTO.qtaTot.get() <= 0) {
|
||||
showQuantityErrorDialog(context);
|
||||
} else {
|
||||
dialogCallback.onResult(quantityDTO);
|
||||
alert.dismiss();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
65
app/src/main/res/raw/error_mail.html
Normal file
65
app/src/main/res/raw/error_mail.html
Normal file
@ -0,0 +1,65 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<style>
|
||||
@import url('https://fonts.googleapis.com/css?family=Open+Sans');
|
||||
|
||||
body {
|
||||
/*background-color: red;*/
|
||||
font-family: 'Open Sans','Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
}
|
||||
|
||||
body > div{
|
||||
/*display: table;*/
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body style="background-color:#FF5252; font-family: 'Open Sans','Segoe UI', Tahoma, Geneva, Verdana, sans-serif;">
|
||||
|
||||
<!--[if mso]>
|
||||
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="http://" style="width:900px; height: 800px;" arcsize="2%" stroke="f" fillcolor="#FFFFFF">
|
||||
<w:anchorlock/>
|
||||
<![endif]-->
|
||||
<div href="http://"
|
||||
style="background-color:#FFFFFF;border-radius:4px;display:inline-block;-webkit-text-size-adjust:none;">
|
||||
|
||||
|
||||
<div id="card" style="margin-left: auto; margin-right: auto; margin: 16px;" >
|
||||
|
||||
<img style="margin-left: 8px;" src="http://www.integry.it/integry-resources/images/Image/immagini-struttura/integry.png" style="margin-top: 8px;" />
|
||||
|
||||
<hr style="color: #95a5a6; margin-top: 14px; margin-bottom: 14px; width: 96%;" size="1" noshade />
|
||||
|
||||
|
||||
<p style="margin-left: 24px;font-size: 2em;">
|
||||
Attenzione!
|
||||
</p>
|
||||
<p style="margin-left: 24px;">
|
||||
Si è verificato un errore con eccezione <b>#exception_name#</b>.<br />
|
||||
<br /><br />
|
||||
Di seguito lo stacktrace dell'eccezione:<br />
|
||||
<br />
|
||||
<small>#stacktrace#</small>
|
||||
</p><br />
|
||||
<p style="margin-left: 24px;">
|
||||
(#azienda_nome#)
|
||||
</p>
|
||||
|
||||
<p style="margin-left: 24px; font-size: .75em; color: #7f8c8d;">
|
||||
#current_date#
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--[if mso]>
|
||||
</v:roundrect>
|
||||
<![endif]-->
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user