Risolto bug della chiusura del collo in vendita tramite tasto Back

This commit is contained in:
Giuseppe Scorrano 2019-02-21 17:00:33 +01:00
parent 17d2e7f980
commit 10c77362b8
11 changed files with 194 additions and 166 deletions

View File

@ -1,153 +1,153 @@
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.27.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
dependencies {
classpath 'io.fabric.tools:gradle:1.27.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
android {
android {
def appVersionCode = 37
def appVersionName = '1.0.34'
signingConfigs {
release {
keyAlias 'wms key'
keyPassword 'inpmiy'
storeFile file('Integry.jks')
storePassword 'inpmiy'
}
}
signingConfigs {
release {
keyAlias 'wms key'
keyPassword 'inpmiy'
storeFile file('Integry.jks')
storePassword 'inpmiy'
}
}
applicationVariants.all { variant ->
variant.outputs.all { output ->
output.outputFileName = "android-release_v2.apk"
}
}
applicationVariants.all { variant ->
variant.outputs.all { output ->
output.outputFileName = "android-release_v2.apk"
}
}
compileSdkVersion 28
buildToolsVersion '28.0.3'
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "it.integry.integrywmsnative"
minSdkVersion 21
targetSdkVersion 28
versionCode appVersionCode
versionName appVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.release
}
defaultConfig {
applicationId "it.integry.integrywmsnative"
minSdkVersion 21
targetSdkVersion 28
versionCode appVersionCode
versionName appVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.release
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
dataBinding {
enabled = true
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
productFlavors {
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
dataBinding {
enabled = true
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
productFlavors {
}
build {
doLast {
delete "$projectDir/build/outputs/apk/release/version_v2.txt"
file("$projectDir/build/outputs/apk/release/version_v2.txt").text = appVersionCode + '\n' + appVersionName
}
}
build {
doLast {
delete "$projectDir/build/outputs/apk/release/version_v2.txt"
file("$projectDir/build/outputs/apk/release/version_v2.txt").text = appVersionCode + '\n' + appVersionName
}
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile.class) {
options.compilerArgs << "-Xmaxerrs" << "10000"
}
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile.class) {
options.compilerArgs << "-Xmaxerrs" << "10000"
}
}
lintOptions {
abortOnError false
}
lintOptions {
abortOnError false
}
dynamicFeatures = [":dynamic__base"]
dynamicFeatures = [":dynamic__base"]
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.orhanobut:logger:2.2.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-perf:16.2.3'
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.orhanobut:logger:2.2.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-perf:16.2.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha02'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha02'
implementation 'androidx.preference:preference:1.1.0-alpha03'
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.0.0'
implementation 'com.annimon:stream:1.2.1'
implementation 'androidx.lifecycle:lifecycle-runtime:2.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.0.0'
kapt "androidx.lifecycle:lifecycle-compiler:2.0.0"
implementation 'com.danielpuiu:ghostfish:2.0.0'
annotationProcessor "com.danielpuiu:ghostfish-compiler:2.0.0"
//MVVM
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.0.0"
implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-recyclerview-v7:2.1.1'
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'br.com.zbra:android-linq:1.1.0'
//FAB
implementation 'com.github.clans:fab:1.6.4'
//CUSTOM VIEWS
implementation 'com.github.NaimishTrivedi:FBToast:1.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
implementation 'com.github.andrefrsousa:SuperBottomSheet:1.2.1@aar'
implementation 'com.fede987:status-bar-alert:1.0.1'
implementation 'com.fxn769:stash:1.2'
testImplementation 'junit:junit:4.12'
implementation project(':waterfall_toolbar')
implementation 'com.mikhaellopez:lazydatepicker:1.0.0'
implementation 'com.github.demoNo:AutoScrollViewPager:v1.0.2'
//AppUpdate
implementation 'com.github.javiersantos:AppUpdater:2.7'
//Barcode
implementation project(':pointmobilescannerlibrary')
implementation project(path: ':barcode_base_library')
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.0.0'
implementation 'com.annimon:stream:1.2.1'
implementation 'androidx.lifecycle:lifecycle-runtime:2.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.0.0'
kapt "androidx.lifecycle:lifecycle-compiler:2.0.0"
implementation 'com.danielpuiu:ghostfish:2.0.0'
annotationProcessor "com.danielpuiu:ghostfish-compiler:2.0.0"
//MVVM
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.0.0"
implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-recyclerview-v7:2.1.1'
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'br.com.zbra:android-linq:1.1.0'
//FAB
implementation 'com.github.clans:fab:1.6.4'
//CUSTOM VIEWS
implementation 'com.github.NaimishTrivedi:FBToast:1.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
implementation 'com.github.andrefrsousa:SuperBottomSheet:1.2.1@aar'
implementation 'com.fede987:status-bar-alert:1.0.1'
implementation 'com.fxn769:stash:1.2'
testImplementation 'junit:junit:4.12'
implementation project(':waterfall_toolbar')
implementation 'com.mikhaellopez:lazydatepicker:1.0.0'
implementation 'com.github.demoNo:AutoScrollViewPager:v1.0.2'
//AppUpdate
implementation 'com.github.javiersantos:AppUpdater:2.7'
//Barcode
implementation project(':pointmobilescannerlibrary')
implementation project(path: ':barcode_base_library')
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}

View File

@ -4,6 +4,9 @@ import androidx.databinding.ObservableArrayList;
import android.os.Parcel;
import android.os.Parcelable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@ -471,7 +474,7 @@ public class MtbColt extends EntityBase implements Parcelable {
return posizione;
}
public MtbColt setPosizione(String posizione) {
public MtbColt setPosizione(@Nullable String posizione) {
this.posizione = posizione;
return this;
}

View File

@ -8,7 +8,9 @@ import it.integry.integrywmsnative.core.settings.SettingsManager;
public class UtilityFirebase {
public static Trace getNewPerformanceTrace(String traceName) {
String username = SettingsManager.i().user.fullname ;
String username = SettingsManager.i().user != null && !UtilityString.isNullOrEmpty(SettingsManager.i().user.fullname) ?
SettingsManager.i().user.fullname :
"N / A";
Trace newTrace = FirebasePerformance.getInstance().newTrace(traceName);

View File

@ -528,18 +528,20 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
}
@Override
public void onColloClosed() {
public void onColloClosed(Runnable onComplete) {
if(thereIsAnOpenedUL()) {
final ProgressDialog progress = UtilityProgress.createDefaultProgressDialog(mActivity);
progress.show();
if(thereIsAnyRowInUL()) {
updateDataFine(progress, () -> printCollo(progress));
updateDataFine(progress, () -> printCollo(progress, onComplete));
} else {
deleteCollo(progress);
deleteCollo(progress, onComplete);
}
} else {
if(onComplete != null) onComplete.run();
}
}
@ -565,11 +567,11 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
}
private void printCollo(ProgressDialog progress) {
private void printCollo(ProgressDialog progress, Runnable onComplete) {
MtbColt currentMtbColt = mArticoliInColloBottomSheetViewModel.mtbColt.get();
if(currentMtbColt.getDisablePrint() != null && currentMtbColt.getDisablePrint()){
postCloseOperations();
postCloseOperations(onComplete);
progress.dismiss();
return;
}
@ -589,7 +591,7 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
currentMtbColt,
1, reportName, () -> {
postCloseOperations();
postCloseOperations(onComplete);
progress.dismiss();
}, ex -> {
@ -602,7 +604,7 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
null,
null,
R.string.button_ignore_print,
() -> postCloseOperations()).show();
() -> postCloseOperations(onComplete)).show();
});
}, ex -> UtilityExceptions.defaultException(mActivity, ex, progress)
@ -629,7 +631,7 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
}
private void deleteCollo(ProgressDialog progress) {
private void deleteCollo(ProgressDialog progress, Runnable onComplete) {
ColliMagazzinoRESTConsumer.deleteCollo(mArticoliInColloBottomSheetViewModel.mtbColt.get(), () -> {
mArticoliInColloBottomSheetViewModel.mtbColt.set(null);
@ -637,8 +639,8 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
isFabVisible.set(true);
progress.dismiss();
}, ex -> UtilityExceptions.defaultException(mActivity, ex, progress)
);
if(onComplete != null) onComplete.run();
}, ex -> UtilityExceptions.defaultException(mActivity, ex, progress));
}
@ -653,7 +655,7 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
private void postCloseOperations() {
private void postCloseOperations(Runnable onComplete) {
MtbColt mtbColt = mArticoliInColloBottomSheetViewModel.mtbColt.get();
@ -682,6 +684,8 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
removeListFilter();
refreshOrderBy(true);
if(onComplete != null) onComplete.run();
}
@Override

View File

@ -22,6 +22,7 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import it.integry.integrywmsnative.MainActivity;
import it.integry.integrywmsnative.R;
@ -469,8 +470,8 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
private void posizionaCollo(Runnable onComplete, Runnable onAbort, RunnableArgs<Exception> onFailed) {
DialogAskPositionOfLU.makeBase(mContext, mtbColt.get(), mtbDepoPosizione -> {
if(mtbDepoPosizione != null) {
mtbColt.get().setPosizione(mtbDepoPosizione.getPosizione());
if(mtbDepoPosizione != null && mtbColt.get() != null) {
Objects.requireNonNull(mtbColt.get()).setPosizione(mtbDepoPosizione.getPosizione());
onComplete.run();
} else {
onAbort.run();

View File

@ -118,7 +118,7 @@ public class MainVenditaFragment extends Fragment implements ITitledFragment, IS
ButterKnife.bind(this, mBinding.getRoot());
mWaterfallToolbar.setRecyclerView(mBinding.venditaMainList);
if(mWaterfallToolbar != null) mWaterfallToolbar.setRecyclerView(mBinding.venditaMainList);
return mBinding.getRoot();
}

View File

@ -72,10 +72,11 @@ public class VenditaOrdineInevasoActivity extends AppCompatActivity {
if(mArticoliInColloBottomSheetViewModel.isExpanded()){
mArticoliInColloBottomSheetViewModel.collapse();
} else if(mVenditaOrdineInevasoViewModel.thereIsAnOpenedUL()) {
mArticoliInColloBottomSheetViewModel.closeCurrentUL();
mArticoliInColloBottomSheetViewModel.closeCurrentUL(() -> {
BarcodeManager.removeCallback(barcodeScannerIstanceID);
super.onBackPressed();
});
BarcodeManager.removeCallback(barcodeScannerIstanceID);
super.onBackPressed();
} else {
BarcodeManager.removeCallback(barcodeScannerIstanceID);
super.onBackPressed();

View File

@ -800,21 +800,21 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
}
@Override
public void onColloClosed() {
public void onColloClosed(Runnable onComplete) {
if(thereIsAnOpenedUL()) {
final ProgressDialog progress = ProgressDialog.show(mActivity, mActivity.getText(R.string.waiting),
mActivity.getText(R.string.loading) + " ...", true);
final ProgressDialog progress = UtilityProgress.createDefaultProgressDialog(mActivity);
progress.show();
if(thereIsAnyRowInUL()) {
updateDataFine(progress, () -> distribuisciCollo(progress, (generatedMtbColts) -> printCollo(progress, generatedMtbColts)));
updateDataFine(progress, () -> distribuisciCollo(progress, (generatedMtbColts) -> printCollo(progress, generatedMtbColts, onComplete)));
} else {
if(mtbColtSessionID != null) ColliDataRecover.closeSession(mtbColtSessionID);
deleteCollo(progress);
deleteCollo(progress, onComplete);
}
} else {
if(onComplete != null) onComplete.run();
}
}
@ -853,7 +853,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
});
}
private void printCollo(ProgressDialog progress, List<MtbColt> mtbColtsToPrint) {
private void printCollo(ProgressDialog progress, List<MtbColt> mtbColtsToPrint, Runnable onComplete) {
DialogAskShouldPrint.make(mActivity, "Packing List", shouldPrint -> {
if(shouldPrint) {
@ -864,7 +864,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
if (value.size() > 0) {
try {
cyclicPrint(mtbColtsToPrint.iterator(), value.get(0), () -> {
postCloseOperations(mtbColtsToPrint);
postCloseOperations(mtbColtsToPrint, onComplete);
progress.dismiss();
}, ex -> {
progress.dismiss();
@ -875,17 +875,17 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
null,
null,
R.string.button_ignore_print,
() -> postCloseOperations(mtbColtsToPrint)).show();
() -> postCloseOperations(mtbColtsToPrint, onComplete)).show();
});
} catch (Exception ex) {
UtilityExceptions.defaultException(mActivity, ex, progress);
postCloseOperations(mtbColtsToPrint);
postCloseOperations(mtbColtsToPrint, onComplete);
}
} else {
progress.dismiss();
String errorMessage = "Nessuna stampante configurata";
DialogSimpleMessageHelper.makeWarningDialog(mActivity, new SpannableString(errorMessage), null, () -> postCloseOperations(mtbColtsToPrint)).show();
DialogSimpleMessageHelper.makeWarningDialog(mActivity, new SpannableString(errorMessage), null, () -> postCloseOperations(mtbColtsToPrint, onComplete)).show();
}
}
@ -895,7 +895,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
}
});
} else {
postCloseOperations(mtbColtsToPrint);
postCloseOperations(mtbColtsToPrint, onComplete);
progress.dismiss();
}
}).show();
@ -925,7 +925,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
}
private void deleteCollo(ProgressDialog progress) {
private void deleteCollo(ProgressDialog progress, Runnable onComplete) {
ColliMagazzinoRESTConsumer.deleteCollo(mArticoliInColloBottomSheetViewModel.mtbColt.get(), () -> {
mArticoliInColloBottomSheetViewModel.mtbColt.set(null);
@ -933,6 +933,9 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
isFabVisible.set(true);
progress.dismiss();
if(onComplete != null) onComplete.run();
}, ex -> UtilityExceptions.defaultException(mActivity, ex, progress)
);
}
@ -948,7 +951,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
}
private void postCloseOperations(List<MtbColt> generatedMtbColt) {
private void postCloseOperations(List<MtbColt> generatedMtbColt, Runnable onComplete) {
MtbColt mtbColt = mArticoliInColloBottomSheetViewModel.mtbColt.get();
@ -983,6 +986,8 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
removeListFilter();
refreshOrderBy(true);
if(onComplete != null) onComplete.run();
}

View File

@ -2,6 +2,6 @@ package it.integry.integrywmsnative.view.bottomsheet.interfaces;
public interface IOnColloClosedCallback {
void onColloClosed();
void onColloClosed(Runnable onComplete);
}

View File

@ -121,7 +121,11 @@ public class ArticoliInColloBottomSheetViewModel {
public void closeCurrentUL(){
if(onCloseColloCallback != null) onCloseColloCallback.onColloClosed();
closeCurrentUL(null);
}
public void closeCurrentUL(Runnable onComplete){
if(onCloseColloCallback != null) onCloseColloCallback.onColloClosed(onComplete);
}
public boolean isExpanded() {

View File

@ -5,6 +5,8 @@ import android.content.Context;
import android.content.Intent;
import android.util.Log;
import java.nio.charset.StandardCharsets;
import device.common.DecodeResult;
import device.common.ScanConst;
import device.sdk.ScanManager;
@ -91,9 +93,15 @@ public class PointMobileBarcodeReader implements BarcodeReaderInterface {
}
if(mDecodeResult != null) {
String stringValue = null;
if(mDecodeResult.decodeValue != null && mDecodeResult.decodeValue.length > 0) {
stringValue = new String(mDecodeResult.decodeValue, StandardCharsets.UTF_8);
}
BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO()
.setByteValue(mDecodeResult.decodeValue)
.setStringValue(mDecodeResult.toString().replaceAll("\n", "").replaceAll("\r", "").trim())
.setStringValue(stringValue)
.setType(BarcodeType.fromInt(mDecodeResult.symType))
.setName(mDecodeResult.symName)
.setDecodingTime(mDecodeResult.decodeTimeMillisecond);