Implementato Firebase e Fabric
This commit is contained in:
@@ -53,7 +53,7 @@ public class MainActivity extends AppCompatActivity
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ExceptionsHandler.init(this);
|
||||
//ExceptionsHandler.init(this);
|
||||
|
||||
PermissionsHelper.askPermissions(this);
|
||||
|
||||
|
||||
@@ -6,9 +6,11 @@ import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.text.SpannableString;
|
||||
|
||||
import com.crashlytics.android.Crashlytics;
|
||||
import com.orhanobut.logger.AndroidLogAdapter;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
import it.integry.integrywmsnative.core.REST.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.exception.ExceptionsHandler;
|
||||
@@ -31,6 +33,9 @@ public class MainApplication extends Application {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
if(!BuildConfig.DEBUG) {
|
||||
Fabric.with(this, new Crashlytics());
|
||||
}
|
||||
Stash.init(this);
|
||||
|
||||
SettingsManager.init(this);
|
||||
|
||||
@@ -43,7 +43,8 @@ public class RESTBuilder {
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.build();
|
||||
|
||||
|
||||
|
||||
return retrofit.create(service);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package it.integry.integrywmsnative.core.REST.model;
|
||||
|
||||
public class SlackMessageDTO {
|
||||
}
|
||||
@@ -19,7 +19,6 @@ public class ExceptionsHandler implements Thread.UncaughtExceptionHandler {
|
||||
private final static String TAG = ExceptionsHandler.class.getSimpleName();
|
||||
|
||||
private final Activity context;
|
||||
//private final Thread.UncaughtExceptionHandler rootHandler;
|
||||
|
||||
public static void init(Activity context) {
|
||||
new ExceptionsHandler(context);
|
||||
@@ -28,10 +27,11 @@ public class ExceptionsHandler implements Thread.UncaughtExceptionHandler {
|
||||
private ExceptionsHandler(Activity context) {
|
||||
this.context = context;
|
||||
|
||||
if (!BuildConfig.DEBUG) {
|
||||
//rootHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||
//if (!BuildConfig.DEBUG) {
|
||||
Thread.setDefaultUncaughtExceptionHandler(this);
|
||||
}
|
||||
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -14,7 +11,6 @@ import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.REST.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import okhttp3.internal.Util;
|
||||
|
||||
public class UtilityLogger {
|
||||
|
||||
|
||||
@@ -210,16 +210,12 @@ public class VersamentoMerceViewModel {
|
||||
private void updatePosizione(MtbDepoPosizione mtbDepoPosizione, boolean shouldAskLivello, ProgressDialog progressDialog) {
|
||||
|
||||
if(shouldAskLivello) {
|
||||
DialogAskLivelloPosizione.make(mContext, livello -> {
|
||||
DialogAskLivelloPosizione.make(mContext, mtbDepoPosizione, newPosizione -> {
|
||||
|
||||
if(livello == null) {
|
||||
if(newPosizione == null) {
|
||||
updatePosizione(mtbDepoPosizione, shouldAskLivello, progressDialog);
|
||||
} else {
|
||||
String newPosizione = mtbDepoPosizione.getPosizione().substring(0, mtbDepoPosizione.getPosizione().length()-1);
|
||||
newPosizione += livello;
|
||||
mtbDepoPosizione.setPosizione(newPosizione);
|
||||
|
||||
updatePosizione(mtbDepoPosizione, false, progressDialog);
|
||||
updatePosizione(newPosizione, false, progressDialog);
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
|
||||
@@ -1,45 +1,133 @@
|
||||
package it.integry.integrywmsnative.view.dialogs;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import android.text.InputType;
|
||||
import android.widget.EditText;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityToast;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
||||
|
||||
public class DialogAskLivelloPosizione {
|
||||
|
||||
|
||||
public static void make(Context context, RunnableArgs<Integer> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
final EditText livelloEditText = new EditText(context);
|
||||
livelloEditText.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
private Context mContext;
|
||||
private MtbDepoPosizione mtbDepoPosizione;
|
||||
|
||||
AlertDialog dialog = new AlertDialog.Builder(context)
|
||||
.setTitle("Livello")
|
||||
.setMessage("In che livello vuoi posizionare?")
|
||||
.setView(livelloEditText)
|
||||
.setPositiveButton("OK", (dialog1, which) -> {
|
||||
String livello = String.valueOf(livelloEditText.getText());
|
||||
if(UtilityString.isNullOrEmpty(livello)) {
|
||||
UtilityToast.showToast("Inserisci un LIVELLO valido");
|
||||
onComplete.run(null);
|
||||
} else {
|
||||
try{
|
||||
Integer livelloInt = Integer.parseInt(livello);
|
||||
onComplete.run(livelloInt);
|
||||
} catch (NumberFormatException nfe) {
|
||||
UtilityToast.showToast("Inserisci un LIVELLO valido");
|
||||
onComplete.run(null);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
.setNegativeButton("Annulla", null)
|
||||
.create();
|
||||
dialog.show();
|
||||
private Dialog mAlert;
|
||||
|
||||
private RunnableArgs<MtbDepoPosizione> onComplete;
|
||||
private RunnableArgs<Exception> onFailed;
|
||||
|
||||
private TextInputLayout livelloTextInputLayout;
|
||||
|
||||
public static void make(Context context, MtbDepoPosizione mtbDepoPosizione, RunnableArgs<MtbDepoPosizione> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
new DialogAskLivelloPosizione(context, mtbDepoPosizione, onComplete, onFailed).mAlert.show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DialogAskLivelloPosizione(Context context, MtbDepoPosizione mtbDepoPosizione, RunnableArgs<MtbDepoPosizione> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
mContext = context;
|
||||
this.mtbDepoPosizione = mtbDepoPosizione;
|
||||
this.onComplete = onComplete;
|
||||
this.onFailed = onFailed;
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||
View currentView = inflater.inflate(R.layout.dialog_ask_position_of_lu__page2, null, false);
|
||||
|
||||
mAlert = new Dialog(mContext);
|
||||
mAlert.setContentView(currentView);
|
||||
mAlert.setCanceledOnTouchOutside(false);
|
||||
|
||||
mAlert.setOnShowListener(dialog -> {
|
||||
|
||||
currentView.findViewById(R.id.button_confirm).setOnClickListener(v -> {
|
||||
String levelNumber = ((TextView)currentView.findViewById(R.id.level_number)).getText().toString();
|
||||
onLevelConfirm(levelNumber);
|
||||
});
|
||||
|
||||
currentView.findViewById(R.id.button_abort).setOnClickListener(v -> {
|
||||
onLevelAbort();
|
||||
});
|
||||
|
||||
livelloTextInputLayout = currentView.findViewById(R.id.level_number_layout);
|
||||
|
||||
livelloTextInputLayout.getEditText().addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if(livelloTextInputLayout.getEditText().getText() != null) {
|
||||
validateLevel(livelloTextInputLayout.getEditText().getText().toString());
|
||||
} else resetLevelError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void onLevelConfirm(String levelString) {
|
||||
|
||||
String newPosizione = mtbDepoPosizione.getPosizione().substring(0, mtbDepoPosizione.getPosizione().length()-1);
|
||||
newPosizione += levelString;
|
||||
|
||||
MtbDepoPosizione foundPosizione = UtilityPosizione.getFromCache(newPosizione);
|
||||
|
||||
if(foundPosizione != null) {
|
||||
resetLevelError();
|
||||
|
||||
onComplete.run(foundPosizione);
|
||||
mAlert.dismiss();
|
||||
|
||||
|
||||
} else {
|
||||
setLevelError(mContext.getResources().getString(R.string.not_valid));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void validateLevel(String levelString) {
|
||||
String newPosizione = mtbDepoPosizione.getPosizione().substring(0, mtbDepoPosizione.getPosizione().length()-1);
|
||||
newPosizione += levelString;
|
||||
|
||||
if(UtilityPosizione.getFromCache(newPosizione) != null) {
|
||||
resetLevelError();
|
||||
} else setLevelError(mContext.getResources().getString(R.string.not_valid));
|
||||
}
|
||||
|
||||
private void setLevelError(String message){
|
||||
livelloTextInputLayout.setErrorEnabled(true);
|
||||
livelloTextInputLayout.setError(message);
|
||||
}
|
||||
|
||||
private void resetLevelError() {
|
||||
livelloTextInputLayout.setError(null);
|
||||
}
|
||||
|
||||
|
||||
private void onLevelAbort() {
|
||||
onComplete.run(null);
|
||||
mAlert.dismiss();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user