Compare commits
112 Commits
v1.16.19(2
...
v1.17.0(21
| Author | SHA1 | Date | |
|---|---|---|---|
| 91b43d1974 | |||
| c167893544 | |||
| 4c9a1bbaa9 | |||
| f970eb6cac | |||
| 1e1163c04d | |||
| 48f1307095 | |||
| 64fdda43db | |||
| 6611617a81 | |||
| f488e6bad0 | |||
| 266b3d707f | |||
| a726631925 | |||
| 0b634154e4 | |||
| 3e4d4300f1 | |||
| fb527c443f | |||
| 259c719344 | |||
| 178787d907 | |||
| a51cf2e899 | |||
| 9f587ac8b1 | |||
| df97d5c4a2 | |||
| 697bd1e85e | |||
| 5ace80ba28 | |||
| 1c8abcaa58 | |||
| 96ab52821c | |||
| ecd58dea14 | |||
| 9cdc4f299e | |||
| 39af233380 | |||
| 2576d423da | |||
| 234c21c7a1 | |||
| 6d5b6b0260 | |||
| f03976595c | |||
| 54dbade661 | |||
| 6d54bda9b4 | |||
| 4c244c1927 | |||
| ee3ee54e69 | |||
| 82d4607375 | |||
| 7ecdbd1f11 | |||
| a4c30b7fdd | |||
| 3ca75ca11a | |||
| f2f8594a18 | |||
| 7b7b3e554b | |||
| 7913771b2a | |||
| ebcd8eea0a | |||
| 97bf8c291a | |||
| e4f783862b | |||
| 653d4def4e | |||
| 3cf63fc1f1 | |||
| 45ddca1928 | |||
| f4ff33a942 | |||
| ca5b5d3151 | |||
| e22f7cf5c7 | |||
| 8ea38fd31c | |||
| ea7acf6053 | |||
| 3a0d4d290c | |||
| c8053831db | |||
| e0c07ea06e | |||
| 3e79b52e23 | |||
| 7d7712e57a | |||
| 6d7a047e8e | |||
| 72e4f2a0b9 | |||
| ef6cdc6a86 | |||
| 23b86e68cc | |||
| 2e46f9f665 | |||
| 88b1c56360 | |||
| 1d71ac10bd | |||
| 8eb677ecdf | |||
| 74efbac452 | |||
| 9c6375083f | |||
| b24d5271a4 | |||
| b5626e5b08 | |||
| fd2e1fa4f4 | |||
| a3f5072646 | |||
| 1258e8c3e6 | |||
| ccef0fe528 | |||
| 9bb5d1adce | |||
| ac446d953c | |||
| 407ff0b264 | |||
| 10e748b9d4 | |||
| e30273fe42 | |||
| 44564245a7 | |||
| 920f306907 | |||
| 90aa52ab55 | |||
| 93f3eb65f0 | |||
| eb94944928 | |||
| 28698ba306 | |||
| c713bbebbc | |||
| 38e2a02766 | |||
| dd8bf264a4 | |||
| 9488c1994d | |||
| 16099cdaf6 | |||
| f061f2bfc9 | |||
| f7253fd44c | |||
| e12d371567 | |||
| 5596f71c03 | |||
| 8669b812f5 | |||
| 3243484dd0 | |||
| 37114dc4d1 | |||
| d5af79abba | |||
| b50aa7a9d2 | |||
| cc333c3147 | |||
| fc5044134c | |||
| 93a3e39332 | |||
| 3eaf187136 | |||
| 36f9fa1e36 | |||
| 0f89913609 | |||
| 4cda247ddc | |||
| e88ea0a45c | |||
| 726cf80dc0 | |||
| a779d8b94d | |||
| f41e1f3a02 | |||
| aa75a77913 | |||
| 639be21ab5 | |||
| dfc241e7f6 |
23
.idea/codeStyles/Project.xml
generated
23
.idea/codeStyles/Project.xml
generated
@@ -1,24 +1,12 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<code_scheme name="Project" version="173">
|
<code_scheme name="Project" version="173">
|
||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
<value>
|
|
||||||
<package name="java.util" alias="false" withSubpackages="false" />
|
|
||||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
|
||||||
<package name="io.ktor" alias="false" withSubpackages="true" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
|
||||||
<value>
|
|
||||||
<package name="" alias="false" withSubpackages="true" />
|
|
||||||
<package name="java" alias="false" withSubpackages="true" />
|
|
||||||
<package name="javax" alias="false" withSubpackages="true" />
|
|
||||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
|
||||||
<package name="" alias="true" withSubpackages="true" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
<codeStyleSettings language="XML">
|
<codeStyleSettings language="XML">
|
||||||
|
<indentOptions>
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||||
|
</indentOptions>
|
||||||
<arrangement>
|
<arrangement>
|
||||||
<rules>
|
<rules>
|
||||||
<section>
|
<section>
|
||||||
@@ -127,5 +115,8 @@
|
|||||||
</rules>
|
</rules>
|
||||||
</arrangement>
|
</arrangement>
|
||||||
</codeStyleSettings>
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="kotlin">
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</codeStyleSettings>
|
||||||
</code_scheme>
|
</code_scheme>
|
||||||
</component>
|
</component>
|
||||||
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
1
.idea/runConfigurations.xml
generated
1
.idea/runConfigurations.xml
generated
@@ -3,6 +3,7 @@
|
|||||||
<component name="RunConfigurationProducerService">
|
<component name="RunConfigurationProducerService">
|
||||||
<option name="ignoredProducers">
|
<option name="ignoredProducers">
|
||||||
<set>
|
<set>
|
||||||
|
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ apply plugin: 'com.google.gms.google-services'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 201
|
def appVersionCode = 218
|
||||||
def appVersionName = '1.16.19'
|
def appVersionName = '1.17.0'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
@@ -24,12 +24,12 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileSdkVersion 29
|
compileSdkVersion 30
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "it.integry.integrywmsnative"
|
applicationId "it.integry.integrywmsnative"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode appVersionCode
|
versionCode appVersionCode
|
||||||
versionName appVersionName
|
versionName appVersionName
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
@@ -50,8 +50,8 @@ android {
|
|||||||
android.buildFeatures.dataBinding true
|
android.buildFeatures.dataBinding true
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
targetCompatibility 1.8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
sourceCompatibility 1.8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
productFlavors {
|
productFlavors {
|
||||||
}
|
}
|
||||||
@@ -72,9 +72,10 @@ android {
|
|||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
abortOnError false
|
abortOnError false
|
||||||
|
checkReleaseBuilds false
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamicFeatures = [":dynamic__base", ":dynamic_vgalimenti", ":dynamic_ime", ":dynamic_frudis", ":dynamic_saporiveri_pv", ":dynamic_saporiveri", ':dynamic_gramm']
|
dynamicFeatures = [":dynamic__base"]
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -101,18 +102,18 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'com.google.android.material:material:1.3.0-rc01'
|
implementation 'com.google.android.material:material:1.3.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||||
implementation 'androidx.cardview:cardview:1.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
implementation 'androidx.recyclerview:recyclerview:1.2.0'
|
||||||
implementation 'androidx.preference:preference-ktx:1.1.1'
|
implementation 'androidx.preference:preference-ktx:1.1.1'
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
|
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||||
implementation 'com.annimon:stream:1.2.1'
|
implementation 'com.annimon:stream:1.2.2'
|
||||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0'
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
|
||||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||||
implementation 'androidx.lifecycle:lifecycle-common-java8:2.3.0'
|
implementation 'androidx.lifecycle:lifecycle-common-java8:2.3.1'
|
||||||
implementation 'org.apache.commons:commons-text:1.9'
|
implementation 'org.apache.commons:commons-text:1.9'
|
||||||
|
|
||||||
//MVVM
|
//MVVM
|
||||||
@@ -127,16 +128,16 @@ dependencies {
|
|||||||
implementation 'com.github.clans:fab:1.6.4'
|
implementation 'com.github.clans:fab:1.6.4'
|
||||||
//CUSTOM VIEWS
|
//CUSTOM VIEWS
|
||||||
implementation 'com.github.NaimishTrivedi:FBToast:1.0'
|
implementation 'com.github.NaimishTrivedi:FBToast:1.0'
|
||||||
implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
|
implementation 'com.github.cachapa:ExpandableLayout:2.9.2'
|
||||||
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
|
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
|
||||||
implementation 'com.fede987:status-bar-alert:1.0.1'
|
implementation 'com.github.fede87:StatusBarAlert:1.0.1'
|
||||||
implementation 'com.fxn769:stash:1.2'
|
implementation 'com.github.akshay2211:Stash:master'
|
||||||
testImplementation 'junit:junit:4.13.1'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
|
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
|
||||||
implementation 'com.github.pedromassango:doubleClick:3.0'
|
implementation 'com.github.pedromassango:doubleClick:3.0'
|
||||||
|
|
||||||
//SQLite ROOM
|
//SQLite ROOM
|
||||||
def room_version = "2.2.6"
|
def room_version = "2.3.0"
|
||||||
|
|
||||||
implementation "androidx.room:room-runtime:$room_version"
|
implementation "androidx.room:room-runtime:$room_version"
|
||||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||||
@@ -150,11 +151,12 @@ dependencies {
|
|||||||
implementation project(':barcode_base_android_library')
|
implementation project(':barcode_base_android_library')
|
||||||
implementation project(':honeywellscannerlibrary')
|
implementation project(':honeywellscannerlibrary')
|
||||||
implementation project(':keyobardemulatorscannerlibrary')
|
implementation project(':keyobardemulatorscannerlibrary')
|
||||||
implementation project(':barcode_kaiteki')
|
androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
|
||||||
androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
|
androidTestImplementation 'org.testng:testng:7.4.0'
|
||||||
androidTestImplementation 'org.testng:testng:7.3.0'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
|
maven { url 'https://jitpack.io' }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".MainApplication"
|
android:name=".MainApplication"
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviForn
|
|||||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreModule;
|
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreModule;
|
||||||
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceComponent;
|
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceComponent;
|
||||||
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceModule;
|
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Component;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Component;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Module;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Module;
|
||||||
import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtComponent;
|
import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtComponent;
|
||||||
@@ -62,6 +64,7 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
|||||||
ProdFabbisognoLineeProdModule.class,
|
ProdFabbisognoLineeProdModule.class,
|
||||||
VersamentoMerceModule.class,
|
VersamentoMerceModule.class,
|
||||||
DialogAskMagazzinoProssimitaModule.class,
|
DialogAskMagazzinoProssimitaModule.class,
|
||||||
|
DialogChooseBatchLotModule.class,
|
||||||
DialogRowInfoProdFabbisognoLineeProdModule.class})
|
DialogRowInfoProdFabbisognoLineeProdModule.class})
|
||||||
public interface MainApplicationComponent {
|
public interface MainApplicationComponent {
|
||||||
|
|
||||||
@@ -82,6 +85,7 @@ public interface MainApplicationComponent {
|
|||||||
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
||||||
VersamentoMerceComponent.Factory versamentoMerceComponent();
|
VersamentoMerceComponent.Factory versamentoMerceComponent();
|
||||||
DialogAskMagazzinoProssimitaComponent.Factory dialogAskMagazzinoProssimitaComponent();
|
DialogAskMagazzinoProssimitaComponent.Factory dialogAskMagazzinoProssimitaComponent();
|
||||||
|
DialogChooseBatchLotComponent.Factory dialogChooseBatchLotComponent();
|
||||||
DialogRowInfoProdFabbisognoLineeProdComponent.Factory dialogRowInfoProdFabbisognoLineeProdComponent();
|
DialogRowInfoProdFabbisognoLineeProdComponent.Factory dialogRowInfoProdFabbisognoLineeProdComponent();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ public class SplashActivity extends BaseActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
|
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
if(this.onRequestPermissionResult != null) {
|
if(this.onRequestPermissionResult != null) {
|
||||||
List<Integer> grantResultsList = new ArrayList<>();
|
List<Integer> grantResultsList = new ArrayList<>();
|
||||||
for(int i = 0; i < grantResults.length; i++) {
|
for(int i = 0; i < grantResults.length; i++) {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||||||
|
|
||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.google.android.gms.common.util.IOUtils;
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
@@ -122,7 +121,7 @@ public class ColliDataRecover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean thereIsAnExistantSession() {
|
public static boolean thereIsAnExistantSession() {
|
||||||
return mtbColtsSessions.size() > 0;
|
return mtbColtsSessions != null && mtbColtsSessions.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Integer> getAllSessionIDs() {
|
public static List<Integer> getAllSessionIDs() {
|
||||||
@@ -193,13 +192,16 @@ public class ColliDataRecover {
|
|||||||
try {
|
try {
|
||||||
inputStream = mContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
|
inputStream = mContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
|
||||||
|
|
||||||
byte[] bytes = IOUtils.readInputStreamFully(inputStream);
|
byte[] bytes = new byte[inputStream.available()];
|
||||||
|
inputStream.read(bytes);
|
||||||
|
inputStream.close();
|
||||||
|
|
||||||
String jsonString = new String(bytes);
|
String jsonString = new String(bytes);
|
||||||
|
|
||||||
Type listType = new TypeToken<ArrayList<RecoverDTO>>(){}.getType();
|
Type listType = new TypeToken<ArrayList<RecoverDTO>>(){}.getType();
|
||||||
mtbColtsSessions = gson.fromJson(jsonString, listType);
|
mtbColtsSessions = gson.fromJson(jsonString, listType);
|
||||||
|
|
||||||
inputStream.close();
|
if(mtbColtsSessions == null) mtbColtsSessions = new ArrayList<>();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
UtilityExceptions.defaultException(mContext, e);
|
UtilityExceptions.defaultException(mContext, e);
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import androidx.room.Update;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.GrigliaWrapper;
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.GrigliaWrapper;
|
||||||
|
|
||||||
@@ -17,7 +16,7 @@ public interface GrigliaDao {
|
|||||||
@Query("SELECT * from griglie")
|
@Query("SELECT * from griglie")
|
||||||
List<Griglia> getAll();
|
List<Griglia> getAll();
|
||||||
|
|
||||||
@Query("SELECT *, COUNT(articoli_griglia.articolo_griglia_id) as countArticoli from griglie LEFT JOIN articoli_griglia ON (griglie.griglia_id = articoli_griglia.id_griglia) where cod_alis = :codAlis GROUP BY griglie.griglia_id")
|
@Query("SELECT griglie.*, COUNT(articoli_griglia.articolo_griglia_id) as countArticoli from griglie LEFT JOIN articoli_griglia ON (griglie.griglia_id = articoli_griglia.id_griglia) where cod_alis = :codAlis GROUP BY griglie.griglia_id")
|
||||||
GrigliaWrapper findByCodAlis(String codAlis);
|
GrigliaWrapper findByCodAlis(String codAlis);
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import androidx.room.PrimaryKey;
|
|||||||
@Index(value = "cod_alis", unique = true)
|
@Index(value = "cod_alis", unique = true)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
public class Griglia {
|
public class Griglia {
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
@ColumnInfo(name = "griglia_id")
|
@ColumnInfo(name = "griglia_id")
|
||||||
|
|||||||
@@ -40,12 +40,14 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
protected void openProgress() {
|
protected void openProgress() {
|
||||||
|
BarcodeManager.disable();
|
||||||
if (this.mCurrentProgress == null) {
|
if (this.mCurrentProgress == null) {
|
||||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this);
|
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void closeProgress() {
|
protected void closeProgress() {
|
||||||
|
BarcodeManager.enable();
|
||||||
if (mCurrentProgress != null) {
|
if (mCurrentProgress != null) {
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
mCurrentProgress = null;
|
mCurrentProgress = null;
|
||||||
|
|||||||
@@ -12,19 +12,24 @@ public class BaseFragment extends Fragment {
|
|||||||
|
|
||||||
|
|
||||||
protected void openProgress() {
|
protected void openProgress() {
|
||||||
if (this.mCurrentProgress == null) {
|
|
||||||
|
// new Thread(() -> {
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
if (this.mCurrentProgress == null) {
|
||||||
|
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
// }).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void closeProgress() {
|
protected void closeProgress() {
|
||||||
if (mCurrentProgress != null) {
|
// new Thread(() -> {
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
mCurrentProgress.dismiss();
|
if (mCurrentProgress != null) {
|
||||||
mCurrentProgress = null;
|
mCurrentProgress.dismiss();
|
||||||
|
mCurrentProgress = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
// }).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@@ -485,40 +484,31 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void getByTestataStatic(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public static void getByTestataStatic(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
String ssccString = null;
|
testata.setMtbColr(new ObservableArrayList<>());
|
||||||
|
|
||||||
if (testata.getSerCollo().equalsIgnoreCase(CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE)) {
|
|
||||||
ssccString = "U";
|
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yy");
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
ssccString += sdf.format(testata.getDataColloD());
|
colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata).enqueue(new Callback<ServiceRESTResponse<MtbColt>>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
||||||
|
analyzeAnswer(response, "getColloInGiac", mtbColt -> {
|
||||||
|
|
||||||
ssccString += String.format("%07d", testata.getNumCollo());
|
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
|
||||||
} else {
|
List<MtbColt> mtbColtList = new ArrayList<>();
|
||||||
ssccString = "";
|
mtbColtList.add(mtbColt);
|
||||||
|
fillMtbAartsOfMtbColtsStatic(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
|
||||||
|
} else {
|
||||||
|
onComplete.run(mtbColt);
|
||||||
|
}
|
||||||
|
|
||||||
switch (testata.getGestioneEnum()) {
|
}, onFailed);
|
||||||
case ACQUISTO:
|
|
||||||
ssccString += "1";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LAVORAZIONE:
|
|
||||||
ssccString += "2";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VENDITA:
|
|
||||||
ssccString += "3";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yy");
|
@Override
|
||||||
ssccString += sdf.format(testata.getDataColloD());
|
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, Throwable t) {
|
||||||
|
onFailed.run(new Exception(t));
|
||||||
ssccString += String.format("%05d", testata.getNumCollo());
|
}
|
||||||
ssccString += "0";
|
});
|
||||||
}
|
|
||||||
|
|
||||||
getBySSCCStatic(ssccString, onlyResiduo, throwExcIfNull, onComplete, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -660,9 +650,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
).enqueue(new Callback<ServiceRESTResponse<MtbColr>>() {
|
).enqueue(new Callback<ServiceRESTResponse<MtbColr>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbColr>> call, Response<ServiceRESTResponse<MtbColr>> response) {
|
public void onResponse(Call<ServiceRESTResponse<MtbColr>> call, Response<ServiceRESTResponse<MtbColr>> response) {
|
||||||
analyzeAnswer(response, "creaRettificaCollo", data -> {
|
analyzeAnswer(response, "creaRettificaCollo", onComplete, onFailed);
|
||||||
onComplete.run(data);
|
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -674,6 +662,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
||||||
|
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
||||||
|
|
||||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||||
mtbColtToMoveClone.getMtbColr().get(i)
|
mtbColtToMoveClone.getMtbColr().get(i)
|
||||||
@@ -681,9 +670,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.setMtbPartitaMag(null);
|
.setMtbPartitaMag(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mtbColtDestClone.setMtbColr(null);
|
||||||
|
|
||||||
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
|
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
|
||||||
.setSourceMtbColt(sourceMtbColt)
|
.setSourceMtbColt(mtbColtToMoveClone)
|
||||||
.setDestinationMtbColt(destMtbColt);
|
.setDestinationMtbColt(mtbColtDestClone);
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
colliMagazzinoRESTConsumerService.spostaArtsTraUL(
|
colliMagazzinoRESTConsumerService.spostaArtsTraUL(
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ public interface ColliMagazzinoRESTConsumerService {
|
|||||||
@POST("getColloByBarcode")
|
@POST("getColloByBarcode")
|
||||||
Call<ServiceRESTResponse<MtbColt>> getColloByBarcode(@Query("codBarreCollo") String sscc, @Query("onlyResiduo") boolean onlyResiduo, @Query("throwExcIfNull") boolean throwExcIfNull);
|
Call<ServiceRESTResponse<MtbColt>> getColloByBarcode(@Query("codBarreCollo") String sscc, @Query("onlyResiduo") boolean onlyResiduo, @Query("throwExcIfNull") boolean throwExcIfNull);
|
||||||
|
|
||||||
|
@POST("getColloInGiac")
|
||||||
|
Call<ServiceRESTResponse<MtbColt>> getColloInGiac(@Query("onlyResiduo") boolean onlyResiduo, @Query("throwExcIfNull") boolean throwExcIfNull, @Body MtbColt mtbColt);
|
||||||
|
|
||||||
@GET("getColliInBasket")
|
@GET("getColliInBasket")
|
||||||
Call<ServiceRESTResponse<List<MtbColt>>> getColliInBasket(@Query("codMdep") String codMdep);
|
Call<ServiceRESTResponse<List<MtbColt>>> getColliInBasket(@Query("codMdep") String codMdep);
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class DBSettingsModel {
|
|||||||
private boolean flagSpedizioneUseQtaOrd;
|
private boolean flagSpedizioneUseQtaOrd;
|
||||||
private String produzioneDefaultCodAnag;
|
private String produzioneDefaultCodAnag;
|
||||||
private String reportNameSpedizionChiudiOrdine;
|
private String reportNameSpedizionChiudiOrdine;
|
||||||
|
private int onNumCnfInputChanged = 1;
|
||||||
|
|
||||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||||
return flagSpedizioneEnableFakeGiacenza;
|
return flagSpedizioneEnableFakeGiacenza;
|
||||||
@@ -261,4 +262,13 @@ public class DBSettingsModel {
|
|||||||
this.reportNameSpedizionChiudiOrdine = reportNameSpedizionChiudiOrdine;
|
this.reportNameSpedizionChiudiOrdine = reportNameSpedizionChiudiOrdine;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getOnNumCnfInputChanged() {
|
||||||
|
return onNumCnfInputChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setOnNumCnfInputChanged(int onNumCnfInputChanged) {
|
||||||
|
this.onNumCnfInputChanged = onNumCnfInputChanged;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,6 +262,10 @@ public class SettingsManager {
|
|||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("SPEDIZIONE")
|
.setSection("SPEDIZIONE")
|
||||||
.setKeySection("FLAG_USE_QTA_ORD"));
|
.setKeySection("FLAG_USE_QTA_ORD"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("SETUP")
|
||||||
|
.setKeySection("ON_NUM_CNF_INPUT_CHANGED"));
|
||||||
|
|
||||||
|
|
||||||
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
||||||
@@ -287,6 +291,11 @@ public class SettingsManager {
|
|||||||
dbSettingsModelIstance.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
|
dbSettingsModelIstance.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
|
||||||
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
||||||
|
|
||||||
|
Integer onNumCnfInputChanged = getValueFromList(list, "SETUP", "ON_NUM_CNF_INPUT_CHANGED", Integer.class);
|
||||||
|
if(onNumCnfInputChanged != null) {
|
||||||
|
dbSettingsModelIstance.setOnNumCnfInputChanged(onNumCnfInputChanged);
|
||||||
|
}
|
||||||
|
|
||||||
if(onComplete != null) onComplete.run();
|
if(onComplete != null) onComplete.run();
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
|
|
||||||
@@ -303,6 +312,8 @@ public class SettingsManager {
|
|||||||
return clazz.cast(value.getValue());
|
return clazz.cast(value.getValue());
|
||||||
} else if(clazz == Boolean.class) {
|
} else if(clazz == Boolean.class) {
|
||||||
return clazz.cast("S".equalsIgnoreCase(value.getValue()));
|
return clazz.cast("S".equalsIgnoreCase(value.getValue()));
|
||||||
|
} else if(clazz == Integer.class && value.getValue() != null) {
|
||||||
|
return clazz.cast(Integer.parseInt(value.getValue()));
|
||||||
} else return null;
|
} else return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
package it.integry.integrywmsnative.core.utility;
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.ProgressDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.widget.ProgressBar;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogProgress;
|
import it.integry.integrywmsnative.view.dialogs.DialogProgress;
|
||||||
|
|
||||||
public class UtilityProgress {
|
public class UtilityProgress {
|
||||||
@@ -26,27 +23,4 @@ public class UtilityProgress {
|
|||||||
return progress;
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Thread makeProgressBarIndeterminate(ProgressBar progressBar) {
|
|
||||||
progressBar.setMax(100);
|
|
||||||
|
|
||||||
Thread updateProgressThread = new Thread(() -> {
|
|
||||||
|
|
||||||
try {
|
|
||||||
while (true) {
|
|
||||||
for (int i = 0; i < 100; i++) {
|
|
||||||
progressBar.setProgress(i);
|
|
||||||
Thread.sleep(10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
// String message = ex.toString();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
updateProgressThread.start();
|
|
||||||
|
|
||||||
return updateProgressThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class UtilityString {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String empty2null(String stringToCheck) {
|
public static String empty2null(String stringToCheck) {
|
||||||
return (stringToCheck != null && stringToCheck.trim().length() == 0 || stringToCheck == null) ? null : stringToCheck.trim();
|
return (stringToCheck == null || stringToCheck.trim().length() == 0) ? null : stringToCheck.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String capitalizeWords(String capString){
|
public static String capitalizeWords(String capString){
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import android.text.SpannableString;
|
|||||||
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.databinding.ObservableField;
|
import androidx.databinding.ObservableField;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
@@ -24,6 +23,7 @@ import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||||
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleActivity;
|
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleActivity;
|
||||||
import it.integry.integrywmsnative.gest.contenuto_bancale.core.ContenutoBancaleListAdapter;
|
import it.integry.integrywmsnative.gest.contenuto_bancale.core.ContenutoBancaleListAdapter;
|
||||||
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
import static android.app.Activity.RESULT_OK;
|
import static android.app.Activity.RESULT_OK;
|
||||||
@@ -66,7 +66,7 @@ public class ContenutoBancaleViewModel implements IRecyclerItemClicked<MtbColr>
|
|||||||
|
|
||||||
mContext.bindings.contenutoBancaleMainList.setLayoutManager(new LinearLayoutManager(mContext));
|
mContext.bindings.contenutoBancaleMainList.setLayoutManager(new LinearLayoutManager(mContext));
|
||||||
|
|
||||||
DividerItemDecoration itemDecorator = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL);
|
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(mContext, SimpleDividerItemDecoration.VERTICAL);
|
||||||
itemDecorator.setDrawable(ContextCompat.getDrawable(mContext, R.drawable.divider));
|
itemDecorator.setDrawable(ContextCompat.getDrawable(mContext, R.drawable.divider));
|
||||||
mContext.bindings.contenutoBancaleMainList.addItemDecoration(itemDecorator);
|
mContext.bindings.contenutoBancaleMainList.addItemDecoration(itemDecorator);
|
||||||
|
|
||||||
|
|||||||
@@ -2,22 +2,22 @@ package it.integry.integrywmsnative.gest.lista_bancali.viewmodel;
|
|||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
|
||||||
import androidx.databinding.ObservableArrayList;
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
import androidx.databinding.ObservableArrayList;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.interfaces.IRecyclerItemClicked;
|
import it.integry.integrywmsnative.core.interfaces.IRecyclerItemClicked;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||||
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliActivity;
|
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliActivity;
|
||||||
import it.integry.integrywmsnative.gest.lista_bancali.core.MainListListaColliAdapter;
|
import it.integry.integrywmsnative.gest.lista_bancali.core.MainListListaColliAdapter;
|
||||||
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
|
|
||||||
public class ListaBancaliViewModel implements IRecyclerItemClicked<MtbColt> {
|
public class ListaBancaliViewModel implements IRecyclerItemClicked<MtbColt> {
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ public class ListaBancaliViewModel implements IRecyclerItemClicked<MtbColt> {
|
|||||||
mContext.bindings.listaColliMainList.setHasFixedSize(true);
|
mContext.bindings.listaColliMainList.setHasFixedSize(true);
|
||||||
mContext.bindings.listaColliMainList.setLayoutManager(new LinearLayoutManager(mContext));
|
mContext.bindings.listaColliMainList.setLayoutManager(new LinearLayoutManager(mContext));
|
||||||
|
|
||||||
DividerItemDecoration itemDecorator = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL);
|
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(mContext, SimpleDividerItemDecoration.VERTICAL);
|
||||||
itemDecorator.setDrawable(ContextCompat.getDrawable(mContext, R.drawable.divider));
|
itemDecorator.setDrawable(ContextCompat.getDrawable(mContext, R.drawable.divider));
|
||||||
mContext.bindings.listaColliMainList.addItemDecoration(itemDecorator);
|
mContext.bindings.listaColliMainList.addItemDecoration(itemDecorator);
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import it.integry.integrywmsnative.core.settings.SettingsManager;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentMainOrdiniUscitaBinding;
|
import it.integry.integrywmsnative.databinding.FragmentMainOrdiniUscitaBinding;
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs.DialogVenditaFiltroAvanzato;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs.DialogVenditaFiltroAvanzatoView;
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs.DialogVenditaFiltroAvanzatoViewModel;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs.DialogVenditaFiltroAvanzatoViewModel;
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.list.OrdiniUscitaElencoAdapter;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.list.OrdiniUscitaElencoAdapter;
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.list.OrdiniUscitaElencoListModel;
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.list.OrdiniUscitaElencoListModel;
|
||||||
@@ -151,13 +151,13 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
boolean canSelectMultipleOrdini = SettingsManager.iDB().isFlagSpedizioneCanSelectMultipleOrders();
|
boolean canSelectMultipleOrdini = SettingsManager.iDB().isFlagSpedizioneCanSelectMultipleOrders();
|
||||||
boolean canSelectMultipleClienti = SettingsManager.iDB().isFlagMultiClienteOrdV();
|
boolean canSelectMultipleClienti = SettingsManager.iDB().isFlagMultiClienteOrdV();
|
||||||
|
|
||||||
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), this::refreshList);
|
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), v -> this.refreshList(null));
|
||||||
|
|
||||||
OrdiniUscitaElencoAdapter ordiniUscitaElencoAdapter =
|
OrdiniUscitaElencoAdapter ordiniUscitaElencoAdapter =
|
||||||
new OrdiniUscitaElencoAdapter(getActivity(), mOrdiniInevasiMutableData)
|
new OrdiniUscitaElencoAdapter(getActivity(), mOrdiniInevasiMutableData)
|
||||||
.setEmptyView(this.mBindings.ordiniVenditaEmptyView)
|
.setEmptyView(this.mBindings.ordiniVenditaEmptyView)
|
||||||
.setOnGroupItemClicked(x -> {
|
.setOnGroupItemClicked(x -> {
|
||||||
if(!canSelectMultipleClienti) {
|
if (!canSelectMultipleClienti) {
|
||||||
Stream.of(mOrdiniInevasiMutableData)
|
Stream.of(mOrdiniInevasiMutableData)
|
||||||
.filter(y -> !y.getGroupTitle().equalsIgnoreCase(x) && y.getSelectedObservable().get())
|
.filter(y -> !y.getGroupTitle().equalsIgnoreCase(x) && y.getSelectedObservable().get())
|
||||||
.forEach(y -> y.getSelectedObservable().set(false));
|
.forEach(y -> y.getSelectedObservable().set(false));
|
||||||
@@ -172,7 +172,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
.forEach(y -> y.getSelectedObservable().set(!allSelected));
|
.forEach(y -> y.getSelectedObservable().set(!allSelected));
|
||||||
})
|
})
|
||||||
.setOnItemChecked(x -> {
|
.setOnItemChecked(x -> {
|
||||||
if(!canSelectMultipleClienti && x.getSelectedObservable().get()) {
|
if (!canSelectMultipleClienti && x.getSelectedObservable().get()) {
|
||||||
Stream.of(mOrdiniInevasiMutableData)
|
Stream.of(mOrdiniInevasiMutableData)
|
||||||
.filter(y -> !y.getGroupTitle().equalsIgnoreCase(x.getGroupTitle()) && y.getSelectedObservable().get())
|
.filter(y -> !y.getGroupTitle().equalsIgnoreCase(x.getGroupTitle()) && y.getSelectedObservable().get())
|
||||||
.forEach(y -> y.getSelectedObservable().set(false));
|
.forEach(y -> y.getSelectedObservable().set(false));
|
||||||
@@ -185,7 +185,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
this.mBindings.venditaMainList.setAdapter(ordiniUscitaElencoAdapter);
|
this.mBindings.venditaMainList.setAdapter(ordiniUscitaElencoAdapter);
|
||||||
this.mBindings.venditaMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
this.mBindings.venditaMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
|
|
||||||
if(mToolbar != null)
|
if (mToolbar != null)
|
||||||
mToolbar.setRecyclerView(this.mBindings.venditaMainList);
|
mToolbar.setRecyclerView(this.mBindings.venditaMainList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,15 +207,28 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
private void refreshList(List<OrdiniUscitaElencoDTO> orderList) {
|
private void refreshList(List<OrdiniUscitaElencoDTO> filteredList) {
|
||||||
|
List<OrdiniUscitaElencoDTO> tmpList = null;
|
||||||
|
|
||||||
|
if(filteredList != null) {
|
||||||
|
tmpList = filteredList;
|
||||||
|
} else if (mAppliedFilterViewModel != null) {
|
||||||
|
mAppliedFilterViewModel.init(mViewModel.getOrderList().getValue());
|
||||||
|
mAppliedFilterViewModel.applyAllTests();
|
||||||
|
tmpList = mAppliedFilterViewModel.getMutableFilteredOrderList().getValue();
|
||||||
|
} else {
|
||||||
|
tmpList = mViewModel.getOrderList().getValue();
|
||||||
|
}
|
||||||
|
|
||||||
this.mOrdiniInevasiMutableData.clear();
|
this.mOrdiniInevasiMutableData.clear();
|
||||||
this.mOrdiniInevasiMutableData.addAll(convertDataModelToListModel(orderList));
|
this.mOrdiniInevasiMutableData.addAll(convertDataModelToListModel(tmpList));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<OrdiniUscitaElencoListModel> convertDataModelToListModel(List<OrdiniUscitaElencoDTO> dataList) {
|
private List<OrdiniUscitaElencoListModel> convertDataModelToListModel(List<OrdiniUscitaElencoDTO> dataList) {
|
||||||
|
|
||||||
ComparatorCompat<OrdiniUscitaElencoDTO> comparator = ComparatorCompat
|
ComparatorCompat<OrdiniUscitaElencoDTO> comparator = ComparatorCompat
|
||||||
.comparing(OrdiniUscitaElencoDTO::getRagSocOrd)
|
.comparing(OrdiniUscitaElencoDTO::getRagSocOrd)
|
||||||
|
.thenComparing(ComparatorCompat.comparing(x -> x.getDestinatario() != null ? x.getDestinatario() : "zzzzzzzzz"))
|
||||||
.thenComparing(ComparatorCompat.comparing(OrdiniUscitaElencoDTO::getNumOrd));
|
.thenComparing(ComparatorCompat.comparing(OrdiniUscitaElencoDTO::getNumOrd));
|
||||||
|
|
||||||
List<OrdiniUscitaElencoListModel> notHiddenElements = Stream.of(dataList)
|
List<OrdiniUscitaElencoListModel> notHiddenElements = Stream.of(dataList)
|
||||||
@@ -343,19 +356,17 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFilterClick() {
|
public void onFilterClick() {
|
||||||
DialogVenditaFiltroAvanzato.make(
|
DialogVenditaFiltroAvanzatoView.make(
|
||||||
getActivity(),
|
getActivity(),
|
||||||
this.mViewModel.getOrderList().getValue(),
|
this.mViewModel.getOrderList().getValue(),
|
||||||
mAppliedFilterViewModel,
|
mAppliedFilterViewModel,
|
||||||
|
|
||||||
(filteredOrderList, filter) -> {
|
filter -> {
|
||||||
mAppliedFilterViewModel = filter;
|
|
||||||
|
|
||||||
if(filteredOrderList != null){
|
mAppliedFilterViewModel = filter;
|
||||||
refreshList(filteredOrderList);
|
refreshList(null);
|
||||||
}
|
|
||||||
|
|
||||||
}).show();
|
}).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,662 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs;
|
|
||||||
|
|
||||||
import android.app.DatePickerDialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.MultiAutoCompleteTextView;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
import com.annimon.stream.function.Predicate;
|
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
|
||||||
import it.integry.integrywmsnative.core.class_router.interfaces.IFiltroOrdiniVendita;
|
|
||||||
import it.integry.integrywmsnative.core.di.BindableString;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogVenditaFiltroAvanzatoBinding;
|
|
||||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoDTO;
|
|
||||||
|
|
||||||
|
|
||||||
public class DialogVenditaFiltroAvanzato {
|
|
||||||
|
|
||||||
|
|
||||||
private final AlertDialog currentAlert;
|
|
||||||
private final Context currentContext;
|
|
||||||
|
|
||||||
private final RunnableArgss<List<OrdiniUscitaElencoDTO>, DialogVenditaFiltroAvanzatoViewModel> currentOnFilterDone;
|
|
||||||
|
|
||||||
private final List<OrdiniUscitaElencoDTO> currentOrderList;
|
|
||||||
private List<OrdiniUscitaElencoDTO> currentFilteredOrderList;
|
|
||||||
|
|
||||||
private ArrayAdapter<String> arrayAdapterCodMdep;
|
|
||||||
private ArrayAdapter<String> arrayAdapterIdViaggio;
|
|
||||||
private ArrayAdapter<String> arrayAdapterNumOrds;
|
|
||||||
private ArrayAdapter<String> arrayAdapterCliente;
|
|
||||||
private ArrayAdapter<String> arrayAdapterTermCons;
|
|
||||||
private ArrayAdapter<String> arrayAdapterVettore;
|
|
||||||
private ArrayAdapter<String> arrayAdapterAgente;
|
|
||||||
private ArrayAdapter<String> arrayAdapterAutomezzo;
|
|
||||||
|
|
||||||
private Predicate<OrdiniUscitaElencoDTO> currentDepositoPredicate = null;
|
|
||||||
private Predicate<OrdiniUscitaElencoDTO> currentIdViaggioPredicate = null;
|
|
||||||
private Predicate<OrdiniUscitaElencoDTO> currentNumOrdsPredicate = null;
|
|
||||||
private Predicate<OrdiniUscitaElencoDTO> currentClientePredicate = null;
|
|
||||||
private Predicate<OrdiniUscitaElencoDTO> currentDataConsPredicate = null;
|
|
||||||
private Predicate<OrdiniUscitaElencoDTO> currentTermConsPredicate = null;
|
|
||||||
private Predicate<OrdiniUscitaElencoDTO> currentVettorePredicate = null;
|
|
||||||
private Predicate<OrdiniUscitaElencoDTO> currentAgentePredicate = null;
|
|
||||||
private Predicate<OrdiniUscitaElencoDTO> currentAutomezzoPredicate = null;
|
|
||||||
|
|
||||||
private boolean firstInit = true;
|
|
||||||
|
|
||||||
public static AlertDialog make(final Context context, final List<OrdiniUscitaElencoDTO> ordersList, RunnableArgss<List<OrdiniUscitaElencoDTO>, DialogVenditaFiltroAvanzatoViewModel> onDismiss) {
|
|
||||||
return new DialogVenditaFiltroAvanzato(context, ordersList, null, onDismiss).currentAlert;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AlertDialog make(final Context context,
|
|
||||||
final List<OrdiniUscitaElencoDTO> ordersList,
|
|
||||||
DialogVenditaFiltroAvanzatoViewModel baseViewModel,
|
|
||||||
RunnableArgss<List<OrdiniUscitaElencoDTO>, DialogVenditaFiltroAvanzatoViewModel> onDismiss) {
|
|
||||||
return new DialogVenditaFiltroAvanzato(context, ordersList, baseViewModel, onDismiss).currentAlert;
|
|
||||||
}
|
|
||||||
|
|
||||||
private DialogVenditaFiltroAvanzato(final Context context, final List<OrdiniUscitaElencoDTO> ordersList, DialogVenditaFiltroAvanzatoViewModel baseViewModel, RunnableArgss<List<OrdiniUscitaElencoDTO>, DialogVenditaFiltroAvanzatoViewModel> onDismiss) {
|
|
||||||
currentContext = context;
|
|
||||||
currentOrderList = ordersList;
|
|
||||||
currentOnFilterDone = onDismiss;
|
|
||||||
|
|
||||||
DialogVenditaFiltroAvanzatoViewModel viewModel = baseViewModel != null ? baseViewModel : new DialogVenditaFiltroAvanzatoViewModel();
|
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
|
||||||
|
|
||||||
DialogVenditaFiltroAvanzatoBinding binding = DataBindingUtil.inflate(inflater, R.layout.dialog_vendita_filtro_avanzato, null, false);
|
|
||||||
|
|
||||||
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
|
|
||||||
.setView(binding.getRoot());
|
|
||||||
|
|
||||||
binding.setViewmodel(viewModel);
|
|
||||||
initViewModelNew(viewModel);
|
|
||||||
initView(binding, viewModel);
|
|
||||||
|
|
||||||
currentAlert = alertDialog.create();
|
|
||||||
currentAlert.setCanceledOnTouchOutside(false);
|
|
||||||
|
|
||||||
currentAlert.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
|
||||||
currentAlert.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
binding.positiveBtn.setOnClickListener(view -> {
|
|
||||||
currentAlert.dismiss();
|
|
||||||
});
|
|
||||||
|
|
||||||
binding.neutralBtn.setOnClickListener(view -> {
|
|
||||||
resetAll(viewModel);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
currentAlert.setOnDismissListener(dialogInterface -> {
|
|
||||||
if(currentOnFilterDone != null) currentOnFilterDone.run(currentFilteredOrderList, viewModel);
|
|
||||||
});
|
|
||||||
|
|
||||||
refreshList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void resetAll(DialogVenditaFiltroAvanzatoViewModel viewModel) {
|
|
||||||
viewModel.deposito.set(null);
|
|
||||||
viewModel.idViaggio.set(null);
|
|
||||||
viewModel.numOrds.set(null);
|
|
||||||
viewModel.cliente.set(null);
|
|
||||||
viewModel.dataConsegna.set(null);
|
|
||||||
viewModel.terminiConsegna.set(null);
|
|
||||||
viewModel.vettore.set(null);
|
|
||||||
viewModel.automezzo.set(null);
|
|
||||||
viewModel.agente.set(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initView(DialogVenditaFiltroAvanzatoBinding bindings, DialogVenditaFiltroAvanzatoViewModel viewModel) {
|
|
||||||
IFiltroOrdiniVendita filtroOrdiniVendita = ClassRouter.getInstance(ClassRouter.PATH.FILTRO_ORDINI_VENDITA);
|
|
||||||
|
|
||||||
// bindings.filledExposedDropdownDataCons.setOnFocusChangeListener((v, hasFocus) -> {
|
|
||||||
// bindings.filledExposedDropdownDataCons.callOnClick();
|
|
||||||
// });
|
|
||||||
|
|
||||||
bindings.filledExposedDropdownDataCons.setOnClickListener(view -> {
|
|
||||||
Calendar c = UtilityDate.getCalendarInstance();
|
|
||||||
|
|
||||||
if(viewModel.dataConsegnaDate != null) {
|
|
||||||
c.setTime(viewModel.dataConsegnaDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
int mYear = c.get(Calendar.YEAR);
|
|
||||||
int mMonth = c.get(Calendar.MONTH);
|
|
||||||
int mDay = c.get(Calendar.DAY_OF_MONTH);
|
|
||||||
|
|
||||||
DatePickerDialog datePickerDialog = new DatePickerDialog(currentContext,
|
|
||||||
(view2, year, month, day) -> {
|
|
||||||
|
|
||||||
viewModel.dataConsegnaDate = new GregorianCalendar(year, month, day).getTime();
|
|
||||||
viewModel.dataConsegna.set(UtilityDate.formatDate(viewModel.dataConsegnaDate, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
|
|
||||||
|
|
||||||
}, mYear, mMonth, mDay);
|
|
||||||
datePickerDialog.show();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
arrayAdapterCodMdep = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
|
||||||
arrayAdapterCodMdep.addAll(getAvailableCodMdeps(false));
|
|
||||||
bindings.inputCodMdepNew.setVisibility(filtroOrdiniVendita.shoudShowCodMdepFilter() ? View.VISIBLE : View.GONE);
|
|
||||||
bindings.filledExposedDropdownCodMdep.setAdapter(arrayAdapterCodMdep);
|
|
||||||
|
|
||||||
arrayAdapterIdViaggio = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
|
||||||
arrayAdapterIdViaggio.addAll(getAvailableIdViaggio(false));
|
|
||||||
bindings.inputIdViaggio.setVisibility(filtroOrdiniVendita.shoudShowIdViaggioFilter() ? View.VISIBLE : View.GONE);
|
|
||||||
bindings.filledExposedDropdownIdViaggio.setAdapter(arrayAdapterIdViaggio);
|
|
||||||
|
|
||||||
arrayAdapterAgente = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
|
||||||
arrayAdapterAgente.addAll(getAvailableAgente(false));
|
|
||||||
bindings.inputAgente.setVisibility(filtroOrdiniVendita.shoudShowAgenteFilter() ? View.VISIBLE : View.GONE);
|
|
||||||
bindings.filledExposedDropdownAgente.setAdapter(arrayAdapterAgente);
|
|
||||||
|
|
||||||
arrayAdapterNumOrds = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
|
||||||
arrayAdapterNumOrds.addAll(getAvailableNumOrds(false));
|
|
||||||
bindings.filledExposedDropdownNumOrds.setAdapter(arrayAdapterNumOrds);
|
|
||||||
bindings.filledExposedDropdownNumOrds.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
|
|
||||||
|
|
||||||
arrayAdapterCliente = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
|
||||||
arrayAdapterCliente.addAll(getAvailableCliente(false));
|
|
||||||
bindings.filledExposedDropdownCliente.setAdapter(arrayAdapterCliente);
|
|
||||||
|
|
||||||
arrayAdapterTermCons = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
|
||||||
arrayAdapterTermCons.addAll(getAvailableTermCons(false));
|
|
||||||
bindings.filledExposedDropdownTermCons.setAdapter(arrayAdapterTermCons);
|
|
||||||
|
|
||||||
arrayAdapterVettore = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
|
||||||
arrayAdapterVettore.addAll(getAvailableVettori(false));
|
|
||||||
bindings.filledExposedDropdownVettore.setAdapter(arrayAdapterVettore);
|
|
||||||
|
|
||||||
arrayAdapterAutomezzo = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
|
||||||
arrayAdapterAutomezzo.addAll(getAvailableAutomezzi(false));
|
|
||||||
bindings.filledExposedDropdownAutomezzo.setAdapter(arrayAdapterAutomezzo);
|
|
||||||
|
|
||||||
|
|
||||||
viewModel.deposito.refresh();
|
|
||||||
viewModel.idViaggio.refresh();
|
|
||||||
viewModel.numOrds.refresh();
|
|
||||||
viewModel.cliente.refresh();
|
|
||||||
viewModel.terminiConsegna.refresh();
|
|
||||||
viewModel.vettore.refresh();
|
|
||||||
viewModel.automezzo.refresh();
|
|
||||||
viewModel.dataConsegna.refresh();
|
|
||||||
viewModel.agente.refresh();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initViewModelNew(DialogVenditaFiltroAvanzatoViewModel viewModel) {
|
|
||||||
BindableString.registerListener(viewModel.idViaggio, value -> {
|
|
||||||
if(UtilityString.isNullOrEmpty(value)) currentIdViaggioPredicate = null;
|
|
||||||
else {
|
|
||||||
String[] idViaggiSplitted = value.split("[,\\ ]");
|
|
||||||
|
|
||||||
try{
|
|
||||||
List<Integer> idViaggiInteger = Stream.of(idViaggiSplitted)
|
|
||||||
.filter(x -> !UtilityString.isNullOrEmpty(x))
|
|
||||||
.map(Integer::parseInt).toList();
|
|
||||||
|
|
||||||
currentIdViaggioPredicate = o -> idViaggiInteger.contains(o.getIdViaggio());
|
|
||||||
} catch (NumberFormatException ex) {
|
|
||||||
currentNumOrdsPredicate = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshList();
|
|
||||||
|
|
||||||
arrayAdapterCodMdep.clear();
|
|
||||||
arrayAdapterCodMdep.addAll(getAvailableCodMdeps(true));
|
|
||||||
arrayAdapterNumOrds.clear();
|
|
||||||
arrayAdapterNumOrds.addAll(getAvailableNumOrds(true));
|
|
||||||
arrayAdapterCliente.clear();
|
|
||||||
arrayAdapterCliente.addAll(getAvailableCliente(true));
|
|
||||||
arrayAdapterTermCons.clear();
|
|
||||||
arrayAdapterTermCons.addAll(getAvailableTermCons(true));
|
|
||||||
arrayAdapterVettore.clear();
|
|
||||||
arrayAdapterVettore.addAll(getAvailableVettori(true));
|
|
||||||
arrayAdapterAutomezzo.clear();
|
|
||||||
arrayAdapterAutomezzo.addAll(getAvailableAutomezzi(true));
|
|
||||||
arrayAdapterAgente.clear();
|
|
||||||
arrayAdapterAgente.addAll(getAvailableAgente(true));
|
|
||||||
});
|
|
||||||
|
|
||||||
BindableString.registerListener(viewModel.deposito, value -> {
|
|
||||||
if(UtilityString.isNullOrEmpty(value)) currentDepositoPredicate = null;
|
|
||||||
else {
|
|
||||||
currentDepositoPredicate = o -> o.getCodMdep().toLowerCase().equalsIgnoreCase(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshList();
|
|
||||||
|
|
||||||
arrayAdapterNumOrds.clear();
|
|
||||||
arrayAdapterNumOrds.addAll(getAvailableNumOrds(true));
|
|
||||||
arrayAdapterIdViaggio.clear();
|
|
||||||
arrayAdapterIdViaggio.addAll(getAvailableIdViaggio(true));
|
|
||||||
arrayAdapterCliente.clear();
|
|
||||||
arrayAdapterCliente.addAll(getAvailableCliente(true));
|
|
||||||
arrayAdapterTermCons.clear();
|
|
||||||
arrayAdapterTermCons.addAll(getAvailableTermCons(true));
|
|
||||||
arrayAdapterVettore.clear();
|
|
||||||
arrayAdapterVettore.addAll(getAvailableVettori(true));
|
|
||||||
arrayAdapterAutomezzo.clear();
|
|
||||||
arrayAdapterAutomezzo.addAll(getAvailableAutomezzi(true));
|
|
||||||
arrayAdapterAgente.clear();
|
|
||||||
arrayAdapterAgente.addAll(getAvailableAgente(true));
|
|
||||||
});
|
|
||||||
|
|
||||||
BindableString.registerListener(viewModel.numOrds, value -> {
|
|
||||||
if(UtilityString.isNullOrEmpty(value)) currentNumOrdsPredicate = null;
|
|
||||||
else {
|
|
||||||
String[] numOrdsSplitted = value.split("[,\\ ]");
|
|
||||||
|
|
||||||
try{
|
|
||||||
List<Integer> numOrdsInteger = Stream.of(numOrdsSplitted)
|
|
||||||
.filter(x -> !UtilityString.isNullOrEmpty(x))
|
|
||||||
.map(Integer::parseInt).toList();
|
|
||||||
|
|
||||||
currentNumOrdsPredicate = o -> numOrdsInteger.contains(o.getNumOrd());
|
|
||||||
} catch (NumberFormatException ex) {
|
|
||||||
currentNumOrdsPredicate = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshList();
|
|
||||||
|
|
||||||
arrayAdapterCodMdep.clear();
|
|
||||||
arrayAdapterCodMdep.addAll(getAvailableCodMdeps(true));
|
|
||||||
arrayAdapterIdViaggio.clear();
|
|
||||||
arrayAdapterIdViaggio.addAll(getAvailableIdViaggio(true));
|
|
||||||
arrayAdapterCliente.clear();
|
|
||||||
arrayAdapterCliente.addAll(getAvailableCliente(true));
|
|
||||||
arrayAdapterTermCons.clear();
|
|
||||||
arrayAdapterTermCons.addAll(getAvailableTermCons(true));
|
|
||||||
arrayAdapterVettore.clear();
|
|
||||||
arrayAdapterVettore.addAll(getAvailableVettori(true));
|
|
||||||
arrayAdapterAutomezzo.clear();
|
|
||||||
arrayAdapterAutomezzo.addAll(getAvailableAutomezzi(true));
|
|
||||||
arrayAdapterAgente.clear();
|
|
||||||
arrayAdapterAgente.addAll(getAvailableAgente(true));
|
|
||||||
});
|
|
||||||
|
|
||||||
BindableString.registerListener(viewModel.cliente, value -> {
|
|
||||||
if(UtilityString.isNullOrEmpty(value)) currentClientePredicate = null;
|
|
||||||
else {
|
|
||||||
currentClientePredicate = o -> o.getRagSocOrd().toLowerCase().contains(value.toLowerCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshList();
|
|
||||||
|
|
||||||
arrayAdapterCodMdep.clear();
|
|
||||||
arrayAdapterCodMdep.addAll(getAvailableCodMdeps(true));
|
|
||||||
arrayAdapterIdViaggio.clear();
|
|
||||||
arrayAdapterIdViaggio.addAll(getAvailableIdViaggio(true));
|
|
||||||
arrayAdapterNumOrds.clear();
|
|
||||||
arrayAdapterNumOrds.addAll(getAvailableNumOrds(true));
|
|
||||||
arrayAdapterTermCons.clear();
|
|
||||||
arrayAdapterTermCons.addAll(getAvailableTermCons(true));
|
|
||||||
arrayAdapterVettore.clear();
|
|
||||||
arrayAdapterVettore.addAll(getAvailableVettori(true));
|
|
||||||
arrayAdapterAutomezzo.clear();
|
|
||||||
arrayAdapterAutomezzo.addAll(getAvailableAutomezzi(true));
|
|
||||||
arrayAdapterAgente.clear();
|
|
||||||
arrayAdapterAgente.addAll(getAvailableAgente(true));
|
|
||||||
});
|
|
||||||
|
|
||||||
BindableString.registerListener(viewModel.terminiConsegna, value -> {
|
|
||||||
if(UtilityString.isNullOrEmpty(value)) currentTermConsPredicate = null;
|
|
||||||
else {
|
|
||||||
currentTermConsPredicate = o -> !UtilityString.isNullOrEmpty(o.getTermCons()) && o.getTermCons().equalsIgnoreCase(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshList();
|
|
||||||
|
|
||||||
arrayAdapterCodMdep.clear();
|
|
||||||
arrayAdapterCodMdep.addAll(getAvailableCodMdeps(true));
|
|
||||||
arrayAdapterIdViaggio.clear();
|
|
||||||
arrayAdapterIdViaggio.addAll(getAvailableIdViaggio(true));
|
|
||||||
arrayAdapterNumOrds.clear();
|
|
||||||
arrayAdapterNumOrds.addAll(getAvailableNumOrds(true));
|
|
||||||
arrayAdapterCliente.clear();
|
|
||||||
arrayAdapterCliente.addAll(getAvailableCliente(true));
|
|
||||||
arrayAdapterVettore.clear();
|
|
||||||
arrayAdapterVettore.addAll(getAvailableVettori(true));
|
|
||||||
arrayAdapterAutomezzo.clear();
|
|
||||||
arrayAdapterAutomezzo.addAll(getAvailableAutomezzi(true));
|
|
||||||
arrayAdapterAgente.clear();
|
|
||||||
arrayAdapterAgente.addAll(getAvailableAgente(true));
|
|
||||||
});
|
|
||||||
|
|
||||||
BindableString.registerListener(viewModel.vettore, value -> {
|
|
||||||
if(UtilityString.isNullOrEmpty(value)) currentVettorePredicate = null;
|
|
||||||
else {
|
|
||||||
currentVettorePredicate = o -> (o.getCodVvet() + " - " + o.getDescrizioneVettore()).equalsIgnoreCase(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshList();
|
|
||||||
|
|
||||||
arrayAdapterCodMdep.clear();
|
|
||||||
arrayAdapterCodMdep.addAll(getAvailableCodMdeps(true));
|
|
||||||
arrayAdapterIdViaggio.clear();
|
|
||||||
arrayAdapterIdViaggio.addAll(getAvailableIdViaggio(true));
|
|
||||||
arrayAdapterNumOrds.clear();
|
|
||||||
arrayAdapterNumOrds.addAll(getAvailableNumOrds(true));
|
|
||||||
arrayAdapterCliente.clear();
|
|
||||||
arrayAdapterCliente.addAll(getAvailableCliente(true));
|
|
||||||
arrayAdapterTermCons.clear();
|
|
||||||
arrayAdapterTermCons.addAll(getAvailableTermCons(true));
|
|
||||||
arrayAdapterAutomezzo.clear();
|
|
||||||
arrayAdapterAutomezzo.addAll(getAvailableAutomezzi(true));
|
|
||||||
arrayAdapterAgente.clear();
|
|
||||||
arrayAdapterAgente.addAll(getAvailableAgente(true));
|
|
||||||
});
|
|
||||||
|
|
||||||
BindableString.registerListener(viewModel.automezzo, value -> {
|
|
||||||
if(UtilityString.isNullOrEmpty(value)) currentAutomezzoPredicate = null;
|
|
||||||
else {
|
|
||||||
currentAutomezzoPredicate = o -> !UtilityString.isNullOrEmpty(o.getDescrizioneAuto()) && (o.getDescrizioneAuto().toLowerCase().contains(value) || o.getDescrizioneAuto().equalsIgnoreCase(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshList();
|
|
||||||
|
|
||||||
arrayAdapterCodMdep.clear();
|
|
||||||
arrayAdapterCodMdep.addAll(getAvailableCodMdeps(true));
|
|
||||||
arrayAdapterIdViaggio.clear();
|
|
||||||
arrayAdapterIdViaggio.addAll(getAvailableIdViaggio(true));
|
|
||||||
arrayAdapterNumOrds.clear();
|
|
||||||
arrayAdapterNumOrds.addAll(getAvailableNumOrds(true));
|
|
||||||
arrayAdapterCliente.clear();
|
|
||||||
arrayAdapterCliente.addAll(getAvailableCliente(true));
|
|
||||||
arrayAdapterTermCons.clear();
|
|
||||||
arrayAdapterTermCons.addAll(getAvailableTermCons(true));
|
|
||||||
arrayAdapterVettore.clear();
|
|
||||||
arrayAdapterVettore.addAll(getAvailableVettori(true));
|
|
||||||
arrayAdapterAgente.clear();
|
|
||||||
arrayAdapterAgente.addAll(getAvailableAgente(true));
|
|
||||||
});
|
|
||||||
|
|
||||||
BindableString.resetListeners(viewModel.dataConsegna);
|
|
||||||
BindableString.registerListener(viewModel.dataConsegna, value -> {
|
|
||||||
if(UtilityString.isNullOrEmpty(value)) currentDataConsPredicate = null;
|
|
||||||
else {
|
|
||||||
currentDataConsPredicate = o -> o.getDataConsD().equals(viewModel.dataConsegnaDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshList();
|
|
||||||
|
|
||||||
arrayAdapterCodMdep.clear();
|
|
||||||
arrayAdapterCodMdep.addAll(getAvailableCodMdeps(true));
|
|
||||||
arrayAdapterIdViaggio.clear();
|
|
||||||
arrayAdapterIdViaggio.addAll(getAvailableIdViaggio(true));
|
|
||||||
arrayAdapterNumOrds.clear();
|
|
||||||
arrayAdapterNumOrds.addAll(getAvailableNumOrds(true));
|
|
||||||
arrayAdapterCliente.clear();
|
|
||||||
arrayAdapterCliente.addAll(getAvailableCliente(true));
|
|
||||||
arrayAdapterTermCons.clear();
|
|
||||||
arrayAdapterTermCons.addAll(getAvailableTermCons(true));
|
|
||||||
arrayAdapterVettore.clear();
|
|
||||||
arrayAdapterVettore.addAll(getAvailableVettori(true));
|
|
||||||
arrayAdapterAutomezzo.clear();
|
|
||||||
arrayAdapterAutomezzo.addAll(getAvailableAutomezzi(true));
|
|
||||||
arrayAdapterAgente.clear();
|
|
||||||
arrayAdapterAgente.addAll(getAvailableAgente(true));
|
|
||||||
});
|
|
||||||
|
|
||||||
BindableString.resetListeners(viewModel.agente);
|
|
||||||
BindableString.registerListener(viewModel.agente, value -> {
|
|
||||||
if(UtilityString.isNullOrEmpty(value)) currentAgentePredicate = null;
|
|
||||||
else {
|
|
||||||
currentAgentePredicate = o -> !UtilityString.isNullOrEmpty(o.getNomeAgente()) && (o.getNomeAgente().toLowerCase().contains(value) || o.getNomeAgente().equalsIgnoreCase(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshList();
|
|
||||||
|
|
||||||
arrayAdapterCodMdep.clear();
|
|
||||||
arrayAdapterCodMdep.addAll(getAvailableCodMdeps(true));
|
|
||||||
arrayAdapterIdViaggio.clear();
|
|
||||||
arrayAdapterIdViaggio.addAll(getAvailableIdViaggio(true));
|
|
||||||
arrayAdapterNumOrds.clear();
|
|
||||||
arrayAdapterNumOrds.addAll(getAvailableNumOrds(true));
|
|
||||||
arrayAdapterCliente.clear();
|
|
||||||
arrayAdapterCliente.addAll(getAvailableCliente(true));
|
|
||||||
arrayAdapterTermCons.clear();
|
|
||||||
arrayAdapterTermCons.addAll(getAvailableTermCons(true));
|
|
||||||
arrayAdapterVettore.clear();
|
|
||||||
arrayAdapterVettore.addAll(getAvailableVettori(true));
|
|
||||||
arrayAdapterAutomezzo.clear();
|
|
||||||
arrayAdapterAutomezzo.addAll(getAvailableAutomezzi(true));
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private List<String> getAvailableIdViaggio(boolean skipRecalc) {
|
|
||||||
if(currentAgentePredicate == null && currentNumOrdsPredicate == null && currentClientePredicate == null && currentDataConsPredicate == null && currentAutomezzoPredicate == null && currentVettorePredicate == null && currentTermConsPredicate == null && currentDepositoPredicate == null){
|
|
||||||
currentFilteredOrderList = currentOrderList;
|
|
||||||
} else if(!skipRecalc){
|
|
||||||
Stream<OrdiniUscitaElencoDTO> tmpStream = Stream.of(currentOrderList)
|
|
||||||
.filter(x ->
|
|
||||||
(currentNumOrdsPredicate == null || (currentNumOrdsPredicate.test(x))) &&
|
|
||||||
(currentClientePredicate == null || (currentClientePredicate.test(x))) &&
|
|
||||||
(currentDataConsPredicate == null || (currentDataConsPredicate.test(x))) &&
|
|
||||||
(currentVettorePredicate == null || (currentVettorePredicate.test(x))) &&
|
|
||||||
(currentAutomezzoPredicate == null || (currentAutomezzoPredicate.test(x))) &&
|
|
||||||
(currentTermConsPredicate == null || (currentTermConsPredicate.test(x))) &&
|
|
||||||
(currentDepositoPredicate == null || (currentDepositoPredicate.test(x))) &&
|
|
||||||
(currentAgentePredicate == null || (currentAgentePredicate.test(x)))
|
|
||||||
);
|
|
||||||
|
|
||||||
currentFilteredOrderList = tmpStream.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Stream
|
|
||||||
.of(currentFilteredOrderList)
|
|
||||||
.filter(x -> x.getIdViaggio() != null)
|
|
||||||
.sortBy(x -> -x.getIdViaggio())
|
|
||||||
.map(x -> x.getIdViaggio() != null ? x.getIdViaggio().toString() : null)
|
|
||||||
.distinct()
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getAvailableAgente(boolean skipRecalc) {
|
|
||||||
if(currentDepositoPredicate == null && currentIdViaggioPredicate == null && currentNumOrdsPredicate == null && currentClientePredicate == null && currentDataConsPredicate == null && currentAutomezzoPredicate == null && currentVettorePredicate == null && currentTermConsPredicate == null){
|
|
||||||
currentFilteredOrderList = currentOrderList;
|
|
||||||
} else if(!skipRecalc){
|
|
||||||
Stream<OrdiniUscitaElencoDTO> tmpStream = Stream.of(currentOrderList)
|
|
||||||
.filter(x ->
|
|
||||||
(currentNumOrdsPredicate == null || (currentNumOrdsPredicate.test(x))) &&
|
|
||||||
(currentClientePredicate == null || (currentClientePredicate.test(x))) &&
|
|
||||||
(currentDataConsPredicate == null || (currentDataConsPredicate.test(x))) &&
|
|
||||||
(currentVettorePredicate == null || (currentVettorePredicate.test(x))) &&
|
|
||||||
(currentAutomezzoPredicate == null || (currentAutomezzoPredicate.test(x))) &&
|
|
||||||
(currentTermConsPredicate == null || (currentTermConsPredicate.test(x))) &&
|
|
||||||
(currentIdViaggioPredicate == null || (currentIdViaggioPredicate.test(x))) &&
|
|
||||||
(currentDepositoPredicate == null || (currentDepositoPredicate.test(x))) &&
|
|
||||||
(currentAgentePredicate == null || (currentAgentePredicate.test(x)))
|
|
||||||
);
|
|
||||||
|
|
||||||
currentFilteredOrderList = tmpStream.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Stream.of(currentFilteredOrderList).map(OrdiniUscitaElencoDTO::getNomeAgente).distinct().withoutNulls().sorted().toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getAvailableCodMdeps(boolean skipRecalc) {
|
|
||||||
if(currentAgentePredicate == null && currentIdViaggioPredicate == null && currentNumOrdsPredicate == null && currentClientePredicate == null && currentDataConsPredicate == null && currentAutomezzoPredicate == null && currentVettorePredicate == null && currentTermConsPredicate == null){
|
|
||||||
currentFilteredOrderList = currentOrderList;
|
|
||||||
} else if(!skipRecalc){
|
|
||||||
Stream<OrdiniUscitaElencoDTO> tmpStream = Stream.of(currentOrderList)
|
|
||||||
.filter(x ->
|
|
||||||
(currentNumOrdsPredicate == null || (currentNumOrdsPredicate.test(x))) &&
|
|
||||||
(currentClientePredicate == null || (currentClientePredicate.test(x))) &&
|
|
||||||
(currentDataConsPredicate == null || (currentDataConsPredicate.test(x))) &&
|
|
||||||
(currentVettorePredicate == null || (currentVettorePredicate.test(x))) &&
|
|
||||||
(currentAutomezzoPredicate == null || (currentAutomezzoPredicate.test(x))) &&
|
|
||||||
(currentTermConsPredicate == null || (currentTermConsPredicate.test(x))) &&
|
|
||||||
(currentIdViaggioPredicate == null || (currentIdViaggioPredicate.test(x))) &&
|
|
||||||
(currentAgentePredicate == null || (currentAgentePredicate.test(x)))
|
|
||||||
);
|
|
||||||
|
|
||||||
currentFilteredOrderList = tmpStream.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Stream.of(currentFilteredOrderList).map(OrdiniUscitaElencoDTO::getCodMdep).distinct().withoutNulls().sorted().toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getAvailableCliente(boolean skipRecalc) {
|
|
||||||
if(currentAgentePredicate == null && currentIdViaggioPredicate == null && currentNumOrdsPredicate == null && currentDepositoPredicate == null && currentDataConsPredicate == null && currentAutomezzoPredicate == null && currentVettorePredicate == null && currentTermConsPredicate == null){
|
|
||||||
currentFilteredOrderList = currentOrderList;
|
|
||||||
} else if(!skipRecalc){
|
|
||||||
Stream<OrdiniUscitaElencoDTO> tmpStream = Stream.of(currentOrderList)
|
|
||||||
.filter(x ->
|
|
||||||
(currentNumOrdsPredicate == null || (currentNumOrdsPredicate.test(x))) &&
|
|
||||||
(currentDepositoPredicate == null || (currentDepositoPredicate.test(x))) &&
|
|
||||||
(currentDataConsPredicate == null || (currentDataConsPredicate.test(x))) &&
|
|
||||||
(currentVettorePredicate == null || (currentVettorePredicate.test(x))) &&
|
|
||||||
(currentAutomezzoPredicate == null || (currentAutomezzoPredicate.test(x))) &&
|
|
||||||
(currentTermConsPredicate == null || (currentTermConsPredicate.test(x))) &&
|
|
||||||
(currentIdViaggioPredicate == null || (currentIdViaggioPredicate.test(x))) &&
|
|
||||||
(currentAgentePredicate == null || (currentAgentePredicate.test(x)))
|
|
||||||
);
|
|
||||||
|
|
||||||
currentFilteredOrderList = tmpStream.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Stream.of(currentFilteredOrderList).map(OrdiniUscitaElencoDTO::getRagSocOrd).distinct().withoutNulls().sorted().toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getAvailableNumOrds(boolean skipRecalc) {
|
|
||||||
if(currentAgentePredicate == null && currentIdViaggioPredicate == null && currentDepositoPredicate == null && currentClientePredicate == null && currentDataConsPredicate == null && currentAutomezzoPredicate == null && currentVettorePredicate == null && currentTermConsPredicate == null){
|
|
||||||
currentFilteredOrderList = currentOrderList;
|
|
||||||
} else if(!skipRecalc){
|
|
||||||
Stream<OrdiniUscitaElencoDTO> tmpStream = Stream.of(currentOrderList)
|
|
||||||
.filter(x ->
|
|
||||||
(currentDepositoPredicate == null || (currentDepositoPredicate.test(x))) &&
|
|
||||||
(currentClientePredicate == null || (currentClientePredicate.test(x))) &&
|
|
||||||
(currentDataConsPredicate == null || (currentDataConsPredicate.test(x))) &&
|
|
||||||
(currentVettorePredicate == null || (currentVettorePredicate.test(x))) &&
|
|
||||||
(currentAutomezzoPredicate == null || (currentAutomezzoPredicate.test(x))) &&
|
|
||||||
(currentTermConsPredicate == null || (currentTermConsPredicate.test(x))) &&
|
|
||||||
(currentIdViaggioPredicate == null || (currentIdViaggioPredicate.test(x))) &&
|
|
||||||
(currentAgentePredicate == null || (currentAgentePredicate.test(x)))
|
|
||||||
);
|
|
||||||
|
|
||||||
currentFilteredOrderList = tmpStream.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Stream.of(currentFilteredOrderList).map(x -> x.getNumOrd().toString()).distinct().withoutNulls().sorted().toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getAvailableTermCons(boolean skipRecalc) {
|
|
||||||
if(currentAgentePredicate == null && currentIdViaggioPredicate == null && currentNumOrdsPredicate == null && currentClientePredicate == null && currentDataConsPredicate == null && currentAutomezzoPredicate == null && currentVettorePredicate == null && currentDepositoPredicate == null){
|
|
||||||
currentFilteredOrderList = currentOrderList;
|
|
||||||
} else if(!skipRecalc){
|
|
||||||
Stream<OrdiniUscitaElencoDTO> tmpStream = Stream.of(currentOrderList)
|
|
||||||
.filter(x ->
|
|
||||||
(currentNumOrdsPredicate == null || (currentNumOrdsPredicate.test(x))) &&
|
|
||||||
(currentClientePredicate == null || (currentClientePredicate.test(x))) &&
|
|
||||||
(currentDataConsPredicate == null || (currentDataConsPredicate.test(x))) &&
|
|
||||||
(currentVettorePredicate == null || (currentVettorePredicate.test(x))) &&
|
|
||||||
(currentAutomezzoPredicate == null || (currentAutomezzoPredicate.test(x))) &&
|
|
||||||
(currentDepositoPredicate == null || (currentDepositoPredicate.test(x))) &&
|
|
||||||
(currentIdViaggioPredicate == null || (currentIdViaggioPredicate.test(x))) &&
|
|
||||||
(currentAgentePredicate == null || (currentAgentePredicate.test(x)))
|
|
||||||
);
|
|
||||||
|
|
||||||
currentFilteredOrderList = tmpStream.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Stream.of(currentFilteredOrderList).map(OrdiniUscitaElencoDTO::getTermCons).distinct().withoutNulls().sorted().toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getAvailableVettori(boolean skipRecalc) {
|
|
||||||
if(currentAgentePredicate == null && currentIdViaggioPredicate == null && currentNumOrdsPredicate == null && currentClientePredicate == null && currentDataConsPredicate == null && currentTermConsPredicate == null && currentAutomezzoPredicate == null && currentDepositoPredicate == null){
|
|
||||||
currentFilteredOrderList = currentOrderList;
|
|
||||||
} else if(!skipRecalc){
|
|
||||||
Stream<OrdiniUscitaElencoDTO> tmpStream = Stream.of(currentOrderList)
|
|
||||||
.filter(x ->
|
|
||||||
(currentNumOrdsPredicate == null || (currentNumOrdsPredicate.test(x))) &&
|
|
||||||
(currentClientePredicate == null || (currentClientePredicate.test(x))) &&
|
|
||||||
(currentDataConsPredicate == null || (currentDataConsPredicate.test(x))) &&
|
|
||||||
(currentTermConsPredicate == null || (currentTermConsPredicate.test(x))) &&
|
|
||||||
(currentAutomezzoPredicate == null || (currentAutomezzoPredicate .test(x))) &&
|
|
||||||
(currentDepositoPredicate == null || (currentDepositoPredicate.test(x))) &&
|
|
||||||
(currentIdViaggioPredicate == null || (currentIdViaggioPredicate.test(x))) &&
|
|
||||||
(currentAgentePredicate == null || (currentAgentePredicate.test(x)))
|
|
||||||
);
|
|
||||||
|
|
||||||
currentFilteredOrderList = tmpStream.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Stream.of(currentFilteredOrderList).filter(x -> x.getCodVvet() != null).map(x -> x.getCodVvet() + " - " + x.getDescrizioneVettore()).distinct().withoutNulls().sorted().toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getAvailableAutomezzi(boolean skipRecalc) {
|
|
||||||
if(currentAgentePredicate == null && currentIdViaggioPredicate == null && currentNumOrdsPredicate == null && currentClientePredicate == null && currentDataConsPredicate == null && currentTermConsPredicate == null && currentVettorePredicate == null && currentDepositoPredicate == null){
|
|
||||||
currentFilteredOrderList = currentOrderList;
|
|
||||||
} else if(!skipRecalc){
|
|
||||||
Stream<OrdiniUscitaElencoDTO> tmpStream = Stream.of(currentOrderList)
|
|
||||||
.filter(x ->
|
|
||||||
(currentNumOrdsPredicate == null || (currentNumOrdsPredicate.test(x))) &&
|
|
||||||
(currentClientePredicate == null || (currentClientePredicate.test(x))) &&
|
|
||||||
(currentDataConsPredicate == null || (currentDataConsPredicate.test(x))) &&
|
|
||||||
(currentTermConsPredicate == null || (currentTermConsPredicate.test(x))) &&
|
|
||||||
(currentVettorePredicate == null || (currentVettorePredicate.test(x))) &&
|
|
||||||
(currentDepositoPredicate == null || (currentDepositoPredicate.test(x))) &&
|
|
||||||
(currentIdViaggioPredicate == null || (currentIdViaggioPredicate.test(x))) &&
|
|
||||||
(currentAgentePredicate == null || (currentAgentePredicate.test(x)))
|
|
||||||
);
|
|
||||||
|
|
||||||
currentFilteredOrderList = tmpStream.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Stream.of(currentFilteredOrderList).map(OrdiniUscitaElencoDTO::getDescrizioneAuto).distinct().withoutNulls().sorted().toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refreshList() {
|
|
||||||
|
|
||||||
if(currentAgentePredicate == null && currentIdViaggioPredicate == null && currentNumOrdsPredicate == null && currentClientePredicate == null && currentDataConsPredicate == null && currentTermConsPredicate == null && currentVettorePredicate == null && currentAutomezzoPredicate == null && currentDepositoPredicate == null){
|
|
||||||
currentFilteredOrderList = currentOrderList;
|
|
||||||
} else {
|
|
||||||
Stream<OrdiniUscitaElencoDTO> tmpStream = Stream.of(currentOrderList)
|
|
||||||
.filter(x ->
|
|
||||||
(currentNumOrdsPredicate == null || (currentNumOrdsPredicate.test(x))) &&
|
|
||||||
(currentClientePredicate == null || (currentClientePredicate.test(x))) &&
|
|
||||||
(currentDataConsPredicate == null || (currentDataConsPredicate.test(x))) &&
|
|
||||||
(currentTermConsPredicate == null || (currentTermConsPredicate.test(x))) &&
|
|
||||||
(currentVettorePredicate == null || (currentVettorePredicate.test(x))) &&
|
|
||||||
(currentAutomezzoPredicate == null || (currentAutomezzoPredicate.test(x))) &&
|
|
||||||
(currentDepositoPredicate == null || (currentDepositoPredicate.test(x))) &&
|
|
||||||
(currentIdViaggioPredicate == null || (currentIdViaggioPredicate.test(x))) &&
|
|
||||||
(currentAgentePredicate == null || (currentAgentePredicate.test(x)))
|
|
||||||
);
|
|
||||||
|
|
||||||
currentFilteredOrderList = tmpStream.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,465 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs;
|
||||||
|
|
||||||
|
import android.app.DatePickerDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.MultiAutoCompleteTextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||||
|
import it.integry.integrywmsnative.core.class_router.interfaces.IFiltroOrdiniVendita;
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableString;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogVenditaFiltroAvanzatoBinding;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoDTO;
|
||||||
|
|
||||||
|
|
||||||
|
public class DialogVenditaFiltroAvanzatoView {
|
||||||
|
|
||||||
|
|
||||||
|
private final AlertDialog currentAlert;
|
||||||
|
private final Context currentContext;
|
||||||
|
|
||||||
|
private final RunnableArgs<DialogVenditaFiltroAvanzatoViewModel> currentOnFilterDone;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public BindableString deposito = new BindableString();
|
||||||
|
public BindableString idViaggio = new BindableString();
|
||||||
|
public BindableString numOrds = new BindableString();
|
||||||
|
public BindableString cliente = new BindableString();
|
||||||
|
public BindableString dataConsegna = new BindableString();
|
||||||
|
public BindableString terminiConsegna = new BindableString();
|
||||||
|
public BindableString agente = new BindableString();
|
||||||
|
public BindableString vettore = new BindableString();
|
||||||
|
public BindableString automezzo = new BindableString();
|
||||||
|
public BindableString paese = new BindableString();
|
||||||
|
|
||||||
|
public Date dataConsegnaDate;
|
||||||
|
|
||||||
|
private ArrayAdapter<String> arrayAdapterCodMdep;
|
||||||
|
private ArrayAdapter<String> arrayAdapterIdViaggio;
|
||||||
|
private ArrayAdapter<String> arrayAdapterNumOrds;
|
||||||
|
private ArrayAdapter<String> arrayAdapterCliente;
|
||||||
|
private ArrayAdapter<String> arrayAdapterTermCons;
|
||||||
|
private ArrayAdapter<String> arrayAdapterVettore;
|
||||||
|
private ArrayAdapter<String> arrayAdapterAgente;
|
||||||
|
private ArrayAdapter<String> arrayAdapterAutomezzo;
|
||||||
|
private ArrayAdapter<String> arrayAdapterPaese;
|
||||||
|
|
||||||
|
private DialogVenditaFiltroAvanzatoViewModel viewModel;
|
||||||
|
|
||||||
|
public static AlertDialog make(final Context context, final List<OrdiniUscitaElencoDTO> ordersList, RunnableArgs<DialogVenditaFiltroAvanzatoViewModel> onDismiss) {
|
||||||
|
return new DialogVenditaFiltroAvanzatoView(context, ordersList, null, onDismiss).currentAlert;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AlertDialog make(final Context context,
|
||||||
|
final List<OrdiniUscitaElencoDTO> ordersList,
|
||||||
|
DialogVenditaFiltroAvanzatoViewModel baseViewModel,
|
||||||
|
RunnableArgs<DialogVenditaFiltroAvanzatoViewModel> onDismiss) {
|
||||||
|
return new DialogVenditaFiltroAvanzatoView(context, ordersList, baseViewModel, onDismiss).currentAlert;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogVenditaFiltroAvanzatoView(final Context context, final List<OrdiniUscitaElencoDTO> ordersList, DialogVenditaFiltroAvanzatoViewModel baseViewModel, RunnableArgs<DialogVenditaFiltroAvanzatoViewModel> onDismiss) {
|
||||||
|
currentContext = context;
|
||||||
|
currentOnFilterDone = onDismiss;
|
||||||
|
|
||||||
|
viewModel = baseViewModel != null ? baseViewModel : new DialogVenditaFiltroAvanzatoViewModel();
|
||||||
|
viewModel.init(ordersList);
|
||||||
|
|
||||||
|
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||||
|
|
||||||
|
DialogVenditaFiltroAvanzatoBinding binding = DataBindingUtil.inflate(inflater, R.layout.dialog_vendita_filtro_avanzato, null, false);
|
||||||
|
|
||||||
|
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
|
||||||
|
.setView(binding.getRoot());
|
||||||
|
|
||||||
|
binding.setView(this);
|
||||||
|
binding.setViewmodel(viewModel);
|
||||||
|
initViewModelNew(viewModel);
|
||||||
|
initView(binding, viewModel);
|
||||||
|
|
||||||
|
currentAlert = alertDialog.create();
|
||||||
|
currentAlert.setCanceledOnTouchOutside(false);
|
||||||
|
|
||||||
|
currentAlert.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
currentAlert.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
binding.positiveBtn.setOnClickListener(view -> {
|
||||||
|
currentAlert.dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
|
binding.neutralBtn.setOnClickListener(view -> {
|
||||||
|
resetAll();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
currentAlert.setOnDismissListener(dialogInterface -> {
|
||||||
|
if(currentOnFilterDone != null) currentOnFilterDone.run(viewModel);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView(DialogVenditaFiltroAvanzatoBinding bindings, DialogVenditaFiltroAvanzatoViewModel viewModel) {
|
||||||
|
IFiltroOrdiniVendita filtroOrdiniVendita = ClassRouter.getInstance(ClassRouter.PATH.FILTRO_ORDINI_VENDITA);
|
||||||
|
|
||||||
|
// bindings.filledExposedDropdownDataCons.setOnFocusChangeListener((v, hasFocus) -> {
|
||||||
|
// bindings.filledExposedDropdownDataCons.callOnClick();
|
||||||
|
// });
|
||||||
|
|
||||||
|
bindings.filledExposedDropdownDataCons.setOnClickListener(view -> {
|
||||||
|
Calendar c = UtilityDate.getCalendarInstance();
|
||||||
|
|
||||||
|
if(dataConsegnaDate != null) {
|
||||||
|
c.setTime(dataConsegnaDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mYear = c.get(Calendar.YEAR);
|
||||||
|
int mMonth = c.get(Calendar.MONTH);
|
||||||
|
int mDay = c.get(Calendar.DAY_OF_MONTH);
|
||||||
|
|
||||||
|
DatePickerDialog datePickerDialog = new DatePickerDialog(currentContext,
|
||||||
|
(view2, year, month, day) -> {
|
||||||
|
|
||||||
|
dataConsegnaDate = new GregorianCalendar(year, month, day).getTime();
|
||||||
|
dataConsegna.set(UtilityDate.formatDate(dataConsegnaDate, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
|
||||||
|
|
||||||
|
}, mYear, mMonth, mDay);
|
||||||
|
datePickerDialog.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
arrayAdapterCodMdep = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
||||||
|
arrayAdapterCodMdep.addAll(getAvailableCodMdeps(false));
|
||||||
|
bindings.inputCodMdepNew.setVisibility(filtroOrdiniVendita.shoudShowCodMdepFilter() ? View.VISIBLE : View.GONE);
|
||||||
|
bindings.filledExposedDropdownCodMdep.setAdapter(arrayAdapterCodMdep);
|
||||||
|
|
||||||
|
arrayAdapterIdViaggio = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
||||||
|
arrayAdapterIdViaggio.addAll(getAvailableIdViaggio(false));
|
||||||
|
bindings.inputIdViaggio.setVisibility(filtroOrdiniVendita.shoudShowIdViaggioFilter() ? View.VISIBLE : View.GONE);
|
||||||
|
bindings.filledExposedDropdownIdViaggio.setAdapter(arrayAdapterIdViaggio);
|
||||||
|
|
||||||
|
arrayAdapterAgente = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
||||||
|
arrayAdapterAgente.addAll(getAvailableAgente(false));
|
||||||
|
bindings.inputAgente.setVisibility(filtroOrdiniVendita.shoudShowAgenteFilter() ? View.VISIBLE : View.GONE);
|
||||||
|
bindings.filledExposedDropdownAgente.setAdapter(arrayAdapterAgente);
|
||||||
|
|
||||||
|
arrayAdapterNumOrds = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
||||||
|
arrayAdapterNumOrds.addAll(getAvailableNumOrds(false));
|
||||||
|
bindings.filledExposedDropdownNumOrds.setAdapter(arrayAdapterNumOrds);
|
||||||
|
bindings.filledExposedDropdownNumOrds.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
|
||||||
|
|
||||||
|
arrayAdapterCliente = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
||||||
|
arrayAdapterCliente.addAll(getAvailableCliente(false));
|
||||||
|
bindings.filledExposedDropdownCliente.setAdapter(arrayAdapterCliente);
|
||||||
|
|
||||||
|
arrayAdapterTermCons = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
||||||
|
arrayAdapterTermCons.addAll(getAvailableTermCons(false));
|
||||||
|
bindings.filledExposedDropdownTermCons.setAdapter(arrayAdapterTermCons);
|
||||||
|
|
||||||
|
arrayAdapterVettore = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
||||||
|
arrayAdapterVettore.addAll(getAvailableVettori(false));
|
||||||
|
bindings.filledExposedDropdownVettore.setAdapter(arrayAdapterVettore);
|
||||||
|
|
||||||
|
arrayAdapterAutomezzo = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
||||||
|
arrayAdapterAutomezzo.addAll(getAvailableAutomezzi(false));
|
||||||
|
bindings.filledExposedDropdownAutomezzo.setAdapter(arrayAdapterAutomezzo);
|
||||||
|
|
||||||
|
arrayAdapterPaese = new ArrayAdapter(currentContext, R.layout.dialog_vendita_filtro_avanzato__single_item);
|
||||||
|
arrayAdapterPaese.addAll(getAvailablePaesi(false));
|
||||||
|
bindings.filledExposedDropdownPaese.setAdapter(arrayAdapterPaese);
|
||||||
|
|
||||||
|
|
||||||
|
refreshAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initViewModelNew(DialogVenditaFiltroAvanzatoViewModel viewModel) {
|
||||||
|
viewModel.applyAllTests();
|
||||||
|
|
||||||
|
BindableString.registerListener(idViaggio, value -> {
|
||||||
|
viewModel.setIDViaggioFilter(value);
|
||||||
|
viewModel.applyAllTests();
|
||||||
|
|
||||||
|
refreshArrayAdapter(arrayAdapterCodMdep, getAvailableCodMdeps(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterNumOrds, getAvailableNumOrds(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterCliente, getAvailableCliente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterTermCons, getAvailableTermCons(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterVettore, getAvailableVettori(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAutomezzo, getAvailableAutomezzi(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAgente, getAvailableAgente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterPaese, getAvailablePaesi(true));
|
||||||
|
});
|
||||||
|
|
||||||
|
BindableString.registerListener(deposito, value -> {
|
||||||
|
viewModel.setDepositoFilter(value);
|
||||||
|
viewModel.applyAllTests();
|
||||||
|
|
||||||
|
refreshArrayAdapter(arrayAdapterNumOrds, getAvailableNumOrds(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterIdViaggio, getAvailableIdViaggio(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterCliente, getAvailableCliente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterTermCons, getAvailableTermCons(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterVettore, getAvailableVettori(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAutomezzo, getAvailableAutomezzi(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAgente, getAvailableAgente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterPaese, getAvailablePaesi(true));
|
||||||
|
});
|
||||||
|
|
||||||
|
BindableString.registerListener(numOrds, value -> {
|
||||||
|
viewModel.setNumOrdFilter(value);
|
||||||
|
viewModel.applyAllTests();
|
||||||
|
|
||||||
|
refreshArrayAdapter(arrayAdapterCodMdep, getAvailableCodMdeps(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterIdViaggio, getAvailableIdViaggio(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterCliente, getAvailableCliente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterTermCons, getAvailableTermCons(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterVettore, getAvailableVettori(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAutomezzo, getAvailableAutomezzi(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAgente, getAvailableAgente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterPaese, getAvailablePaesi(true));
|
||||||
|
});
|
||||||
|
|
||||||
|
BindableString.registerListener(cliente, value -> {
|
||||||
|
viewModel.setClienteFilter(value);
|
||||||
|
viewModel.applyAllTests();
|
||||||
|
|
||||||
|
refreshArrayAdapter(arrayAdapterCodMdep, getAvailableCodMdeps(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterIdViaggio, getAvailableIdViaggio(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterNumOrds, getAvailableNumOrds(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterTermCons, getAvailableTermCons(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterVettore, getAvailableVettori(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAutomezzo, getAvailableAutomezzi(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAgente, getAvailableAgente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterPaese, getAvailablePaesi(true));
|
||||||
|
});
|
||||||
|
|
||||||
|
BindableString.registerListener(terminiConsegna, value -> {
|
||||||
|
viewModel.setTerminiConsegnaFilter(value);
|
||||||
|
viewModel.applyAllTests();
|
||||||
|
|
||||||
|
refreshArrayAdapter(arrayAdapterCodMdep, getAvailableCodMdeps(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterIdViaggio, getAvailableIdViaggio(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterNumOrds, getAvailableNumOrds(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterCliente, getAvailableCliente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterVettore, getAvailableVettori(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAutomezzo, getAvailableAutomezzi(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAgente, getAvailableAgente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterPaese, getAvailablePaesi(true));
|
||||||
|
});
|
||||||
|
|
||||||
|
BindableString.registerListener(vettore, value -> {
|
||||||
|
viewModel.setVettoreFilter(value);
|
||||||
|
viewModel.applyAllTests();
|
||||||
|
|
||||||
|
refreshArrayAdapter(arrayAdapterCodMdep, getAvailableCodMdeps(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterIdViaggio, getAvailableIdViaggio(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterNumOrds, getAvailableNumOrds(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterCliente, getAvailableCliente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterTermCons, getAvailableTermCons(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAutomezzo, getAvailableAutomezzi(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAgente, getAvailableAgente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterPaese, getAvailablePaesi(true));
|
||||||
|
});
|
||||||
|
|
||||||
|
BindableString.registerListener(automezzo, value -> {
|
||||||
|
viewModel.setAutomezzoFilter(value);
|
||||||
|
viewModel.applyAllTests();
|
||||||
|
|
||||||
|
refreshArrayAdapter(arrayAdapterCodMdep, getAvailableCodMdeps(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterIdViaggio, getAvailableIdViaggio(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterNumOrds, getAvailableNumOrds(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterCliente, getAvailableCliente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterTermCons, getAvailableTermCons(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterVettore, getAvailableVettori(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAgente, getAvailableAgente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterPaese, getAvailablePaesi(true));
|
||||||
|
});
|
||||||
|
|
||||||
|
BindableString.resetListeners(dataConsegna);
|
||||||
|
BindableString.registerListener(dataConsegna, value -> {
|
||||||
|
viewModel.setDataConsegnaFilter(dataConsegnaDate);
|
||||||
|
viewModel.applyAllTests();
|
||||||
|
|
||||||
|
refreshArrayAdapter(arrayAdapterCodMdep, getAvailableCodMdeps(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterIdViaggio, getAvailableIdViaggio(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterNumOrds, getAvailableNumOrds(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterCliente, getAvailableCliente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterTermCons, getAvailableTermCons(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterVettore, getAvailableVettori(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAgente, getAvailableAgente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterPaese, getAvailablePaesi(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAutomezzo, getAvailableAutomezzi(true));
|
||||||
|
});
|
||||||
|
|
||||||
|
BindableString.resetListeners(agente);
|
||||||
|
BindableString.registerListener(agente, value -> {
|
||||||
|
viewModel.setAgenteFilter(value);
|
||||||
|
viewModel.applyAllTests();
|
||||||
|
|
||||||
|
refreshArrayAdapter(arrayAdapterCodMdep, getAvailableCodMdeps(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterIdViaggio, getAvailableIdViaggio(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterNumOrds, getAvailableNumOrds(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterCliente, getAvailableCliente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterTermCons, getAvailableTermCons(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterVettore, getAvailableVettori(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterPaese, getAvailablePaesi(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAutomezzo, getAvailableAutomezzi(true));
|
||||||
|
});
|
||||||
|
|
||||||
|
BindableString.resetListeners(paese);
|
||||||
|
BindableString.registerListener(paese, value -> {
|
||||||
|
viewModel.setPaeseFilter(value);
|
||||||
|
viewModel.applyAllTests();
|
||||||
|
|
||||||
|
refreshArrayAdapter(arrayAdapterCodMdep, getAvailableCodMdeps(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterIdViaggio, getAvailableIdViaggio(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterNumOrds, getAvailableNumOrds(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterCliente, getAvailableCliente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterTermCons, getAvailableTermCons(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterVettore, getAvailableVettori(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAgente, getAvailableAgente(true));
|
||||||
|
refreshArrayAdapter(arrayAdapterAutomezzo, getAvailableAutomezzi(true));
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void refreshArrayAdapter(ArrayAdapter<String> arrayAdapter, List<String> inputList) {
|
||||||
|
arrayAdapter.clear();
|
||||||
|
arrayAdapter.addAll(inputList);
|
||||||
|
arrayAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private List<String> getAvailableIdViaggio(boolean skipRecalc) {
|
||||||
|
return Stream
|
||||||
|
.of(Objects.requireNonNull(viewModel.getMutableFilteredOrderList().getValue()))
|
||||||
|
.filter(x -> x.getIdViaggio() != null)
|
||||||
|
.sortBy(x -> -x.getIdViaggio())
|
||||||
|
.map(x -> x.getIdViaggio() != null ? x.getIdViaggio().toString() : null)
|
||||||
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getAvailableAgente(boolean skipRecalc) {
|
||||||
|
return Stream.of(Objects.requireNonNull(viewModel.getMutableFilteredOrderList().getValue()))
|
||||||
|
.map(OrdiniUscitaElencoDTO::getNomeAgente)
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sorted()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getAvailableCodMdeps(boolean skipRecalc) {
|
||||||
|
return Stream.of(Objects.requireNonNull(viewModel.getMutableFilteredOrderList().getValue()))
|
||||||
|
.map(OrdiniUscitaElencoDTO::getCodMdep)
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sorted()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getAvailableCliente(boolean skipRecalc) {
|
||||||
|
return Stream.of(Objects.requireNonNull(viewModel.getMutableFilteredOrderList().getValue()))
|
||||||
|
.map(OrdiniUscitaElencoDTO::getRagSocOrd)
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sorted()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getAvailableNumOrds(boolean skipRecalc) {
|
||||||
|
return Stream.of(Objects.requireNonNull(viewModel.getMutableFilteredOrderList().getValue()))
|
||||||
|
.map(x -> x.getNumOrd().toString())
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sorted()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getAvailableTermCons(boolean skipRecalc) {
|
||||||
|
return Stream.of(Objects.requireNonNull(viewModel.getMutableFilteredOrderList().getValue()))
|
||||||
|
.map(OrdiniUscitaElencoDTO::getTermCons)
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sorted()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getAvailableVettori(boolean skipRecalc) {
|
||||||
|
return Stream.of(Objects.requireNonNull(viewModel.getMutableFilteredOrderList().getValue()))
|
||||||
|
.filter(x -> x.getCodVvet() != null)
|
||||||
|
.map(x -> x.getCodVvet() + " - " + x.getDescrizioneVettore())
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sorted()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getAvailableAutomezzi(boolean skipRecalc) {
|
||||||
|
return Stream.of(Objects.requireNonNull(viewModel.getMutableFilteredOrderList().getValue()))
|
||||||
|
.map(OrdiniUscitaElencoDTO::getDescrizioneAuto)
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.sorted()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getAvailablePaesi(boolean skipRecalc) {
|
||||||
|
return Stream.of(Objects.requireNonNull(viewModel.getMutableFilteredOrderList().getValue()))
|
||||||
|
.map(OrdiniUscitaElencoDTO::getCitta)
|
||||||
|
.withoutNulls()
|
||||||
|
.distinct()
|
||||||
|
.sorted()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void refreshAll() {
|
||||||
|
deposito.refresh();
|
||||||
|
idViaggio.refresh();
|
||||||
|
numOrds.refresh();
|
||||||
|
cliente.refresh();
|
||||||
|
terminiConsegna.refresh();
|
||||||
|
vettore.refresh();
|
||||||
|
automezzo.refresh();
|
||||||
|
dataConsegna.refresh();
|
||||||
|
agente.refresh();
|
||||||
|
paese.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void resetAll() {
|
||||||
|
deposito.set(null);
|
||||||
|
idViaggio.set(null);
|
||||||
|
numOrds.set(null);
|
||||||
|
cliente.set(null);
|
||||||
|
dataConsegna.set(null);
|
||||||
|
terminiConsegna.set(null);
|
||||||
|
vettore.set(null);
|
||||||
|
automezzo.set(null);
|
||||||
|
agente.set(null);
|
||||||
|
paese.set(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,21 +1,167 @@
|
|||||||
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs;
|
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs;
|
||||||
|
|
||||||
import java.util.Date;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.di.BindableString;
|
import com.annimon.stream.Stream;
|
||||||
|
import com.annimon.stream.function.Predicate;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoDTO;
|
||||||
|
|
||||||
public class DialogVenditaFiltroAvanzatoViewModel {
|
public class DialogVenditaFiltroAvanzatoViewModel {
|
||||||
|
|
||||||
public BindableString deposito = new BindableString();
|
private Predicate<OrdiniUscitaElencoDTO> currentDepositoPredicate = null;
|
||||||
public BindableString idViaggio = new BindableString();
|
private Predicate<OrdiniUscitaElencoDTO> currentIdViaggioPredicate = null;
|
||||||
public BindableString numOrds = new BindableString();
|
private Predicate<OrdiniUscitaElencoDTO> currentNumOrdsPredicate = null;
|
||||||
public BindableString cliente = new BindableString();
|
private Predicate<OrdiniUscitaElencoDTO> currentClientePredicate = null;
|
||||||
public BindableString dataConsegna = new BindableString();
|
private Predicate<OrdiniUscitaElencoDTO> currentDataConsPredicate = null;
|
||||||
public BindableString terminiConsegna = new BindableString();
|
private Predicate<OrdiniUscitaElencoDTO> currentTermConsPredicate = null;
|
||||||
public BindableString agente = new BindableString();
|
private Predicate<OrdiniUscitaElencoDTO> currentVettorePredicate = null;
|
||||||
public BindableString vettore = new BindableString();
|
private Predicate<OrdiniUscitaElencoDTO> currentAgentePredicate = null;
|
||||||
public BindableString automezzo = new BindableString();
|
private Predicate<OrdiniUscitaElencoDTO> currentAutomezzoPredicate = null;
|
||||||
|
private Predicate<OrdiniUscitaElencoDTO> currentPaesePredicate = null;
|
||||||
|
|
||||||
public Date dataConsegnaDate;
|
|
||||||
|
private List<OrdiniUscitaElencoDTO> initialOrderList;
|
||||||
|
private MutableLiveData<List<OrdiniUscitaElencoDTO>> currentFilteredOrderList = new MutableLiveData<>();
|
||||||
|
|
||||||
|
public void init(List<OrdiniUscitaElencoDTO> initialList) {
|
||||||
|
this.initialOrderList = initialList;
|
||||||
|
this.currentFilteredOrderList.setValue(this.initialOrderList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableLiveData<List<OrdiniUscitaElencoDTO>> getMutableFilteredOrderList() {
|
||||||
|
return this.currentFilteredOrderList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIDViaggioFilter(String idViaggio) {
|
||||||
|
if(UtilityString.isNullOrEmpty(idViaggio)) currentIdViaggioPredicate = null;
|
||||||
|
else {
|
||||||
|
String[] idViaggiSplitted = idViaggio.split("[,\\ ]");
|
||||||
|
|
||||||
|
try{
|
||||||
|
List<Integer> idViaggiInteger = Stream.of(idViaggiSplitted)
|
||||||
|
.filter(x -> !UtilityString.isNullOrEmpty(x))
|
||||||
|
.map(Integer::parseInt).toList();
|
||||||
|
|
||||||
|
currentIdViaggioPredicate = o -> idViaggiInteger.contains(o.getIdViaggio());
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
currentIdViaggioPredicate = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepositoFilter(String deposito) {
|
||||||
|
if(UtilityString.isNullOrEmpty(deposito)) currentDepositoPredicate = null;
|
||||||
|
else {
|
||||||
|
currentDepositoPredicate = o -> o.getCodMdep().toLowerCase().equalsIgnoreCase(deposito);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumOrdFilter(String numOrds) {
|
||||||
|
if(UtilityString.isNullOrEmpty(numOrds)) currentNumOrdsPredicate = null;
|
||||||
|
else {
|
||||||
|
String[] numOrdsSplitted = numOrds.split("[,\\ ]");
|
||||||
|
|
||||||
|
try{
|
||||||
|
List<Integer> numOrdsInteger = Stream.of(numOrdsSplitted)
|
||||||
|
.filter(x -> !UtilityString.isNullOrEmpty(x))
|
||||||
|
.map(Integer::parseInt).toList();
|
||||||
|
|
||||||
|
currentNumOrdsPredicate = o -> numOrdsInteger.contains(o.getNumOrd());
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
currentNumOrdsPredicate = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClienteFilter(String cliente) {
|
||||||
|
if(UtilityString.isNullOrEmpty(cliente)) currentClientePredicate = null;
|
||||||
|
else {
|
||||||
|
currentClientePredicate = o -> o.getRagSocOrd().toLowerCase().contains(cliente.toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminiConsegnaFilter(String terminiConsegna) {
|
||||||
|
if(UtilityString.isNullOrEmpty(terminiConsegna)) currentTermConsPredicate = null;
|
||||||
|
else {
|
||||||
|
currentTermConsPredicate = o -> !UtilityString.isNullOrEmpty(o.getTermCons()) && o.getTermCons().equalsIgnoreCase(terminiConsegna);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVettoreFilter(String vettore) {
|
||||||
|
if(UtilityString.isNullOrEmpty(vettore)) currentVettorePredicate = null;
|
||||||
|
else {
|
||||||
|
currentVettorePredicate = o -> (o.getCodVvet() + " - " + o.getDescrizioneVettore()).equalsIgnoreCase(vettore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutomezzoFilter(String automezzo) {
|
||||||
|
if(UtilityString.isNullOrEmpty(automezzo)) currentAutomezzoPredicate = null;
|
||||||
|
else {
|
||||||
|
currentAutomezzoPredicate = o -> !UtilityString.isNullOrEmpty(o.getDescrizioneAuto()) && (o.getDescrizioneAuto().toLowerCase().contains(automezzo) || o.getDescrizioneAuto().equalsIgnoreCase(automezzo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataConsegnaFilter(Date dataConsegna) {
|
||||||
|
if(dataConsegna == null) currentDataConsPredicate = null;
|
||||||
|
else {
|
||||||
|
currentDataConsPredicate = o -> o.getDataConsD().equals(dataConsegna);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAgenteFilter(String agente) {
|
||||||
|
if(UtilityString.isNullOrEmpty(agente)) currentAgentePredicate = null;
|
||||||
|
else {
|
||||||
|
currentAgentePredicate = o -> !UtilityString.isNullOrEmpty(o.getNomeAgente()) && (o.getNomeAgente().toLowerCase().contains(agente) || o.getNomeAgente().equalsIgnoreCase(agente));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaeseFilter(String paese) {
|
||||||
|
if(UtilityString.isNullOrEmpty(paese)) currentPaesePredicate = null;
|
||||||
|
else {
|
||||||
|
currentPaesePredicate = o -> !UtilityString.isNullOrEmpty(o.getCitta()) && (o.getCitta().toLowerCase().contains(paese) || o.getCitta().equalsIgnoreCase(paese));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyAllTests() {
|
||||||
|
|
||||||
|
List<OrdiniUscitaElencoDTO> returnList = null;
|
||||||
|
|
||||||
|
if (currentNumOrdsPredicate == null &&
|
||||||
|
currentClientePredicate == null &&
|
||||||
|
currentDataConsPredicate == null &&
|
||||||
|
currentTermConsPredicate == null &&
|
||||||
|
currentVettorePredicate == null &&
|
||||||
|
currentAutomezzoPredicate == null &&
|
||||||
|
currentDepositoPredicate == null &&
|
||||||
|
currentIdViaggioPredicate == null &&
|
||||||
|
currentAgentePredicate == null &&
|
||||||
|
currentPaesePredicate == null
|
||||||
|
) {
|
||||||
|
returnList = this.initialOrderList;
|
||||||
|
} else {
|
||||||
|
Stream<OrdiniUscitaElencoDTO> tmpStream = Stream.of(this.initialOrderList)
|
||||||
|
.filter(x ->
|
||||||
|
(currentNumOrdsPredicate == null || (currentNumOrdsPredicate.test(x))) &&
|
||||||
|
(currentClientePredicate == null || (currentClientePredicate.test(x))) &&
|
||||||
|
(currentDataConsPredicate == null || (currentDataConsPredicate.test(x))) &&
|
||||||
|
(currentTermConsPredicate == null || (currentTermConsPredicate.test(x))) &&
|
||||||
|
(currentVettorePredicate == null || (currentVettorePredicate.test(x))) &&
|
||||||
|
(currentAutomezzoPredicate == null || (currentAutomezzoPredicate.test(x))) &&
|
||||||
|
(currentDepositoPredicate == null || (currentDepositoPredicate.test(x))) &&
|
||||||
|
(currentIdViaggioPredicate == null || (currentIdViaggioPredicate.test(x))) &&
|
||||||
|
(currentAgentePredicate == null || (currentAgentePredicate.test(x))) &&
|
||||||
|
(currentPaesePredicate == null || (currentPaesePredicate.test(x)))
|
||||||
|
);
|
||||||
|
|
||||||
|
returnList = tmpStream.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.currentFilteredOrderList.setValue(returnList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import androidx.core.content.ContextCompat;
|
|||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.databinding.ObservableList;
|
import androidx.databinding.ObservableList;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.tfb.fbtoast.FBToast;
|
import com.tfb.fbtoast.FBToast;
|
||||||
@@ -52,9 +51,9 @@ import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGExcep
|
|||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskCliente;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
|
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||||
@@ -169,7 +168,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
mBindings.pickingLiberoMainList.setHasFixedSize(true);
|
mBindings.pickingLiberoMainList.setHasFixedSize(true);
|
||||||
mBindings.pickingLiberoMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
mBindings.pickingLiberoMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
|
|
||||||
DividerItemDecoration itemDecorator = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL);
|
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(getActivity(), SimpleDividerItemDecoration.VERTICAL);
|
||||||
itemDecorator.setDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.divider));
|
itemDecorator.setDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.divider));
|
||||||
mBindings.pickingLiberoMainList.addItemDecoration(itemDecorator);
|
mBindings.pickingLiberoMainList.addItemDecoration(itemDecorator);
|
||||||
}
|
}
|
||||||
@@ -191,7 +190,6 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
|
|
||||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
|
|
||||||
this.openProgress();
|
this.openProgress();
|
||||||
|
|
||||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||||
@@ -239,30 +237,34 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUOpened(MtbColt mtbColt) {
|
public void onLUOpened(MtbColt mtbColt) {
|
||||||
mToolbarTitleText.setText(String.format(getActivity().getText(R.string.lu_number_text).toString(), mtbColt.getNumCollo()));
|
getActivity().runOnUiThread(() -> {
|
||||||
|
mToolbarTitleText.setText(String.format(getActivity().getText(R.string.lu_number_text).toString(), mtbColt.getNumCollo()));
|
||||||
|
|
||||||
initAdapter();
|
initAdapter();
|
||||||
|
|
||||||
thereIsAnOpenedUL.set(true);
|
thereIsAnOpenedUL.set(true);
|
||||||
thereIsAnyRowInUL.set(mtbColt.getMtbColr().size() > 0, true);
|
thereIsAnyRowInUL.set(mtbColt.getMtbColr().size() > 0, true);
|
||||||
|
|
||||||
mtbColt.getMtbColr().addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
mtbColt.getMtbColr().addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(ObservableList sender) {
|
public void onChanged(ObservableList sender) {
|
||||||
thereIsAnyRowInUL.set(mtbColt.getMtbColr().size() > 0, true);
|
thereIsAnyRowInUL.set(mtbColt.getMtbColr().size() > 0, true);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||||
});
|
});
|
||||||
|
|
||||||
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUClosed() {
|
public void onLUClosed() {
|
||||||
mToolbarTitleText.setText(getActivity().getText(R.string.free_picking_title_fragment).toString());
|
getActivity().runOnUiThread(() -> {
|
||||||
destroyAdapter();
|
mToolbarTitleText.setText(getActivity().getText(R.string.free_picking_title_fragment).toString());
|
||||||
|
destroyAdapter();
|
||||||
|
|
||||||
thereIsAnyRowInUL.set(false);
|
thereIsAnyRowInUL.set(false);
|
||||||
thereIsAnOpenedUL.set(false);
|
thereIsAnOpenedUL.set(false);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -277,26 +279,23 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception ex) {
|
public void onError(Exception ex) {
|
||||||
this.closeProgress();
|
getActivity().runOnUiThread(() -> {
|
||||||
|
this.closeProgress();
|
||||||
|
|
||||||
if (ex instanceof InvalidPesoKGException) {
|
if (ex instanceof InvalidPesoKGException) {
|
||||||
UtilityToast.showToast(ex.getMessage());
|
UtilityToast.showToast(ex.getMessage());
|
||||||
} else {
|
} else {
|
||||||
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort) {
|
public void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort) {
|
||||||
DialogAskCliente.makeBase(getActivity(), (status, result, codJcom) -> {
|
DialogAskClienteView.newInstance(onComplete, onAbort)
|
||||||
if (status == DialogConsts.Results.YES) {
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
onComplete.run(result, codJcom);
|
|
||||||
} else {
|
|
||||||
onAbort.run();
|
|
||||||
}
|
|
||||||
}).show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -304,8 +303,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
DialogChooseArtsFromListaArts.make(getActivity(), mtbColrsToPick, onComplete, () -> {
|
DialogChooseArtsFromListaArts.make(getActivity(), mtbColrsToPick, onComplete, () -> {
|
||||||
onAbort.run();
|
onAbort.run();
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
})
|
});
|
||||||
.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -364,11 +362,12 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRowSaved() {
|
public void onRowSaved() {
|
||||||
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
getActivity().runOnUiThread(() -> {
|
||||||
|
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||||
this.mViewModel.dispatchRowEdit(mtbColr);
|
this.mViewModel.dispatchRowEdit(mtbColr);
|
||||||
@@ -382,7 +381,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
@Override
|
@Override
|
||||||
public void onPreDestroy(Runnable onComplete) {
|
public void onPreDestroy(Runnable onComplete) {
|
||||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||||
if(thereIsAnOpenedUL.get()) mViewModel.closeLU(onComplete);
|
if (thereIsAnOpenedUL.get()) mViewModel.closeLU(onComplete);
|
||||||
else onComplete.run();
|
else onComplete.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -179,15 +179,20 @@ public class PickingLiberoViewModel {
|
|||||||
|
|
||||||
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
|
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
|
||||||
if (this.mFlagAskCliente) {
|
if (this.mFlagAskCliente) {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
this.sendLUClienteRequired((vtbDest, codJcom) -> {
|
this.sendLUClienteRequired((vtbDest, codJcom) -> {
|
||||||
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, vtbDest, codJcom, onComplete);
|
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, vtbDest, codJcom, onComplete);
|
||||||
}, onComplete);
|
}, () -> {
|
||||||
|
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, null, null, onComplete);
|
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, null, null, onComplete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createNewLU_PostClienteAsk(Integer customNumCollo, String customSerCollo, VtbDest vtbDest, String codJcom, Runnable onComplete) {
|
private void createNewLU_PostClienteAsk(Integer customNumCollo, String customSerCollo, VtbDest vtbDest, String codJcom, Runnable onComplete) {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
MtbColt mtbColt = new MtbColt();
|
MtbColt mtbColt = new MtbColt();
|
||||||
mtbColt.initDefaultFields();
|
mtbColt.initDefaultFields();
|
||||||
mtbColt.setGestione(mDefaultGestione)
|
mtbColt.setGestione(mDefaultGestione)
|
||||||
@@ -209,7 +214,7 @@ public class PickingLiberoViewModel {
|
|||||||
mtbColt.setCodVdes(vtbDest.getCodVdes());
|
mtbColt.setCodVdes(vtbDest.getCodVdes());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(codJcom)) {
|
if (!UtilityString.isNullOrEmpty(codJcom)) {
|
||||||
mtbColt.setCodJcom(codJcom);
|
mtbColt.setCodJcom(codJcom);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,38 +381,29 @@ public class PickingLiberoViewModel {
|
|||||||
|
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
mColliMagazzinoRESTConsumer.saveCollo(clonedTestata, value -> {
|
new Thread(() -> {
|
||||||
for (int i = 0; i < mtbColrObservableField.size(); i++) {
|
mColliMagazzinoRESTConsumer.saveCollo(clonedTestata, value -> {
|
||||||
MtbColr initialMtbColr = mtbColrObservableField.get(i);
|
for (int i = 0; i < mtbColrObservableField.size(); i++) {
|
||||||
|
MtbColr initialMtbColr = mtbColrObservableField.get(i);
|
||||||
|
|
||||||
initialMtbColr
|
initialMtbColr
|
||||||
.setDataCollo(value.getDataColloS())
|
.setDataCollo(value.getDataColloS())
|
||||||
.setNumCollo(value.getNumCollo())
|
.setNumCollo(value.getNumCollo())
|
||||||
.setGestione(value.getGestione())
|
.setGestione(value.getGestione())
|
||||||
.setSerCollo(value.getSerCollo());
|
.setSerCollo(value.getSerCollo());
|
||||||
|
|
||||||
initialMtbColr.setRiga(value.getMtbColr().get(i).getRiga());
|
initialMtbColr.setRiga(value.getMtbColr().get(i).getRiga());
|
||||||
|
mCurrentMtbColt.getMtbColr().add(mtbColrObservableField.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
// for (int j = 0; j < value.getMtbColr().size(); j++) {
|
this.sendOnRowSaved();
|
||||||
// MtbColr savedMtbColr = value.getMtbColr().get(j);
|
this.sendOnLoadingEnded();
|
||||||
// if (savedMtbColr.getCodMart().equals(initialMtbColr.getCodMart()) &&
|
|
||||||
// UtilityString.equalsIgnoreCase(savedMtbColr.getPartitaMag(), initialMtbColr.getPartitaMag()) &&
|
|
||||||
// UtilityString.equalsIgnoreCase(savedMtbColr.getCodCol(), initialMtbColr.getCodCol()) &&
|
|
||||||
// UtilityString.equalsIgnoreCase(savedMtbColr.getCodTagl(), initialMtbColr.getCodTagl()) &&
|
|
||||||
// savedMtbColr.getQtaCol().equals(initialMtbColr.getQtaCol()) &&
|
|
||||||
// savedMtbColr.getNumCnf().equals(initialMtbColr.getNumCnf())) {
|
|
||||||
// initialMtbColr.setRiga(savedMtbColr.getRiga());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
mCurrentMtbColt.getMtbColr().add(mtbColrObservableField.get(i));
|
onComplete.run();
|
||||||
}
|
|
||||||
|
|
||||||
this.sendOnRowSaved();
|
}, this::sendError);
|
||||||
this.sendOnLoadingEnded();
|
|
||||||
|
|
||||||
onComplete.run();
|
}).start();
|
||||||
}, this::sendError);
|
|
||||||
}
|
}
|
||||||
}, onComplete);
|
}, onComplete);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public class ProdVersamentoMaterialViewModel {
|
|||||||
DialogSimpleMessageView
|
DialogSimpleMessageView
|
||||||
.makeWarningDialog(new SpannableString(Html.fromHtml("Il collo selezionato non presenta articoli versabili sulla linea.")),
|
.makeWarningDialog(new SpannableString(Html.fromHtml("Il collo selezionato non presenta articoli versabili sulla linea.")),
|
||||||
null, this::openLU)
|
null, this::openLU)
|
||||||
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag");
|
.show(mContext.getSupportFragmentManager(), "tag");
|
||||||
return;
|
return;
|
||||||
} else if (mtbColt.get().getMtbColr().size() > 1) {
|
} else if (mtbColt.get().getMtbColr().size() > 1) {
|
||||||
|
|
||||||
@@ -137,10 +137,11 @@ public class ProdVersamentoMaterialViewModel {
|
|||||||
null, () -> {
|
null, () -> {
|
||||||
cyclicGetOrdiniLavByCollo(mtbColt.get().getMtbColr().iterator(), mtbDepoPosizione);
|
cyclicGetOrdiniLavByCollo(mtbColt.get().getMtbColr().iterator(), mtbDepoPosizione);
|
||||||
})
|
})
|
||||||
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag");
|
.show(mContext.getSupportFragmentManager(), "tag");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MesRESTConsumer.getOrdiniLavorazioneMateriale(
|
MesRESTConsumer.getOrdiniLavorazioneMateriale(
|
||||||
mtbDepoPosizione.getPosizione(),
|
mtbDepoPosizione.getPosizione(),
|
||||||
getIdMaterialeFromCollo(mtbColt.get()),
|
getIdMaterialeFromCollo(mtbColt.get()),
|
||||||
@@ -148,7 +149,7 @@ public class ProdVersamentoMaterialViewModel {
|
|||||||
e -> DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(e.getMessage())),
|
e -> DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(e.getMessage())),
|
||||||
null,
|
null,
|
||||||
this::openLU)
|
this::openLU)
|
||||||
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag"));
|
.show(mContext.getSupportFragmentManager(), "tag"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DialogSimpleMessageView
|
DialogSimpleMessageView
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -40,6 +39,7 @@ import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.adapter.OrdineAc
|
|||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.EditArticoloDialog;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.EditArticoloDialog;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper.PVEditOrderHelper;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper.PVEditOrderHelper;
|
||||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||||
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogAskAction;
|
import it.integry.integrywmsnative.view.dialogs.DialogAskAction;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
@@ -114,7 +114,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
|
|
||||||
mBinding.articoliOrdineList.setLayoutManager(new LinearLayoutManager(this));
|
mBinding.articoliOrdineList.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
|
||||||
DividerItemDecoration itemDecorator = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL);
|
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(this, SimpleDividerItemDecoration.VERTICAL);
|
||||||
itemDecorator.setDrawable(ContextCompat.getDrawable(this, R.drawable.divider));
|
itemDecorator.setDrawable(ContextCompat.getDrawable(this, R.drawable.divider));
|
||||||
mBinding.articoliOrdineList.addItemDecoration(itemDecorator);
|
mBinding.articoliOrdineList.addItemDecoration(itemDecorator);
|
||||||
mAdapter = new OrdineAcquistoArtListAdapter(this, mArticoli, this::selectAction);
|
mAdapter = new OrdineAcquistoArtListAdapter(this, mArticoli, this::selectAction);
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import androidx.appcompat.widget.AppCompatTextView;
|
|||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -46,6 +45,7 @@ import it.integry.integrywmsnative.gest.pv_ordini_acquisto.core.OrdineAcquistoPv
|
|||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanLisA;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanLisA;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.helper.OrdineAcquistoPvHelper;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.helper.OrdineAcquistoPvHelper;
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogAskAction;
|
import it.integry.integrywmsnative.view.dialogs.DialogAskAction;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
|
|
||||||
mBinding.ordiniAApertiMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
mBinding.ordiniAApertiMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
|
|
||||||
DividerItemDecoration itemDecorator = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL);
|
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(getActivity(), SimpleDividerItemDecoration.VERTICAL);
|
||||||
itemDecorator.setDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.divider));
|
itemDecorator.setDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.divider));
|
||||||
mBinding.ordiniAApertiMainList.addItemDecoration(itemDecorator);
|
mBinding.ordiniAApertiMainList.addItemDecoration(itemDecorator);
|
||||||
mAdapter = new OrdineAcquistoPvOpenListAdapter(getActivity(), mRenderedOrderList, this::selectAction);
|
mAdapter = new OrdineAcquistoPvOpenListAdapter(getActivity(), mRenderedOrderList, this::selectAction);
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import androidx.core.content.res.ResourcesCompat;
|
|||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.databinding.ObservableField;
|
import androidx.databinding.ObservableField;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.google.android.material.textfield.TextInputLayout;
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
@@ -57,13 +56,14 @@ import it.integry.integrywmsnative.gest.rettifica_giacenze.dto.FornitoreDTO;
|
|||||||
import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGException;
|
import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGException;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||||
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLU;
|
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLU;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArts;
|
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArts;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView;
|
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNo;
|
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNo;
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ public class RettificaGiacenzeFragment extends Fragment implements ITitledFragme
|
|||||||
mBinding.rettificaGiacenzeMainList.setHasFixedSize(true);
|
mBinding.rettificaGiacenzeMainList.setHasFixedSize(true);
|
||||||
mBinding.rettificaGiacenzeMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
mBinding.rettificaGiacenzeMainList.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
|
|
||||||
DividerItemDecoration itemDecorator = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL);
|
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(getActivity(), SimpleDividerItemDecoration.VERTICAL);
|
||||||
itemDecorator.setDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.divider));
|
itemDecorator.setDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.divider));
|
||||||
mBinding.rettificaGiacenzeMainList.addItemDecoration(itemDecorator);
|
mBinding.rettificaGiacenzeMainList.addItemDecoration(itemDecorator);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import it.integry.integrywmsnative.core.model.MtbAart;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||||
@@ -68,7 +69,7 @@ import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPosi
|
|||||||
import it.integry.integrywmsnative.view.dialogs.ask_should_print.DialogAskShouldPrint;
|
import it.integry.integrywmsnative.view.dialogs.ask_should_print.DialogAskShouldPrint;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.camera_barcode_reader.DialogCameraBarcodeReader;
|
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_peso_lu.DialogInputPeso;
|
import it.integry.integrywmsnative.view.dialogs.input_peso_lu.DialogInputPeso;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
@@ -642,13 +643,6 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
}, BarcodeManager::enable).show();
|
}, BarcodeManager::enable).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startCameraBarcode() {
|
|
||||||
DialogCameraBarcodeReader.newInstance(this, data -> {
|
|
||||||
this.onScanSuccessful.run(data);
|
|
||||||
})
|
|
||||||
.show(getSupportFragmentManager(), "camera_barcode");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeListFilter() {
|
public void removeListFilter() {
|
||||||
this.mViewmodel.resetMatchedRows();
|
this.mViewmodel.resetMatchedRows();
|
||||||
}
|
}
|
||||||
@@ -724,7 +718,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||||
DialogSimpleMessageView
|
DialogSimpleMessageView
|
||||||
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||||
.show(getSupportFragmentManager(), "tag");;
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -765,7 +759,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
() -> onComplete.run(true),
|
() -> onComplete.run(true),
|
||||||
() -> onComplete.run(false)
|
() -> onComplete.run(false)
|
||||||
)
|
)
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -859,6 +853,12 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
}).show();
|
}).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBatchLotSelectionRequest(List<MtbPartitaMag> availableBatchLots, RunnableArgs<MtbPartitaMag> onComplete) {
|
||||||
|
DialogChooseBatchLotView.newInstance(availableBatchLots, onComplete)
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRowSaved() {
|
public void onRowSaved() {
|
||||||
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||||
|
|||||||
@@ -395,6 +395,11 @@ public class SpedizioneViewModel {
|
|||||||
if (this.mListener != null) mListener.onLUPositionChangeRequest(onComplete);
|
if (this.mListener != null) mListener.onLUPositionChangeRequest(onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendBatchLotSelectionRequest(List<MtbPartitaMag> availableBatchLots, RunnableArgs<MtbPartitaMag> onComplete) {
|
||||||
|
if (this.mListener != null)
|
||||||
|
mListener.onBatchLotSelectionRequest(availableBatchLots, onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
|
||||||
//Se non c'è una UL aperta
|
//Se non c'è una UL aperta
|
||||||
@@ -758,6 +763,70 @@ public class SpedizioneViewModel {
|
|||||||
|
|
||||||
public void dispatchOrdineRow(final PickingObjectDTO pickingObjectDTO, MtbColt refMtbColt, boolean canPartitaMagBeChanged) {
|
public void dispatchOrdineRow(final PickingObjectDTO pickingObjectDTO, MtbColt refMtbColt, boolean canPartitaMagBeChanged) {
|
||||||
|
|
||||||
|
//TODO: Al posto di prelevare la prima riga bisognerebbe controllare se c'è ne una che corrisponde con la partita richiesta
|
||||||
|
|
||||||
|
if (pickingObjectDTO.getTempPickData() != null &&
|
||||||
|
pickingObjectDTO.getTempPickData().getSourceMtbColt() != null &&
|
||||||
|
pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr() != null) {
|
||||||
|
|
||||||
|
List<MtbColr> scannedMtbColrs = pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr();
|
||||||
|
|
||||||
|
List<MtbPartitaMag> availableBatchLot = Stream.of(scannedMtbColrs)
|
||||||
|
.filter(x -> x.getCodMart().equalsIgnoreCase(pickingObjectDTO.getMtbAart().getCodMart()) && (
|
||||||
|
x.getPartitaMag() == null || UtilityString.isNullOrEmpty(x.getMtbPartitaMag().getDataScadS()) || UtilityDate.getDateInstance().before(x.getMtbPartitaMag().getDataScadD())
|
||||||
|
))
|
||||||
|
.distinctBy(MtbColr::getPartitaMag)
|
||||||
|
.map(x -> x.getPartitaMag() == null ? new MtbPartitaMag().setCodMart(x.getMtbAart().getCodMart()) : x.getMtbPartitaMag())
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if(availableBatchLot.size() > 1) {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
|
List<MtbPartitaMag> tmp = new ArrayList<>();
|
||||||
|
|
||||||
|
if(Stream.of(availableBatchLot).anyMatch(x -> !UtilityString.isNullOrEmpty(x.getDataScadS()))) {
|
||||||
|
tmp.addAll(
|
||||||
|
Stream.of(availableBatchLot)
|
||||||
|
.filter(x -> !UtilityString.isNullOrEmpty(x.getDataScadS()) && UtilityDate.getDateInstance().before(x.getDataScadD()))
|
||||||
|
.sortBy(MtbPartitaMag::getDataScadD)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Stream.of(availableBatchLot).anyMatch(x -> UtilityString.isNullOrEmpty(x.getDataScadS()))) {
|
||||||
|
tmp.addAll(
|
||||||
|
Stream.of(availableBatchLot)
|
||||||
|
.filter(x -> UtilityString.isNullOrEmpty(x.getDataScadS()))
|
||||||
|
.sortBy(MtbPartitaMag::getPartitaMag)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sendBatchLotSelectionRequest(tmp, selected -> {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
|
||||||
|
if(selected != null) {
|
||||||
|
MtbColr scannedMtbColr = Stream.of(pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr())
|
||||||
|
.filter(x -> x.getCodMart().equalsIgnoreCase(pickingObjectDTO.getMtbAart().getCodMart()) &&
|
||||||
|
((x.getPartitaMag() != null && selected.getPartitaMag() != null && x.getPartitaMag().equalsIgnoreCase(selected.getPartitaMag())) ||
|
||||||
|
(x.getPartitaMag() == null && selected.getPartitaMag() == null)))
|
||||||
|
.toList()
|
||||||
|
.get(0);
|
||||||
|
|
||||||
|
dispatchOrdineRowOnPostBatchLotSelection(pickingObjectDTO, refMtbColt, scannedMtbColr, canPartitaMagBeChanged);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
dispatchOrdineRowOnPostBatchLotSelection(pickingObjectDTO, refMtbColt, scannedMtbColrs.get(0), canPartitaMagBeChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
dispatchOrdineRowOnPostBatchLotSelection(pickingObjectDTO, refMtbColt, null, canPartitaMagBeChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dispatchOrdineRowOnPostBatchLotSelection(final PickingObjectDTO pickingObjectDTO, MtbColt refMtbColt, MtbColr scannedMtbColr, boolean canPartitaMagBeChanged) {
|
||||||
BigDecimal totalQtaOrd = pickingObjectDTO.getSitArtOrdDTO().getQtaOrd();
|
BigDecimal totalQtaOrd = pickingObjectDTO.getSitArtOrdDTO().getQtaOrd();
|
||||||
BigDecimal totalNumCnfOrd = pickingObjectDTO.getSitArtOrdDTO().getNumCnfOrd();
|
BigDecimal totalNumCnfOrd = pickingObjectDTO.getSitArtOrdDTO().getNumCnfOrd();
|
||||||
BigDecimal qtaCnfOrd = pickingObjectDTO.getSitArtOrdDTO().getQtaCnfOrd();
|
BigDecimal qtaCnfOrd = pickingObjectDTO.getSitArtOrdDTO().getQtaCnfOrd();
|
||||||
@@ -791,14 +860,6 @@ public class SpedizioneViewModel {
|
|||||||
Date dataScad = null;
|
Date dataScad = null;
|
||||||
|
|
||||||
|
|
||||||
//TODO: Al posto di prelevare la prima riga bisognerebbe controllare se c'è ne una che corrisponde con la partita richiesta
|
|
||||||
MtbColr scannedMtbColr = pickingObjectDTO.getTempPickData() != null &&
|
|
||||||
pickingObjectDTO.getTempPickData().getSourceMtbColt() != null &&
|
|
||||||
pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr() != null &&
|
|
||||||
pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().size() > 0 ?
|
|
||||||
pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr().get(0) : null;
|
|
||||||
|
|
||||||
|
|
||||||
if (refMtbColt == null && pickingObjectDTO.getMtbColts() != null && pickingObjectDTO.getMtbColts().size() == 1) {
|
if (refMtbColt == null && pickingObjectDTO.getMtbColts() != null && pickingObjectDTO.getMtbColts().size() == 1) {
|
||||||
refMtbColt = pickingObjectDTO.getMtbColts().get(0);
|
refMtbColt = pickingObjectDTO.getMtbColts().get(0);
|
||||||
}
|
}
|
||||||
@@ -816,7 +877,7 @@ public class SpedizioneViewModel {
|
|||||||
if (optionalMtbColr.isPresent()) refMtbColr = optionalMtbColr.get();
|
if (optionalMtbColr.isPresent()) refMtbColr = optionalMtbColr.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
MtbColr mtbColrToUse = refMtbColr != null ? refMtbColr : scannedMtbColr;
|
MtbColr mtbColrToUse = scannedMtbColr != null ? scannedMtbColr : refMtbColr;
|
||||||
|
|
||||||
if (mtbColrToUse != null) {
|
if (mtbColrToUse != null) {
|
||||||
if (pickingObjectDTO.getMtbAart().isFlagQtaCnfFissaBoolean()) {
|
if (pickingObjectDTO.getMtbAart().isFlagQtaCnfFissaBoolean()) {
|
||||||
@@ -933,7 +994,6 @@ public class SpedizioneViewModel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, MtbColr mtbColrToUse) {
|
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, MtbColr mtbColrToUse) {
|
||||||
|
|
||||||
PickingObjectDTO pickingObjectDTO = new PickingObjectDTO()
|
PickingObjectDTO pickingObjectDTO = new PickingObjectDTO()
|
||||||
@@ -1460,7 +1520,7 @@ public class SpedizioneViewModel {
|
|||||||
|
|
||||||
MtbColr mtbColr = (MtbColr) mtbColrToDelete.clone();
|
MtbColr mtbColr = (MtbColr) mtbColrToDelete.clone();
|
||||||
|
|
||||||
if(mCurrentMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) {
|
if (mCurrentMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) {
|
||||||
mtbColr.setOperation(CommonModelConsts.OPERATION.DELETE);
|
mtbColr.setOperation(CommonModelConsts.OPERATION.DELETE);
|
||||||
} else {
|
} else {
|
||||||
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT);
|
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||||
@@ -1540,7 +1600,7 @@ public class SpedizioneViewModel {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
distribuisciLU(mtbColts -> {
|
distribuisciLU(mtbColts -> {
|
||||||
if(this.mIsNewLU) {
|
if (this.mIsNewLU) {
|
||||||
this.sendLUPositionChangeRequest((shouldChangePosition, mtbDepoPosizione) -> {
|
this.sendLUPositionChangeRequest((shouldChangePosition, mtbDepoPosizione) -> {
|
||||||
|
|
||||||
if (shouldChangePosition) {
|
if (shouldChangePosition) {
|
||||||
@@ -1702,7 +1762,7 @@ public class SpedizioneViewModel {
|
|||||||
this.mCurrentMtbColt = null;
|
this.mCurrentMtbColt = null;
|
||||||
|
|
||||||
|
|
||||||
if(mEnableQuantityReset) {
|
if (mEnableQuantityReset) {
|
||||||
for (PickingObjectDTO pickingObjectDTO : mPickingList.getValue()) {
|
for (PickingObjectDTO pickingObjectDTO : mPickingList.getValue()) {
|
||||||
|
|
||||||
List<MtbColr> withdrawMtbColrList = pickingObjectDTO.getWithdrawMtbColrs();
|
List<MtbColr> withdrawMtbColrList = pickingObjectDTO.getWithdrawMtbColrs();
|
||||||
@@ -1864,6 +1924,8 @@ public class SpedizioneViewModel {
|
|||||||
|
|
||||||
|
|
||||||
void onLUPositionChangeRequest(RunnableArgss<Boolean, MtbDepoPosizione> onComplete);
|
void onLUPositionChangeRequest(RunnableArgss<Boolean, MtbDepoPosizione> onComplete);
|
||||||
|
|
||||||
|
void onBatchLotSelectionRequest(List<MtbPartitaMag> availableBatchLots, RunnableArgs<MtbPartitaMag> onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public class UltimeConsegneClienteFragment extends BaseFragment implements Ultim
|
|||||||
dispatchConsegne();
|
dispatchConsegne();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.mViewModel.getDocuments().observe(this, this::refreshList);
|
this.mViewModel.getDocuments().observe(this.getViewLifecycleOwner(), this::refreshList);
|
||||||
|
|
||||||
openFilterDialog();
|
openFilterDialog();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,16 +194,15 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
|
|||||||
private void onSingleSelectionChanged(DocumentoResoDTO dto) {
|
private void onSingleSelectionChanged(DocumentoResoDTO dto) {
|
||||||
List<DocumentoResoDTO> selectedOrders = getSelectedItems();
|
List<DocumentoResoDTO> selectedOrders = getSelectedItems();
|
||||||
|
|
||||||
if(dto.isSelected()) {
|
if (dto.isSelected()) {
|
||||||
Stream.of(selectedOrders)
|
Stream.of(selectedOrders)
|
||||||
.filter(x -> !x.getRagSoc().equalsIgnoreCase(dto.getRagSoc()))
|
.filter(x -> !x.getRagSoc().equalsIgnoreCase(dto.getRagSoc()))
|
||||||
.forEach(x -> x.setSelected(false));
|
.forEach(x -> x.setSelected(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(selectedOrders != null && selectedOrders.size() > 0) {
|
if (selectedOrders != null && selectedOrders.size() > 0) {
|
||||||
mBindings.mainFab.show();
|
mBindings.mainFab.show();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mBindings.mainFab.hide();
|
mBindings.mainFab.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -285,8 +284,7 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
|
|||||||
|
|
||||||
filterItems(mtbAarts);
|
filterItems(mtbAarts);
|
||||||
|
|
||||||
}, null)
|
}, null);
|
||||||
.show();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,8 +177,7 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
public void onArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||||
|
DialogChooseArtsFromListaArts.make(getActivity(), mtbColrList, onComplete, onAbort);
|
||||||
DialogChooseArtsFromListaArts.make(getActivity(), mtbColrList, onComplete, onAbort).show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -55,15 +55,17 @@ public class VersamentoMerceViewModel {
|
|||||||
|
|
||||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
|
||||||
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO, false)) {
|
new Thread(() -> {
|
||||||
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO, false)) {
|
||||||
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
||||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), true, onComplete);
|
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), true, onComplete);
|
||||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||||
} else {
|
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||||
onComplete.run();
|
} else {
|
||||||
}
|
onComplete.run();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -93,9 +95,9 @@ public class VersamentoMerceViewModel {
|
|||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
|
if (!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
|
||||||
this.sendOnSpostamentoTraDepConfirmRequired(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep(), canContinue -> {
|
this.sendOnSpostamentoTraDepConfirmRequired(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep(), canContinue -> {
|
||||||
if(canContinue) {
|
if (canContinue) {
|
||||||
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione));
|
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione));
|
||||||
} else {
|
} else {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
@@ -165,7 +167,7 @@ public class VersamentoMerceViewModel {
|
|||||||
private void pickMerceULtoUL(MtbColt destMtbColt) {
|
private void pickMerceULtoUL(MtbColt destMtbColt) {
|
||||||
MtbColt sourceMtbColt = mCurrentMtbColt.getValue();
|
MtbColt sourceMtbColt = mCurrentMtbColt.getValue();
|
||||||
|
|
||||||
if(!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
|
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
|
||||||
this.sendError(new Exception("Impossibile spostare la merce tra UL di due depositi differenti"));
|
this.sendError(new Exception("Impossibile spostare la merce tra UL di due depositi differenti"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -174,7 +176,7 @@ public class VersamentoMerceViewModel {
|
|||||||
.filter(x -> x.getQtaCol().floatValue() > 0)
|
.filter(x -> x.getQtaCol().floatValue() > 0)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if(mtbColrsToPick.size() == 0) {
|
if (mtbColrsToPick.size() == 0) {
|
||||||
this.sendError(new NoArtsInLUException());
|
this.sendError(new NoArtsInLUException());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -191,7 +193,7 @@ public class VersamentoMerceViewModel {
|
|||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
this.mColliMagazzinoRESTConsumer.spostaArtsTraUL(
|
this.mColliMagazzinoRESTConsumer.spostaArtsTraUL(
|
||||||
sourceMtbColt,
|
clonedSourceTestata,
|
||||||
destMtbColt,
|
destMtbColt,
|
||||||
this::sendOnDataSaved,
|
this::sendOnDataSaved,
|
||||||
this::sendError
|
this::sendError
|
||||||
|
|||||||
@@ -0,0 +1,165 @@
|
|||||||
|
package it.integry.integrywmsnative.ui;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
public class SimpleDividerItemDecoration extends RecyclerView.ItemDecoration {
|
||||||
|
public static final int HORIZONTAL = LinearLayout.HORIZONTAL;
|
||||||
|
public static final int VERTICAL = LinearLayout.VERTICAL;
|
||||||
|
|
||||||
|
private static final String TAG = "DividerItem";
|
||||||
|
private static final int[] ATTRS = new int[]{ android.R.attr.listDivider };
|
||||||
|
|
||||||
|
private Drawable mDivider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current orientation. Either {@link #HORIZONTAL} or {@link #VERTICAL}.
|
||||||
|
*/
|
||||||
|
private int mOrientation;
|
||||||
|
|
||||||
|
private final Rect mBounds = new Rect();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a divider {@link RecyclerView.ItemDecoration} that can be used with a
|
||||||
|
* {@link LinearLayoutManager}.
|
||||||
|
*
|
||||||
|
* @param context Current context, it will be used to access resources.
|
||||||
|
* @param orientation Divider orientation. Should be {@link #HORIZONTAL} or {@link #VERTICAL}.
|
||||||
|
*/
|
||||||
|
public SimpleDividerItemDecoration(Context context, int orientation) {
|
||||||
|
final TypedArray a = context.obtainStyledAttributes(ATTRS);
|
||||||
|
mDivider = a.getDrawable(0);
|
||||||
|
if (mDivider == null) {
|
||||||
|
Log.w(TAG, "@android:attr/listDivider was not set in the theme used for this "
|
||||||
|
+ "DividerItemDecoration. Please set that attribute all call setDrawable()");
|
||||||
|
}
|
||||||
|
a.recycle();
|
||||||
|
setOrientation(orientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the orientation for this divider. This should be called if
|
||||||
|
* {@link RecyclerView.LayoutManager} changes orientation.
|
||||||
|
*
|
||||||
|
* @param orientation {@link #HORIZONTAL} or {@link #VERTICAL}
|
||||||
|
*/
|
||||||
|
public void setOrientation(int orientation) {
|
||||||
|
if (orientation != HORIZONTAL && orientation != VERTICAL) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Invalid orientation. It should be either HORIZONTAL or VERTICAL");
|
||||||
|
}
|
||||||
|
mOrientation = orientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the {@link Drawable} for this divider.
|
||||||
|
*
|
||||||
|
* @param drawable Drawable that should be used as a divider.
|
||||||
|
*/
|
||||||
|
public void setDrawable(@NonNull Drawable drawable) {
|
||||||
|
if (drawable == null) {
|
||||||
|
throw new IllegalArgumentException("Drawable cannot be null.");
|
||||||
|
}
|
||||||
|
mDivider = drawable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the {@link Drawable} for this divider.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public Drawable getDrawable() {
|
||||||
|
return mDivider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||||
|
if (parent.getLayoutManager() == null || mDivider == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mOrientation == VERTICAL) {
|
||||||
|
drawVertical(c, parent);
|
||||||
|
} else {
|
||||||
|
drawHorizontal(c, parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawVertical(Canvas canvas, RecyclerView parent) {
|
||||||
|
canvas.save();
|
||||||
|
final int left;
|
||||||
|
final int right;
|
||||||
|
//noinspection AndroidLintNewApi - NewApi lint fails to handle overrides.
|
||||||
|
if (parent.getClipToPadding()) {
|
||||||
|
left = parent.getPaddingLeft();
|
||||||
|
right = parent.getWidth() - parent.getPaddingRight();
|
||||||
|
canvas.clipRect(left, parent.getPaddingTop(), right,
|
||||||
|
parent.getHeight() - parent.getPaddingBottom());
|
||||||
|
} else {
|
||||||
|
left = 0;
|
||||||
|
right = parent.getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
final int childCount = parent.getChildCount();
|
||||||
|
for (int i = 0; i < childCount - 1; i++) {
|
||||||
|
final View child = parent.getChildAt(i);
|
||||||
|
parent.getDecoratedBoundsWithMargins(child, mBounds);
|
||||||
|
final int bottom = mBounds.bottom + Math.round(child.getTranslationY());
|
||||||
|
final int top = bottom - mDivider.getIntrinsicHeight();
|
||||||
|
mDivider.setBounds(left, top, right, bottom);
|
||||||
|
mDivider.draw(canvas);
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawHorizontal(Canvas canvas, RecyclerView parent) {
|
||||||
|
canvas.save();
|
||||||
|
final int top;
|
||||||
|
final int bottom;
|
||||||
|
//noinspection AndroidLintNewApi - NewApi lint fails to handle overrides.
|
||||||
|
if (parent.getClipToPadding()) {
|
||||||
|
top = parent.getPaddingTop();
|
||||||
|
bottom = parent.getHeight() - parent.getPaddingBottom();
|
||||||
|
canvas.clipRect(parent.getPaddingLeft(), top,
|
||||||
|
parent.getWidth() - parent.getPaddingRight(), bottom);
|
||||||
|
} else {
|
||||||
|
top = 0;
|
||||||
|
bottom = parent.getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
final int childCount = parent.getChildCount();
|
||||||
|
for (int i = 0; i < childCount - 1; i++) {
|
||||||
|
final View child = parent.getChildAt(i);
|
||||||
|
parent.getLayoutManager().getDecoratedBoundsWithMargins(child, mBounds);
|
||||||
|
final int right = mBounds.right + Math.round(child.getTranslationX());
|
||||||
|
final int left = right - mDivider.getIntrinsicWidth();
|
||||||
|
mDivider.setBounds(left, top, right, bottom);
|
||||||
|
mDivider.draw(canvas);
|
||||||
|
}
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
|
||||||
|
RecyclerView.State state) {
|
||||||
|
if (mDivider == null) {
|
||||||
|
outRect.set(0, 0, 0, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mOrientation == VERTICAL) {
|
||||||
|
outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
|
||||||
|
} else {
|
||||||
|
outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,6 +11,8 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import com.google.android.material.textfield.TextInputLayout;
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
@@ -35,8 +37,10 @@ public class DialogAskLivelloPosizione {
|
|||||||
|
|
||||||
private boolean completedFLow = false;
|
private boolean completedFLow = false;
|
||||||
|
|
||||||
public static void make(Context context, MtbDepoPosizione mtbDepoPosizione, boolean canAbort, RunnableArgs<MtbDepoPosizione> onComplete, RunnableArgs<Exception> onFailed) {
|
public static void make(FragmentActivity activity, MtbDepoPosizione mtbDepoPosizione, boolean canAbort, RunnableArgs<MtbDepoPosizione> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
new DialogAskLivelloPosizione(context, mtbDepoPosizione, canAbort, onComplete, onFailed).mDialog.show();
|
activity.runOnUiThread(() -> {
|
||||||
|
new DialogAskLivelloPosizione(activity, mtbDepoPosizione, canAbort, onComplete, onFailed).mDialog.show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -17,7 +18,7 @@ public class DialogCommon {
|
|||||||
public static void showNoArtFoundDialog(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
public static void showNoArtFoundDialog(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
||||||
DialogSimpleMessageView
|
DialogSimpleMessageView
|
||||||
.makeWarningDialog(new SpannableString(context.getResources().getText(R.string.no_result_from_barcode)),
|
.makeWarningDialog(new SpannableString(context.getResources().getText(R.string.no_result_from_barcode)),
|
||||||
null, onPositiveClick)
|
null, onPositiveClick)
|
||||||
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
|
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,17 +32,19 @@ public class DialogCommon {
|
|||||||
public static void showNoOrderFound(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
public static void showNoOrderFound(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
||||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(context.getResources().getText(R.string.no_orders_found_message)),
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(context.getResources().getText(R.string.no_orders_found_message)),
|
||||||
null, onPositiveClick)
|
null, onPositiveClick)
|
||||||
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");;
|
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void showDataSaved(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
public static void showDataSaved(@NotNull FragmentActivity context, @Nullable Runnable onPositiveClick) {
|
||||||
|
context.runOnUiThread(() -> {
|
||||||
DialogSimpleMessageView.makeSuccessDialog(
|
DialogSimpleMessageView.makeSuccessDialog(
|
||||||
context.getResources().getString(R.string.completed),
|
context.getResources().getString(R.string.completed),
|
||||||
new SpannableString(context.getResources().getString(R.string.data_saved)),
|
new SpannableString(context.getResources().getString(R.string.data_saved)),
|
||||||
null, onPositiveClick)
|
null, onPositiveClick)
|
||||||
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
|
.show(context.getSupportFragmentManager(), "tag");
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,109 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
|
|
||||||
import java.util.AbstractMap;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
|
|
||||||
import it.integry.integrywmsnative.core.model.VtbDest;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogAskClienteBinding;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page1ViewModel;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page2ViewModel;
|
|
||||||
|
|
||||||
public class DialogAskCliente {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
private Dialog mDialog;
|
|
||||||
|
|
||||||
private DialogAskClienteBinding mBinding;
|
|
||||||
|
|
||||||
|
|
||||||
public static Dialog makeBase(final Context context, RunnableArgsss<DialogConsts.Results, VtbDest, String> onComplete) {
|
|
||||||
return new DialogAskCliente(context, onComplete).mDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogAskCliente(Context context, RunnableArgsss<DialogConsts.Results, VtbDest, String> onComplete) {
|
|
||||||
mContext = context;
|
|
||||||
|
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
|
||||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_cliente, null, false);
|
|
||||||
|
|
||||||
List<Map.Entry<Integer, Class>> views = new ArrayList<>();
|
|
||||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page1, DialogAskCliente_Page1ViewModel.class));
|
|
||||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page2, DialogAskCliente_Page2ViewModel.class));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DialogAskClienteAdapter adapter = new DialogAskClienteAdapter(mContext, views);
|
|
||||||
mBinding.viewpager.setAdapter(adapter);
|
|
||||||
mBinding.viewpager.beginFakeDrag();
|
|
||||||
mBinding.viewpager.addOnPageChangeListener(adapter);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mDialog = new Dialog(mContext);
|
|
||||||
mDialog.setContentView(mBinding.getRoot());
|
|
||||||
mDialog.setCanceledOnTouchOutside(false);
|
|
||||||
// mDialog.setCancelable(false);
|
|
||||||
UtilityDialog.setTo90PercentWidth(mContext, mDialog);
|
|
||||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
mDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
|
||||||
|
|
||||||
|
|
||||||
mDialog.setOnShowListener(dialog -> {
|
|
||||||
|
|
||||||
DialogAskCliente_Page1ViewModel viewModel1 = (DialogAskCliente_Page1ViewModel) adapter.getViewModel(R.layout.dialog_ask_cliente__page1);
|
|
||||||
DialogAskCliente_Page2ViewModel viewModel2 = (DialogAskCliente_Page2ViewModel) adapter.getViewModel(R.layout.dialog_ask_cliente__page2);
|
|
||||||
|
|
||||||
viewModel1
|
|
||||||
.setOnConfirmClickListener(() -> {
|
|
||||||
String codAnag = viewModel1.getCurrentCliente();
|
|
||||||
|
|
||||||
if(UtilityString.isNullOrEmpty(codAnag)) {
|
|
||||||
mDialog.dismiss();
|
|
||||||
onComplete.run(DialogConsts.Results.YES, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
viewModel2.setCodAnag(codAnag);
|
|
||||||
|
|
||||||
mBinding.viewpager.setCurrentItem(mBinding.viewpager.getCurrentItem() + 1, true);
|
|
||||||
});
|
|
||||||
|
|
||||||
viewModel1.setOnAbortClickListener(() -> {
|
|
||||||
mDialog.dismiss();
|
|
||||||
onComplete.run(DialogConsts.Results.ABORT, null, null);
|
|
||||||
});
|
|
||||||
|
|
||||||
viewModel2.setOnConfirmClickListener(() -> {
|
|
||||||
DialogAskClienteDestinatarioDTO cliente = viewModel2.getCurrentDestinatario();
|
|
||||||
|
|
||||||
onComplete.run(DialogConsts.Results.YES, cliente != null ? cliente.toVtbDestModel() : null, viewModel1.getCurrentCommessa());
|
|
||||||
mDialog.dismiss();
|
|
||||||
});
|
|
||||||
|
|
||||||
viewModel2.setOnAbortClickListener(() -> {
|
|
||||||
mDialog.dismiss();
|
|
||||||
onComplete.run(DialogConsts.Results.ABORT, null, null);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -15,13 +14,10 @@ import androidx.viewpager.widget.ViewPager;
|
|||||||
|
|
||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.BR;
|
import it.integry.integrywmsnative.BR;
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.ui.DeactivatableViewPager;
|
import it.integry.integrywmsnative.ui.DeactivatableViewPager;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.IDialogAskClienteViewModel;
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.IDialogAskClienteViewModel;
|
||||||
|
|
||||||
@@ -58,9 +54,7 @@ public class DialogAskClienteAdapter extends PagerAdapter implements ViewPager.O
|
|||||||
viewModel = (IDialogAskClienteViewModel) viewModelClass.newInstance();
|
viewModel = (IDialogAskClienteViewModel) viewModelClass.newInstance();
|
||||||
viewModel.setBinding(mBinding);
|
viewModel.setBinding(mBinding);
|
||||||
viewModel.setContext(mContext);
|
viewModel.setContext(mContext);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException | InstantiationException e) {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InstantiationException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +96,7 @@ public class DialogAskClienteAdapter extends PagerAdapter implements ViewPager.O
|
|||||||
@Override
|
@Override
|
||||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
if(position != lastPage) {
|
if(position != lastPage) {
|
||||||
|
if(lastPage != -1) mDatasetViews.get(lastPage).getValue().onDismiss();
|
||||||
viewPager.onPageChanged(mDatasetViews.get(position).getKey().getRoot());
|
viewPager.onPageChanged(mDatasetViews.get(position).getKey().getRoot());
|
||||||
mDatasetViews.get(position).getValue().onShow();
|
mDatasetViews.get(position).getValue().onShow();
|
||||||
lastPage = position;
|
lastPage = position;
|
||||||
@@ -117,4 +112,8 @@ public class DialogAskClienteAdapter extends PagerAdapter implements ViewPager.O
|
|||||||
public void onPageScrollStateChanged(int state) {
|
public void onPageScrollStateChanged(int state) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onDismiss() {
|
||||||
|
if(lastPage != -1) mDatasetViews.get(lastPage).getValue().onDismiss();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,143 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
||||||
|
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.AbstractMap;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
|
import it.integry.integrywmsnative.core.model.VtbDest;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogAskClienteBinding;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page1ViewModel;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page2ViewModel;
|
||||||
|
|
||||||
|
public class DialogAskClienteView extends BaseDialogFragment {
|
||||||
|
|
||||||
|
private final RunnableArgss<VtbDest, String> mOnComplete;
|
||||||
|
private final Runnable mOnAbort;
|
||||||
|
|
||||||
|
private DialogAskClienteAdapter mAdapter;
|
||||||
|
|
||||||
|
private FragmentActivity mContext;
|
||||||
|
private DialogAskClienteBinding mBindings;
|
||||||
|
|
||||||
|
private boolean mIsClienteSelected = false;
|
||||||
|
|
||||||
|
public static DialogAskClienteView newInstance(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
|
||||||
|
return new DialogAskClienteView( onComplete, onAbort);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogAskClienteView(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.mOnComplete = onComplete;
|
||||||
|
this.mOnAbort = onAbort;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
this.mContext = getActivity();
|
||||||
|
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_cliente, container, false);
|
||||||
|
mBindings.setLifecycleOwner(this);
|
||||||
|
|
||||||
|
getDialog().setCanceledOnTouchOutside(false);
|
||||||
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
|
||||||
|
|
||||||
|
List<Map.Entry<Integer, Class>> views = new ArrayList<>();
|
||||||
|
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page1, DialogAskCliente_Page1ViewModel.class));
|
||||||
|
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page2, DialogAskCliente_Page2ViewModel.class));
|
||||||
|
|
||||||
|
mAdapter = new DialogAskClienteAdapter(mContext, views);
|
||||||
|
mBindings.viewpager.setAdapter(mAdapter);
|
||||||
|
mBindings.viewpager.beginFakeDrag();
|
||||||
|
mBindings.viewpager.addOnPageChangeListener(mAdapter);
|
||||||
|
mBindings.viewpager.setCurrentItem(0, false);
|
||||||
|
|
||||||
|
getDialog().setOnShowListener(d -> {
|
||||||
|
this.initView();
|
||||||
|
});
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
UtilityDialog.setTo90PercentWidth(this.mContext, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
DialogAskCliente_Page1ViewModel viewModel1 = (DialogAskCliente_Page1ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page1);
|
||||||
|
DialogAskCliente_Page2ViewModel viewModel2 = (DialogAskCliente_Page2ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page2);
|
||||||
|
|
||||||
|
viewModel1
|
||||||
|
.setOnConfirmClickListener(() -> {
|
||||||
|
String codAnag = viewModel1.getCurrentCliente();
|
||||||
|
|
||||||
|
if(UtilityString.isNullOrEmpty(codAnag)) {
|
||||||
|
this.mIsClienteSelected = true;
|
||||||
|
dismiss();
|
||||||
|
mOnComplete.run(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel2.setCodAnag(codAnag);
|
||||||
|
|
||||||
|
mBindings.viewpager.setCurrentItem(mBindings.viewpager.getCurrentItem() + 1, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
viewModel2.setOnConfirmClickListener(() -> {
|
||||||
|
DialogAskClienteDestinatarioDTO cliente = viewModel2.getCurrentDestinatario();
|
||||||
|
|
||||||
|
this.mIsClienteSelected = true;
|
||||||
|
dismiss();
|
||||||
|
mOnComplete.run(cliente != null ? cliente.toVtbDestModel() : null, viewModel1.getCurrentCommessa());
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
viewModel1.setOnAbortClickListener(this::dismiss);
|
||||||
|
viewModel2.setOnAbortClickListener(this::dismiss);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
|
mAdapter.onDismiss();
|
||||||
|
if(!mIsClienteSelected) {
|
||||||
|
this.mOnAbort.run();
|
||||||
|
}
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -66,8 +66,8 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
|||||||
"WHERE vtb_clie.flag_stato = 'A' " +
|
"WHERE vtb_clie.flag_stato = 'A' " +
|
||||||
"ORDER BY rag_soc";
|
"ORDER BY rag_soc";
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<HashMap<String, Object>>>() {
|
Type typeOfObjectsList = new TypeToken<ArrayList<HashMap<String, Object>>>() { }.getType();
|
||||||
}.getType();
|
|
||||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<HashMap<String, Object>>>() {
|
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<HashMap<String, Object>>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ArrayList<HashMap<String, Object>> value) {
|
public void onSuccess(ArrayList<HashMap<String, Object>> value) {
|
||||||
@@ -106,6 +106,11 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss() {
|
||||||
|
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOnConfirmClickListener(Runnable onConfirm) {
|
public void setOnConfirmClickListener(Runnable onConfirm) {
|
||||||
this.mBinding.buttonYes.setOnClickListener(v -> {
|
this.mBinding.buttonYes.setOnClickListener(v -> {
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewMod
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOnConfirmClickListener(Runnable onConfirm) {
|
public void setOnConfirmClickListener(Runnable onConfirm) {
|
||||||
this.mOnConfirm = onConfirm;
|
this.mOnConfirm = onConfirm;
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ public interface IDialogAskClienteViewModel {
|
|||||||
|
|
||||||
void onShow();
|
void onShow();
|
||||||
|
|
||||||
|
void onDismiss();
|
||||||
|
|
||||||
void setOnConfirmClickListener(Runnable onConfirm);
|
void setOnConfirmClickListener(Runnable onConfirm);
|
||||||
|
|
||||||
void setOnAbortClickListener(Runnable onAbort);
|
void setOnAbortClickListener(Runnable onAbort);
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
|||||||
String currentKey = mHashmapContent.keySet().toArray()[i].toString();
|
String currentKey = mHashmapContent.keySet().toArray()[i].toString();
|
||||||
String currentValue = mHashmapContent.get(currentKey);
|
String currentValue = mHashmapContent.get(currentKey);
|
||||||
|
|
||||||
RelativeLayout singleMapContent = (RelativeLayout) inflater.inflate(R.layout.dialog_custom_content_hashmap_viewmodel, null);
|
RelativeLayout singleMapContent = (RelativeLayout) inflater.inflate(R.layout.dialog_custom_content_hashmap_viewmodel, hashMapContainer);
|
||||||
((TextView) singleMapContent.findViewById(R.id.dialog_content_hashmap_key)).setText(currentKey);
|
((TextView) singleMapContent.findViewById(R.id.dialog_content_hashmap_key)).setText(currentKey);
|
||||||
((TextView) singleMapContent.findViewById(R.id.dialog_content_hashmap_value)).setText(currentValue);
|
((TextView) singleMapContent.findViewById(R.id.dialog_content_hashmap_value)).setText(currentValue);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import android.view.View;
|
|||||||
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.databinding.ViewDataBinding;
|
import androidx.databinding.ViewDataBinding;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -14,9 +13,8 @@ import it.integry.integrywmsnative.R;
|
|||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogBasketLuBinding;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogBasketLuPage1Binding;
|
import it.integry.integrywmsnative.databinding.DialogBasketLuPage1Binding;
|
||||||
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.interfaces.DialogBasketLU_BaseViewModel;
|
import it.integry.integrywmsnative.view.dialogs.basket_lu.interfaces.DialogBasketLU_BaseViewModel;
|
||||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.interfaces.IDialogBasketLUViewModel;
|
import it.integry.integrywmsnative.view.dialogs.basket_lu.interfaces.IDialogBasketLUViewModel;
|
||||||
|
|
||||||
@@ -82,7 +80,7 @@ public class DialogBasketLU_Page1_ViewModel extends DialogBasketLU_BaseViewModel
|
|||||||
mBinding.dialogBasketLuMainList.setHasFixedSize(true);
|
mBinding.dialogBasketLuMainList.setHasFixedSize(true);
|
||||||
mBinding.dialogBasketLuMainList.setLayoutManager(new LinearLayoutManager(mContext));
|
mBinding.dialogBasketLuMainList.setLayoutManager(new LinearLayoutManager(mContext));
|
||||||
|
|
||||||
DividerItemDecoration itemDecorator = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL);
|
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(mContext, SimpleDividerItemDecoration.VERTICAL);
|
||||||
itemDecorator.setDrawable(ContextCompat.getDrawable(mContext, R.drawable.divider));
|
itemDecorator.setDrawable(ContextCompat.getDrawable(mContext, R.drawable.divider));
|
||||||
mBinding.dialogBasketLuMainList.addItemDecoration(itemDecorator);
|
mBinding.dialogBasketLuMainList.addItemDecoration(itemDecorator);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import android.view.View;
|
|||||||
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.databinding.ViewDataBinding;
|
import androidx.databinding.ViewDataBinding;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,6 +14,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.databinding.DialogBasketLuPage2Binding;
|
import it.integry.integrywmsnative.databinding.DialogBasketLuPage2Binding;
|
||||||
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.interfaces.DialogBasketLU_BaseViewModel;
|
import it.integry.integrywmsnative.view.dialogs.basket_lu.interfaces.DialogBasketLU_BaseViewModel;
|
||||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.interfaces.IDialogBasketLUViewModel;
|
import it.integry.integrywmsnative.view.dialogs.basket_lu.interfaces.IDialogBasketLUViewModel;
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ public class DialogBasketLU_Page2_ViewModel extends DialogBasketLU_BaseViewModel
|
|||||||
mBinding.dialogBasketLuMtbColrList.setHasFixedSize(true);
|
mBinding.dialogBasketLuMtbColrList.setHasFixedSize(true);
|
||||||
mBinding.dialogBasketLuMtbColrList.setLayoutManager(new LinearLayoutManager(mContext));
|
mBinding.dialogBasketLuMtbColrList.setLayoutManager(new LinearLayoutManager(mContext));
|
||||||
|
|
||||||
DividerItemDecoration itemDecorator = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL);
|
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(mContext, SimpleDividerItemDecoration.VERTICAL);
|
||||||
itemDecorator.setDrawable(ContextCompat.getDrawable(mContext, R.drawable.divider));
|
itemDecorator.setDrawable(ContextCompat.getDrawable(mContext, R.drawable.divider));
|
||||||
mBinding.dialogBasketLuMtbColrList.addItemDecoration(itemDecorator);
|
mBinding.dialogBasketLuMtbColrList.addItemDecoration(itemDecorator);
|
||||||
|
|
||||||
|
|||||||
@@ -1,146 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.camera_barcode_reader;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
import androidx.fragment.app.DialogFragment;
|
|
||||||
|
|
||||||
import com.google.zxing.BarcodeFormat;
|
|
||||||
import com.google.zxing.Result;
|
|
||||||
import com.kroegerama.kaiteki.bcode.BarcodeResultListener;
|
|
||||||
import com.orhanobut.logger.Logger;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeType;
|
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogCameraBarcodeReaderBinding;
|
|
||||||
|
|
||||||
public class DialogCameraBarcodeReader extends DialogFragment implements BarcodeResultListener {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
private DialogCameraBarcodeReaderBinding mBindings;
|
|
||||||
private final RunnableArgs<BarcodeScanDTO> onComplete;
|
|
||||||
|
|
||||||
public static DialogCameraBarcodeReader newInstance(@NonNull Context context, @NonNull final RunnableArgs<BarcodeScanDTO> onComplete) {
|
|
||||||
return new DialogCameraBarcodeReader(context, onComplete);
|
|
||||||
}
|
|
||||||
|
|
||||||
private DialogCameraBarcodeReader(@NonNull Context context, @NonNull final RunnableArgs<BarcodeScanDTO> onComplete){
|
|
||||||
this.mContext = context;
|
|
||||||
this.onComplete = onComplete;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
||||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_camera_barcode_reader, container, false);
|
|
||||||
|
|
||||||
|
|
||||||
getDialog().setCanceledOnTouchOutside(false);
|
|
||||||
getDialog().setCancelable(false);
|
|
||||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
|
|
||||||
this.initBarcodeView();
|
|
||||||
|
|
||||||
mBindings.buttonConfirm.setOnClickListener(v -> {
|
|
||||||
dismiss();
|
|
||||||
});
|
|
||||||
|
|
||||||
return mBindings.getRoot();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
|
|
||||||
UtilityDialog.setTo95PercentWidth(mContext, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop() {
|
|
||||||
super.onStop();
|
|
||||||
this.mBindings.bcode.unbind();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initBarcodeView() {
|
|
||||||
List<BarcodeFormat> availableBarcodeFormats = new ArrayList<>();
|
|
||||||
availableBarcodeFormats.add(BarcodeFormat.QR_CODE);
|
|
||||||
availableBarcodeFormats.add(BarcodeFormat.CODE_128);
|
|
||||||
availableBarcodeFormats.add(BarcodeFormat.UPC_E);
|
|
||||||
availableBarcodeFormats.add(BarcodeFormat.CODABAR);
|
|
||||||
availableBarcodeFormats.add(BarcodeFormat.EAN_8);
|
|
||||||
availableBarcodeFormats.add(BarcodeFormat.EAN_13);
|
|
||||||
availableBarcodeFormats.add(BarcodeFormat.ITF);
|
|
||||||
availableBarcodeFormats.add(BarcodeFormat.UPC_A);
|
|
||||||
|
|
||||||
mBindings.bcode.setFormats(availableBarcodeFormats);
|
|
||||||
mBindings.bcode.setBarcodeInverted(false);
|
|
||||||
mBindings.bcode.setBarcodeResultListener(this);
|
|
||||||
mBindings.bcode.bindToLifecycle(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBarcodeResult(@NotNull Result result) {
|
|
||||||
|
|
||||||
BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO()
|
|
||||||
.setByteValue(result.getRawBytes())
|
|
||||||
.setStringValue(result.getText());
|
|
||||||
|
|
||||||
BarcodeType type = null;
|
|
||||||
|
|
||||||
switch (result.getBarcodeFormat()) {
|
|
||||||
case CODE_128:
|
|
||||||
type = BarcodeType.CODE128;
|
|
||||||
break;
|
|
||||||
case CODE_39:
|
|
||||||
type = BarcodeType.CODE39;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EAN_13:
|
|
||||||
type = BarcodeType.EAN13;
|
|
||||||
break;
|
|
||||||
case EAN_8:
|
|
||||||
type = BarcodeType.EAN8;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UPC_A:
|
|
||||||
type = BarcodeType.UPCA;
|
|
||||||
break;
|
|
||||||
case UPC_E:
|
|
||||||
type = BarcodeType.UPCE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Logger.e("Barcode type " + result.getBarcodeFormat().toString() + " was not mapped in DialogCameraBarcodeReader.java");
|
|
||||||
type = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
barcodeScanDTO.setType(type);
|
|
||||||
|
|
||||||
this.dismiss();
|
|
||||||
this.onComplete.run(barcodeScanDTO);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBarcodeScanCancelled() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,15 +2,14 @@ package it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts;
|
|||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
@@ -19,6 +18,7 @@ import it.integry.integrywmsnative.core.interfaces.IRecyclerItemClicked;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||||
import it.integry.integrywmsnative.databinding.DialogChooseArtFromListaArtBinding;
|
import it.integry.integrywmsnative.databinding.DialogChooseArtFromListaArtBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
|
|
||||||
public class DialogChooseArtFromListaArts {
|
public class DialogChooseArtFromListaArts {
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ public class DialogChooseArtFromListaArts {
|
|||||||
|
|
||||||
binding.dialogChooseArtFromListaArtMainList.setLayoutManager(new LinearLayoutManager(currentContext));
|
binding.dialogChooseArtFromListaArtMainList.setLayoutManager(new LinearLayoutManager(currentContext));
|
||||||
|
|
||||||
DividerItemDecoration itemDecorator = new DividerItemDecoration(currentContext, DividerItemDecoration.VERTICAL);
|
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(currentContext, SimpleDividerItemDecoration.VERTICAL);
|
||||||
itemDecorator.setDrawable(ContextCompat.getDrawable(currentContext, R.drawable.divider));
|
itemDecorator.setDrawable(ContextCompat.getDrawable(currentContext, R.drawable.divider));
|
||||||
binding.dialogChooseArtFromListaArtMainList.addItemDecoration(itemDecorator);
|
binding.dialogChooseArtFromListaArtMainList.addItemDecoration(itemDecorator);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import android.view.LayoutInflater;
|
|||||||
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -19,6 +18,7 @@ import it.integry.integrywmsnative.core.interfaces.IRecyclerItemClicked;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||||
import it.integry.integrywmsnative.databinding.DialogChooseArtFromListaArtBinding;
|
import it.integry.integrywmsnative.databinding.DialogChooseArtFromListaArtBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
|
|
||||||
public class DialogChooseArtFromListaMtbColrView {
|
public class DialogChooseArtFromListaMtbColrView {
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ public class DialogChooseArtFromListaMtbColrView {
|
|||||||
|
|
||||||
binding.dialogChooseArtFromListaArtMainList.setLayoutManager(new LinearLayoutManager(currentContext));
|
binding.dialogChooseArtFromListaArtMainList.setLayoutManager(new LinearLayoutManager(currentContext));
|
||||||
|
|
||||||
DividerItemDecoration itemDecorator = new DividerItemDecoration(currentContext, DividerItemDecoration.VERTICAL);
|
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(currentContext, SimpleDividerItemDecoration.VERTICAL);
|
||||||
itemDecorator.setDrawable(ContextCompat.getDrawable(currentContext, R.drawable.divider));
|
itemDecorator.setDrawable(ContextCompat.getDrawable(currentContext, R.drawable.divider));
|
||||||
binding.dialogChooseArtFromListaArtMainList.addItemDecoration(itemDecorator);
|
binding.dialogChooseArtFromListaArtMainList.addItemDecoration(itemDecorator);
|
||||||
|
|
||||||
|
|||||||
@@ -2,30 +2,33 @@ package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
|||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.appcompat.widget.SearchView;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
@@ -33,23 +36,24 @@ import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.databinding.DialogChooseArtsFromListaArtsLayoutBinding;
|
import it.integry.integrywmsnative.databinding.DialogChooseArtsFromListaArtsLayoutBinding;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
|
||||||
|
|
||||||
public class DialogChooseArtsFromListaArts {
|
public class DialogChooseArtsFromListaArts {
|
||||||
|
|
||||||
private Context currentContext;
|
private Context currentContext;
|
||||||
private Dialog mDialog;
|
private Dialog mDialog;
|
||||||
|
|
||||||
|
private DialogChooseArtsFromListaArtsLayoutBinding mBindings;
|
||||||
private DialogChooseArtsFromListaArtsAdapter currentAdapter;
|
private DialogChooseArtsFromListaArtsAdapter currentAdapter;
|
||||||
|
|
||||||
private RunnableArgs<List<MtbColr>> mOnItemsChoosed;
|
private RunnableArgs<List<MtbColr>> mOnItemsChoosed;
|
||||||
private Runnable mOnAbort;
|
private Runnable mOnAbort;
|
||||||
|
|
||||||
private List<DialogChooseArtsFromListaArtsItemModel> mDataset;
|
private List<DialogChooseArtsFromListaArtsItemModel> mDataset;
|
||||||
private BindableBoolean filterStatus = new BindableBoolean(false);
|
|
||||||
|
|
||||||
public static Dialog make(final Context context, List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
public static void make(@NotNull final FragmentActivity activity, List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||||
return new DialogChooseArtsFromListaArts(context, listaMtbColr, onItemsChoosed, onAbort).mDialog;
|
activity.runOnUiThread(() -> {
|
||||||
|
new DialogChooseArtsFromListaArts(activity, listaMtbColr, onItemsChoosed, onAbort).mDialog.show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -60,9 +64,9 @@ public class DialogChooseArtsFromListaArts {
|
|||||||
|
|
||||||
mDataset = new ArrayList<>();
|
mDataset = new ArrayList<>();
|
||||||
|
|
||||||
if(listaMtbColr != null){
|
if (listaMtbColr != null) {
|
||||||
for (MtbColr mtbColr : listaMtbColr) {
|
for (MtbColr mtbColr : listaMtbColr) {
|
||||||
if(UtilityString.isNullOrEmpty(mtbColr.getUntMis()) && mtbColr.getMtbAart() != null){
|
if (UtilityString.isNullOrEmpty(mtbColr.getUntMis()) && mtbColr.getMtbAart() != null) {
|
||||||
mtbColr.setUntMis(mtbColr.getMtbAart().getUntMis());
|
mtbColr.setUntMis(mtbColr.getMtbAart().getUntMis());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,56 +75,131 @@ public class DialogChooseArtsFromListaArts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
DialogChooseArtsFromListaArtsLayoutBinding binding = DataBindingUtil.inflate(inflater, R.layout.dialog_choose_arts_from_lista_arts_layout, null, false);
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_choose_arts_from_lista_arts_layout, null, false);
|
||||||
|
|
||||||
binding.setFilterStatus(filterStatus);
|
mBindings.emptyView.setVisibility(listaMtbColr != null && listaMtbColr.size() > 0 ? View.GONE : View.VISIBLE);
|
||||||
binding.emptyView.setVisibility(listaMtbColr != null && listaMtbColr.size() > 0 ? View.GONE : View.VISIBLE);
|
|
||||||
|
|
||||||
|
|
||||||
mDialog = new Dialog(context);
|
mDialog = new Dialog(context);
|
||||||
mDialog.setContentView(binding.getRoot());
|
mDialog.setContentView(mBindings.getRoot());
|
||||||
mDialog.setCanceledOnTouchOutside(false);
|
mDialog.setCanceledOnTouchOutside(false);
|
||||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
mDialog.setOnCancelListener(dialog -> {
|
mDialog.setOnCancelListener(dialog -> {
|
||||||
if(this.mOnAbort != null) this.mOnAbort.run();
|
if (this.mOnAbort != null) this.mOnAbort.run();
|
||||||
});
|
});
|
||||||
|
|
||||||
UtilityDialog.setTo90PercentWidth(context, mDialog);
|
UtilityDialog.setTo90PercentWidth(context, mDialog);
|
||||||
|
|
||||||
|
|
||||||
initRecyclerView(binding);
|
initRecyclerView();
|
||||||
|
|
||||||
initRemoveFilterButton(binding);
|
initFilter();
|
||||||
|
|
||||||
setupBarcode();
|
setupBarcode();
|
||||||
|
|
||||||
binding.positiveButton.setOnClickListener(v -> {
|
mBindings.positiveButton.setOnClickListener(v -> {
|
||||||
mDialog.dismiss();
|
mDialog.dismiss();
|
||||||
onPositiveClick();
|
onPositiveClick();
|
||||||
});
|
});
|
||||||
|
|
||||||
binding.negativeButton.setOnClickListener(v -> {
|
mBindings.negativeButton.setOnClickListener(v -> {
|
||||||
mDialog.dismiss();
|
mDialog.dismiss();
|
||||||
onNegativeClick();
|
onNegativeClick();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initRecyclerView(DialogChooseArtsFromListaArtsLayoutBinding binding) {
|
private void initRecyclerView() {
|
||||||
binding.dialogChooseArtsFromListaArtMainList.setNestedScrollingEnabled(false);
|
mBindings.dialogChooseArtsFromListaArtMainList.setNestedScrollingEnabled(false);
|
||||||
|
|
||||||
binding.dialogChooseArtsFromListaArtMainList.setHasFixedSize(true);
|
mBindings.dialogChooseArtsFromListaArtMainList.setHasFixedSize(true);
|
||||||
|
|
||||||
binding.dialogChooseArtsFromListaArtMainList.setLayoutManager(new LinearLayoutManager(currentContext));
|
mBindings.dialogChooseArtsFromListaArtMainList.setLayoutManager(new LinearLayoutManager(currentContext));
|
||||||
|
|
||||||
currentAdapter = new DialogChooseArtsFromListaArtsAdapter(currentContext, mDataset);
|
currentAdapter = new DialogChooseArtsFromListaArtsAdapter(currentContext, mDataset);
|
||||||
binding.dialogChooseArtsFromListaArtMainList.setAdapter(currentAdapter);
|
mBindings.dialogChooseArtsFromListaArtMainList.setAdapter(currentAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initRemoveFilterButton(DialogChooseArtsFromListaArtsLayoutBinding binding) {
|
private void initFilter() {
|
||||||
binding.buttonRemoveFilter.setOnClickListener(v -> {
|
mBindings.mainSearch.setOnCloseListener(() -> {
|
||||||
removeListFilter();
|
this.removeListFilter();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
mBindings.mainSearch.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onQueryTextSubmit(String query) {
|
||||||
|
// removeListFilter();
|
||||||
|
//
|
||||||
|
// if (!UtilityString.isNullOrEmpty(query) && query.trim().length() > 3) {
|
||||||
|
// List<DialogChooseArtsFromListaArtsItemModel> foundRowsList = Stream.of(mDataset)
|
||||||
|
// .filter(x -> {
|
||||||
|
// String codMart = x.getMtbColr().getMtbAart().getCodMart();
|
||||||
|
// String descrizioneArt = x.getMtbColr().getMtbAart().getDescrizioneEstesa();
|
||||||
|
// String diacod = x.getMtbColr().getMtbAart().getDiacod();
|
||||||
|
//
|
||||||
|
// return ((codMart.startsWith(query) ||
|
||||||
|
// codMart.endsWith(query) ||
|
||||||
|
// codMart.contains(query) ||
|
||||||
|
// codMart.equalsIgnoreCase(query)) ||
|
||||||
|
// (descrizioneArt.startsWith(query) ||
|
||||||
|
// descrizioneArt.endsWith(query) ||
|
||||||
|
// descrizioneArt.contains(query) ||
|
||||||
|
// descrizioneArt.equalsIgnoreCase(query)) ||
|
||||||
|
// (diacod.startsWith(query) ||
|
||||||
|
// diacod.endsWith(query) ||
|
||||||
|
// diacod.contains(query) ||
|
||||||
|
// diacod.equalsIgnoreCase(query))) &&
|
||||||
|
// !x.isHidden();
|
||||||
|
// })
|
||||||
|
// .toList();
|
||||||
|
//
|
||||||
|
// for (int i = 0; i < mDataset.size(); i++) {
|
||||||
|
// mDataset.get(i).setHidden(!foundRowsList.contains(mDataset.get(i)));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onQueryTextChange(String newText) {
|
||||||
|
removeListFilter();
|
||||||
|
|
||||||
|
newText = newText.toLowerCase();
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(newText) && newText.trim().length() > 2) {
|
||||||
|
String finalNewText = newText;
|
||||||
|
List<DialogChooseArtsFromListaArtsItemModel> foundRowsList = Stream.of(mDataset)
|
||||||
|
.filter(x -> {
|
||||||
|
String codMart = x.getMtbColr().getMtbAart().getCodMart().toLowerCase();
|
||||||
|
String descrizioneArt = x.getMtbColr().getMtbAart().getDescrizioneEstesa().toLowerCase();
|
||||||
|
String diacod = x.getMtbColr().getMtbAart().getDiacod().toLowerCase();
|
||||||
|
|
||||||
|
return ((codMart.startsWith(finalNewText) ||
|
||||||
|
codMart.endsWith(finalNewText) ||
|
||||||
|
codMart.contains(finalNewText) ||
|
||||||
|
codMart.equalsIgnoreCase(finalNewText)) ||
|
||||||
|
(descrizioneArt.startsWith(finalNewText) ||
|
||||||
|
descrizioneArt.endsWith(finalNewText) ||
|
||||||
|
descrizioneArt.contains(finalNewText) ||
|
||||||
|
descrizioneArt.equalsIgnoreCase(finalNewText)) ||
|
||||||
|
(diacod.startsWith(finalNewText) ||
|
||||||
|
diacod.endsWith(finalNewText) ||
|
||||||
|
diacod.contains(finalNewText) ||
|
||||||
|
diacod.equalsIgnoreCase(finalNewText))) &&
|
||||||
|
!x.isHidden();
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
for (int i = 0; i < mDataset.size(); i++) {
|
||||||
|
mDataset.get(i).setHidden(!foundRowsList.contains(mDataset.get(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,9 +222,9 @@ public class DialogChooseArtsFromListaArts {
|
|||||||
|
|
||||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(currentContext);
|
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(currentContext);
|
||||||
|
|
||||||
if(UtilityBarcode.isEan13(data)){
|
if (UtilityBarcode.isEan13(data)) {
|
||||||
this.loadArticolo(data.getStringValue(), null, progressDialog);
|
this.loadArticolo(data.getStringValue(), null, progressDialog);
|
||||||
} else if(UtilityBarcode.isEtichetta128(data)) {
|
} else if (UtilityBarcode.isEtichetta128(data)) {
|
||||||
this.executeEtichettaEan128(data, progressDialog);
|
this.executeEtichettaEan128(data, progressDialog);
|
||||||
} else {
|
} else {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
@@ -161,14 +240,15 @@ public class DialogChooseArtsFromListaArts {
|
|||||||
|
|
||||||
String barcodeProd = null;
|
String barcodeProd = null;
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||||
if(!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||||
if(!UtilityString.isNullOrEmpty(ean128Model.Content)) barcodeProd = ean128Model.Content;
|
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||||
|
barcodeProd = ean128Model.Content;
|
||||||
|
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(barcodeProd)) {
|
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(ean128Model.Gtin) || !UtilityString.isNullOrEmpty(ean128Model.Content)){
|
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin) || !UtilityString.isNullOrEmpty(ean128Model.Content)) {
|
||||||
this.loadArticolo(barcodeProd, ean128Model, progressDialog);
|
this.loadArticolo(barcodeProd, ean128Model, progressDialog);
|
||||||
} else {
|
} else {
|
||||||
DialogCommon.showNoArtFoundDialog(currentContext, () -> {
|
DialogCommon.showNoArtFoundDialog(currentContext, () -> {
|
||||||
@@ -187,22 +267,23 @@ public class DialogChooseArtsFromListaArts {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}, ex-> {
|
}, ex -> {
|
||||||
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
UtilityExceptions.defaultException(currentContext, ex, progressDialog);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void loadArticolo(String barcodeProd, Ean128Model ean128Model, Dialog progressDialog) {
|
private void loadArticolo(String barcodeProd, Ean128Model ean128Model, Dialog progressDialog) {
|
||||||
if(barcodeProd.length() == 14) {
|
if (barcodeProd.length() == 14) {
|
||||||
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String finalBarcodeProd = barcodeProd;
|
||||||
ArticoloRESTConsumer.getByBarcodeProdStatic(barcodeProd, mtbAartList -> {
|
ArticoloRESTConsumer.getByBarcodeProdStatic(barcodeProd, mtbAartList -> {
|
||||||
|
|
||||||
if(mtbAartList != null && mtbAartList.size() > 0) {
|
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||||
|
this.mBindings.mainSearch.setQuery(finalBarcodeProd, false);
|
||||||
|
|
||||||
this.searchArtInList(mtbAartList.get(0), ean128Model);
|
this.searchArtInList(mtbAartList.get(0), ean128Model);
|
||||||
|
|
||||||
@@ -232,42 +313,34 @@ public class DialogChooseArtsFromListaArts {
|
|||||||
!x.isHidden())
|
!x.isHidden())
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if(foundRowsList.size() == 0) {
|
if (foundRowsList.size() == 0) {
|
||||||
DialogCommon.showNoArtFoundDialog(currentContext, null);
|
DialogCommon.showNoArtFoundDialog(currentContext, null);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for(int i = 0; i < mDataset.size(); i++) {
|
for (int i = 0; i < mDataset.size(); i++) {
|
||||||
mDataset.get(i).setHidden(!foundRowsList.contains(mDataset.get(i)));
|
mDataset.get(i).setHidden(!foundRowsList.contains(mDataset.get(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
filterStatus.set(true);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void removeListFilter() {
|
private void removeListFilter() {
|
||||||
filterStatus.set(false);
|
|
||||||
for (DialogChooseArtsFromListaArtsItemModel itemModel : mDataset) {
|
for (DialogChooseArtsFromListaArtsItemModel itemModel : mDataset) {
|
||||||
itemModel.setHidden(false);
|
itemModel.setHidden(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void onPositiveClick() {
|
private void onPositiveClick() {
|
||||||
if(mOnItemsChoosed != null) {
|
if (mOnItemsChoosed != null) {
|
||||||
mOnItemsChoosed.run(currentAdapter.getSelectedItems());
|
mOnItemsChoosed.run(currentAdapter.getSelectedItems());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void onNegativeClick() {
|
private void onNegativeClick() {
|
||||||
if(this.mOnAbort != null) mOnAbort.run();
|
if (this.mOnAbort != null) mOnAbort.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.choose_batch_lot;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.interfaces.IRecyclerItemClicked;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogChooseBatchLotItemModelBinding;
|
||||||
|
|
||||||
|
public class DialogChooseBatchLotAdapter extends RecyclerView.Adapter<DialogChooseBatchLotAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
protected Context mContext;
|
||||||
|
|
||||||
|
private final List<MtbPartitaMag> mDataset;
|
||||||
|
private final IRecyclerItemClicked<MtbPartitaMag> mOnItemClickListener;
|
||||||
|
|
||||||
|
|
||||||
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
protected DialogChooseBatchLotItemModelBinding mViewDataBinding;
|
||||||
|
|
||||||
|
|
||||||
|
public ViewHolder(DialogChooseBatchLotItemModelBinding v) {
|
||||||
|
super(v.getRoot());
|
||||||
|
mViewDataBinding = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bind(MtbPartitaMag mtbPartitaMag) {
|
||||||
|
mViewDataBinding.setMtbPartitaMag(mtbPartitaMag);
|
||||||
|
mViewDataBinding.executePendingBindings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogChooseBatchLotAdapter(List<MtbPartitaMag> myDataset, IRecyclerItemClicked<MtbPartitaMag> onItemClickListener) {
|
||||||
|
mDataset = myDataset;
|
||||||
|
mOnItemClickListener = onItemClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DialogChooseBatchLotAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
// create a new view
|
||||||
|
DialogChooseBatchLotItemModelBinding viewDataBinding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.dialog_choose_batch_lot_item_model, parent, false);
|
||||||
|
return new DialogChooseBatchLotAdapter.ViewHolder(viewDataBinding);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(DialogChooseBatchLotAdapter.ViewHolder holder, int position) {
|
||||||
|
MtbPartitaMag item = mDataset.get(position);
|
||||||
|
holder.bind(item);
|
||||||
|
|
||||||
|
holder.mViewDataBinding.getRoot().setOnClickListener(x -> {
|
||||||
|
if(mOnItemClickListener != null) {
|
||||||
|
mOnItemClickListener.onItemClick(item, position);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewRecycled(DialogChooseBatchLotAdapter.ViewHolder holder) {
|
||||||
|
super.onViewRecycled(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mDataset.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.choose_batch_lot;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface DialogChooseBatchLotComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
DialogChooseBatchLotComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(DialogChooseBatchLotView dialogChooseBatchLotView);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.choose_batch_lot;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
|
||||||
|
@Module
|
||||||
|
public class DialogChooseBatchLotModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
DialogChooseBatchLotViewModel providesDialogChooseBatchLotViewModel() {
|
||||||
|
return new DialogChooseBatchLotViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.choose_batch_lot;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.interfaces.IRecyclerItemClicked;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogChooseBatchLotBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
|
|
||||||
|
public class DialogChooseBatchLotView extends BaseDialogFragment {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogChooseBatchLotViewModel mViewModel;
|
||||||
|
|
||||||
|
private List<MtbPartitaMag> mAvailableBatchLot;
|
||||||
|
private RunnableArgs<MtbPartitaMag> mOnItemSelected;
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private DialogChooseBatchLotBinding mBindings;
|
||||||
|
|
||||||
|
private DialogChooseBatchLotAdapter mAdapter;
|
||||||
|
|
||||||
|
private MtbPartitaMag mSelectedItem;
|
||||||
|
|
||||||
|
public static DialogChooseBatchLotView newInstance(List<MtbPartitaMag> availableBatchLot, RunnableArgs<MtbPartitaMag> onItemSelected) {
|
||||||
|
return new DialogChooseBatchLotView(availableBatchLot, onItemSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogChooseBatchLotView(List<MtbPartitaMag> availableBatchLot, RunnableArgs<MtbPartitaMag> onItemSelected) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.mAvailableBatchLot = availableBatchLot;
|
||||||
|
this.mOnItemSelected = onItemSelected;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
this.mContext = getActivity();
|
||||||
|
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_choose_batch_lot, container, false);
|
||||||
|
|
||||||
|
MainApplication.appComponent
|
||||||
|
.dialogChooseBatchLotComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
|
mBindings.setView(this);
|
||||||
|
mBindings.setViewmodel(this.mViewModel);
|
||||||
|
|
||||||
|
getDialog().setCanceledOnTouchOutside(false);
|
||||||
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
|
||||||
|
this.initRecyclerView();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dismiss() {
|
||||||
|
super.dismiss();
|
||||||
|
|
||||||
|
if(mOnItemSelected != null) {
|
||||||
|
this.mOnItemSelected.run(mSelectedItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initRecyclerView() {
|
||||||
|
mBindings.mainList.setNestedScrollingEnabled(false);
|
||||||
|
mBindings.mainList.setHasFixedSize(true);
|
||||||
|
mBindings.mainList.setLayoutManager(new LinearLayoutManager(mContext));
|
||||||
|
|
||||||
|
SimpleDividerItemDecoration itemDecorator = new SimpleDividerItemDecoration(mContext, SimpleDividerItemDecoration.VERTICAL);
|
||||||
|
itemDecorator.setDrawable(ContextCompat.getDrawable(mContext, R.drawable.divider));
|
||||||
|
mBindings.mainList.addItemDecoration(itemDecorator);
|
||||||
|
|
||||||
|
mAdapter = new DialogChooseBatchLotAdapter(mAvailableBatchLot, onItemClicked);
|
||||||
|
mBindings.mainList.setAdapter(mAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final IRecyclerItemClicked<MtbPartitaMag> onItemClicked = (item, position) -> {
|
||||||
|
mSelectedItem = item;
|
||||||
|
dismiss();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.choose_batch_lot;
|
||||||
|
|
||||||
|
public class DialogChooseBatchLotViewModel {
|
||||||
|
}
|
||||||
@@ -38,6 +38,7 @@ import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
|||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
||||||
import it.integry.integrywmsnative.databinding.DialogInputQuantityV2Binding;
|
import it.integry.integrywmsnative.databinding.DialogInputQuantityV2Binding;
|
||||||
@@ -179,8 +180,10 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
this.init();
|
this.init();
|
||||||
|
|
||||||
|
int onNumCnfInputChanged = SettingsManager.iDB().getOnNumCnfInputChanged();
|
||||||
|
|
||||||
this.mViewModel.setListener(this);
|
this.mViewModel.setListener(this);
|
||||||
this.mViewModel.init();
|
this.mViewModel.init(onNumCnfInputChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.exception.Over
|
|||||||
|
|
||||||
public class DialogInputQuantityV2ViewModel {
|
public class DialogInputQuantityV2ViewModel {
|
||||||
|
|
||||||
|
private final int UPDATE_QTA_CNF = 1;
|
||||||
|
private final int UPDATE_QTA_TOT = 2;
|
||||||
|
|
||||||
public ObservableField<MtbAart> mtbAart = new ObservableField<>();
|
public ObservableField<MtbAart> mtbAart = new ObservableField<>();
|
||||||
|
|
||||||
public ObservableField<Boolean> blockedNumCnf = new ObservableField<>();
|
public ObservableField<Boolean> blockedNumCnf = new ObservableField<>();
|
||||||
@@ -60,6 +63,7 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
|
|
||||||
private boolean canOverflowOrderQuantity;
|
private boolean canOverflowOrderQuantity;
|
||||||
private boolean canPartitaMagBeChanged;
|
private boolean canPartitaMagBeChanged;
|
||||||
|
private int onNumCnfInputChanged;
|
||||||
|
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
|
|
||||||
@@ -70,7 +74,9 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init(int onNumCnfInputChanged) {
|
||||||
|
this.onNumCnfInputChanged = onNumCnfInputChanged;
|
||||||
|
|
||||||
if (this.initialNumCnf != null && this.initialQtaTot != null && this.initialQtaCnf != null) {
|
if (this.initialNumCnf != null && this.initialQtaTot != null && this.initialQtaCnf != null) {
|
||||||
this.internalNumCnf = this.initialNumCnf;
|
this.internalNumCnf = this.initialNumCnf;
|
||||||
this.internalQtaCnf = this.initialQtaCnf;
|
this.internalQtaCnf = this.initialQtaCnf;
|
||||||
@@ -179,6 +185,8 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
this.mListener.onError(ex);
|
this.mListener.onError(ex);
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
onComplete.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,10 +312,21 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
|
switch (onNumCnfInputChanged) {
|
||||||
this.internalQtaCnf = UtilityBigDecimal.divide(internalQtaTot, newValue);
|
case UPDATE_QTA_CNF:
|
||||||
else if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
|
if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
|
||||||
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
|
this.internalQtaCnf = UtilityBigDecimal.divide(internalQtaTot, newValue);
|
||||||
|
else if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
|
||||||
|
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UPDATE_QTA_TOT:if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
|
||||||
|
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
|
||||||
|
else if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
|
||||||
|
this.internalQtaCnf = UtilityBigDecimal.divide(internalQtaTot, newValue);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
this.mListener.onDataChanged();
|
this.mListener.onDataChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
|||||||
|
|
||||||
private boolean mShouldCheckResiduo;
|
private boolean mShouldCheckResiduo;
|
||||||
private boolean mShouldCheckIfExistDoc;
|
private boolean mShouldCheckIfExistDoc;
|
||||||
|
private boolean mEnableCreation;
|
||||||
|
|
||||||
private final BindableBoolean basketEnabled = new BindableBoolean();
|
private final BindableBoolean basketEnabled = new BindableBoolean();
|
||||||
private final BindableBoolean creationEnabled = new BindableBoolean();
|
private final BindableBoolean creationEnabled = new BindableBoolean();
|
||||||
@@ -71,6 +72,7 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
|||||||
this.basketEnabled.set(enableBasket);
|
this.basketEnabled.set(enableBasket);
|
||||||
this.creationEnabled.set(enableCreation);
|
this.creationEnabled.set(enableCreation);
|
||||||
|
|
||||||
|
mEnableCreation = enableCreation;
|
||||||
mOnComplete = onComplete;
|
mOnComplete = onComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +97,7 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
|||||||
getDialog().setCanceledOnTouchOutside(false);
|
getDialog().setCanceledOnTouchOutside(false);
|
||||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
this.mViewModel.init(mShouldCheckResiduo, mShouldCheckIfExistDoc);
|
this.mViewModel.init(mShouldCheckResiduo, mShouldCheckIfExistDoc, mEnableCreation);
|
||||||
|
|
||||||
mBindings.createNewLuButton.setOnClickListener(v -> {
|
mBindings.createNewLuButton.setOnClickListener(v -> {
|
||||||
this.mViewModel.createNewLU();
|
this.mViewModel.createNewLU();
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class DialogScanOrCreateLUViewModel {
|
|||||||
|
|
||||||
private boolean mShouldCheckResiduo = false;
|
private boolean mShouldCheckResiduo = false;
|
||||||
private boolean mShouldCheckIfExistDoc = true;
|
private boolean mShouldCheckIfExistDoc = true;
|
||||||
|
private boolean mEnableCreation = false;
|
||||||
|
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
|
|
||||||
@@ -40,9 +41,10 @@ public class DialogScanOrCreateLUViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void init(boolean checkResiduo, boolean shouldCheckIfExistDoc) {
|
public void init(boolean checkResiduo, boolean shouldCheckIfExistDoc, boolean enableCreation) {
|
||||||
this.mShouldCheckResiduo = checkResiduo;
|
this.mShouldCheckResiduo = checkResiduo;
|
||||||
this.mShouldCheckIfExistDoc = shouldCheckIfExistDoc;
|
this.mShouldCheckIfExistDoc = shouldCheckIfExistDoc;
|
||||||
|
this.mEnableCreation = enableCreation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createNewLU() {
|
public void createNewLU() {
|
||||||
@@ -94,11 +96,14 @@ public class DialogScanOrCreateLUViewModel {
|
|||||||
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, mtbColt -> {
|
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, mtbColt -> {
|
||||||
|
|
||||||
if (mtbColt == null) {
|
if (mtbColt == null) {
|
||||||
this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(barcodeScanDTO, GestioneEnum.LAVORAZIONE, createdMtbColt -> {
|
if(mEnableCreation) {
|
||||||
onComplete.run();
|
this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(barcodeScanDTO, GestioneEnum.LAVORAZIONE, createdMtbColt -> {
|
||||||
this.sendOnLUOpened(createdMtbColt, true);
|
onComplete.run();
|
||||||
}, this::sendError);
|
this.sendOnLUOpened(createdMtbColt, true);
|
||||||
|
}, this::sendError);
|
||||||
|
} else {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||||
this.sendError(new AlreadyAttachedDocumentToLUException());
|
this.sendError(new AlreadyAttachedDocumentToLUException());
|
||||||
|
|||||||
@@ -79,23 +79,11 @@
|
|||||||
android:tint="@color/colorPrimaryGray"
|
android:tint="@color/colorPrimaryGray"
|
||||||
android:visibility="@{BuildConfig.DEBUG ? View.VISIBLE : View.GONE}" />
|
android:visibility="@{BuildConfig.DEBUG ? View.VISIBLE : View.GONE}" />
|
||||||
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageButton
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
android:layout_gravity="end"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:background="@drawable/ripple_effect"
|
|
||||||
app:singleClick="@{() -> spedizioneView.startCameraBarcode()}"
|
|
||||||
android:src="@drawable/ic_photo_camera_black_24dp"
|
|
||||||
android:tint="@color/colorPrimaryGray"
|
|
||||||
android:visibility="@{BuildConfig.DEBUG ? View.VISIBLE : View.GONE}" />
|
|
||||||
|
|
||||||
</androidx.appcompat.widget.Toolbar>
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
@@ -168,7 +156,7 @@
|
|||||||
android:paddingBottom="72dp"
|
android:paddingBottom="72dp"
|
||||||
android:scrollbars="vertical" />
|
android:scrollbars="vertical" />
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
@@ -199,7 +187,7 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent="0.85" />
|
app:layout_constraintGuide_percent="0.85" />
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
@@ -221,7 +209,7 @@
|
|||||||
android:text="@string/no_item_to_pick_text"
|
android:text="@string/no_item_to_pick_text"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
android:textSize="18sp" />
|
android:textSize="18sp" />
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<layout>
|
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:cardCornerRadius="12dp"
|
|
||||||
app:cardElevation="0dp">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<com.kroegerama.kaiteki.bcode.views.BarcodeView
|
|
||||||
android:id="@+id/bcode"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:resultPointColor="#09E85E"
|
|
||||||
app:resultPointSize="8dp"
|
|
||||||
app:showResultPoints="true" />
|
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center|bottom"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:paddingBottom="8dp">
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/button_confirm"
|
|
||||||
style="@style/Button.PrimaryFull"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/action_close"
|
|
||||||
android:layout_alignParentBottom="true"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
</layout>
|
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
type="it.integry.integrywmsnative.core.model.MtbAart"/>
|
type="it.integry.integrywmsnative.core.model.MtbAart"/>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
android:paddingBottom="8dp">
|
android:paddingBottom="8dp">
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:id="@+id/linearLayout"
|
android:id="@+id/linearLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -67,8 +67,8 @@
|
|||||||
tools:text="Descrizione lunga articolo" />
|
tools:text="Descrizione lunga articolo" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -3,171 +3,168 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
<import type="android.view.View" />
|
<import type="android.view.View" />
|
||||||
|
|
||||||
<variable
|
|
||||||
name="filterStatus"
|
|
||||||
type="it.integry.integrywmsnative.core.di.BindableBoolean" />
|
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/base_root"
|
android:id="@+id/base_root"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
app:cardCornerRadius="12dp"
|
app:cardCornerRadius="12dp"
|
||||||
app:cardElevation="0dp">
|
app:cardElevation="0dp">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:paddingStart="8dp"
|
||||||
|
android:paddingTop="24dp"
|
||||||
|
android:paddingEnd="8dp"
|
||||||
|
android:paddingBottom="8dp">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:layout_above="@id/buttons"
|
||||||
android:paddingTop="24dp"
|
android:layout_below="@id/title_container"
|
||||||
android:paddingBottom="8dp"
|
android:paddingTop="8dp">
|
||||||
android:paddingStart="8dp"
|
|
||||||
android:paddingEnd="8dp"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/buttons"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintHeight_default="wrap"
|
|
||||||
app:layout_constraintHorizontal_chainStyle="packed"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent" >
|
|
||||||
|
|
||||||
<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"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/button_remove_filter"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
style="@style/Button.DangerOutline"
|
|
||||||
app:icon="@drawable/ic_clear_24dp"
|
|
||||||
app:strokeColor="@color/red_400"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:visibility="@{filterStatus.get() ? View.VISIBLE : View.GONE}"
|
|
||||||
android:text="@string/remove_filter_button"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/title_text"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
android:id="@+id/empty_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="16dp"
|
||||||
app:layout_constraintTop_toBottomOf="@id/button_remove_filter"
|
android:layout_marginBottom="16dp"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
android:gravity="center"
|
||||||
app:layout_constraintRight_toRightOf="parent">
|
android:padding="16dp">
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/empty_view"
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="16dp"
|
android:text="@string/no_item_to_pick_text"
|
||||||
android:layout_marginTop="16dp"
|
android:textColor="@color/empty_view_gray"
|
||||||
android:layout_marginBottom="16dp">
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
|
||||||
<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"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<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>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<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.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:id="@+id/title_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title_text"
|
||||||
|
style="@style/TextViewMaterial.DialogTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="@string/dialog_choose_arts_from_lista_art" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_gravity="center">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SearchView
|
||||||
|
android:id="@+id/main_search"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:iconifiedByDefault="true"
|
||||||
|
app:defaultQueryHint="@string/search"
|
||||||
|
app:iconifiedByDefault="false"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:tint="@android:color/black"/>
|
||||||
|
|
||||||
|
<!-- <com.google.android.material.button.MaterialButton-->
|
||||||
|
<!-- android:id="@+id/button_remove_filter"-->
|
||||||
|
<!-- style="@style/Button.DangerOutline"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_gravity="center_horizontal"-->
|
||||||
|
<!-- android:layout_marginTop="8dp"-->
|
||||||
|
<!-- android:text="@string/remove_filter_button"-->
|
||||||
|
<!-- android:visibility="@{filterStatus.get() ? View.VISIBLE : View.GONE}"-->
|
||||||
|
<!-- app:icon="@drawable/ic_clear_24dp"-->
|
||||||
|
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
|
||||||
|
<!-- app:layout_constraintRight_toRightOf="parent"-->
|
||||||
|
<!-- app:strokeColor="@color/red_400" />-->
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/buttons"
|
android:id="@+id/buttons"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_marginStart="4dp"
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginEnd="4dp"
|
android:layout_marginEnd="4dp"
|
||||||
android:paddingBottom="8dp"
|
android:paddingBottom="8dp">
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
<androidx.constraintlayout.widget.Guideline
|
||||||
android:id="@+id/center_guideline"
|
android:id="@+id/center_guideline"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent="0.5"/>
|
app:layout_constraintGuide_percent="0.5" />
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/negative_button"
|
android:id="@+id/negative_button"
|
||||||
|
style="@style/Button.PrimaryOutline"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/Button.PrimaryOutline"
|
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
|
android:text="@string/abort"
|
||||||
app:layout_constrainedHeight="true"
|
app:layout_constrainedHeight="true"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
||||||
android:text="@string/abort"/>
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/positive_button"
|
android:id="@+id/positive_button"
|
||||||
|
style="@style/Button.PrimaryFull"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/Button.PrimaryFull"
|
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
|
android:text="@string/confirm"
|
||||||
app:layout_constrainedHeight="true"
|
app:layout_constrainedHeight="true"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@id/center_guideline"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:text="@string/confirm"/>
|
app:layout_constraintStart_toStartOf="@id/center_guideline"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|||||||
85
app/src/main/res/layout/dialog_choose_batch_lot.xml
Normal file
85
app/src/main/res/layout/dialog_choose_batch_lot.xml
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<import type="it.integry.integrywmsnative.core.utility.UtilityString" />
|
||||||
|
|
||||||
|
<import type="it.integry.integrywmsnative.core.utility.UtilityNumber" />
|
||||||
|
|
||||||
|
<import type="it.integry.integrywmsnative.core.utility.UtilityBigDecimal" />
|
||||||
|
|
||||||
|
<import type="android.view.View" />
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="viewmodel"
|
||||||
|
type="it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotViewModel" />
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="view"
|
||||||
|
type="it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotView" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:cardCornerRadius="12dp"
|
||||||
|
app:cardElevation="0dp">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/light_blue_300"
|
||||||
|
android:gravity="center_horizontal">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="24dp"
|
||||||
|
android:src="@drawable/ic_error_white_24dp" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="24dp"
|
||||||
|
android:paddingTop="24dp"
|
||||||
|
android:paddingRight="24dp"
|
||||||
|
android:paddingBottom="24dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title_text"
|
||||||
|
style="@style/TextViewMaterial.DialogTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="@string/select_batch_lot" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/main_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"/>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
</layout>
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<import type="it.integry.integrywmsnative.core.utility.UtilityString" />
|
||||||
|
<import type="it.integry.integrywmsnative.core.utility.UtilityDate" />
|
||||||
|
|
||||||
|
<import type="android.view.View" />
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="mtbPartitaMag"
|
||||||
|
type="it.integry.integrywmsnative.core.model.MtbPartitaMag" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:paddingBottom="8dp">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@{UtilityString.isNull(mtbPartitaMag.partitaMag, "Nessun lotto")}"
|
||||||
|
style="@style/AppTheme.NewMaterial.Text.Medium"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:text="PARTITA MAG" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Data scad: "
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_toStartOf="@id/data_scad"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:visibility="@{UtilityString.isNullOrEmpty(mtbPartitaMag.dataScadS) ? View.GONE : View.VISIBLE}" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/data_scad"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:text="@{UtilityDate.formatDate(mtbPartitaMag.dataScadD, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)}"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:visibility="@{UtilityString.isNullOrEmpty(mtbPartitaMag.dataScadS) ? View.GONE : View.VISIBLE}"
|
||||||
|
tools:text="Data scad" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:text="@{UtilityString.isNull(mtbPartitaMag.descrizione, "Nessuna descrizione")}"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
android:textSize="16sp"
|
||||||
|
tools:text="Descrizione lunga articolo" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
</layout>
|
||||||
@@ -223,8 +223,20 @@
|
|||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
@@ -234,7 +246,7 @@
|
|||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="0dp"
|
android:layout_marginStart="0dp"
|
||||||
@@ -243,7 +255,7 @@
|
|||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
@@ -253,7 +265,7 @@
|
|||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
@@ -262,7 +274,6 @@
|
|||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
@@ -312,9 +323,21 @@
|
|||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
@@ -324,7 +347,7 @@
|
|||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="0dp"
|
android:layout_marginStart="0dp"
|
||||||
@@ -333,7 +356,7 @@
|
|||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
@@ -343,7 +366,7 @@
|
|||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/AppTheme.NewMaterial.Text.Medium"
|
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
@@ -355,7 +378,6 @@
|
|||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
name="viewmodel"
|
name="viewmodel"
|
||||||
type="it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs.DialogVenditaFiltroAvanzatoViewModel" />
|
type="it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs.DialogVenditaFiltroAvanzatoViewModel" />
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="view"
|
||||||
|
type="it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs.DialogVenditaFiltroAvanzatoView" />
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
@@ -59,7 +63,7 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
android:nextFocusDown="@id/input_id_viaggio"
|
android:nextFocusDown="@id/input_id_viaggio"
|
||||||
app:binding="@{viewmodel.deposito}" />
|
app:binding="@{view.deposito}" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
@@ -79,7 +83,7 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
android:nextFocusForward="@id/filled_exposed_dropdown_num_ords"
|
android:nextFocusForward="@id/filled_exposed_dropdown_num_ords"
|
||||||
app:binding="@{viewmodel.idViaggio}" />
|
app:binding="@{view.idViaggio}" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
@@ -101,7 +105,7 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
android:nextFocusForward="@id/filled_exposed_dropdown_cliente"
|
android:nextFocusForward="@id/filled_exposed_dropdown_cliente"
|
||||||
app:binding="@{viewmodel.numOrds}"/>
|
app:binding="@{view.numOrds}"/>
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
@@ -122,7 +126,7 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
android:nextFocusForward="@id/filled_exposed_dropdown_vettore"
|
android:nextFocusForward="@id/filled_exposed_dropdown_vettore"
|
||||||
app:binding="@{viewmodel.cliente}"/>
|
app:binding="@{view.cliente}"/>
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
@@ -143,7 +147,7 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
android:nextFocusForward="@id/filled_exposed_dropdown_automezzo"
|
android:nextFocusForward="@id/filled_exposed_dropdown_automezzo"
|
||||||
app:binding="@{viewmodel.vettore}"/>
|
app:binding="@{view.vettore}"/>
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
@@ -163,8 +167,29 @@
|
|||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
|
android:nextFocusForward="@id/filled_exposed_dropdown_paese"
|
||||||
|
app:binding="@{view.automezzo}"/>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/input_paese"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/city">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
|
||||||
|
android:id="@+id/filled_exposed_dropdown_paese"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
android:nextFocusForward="@id/filled_exposed_dropdown_agente"
|
android:nextFocusForward="@id/filled_exposed_dropdown_agente"
|
||||||
app:binding="@{viewmodel.automezzo}"/>
|
app:binding="@{view.paese}"/>
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
@@ -185,7 +210,7 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
android:nextFocusForward="@id/filled_exposed_dropdown_term_cons"
|
android:nextFocusForward="@id/filled_exposed_dropdown_term_cons"
|
||||||
app:binding="@{viewmodel.agente}"/>
|
app:binding="@{view.agente}"/>
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
@@ -204,7 +229,7 @@
|
|||||||
android:inputType="textNoSuggestions"
|
android:inputType="textNoSuggestions"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
app:binding="@{viewmodel.dataConsegna}"/>
|
app:binding="@{view.dataConsegna}"/>
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
@@ -224,7 +249,7 @@
|
|||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:imeOptions="actionDone"
|
android:imeOptions="actionDone"
|
||||||
app:binding="@{viewmodel.terminiConsegna}"/>
|
app:binding="@{view.terminiConsegna}"/>
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -210,6 +210,7 @@
|
|||||||
<string name="document_date">Data documento</string>
|
<string name="document_date">Data documento</string>
|
||||||
<string name="terms_of_delivery">Termini di consegna</string>
|
<string name="terms_of_delivery">Termini di consegna</string>
|
||||||
<string name="vehicle">Automezzo</string>
|
<string name="vehicle">Automezzo</string>
|
||||||
|
<string name="city">Paese</string>
|
||||||
<string name="deposit">Deposito</string>
|
<string name="deposit">Deposito</string>
|
||||||
<string name="rag_soc">Ragione sociale</string>
|
<string name="rag_soc">Ragione sociale</string>
|
||||||
<string name="travel_id">ID Viaggio</string>
|
<string name="travel_id">ID Viaggio</string>
|
||||||
@@ -274,6 +275,7 @@
|
|||||||
<string name="manufacture">Lav. terzi / Trasf. interni</string>
|
<string name="manufacture">Lav. terzi / Trasf. interni</string>
|
||||||
<string name="production">Produzione</string>
|
<string name="production">Produzione</string>
|
||||||
<string name="production_line">Linea di produzione</string>
|
<string name="production_line">Linea di produzione</string>
|
||||||
|
<string name="select_batch_lot">Seleziona un lotto</string>
|
||||||
<string name="internal_handling">Movimentazione interna</string>
|
<string name="internal_handling">Movimentazione interna</string>
|
||||||
<string name="prod_ordine_produzione_title_fragment">Accettazione da ordine</string>
|
<string name="prod_ordine_produzione_title_fragment">Accettazione da ordine</string>
|
||||||
<string name="prod_ordine_lavorazione_title_fragment">Picking da ordine</string>
|
<string name="prod_ordine_lavorazione_title_fragment">Picking da ordine</string>
|
||||||
|
|||||||
@@ -213,6 +213,7 @@
|
|||||||
<string name="document_date">Document date</string>
|
<string name="document_date">Document date</string>
|
||||||
<string name="terms_of_delivery">Terms of delivery</string>
|
<string name="terms_of_delivery">Terms of delivery</string>
|
||||||
<string name="vehicle">Vehicle</string>
|
<string name="vehicle">Vehicle</string>
|
||||||
|
<string name="city">City</string>
|
||||||
<string name="deposit">Deposit</string>
|
<string name="deposit">Deposit</string>
|
||||||
<string name="rag_soc">Company name</string>
|
<string name="rag_soc">Company name</string>
|
||||||
<string name="travel_id">Travel ID</string>
|
<string name="travel_id">Travel ID</string>
|
||||||
@@ -279,6 +280,7 @@
|
|||||||
<string name="manufacture">Manufacture / Internal movement</string>
|
<string name="manufacture">Manufacture / Internal movement</string>
|
||||||
<string name="production">Production</string>
|
<string name="production">Production</string>
|
||||||
<string name="production_line">Production line</string>
|
<string name="production_line">Production line</string>
|
||||||
|
<string name="select_batch_lot">Select a batch lot</string>
|
||||||
<string name="internal_handling">Internal handling</string>
|
<string name="internal_handling">Internal handling</string>
|
||||||
<string name="prod_ordine_produzione_title_fragment">Production picking</string>
|
<string name="prod_ordine_produzione_title_fragment">Production picking</string>
|
||||||
<string name="prod_ordine_lavorazione_title_fragment">Manufacture picking</string>
|
<string name="prod_ordine_lavorazione_title_fragment">Manufacture picking</string>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 30
|
||||||
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
@@ -20,9 +20,14 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -31,7 +36,7 @@ dependencies {
|
|||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
testImplementation 'junit:junit:4.13.1'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
|
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
|
||||||
exclude group: 'com.android.support', module: 'support-annotations'
|
exclude group: 'com.android.support', module: 'support-annotations'
|
||||||
|
|||||||
@@ -3,6 +3,3 @@ apply plugin: 'java-library'
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = "7"
|
|
||||||
targetCompatibility = "7"
|
|
||||||
|
|||||||
1
barcode_kaiteki/.gitignore
vendored
1
barcode_kaiteki/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
/build
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
apply plugin: 'com.android.library'
|
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
apply plugin: 'kotlin-android-extensions'
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 29
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
minSdkVersion 21
|
|
||||||
targetSdkVersion 29
|
|
||||||
versionCode 1
|
|
||||||
versionName "1.1.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
kotlinOptions.freeCompilerArgs += ['-module-name', "barcode.kaiteki"]
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
|
|
||||||
// For Kotlin projects
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = "1.8"
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
|
||||||
|
|
||||||
implementation 'androidx.core:core-ktx:1.3.2'
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
|
||||||
implementation 'com.google.android.material:material:1.3.0-alpha03'
|
|
||||||
|
|
||||||
api 'androidx.camera:camera-core:1.0.0-alpha03'
|
|
||||||
api 'androidx.camera:camera-camera2:1.0.0-alpha03'
|
|
||||||
|
|
||||||
api 'com.google.zxing:core:3.4.0'
|
|
||||||
}
|
|
||||||
21
barcode_kaiteki/proguard-rules.pro
vendored
21
barcode_kaiteki/proguard-rules.pro
vendored
@@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="com.kroegerama.kaiteki.bcode">
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
package com.kroegerama.kaiteki.bcode
|
|
||||||
|
|
||||||
import android.graphics.ImageFormat
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.camera.core.ImageAnalysis
|
|
||||||
import androidx.camera.core.ImageProxy
|
|
||||||
import com.google.zxing.BinaryBitmap
|
|
||||||
import com.google.zxing.MultiFormatReader
|
|
||||||
import com.google.zxing.PlanarYUVLuminanceSource
|
|
||||||
import com.google.zxing.Result
|
|
||||||
import com.google.zxing.common.HybridBinarizer
|
|
||||||
|
|
||||||
internal interface ResultListener {
|
|
||||||
fun onResult(result: Result, imageWidth: Int, imageHeight: Int, imageRotation: Int)
|
|
||||||
fun onNoResult()
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class BarcodeAnalyzer(
|
|
||||||
private val listener: ResultListener,
|
|
||||||
private val reader: MultiFormatReader
|
|
||||||
) : ImageAnalysis.Analyzer {
|
|
||||||
|
|
||||||
var enabled = true
|
|
||||||
var inverted = false
|
|
||||||
|
|
||||||
override fun analyze(image: ImageProxy, rotationDegrees: Int) {
|
|
||||||
if (!enabled) return
|
|
||||||
|
|
||||||
//YUV_420 is normally the input type here, but other YUV types are also supported in theory
|
|
||||||
if (ImageFormat.YUV_420_888 != image.format && ImageFormat.YUV_422_888 != image.format && ImageFormat.YUV_444_888 != image.format) {
|
|
||||||
Log.e(TAG, "Unexpected format: ${image.format}")
|
|
||||||
listener.onNoResult()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val byteBuffer = image.image?.planes?.firstOrNull()?.buffer
|
|
||||||
if (byteBuffer == null) {
|
|
||||||
listener.onNoResult()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var data = ByteArray(byteBuffer.remaining()).also { byteBuffer.get(it) }
|
|
||||||
|
|
||||||
var width = image.width
|
|
||||||
var height = image.height
|
|
||||||
|
|
||||||
// val rotatedData = ByteArray(data.size)
|
|
||||||
// for (y in 0 until height) {
|
|
||||||
// for (x in 0 until width) rotatedData[x * height + height - y - 1] = data[x + y * width]
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// data = rotatedData
|
|
||||||
// val tmp = width
|
|
||||||
// width = height
|
|
||||||
// height = tmp
|
|
||||||
|
|
||||||
val source = PlanarYUVLuminanceSource(data, width, height, 0, 0, width, height, false).let {
|
|
||||||
if (inverted) it.invert() else it
|
|
||||||
}
|
|
||||||
val bitmap = BinaryBitmap(HybridBinarizer(source))
|
|
||||||
|
|
||||||
try {
|
|
||||||
val result = reader.decodeWithState(bitmap)
|
|
||||||
listener.onResult(result, width, height, rotationDegrees)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
listener.onNoResult()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "BarcodeAnalyzer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.kroegerama.kaiteki.bcode
|
|
||||||
|
|
||||||
import com.google.zxing.Result
|
|
||||||
|
|
||||||
interface BarcodeResultListener {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param result zxing result
|
|
||||||
*
|
|
||||||
* @return return true to dismiss the dialog/fragment
|
|
||||||
*/
|
|
||||||
fun onBarcodeResult(result: Result): Boolean
|
|
||||||
|
|
||||||
fun onBarcodeScanCancelled()
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package com.kroegerama.kaiteki.bcode
|
|
||||||
|
|
||||||
import android.graphics.*
|
|
||||||
import android.media.Image
|
|
||||||
import com.google.zxing.PlanarYUVLuminanceSource
|
|
||||||
import java.io.ByteArrayOutputStream
|
|
||||||
|
|
||||||
internal fun Image.toBitmap(): Bitmap {
|
|
||||||
val yBuffer = planes[0].buffer // Y
|
|
||||||
val uBuffer = planes[1].buffer // U
|
|
||||||
val vBuffer = planes[2].buffer // V
|
|
||||||
|
|
||||||
val ySize = yBuffer.remaining()
|
|
||||||
val uSize = uBuffer.remaining()
|
|
||||||
val vSize = vBuffer.remaining()
|
|
||||||
|
|
||||||
val nv21 = ByteArray(ySize + uSize + vSize)
|
|
||||||
|
|
||||||
//U and V are swapped
|
|
||||||
yBuffer.get(nv21, 0, ySize)
|
|
||||||
vBuffer.get(nv21, ySize, vSize)
|
|
||||||
uBuffer.get(nv21, ySize + vSize, uSize)
|
|
||||||
|
|
||||||
val yuvImage = YuvImage(nv21, ImageFormat.NV21, this.width, this.height, null)
|
|
||||||
val out = ByteArrayOutputStream()
|
|
||||||
yuvImage.compressToJpeg(Rect(0, 0, yuvImage.width, yuvImage.height), 50, out)
|
|
||||||
val imageBytes = out.toByteArray()
|
|
||||||
return BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.size)
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun PlanarYUVLuminanceSource.toBitmap() =
|
|
||||||
Bitmap.createBitmap(renderThumbnail(), thumbnailWidth, thumbnailHeight, Bitmap.Config.ARGB_8888)
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
package com.kroegerama.kaiteki.bcode
|
|
||||||
|
|
||||||
import android.Manifest
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.pm.PackageManager
|
|
||||||
import android.content.res.TypedArray
|
|
||||||
import android.os.Build
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
|
|
||||||
internal fun AttributeSet?.handleArguments(
|
|
||||||
context: Context, attrs: IntArray, defStyleAttr: Int, defStyleRes: Int,
|
|
||||||
block: TypedArray.() -> Unit
|
|
||||||
) = this?.let {
|
|
||||||
val arr = context.obtainStyledAttributes(it, attrs, defStyleAttr, defStyleRes)
|
|
||||||
block(arr)
|
|
||||||
arr.recycle()
|
|
||||||
}
|
|
||||||
|
|
||||||
internal typealias Style = R.styleable
|
|
||||||
|
|
||||||
internal val Context.hasCameraPermission
|
|
||||||
get() = isPermissionGranted(Manifest.permission.CAMERA)
|
|
||||||
|
|
||||||
internal fun Fragment.requestCameraPermission(requestCode: Int) =
|
|
||||||
requestPermission(Manifest.permission.CAMERA, requestCode)
|
|
||||||
|
|
||||||
internal val IntArray.isPermissionGranted
|
|
||||||
get() = size > 0 && get(0) == PackageManager.PERMISSION_GRANTED
|
|
||||||
|
|
||||||
private fun Context.isPermissionGranted(permission: String) =
|
|
||||||
ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED
|
|
||||||
|
|
||||||
private fun Fragment.requestPermission(permission: String, requestCode: Int) {
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return
|
|
||||||
if (context?.isPermissionGranted(permission) == true) return
|
|
||||||
requestPermissions(arrayOf(permission), requestCode)
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class Debouncer(
|
|
||||||
val debounceTime: Int
|
|
||||||
) {
|
|
||||||
private var lastShot = 0L
|
|
||||||
|
|
||||||
operator fun <T> invoke(block: () -> T) = if (System.currentTimeMillis() - lastShot > debounceTime) {
|
|
||||||
block.invoke().also {
|
|
||||||
lastShot = System.currentTimeMillis()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
package com.kroegerama.kaiteki.bcode.ui
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.os.Handler
|
|
||||||
import android.util.Log
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.appcompat.app.AlertDialog
|
|
||||||
import androidx.core.os.postDelayed
|
|
||||||
import androidx.lifecycle.LifecycleOwner
|
|
||||||
import com.google.zxing.BarcodeFormat
|
|
||||||
import com.google.zxing.Result
|
|
||||||
import com.kroegerama.kaiteki.bcode.BarcodeResultListener
|
|
||||||
import com.kroegerama.kaiteki.bcode.R
|
|
||||||
import com.kroegerama.kaiteki.bcode.hasCameraPermission
|
|
||||||
import com.kroegerama.kaiteki.bcode.views.BarcodeView
|
|
||||||
|
|
||||||
|
|
||||||
fun Context.showBarcodeAlertDialog(
|
|
||||||
owner: LifecycleOwner,
|
|
||||||
listener: BarcodeResultListener,
|
|
||||||
formats: List<BarcodeFormat> = listOf(BarcodeFormat.QR_CODE),
|
|
||||||
barcodeInverted: Boolean = false
|
|
||||||
) {
|
|
||||||
if (!hasCameraPermission) {
|
|
||||||
Log.w("BarcodeAlertDialog", "Camera permission required")
|
|
||||||
Toast.makeText(this, "Camera permission required", Toast.LENGTH_LONG).show()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val view = LayoutInflater.from(this).inflate(R.layout.dlg_barcode, null, false)
|
|
||||||
val bcode = view.findViewById<BarcodeView>(R.id.bcode)
|
|
||||||
val handler = Handler()
|
|
||||||
|
|
||||||
val dlg = AlertDialog.Builder(this)
|
|
||||||
.setOnDismissListener { bcode.unbind() }
|
|
||||||
.setView(view)
|
|
||||||
.setOnCancelListener {
|
|
||||||
listener.onBarcodeScanCancelled()
|
|
||||||
}
|
|
||||||
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
|
||||||
listener.onBarcodeScanCancelled()
|
|
||||||
}
|
|
||||||
.show()
|
|
||||||
|
|
||||||
bcode.setFormats(formats)
|
|
||||||
bcode.setBarcodeInverted(barcodeInverted)
|
|
||||||
bcode.setBarcodeResultListener(object : BarcodeResultListener {
|
|
||||||
override fun onBarcodeResult(result: Result): Boolean {
|
|
||||||
val doDismiss = listener.onBarcodeResult(result)
|
|
||||||
if (doDismiss) {
|
|
||||||
handler.postDelayed(500) {
|
|
||||||
dlg.dismiss()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return doDismiss
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBarcodeScanCancelled() {
|
|
||||||
//Ignore: BarcodeView will never emit this event
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
bcode.bindToLifecycle(owner)
|
|
||||||
}
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
package com.kroegerama.kaiteki.bcode.ui
|
|
||||||
|
|
||||||
import android.content.DialogInterface
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.os.Handler
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.os.bundleOf
|
|
||||||
import androidx.core.os.postDelayed
|
|
||||||
import androidx.fragment.app.FragmentManager
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
|
||||||
import com.google.zxing.BarcodeFormat
|
|
||||||
import com.google.zxing.Result
|
|
||||||
import com.kroegerama.kaiteki.bcode.*
|
|
||||||
import kotlinx.android.synthetic.main.dlg_barcode.*
|
|
||||||
|
|
||||||
class BarcodeBottomSheet : BottomSheetDialogFragment(), BarcodeResultListener {
|
|
||||||
|
|
||||||
private val formats: List<BarcodeFormat>? by lazy {
|
|
||||||
arguments?.getSerializable(KEY_FORMATS) as List<BarcodeFormat>
|
|
||||||
}
|
|
||||||
|
|
||||||
private val barcodeInverted by lazy {
|
|
||||||
arguments?.getBoolean(KEY_INVERTED, false) ?: false
|
|
||||||
}
|
|
||||||
|
|
||||||
private val handler = Handler()
|
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
|
||||||
inflater.inflate(R.layout.dlg_barcode, container, false)
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
||||||
super.onViewCreated(view, savedInstanceState)
|
|
||||||
|
|
||||||
formats?.let(bcode::setFormats)
|
|
||||||
bcode.setBarcodeInverted(barcodeInverted)
|
|
||||||
bcode.setBarcodeResultListener(this)
|
|
||||||
|
|
||||||
if (requireContext().hasCameraPermission) {
|
|
||||||
bcode.bindToLifecycle(this)
|
|
||||||
} else {
|
|
||||||
requestCameraPermission(REQUEST_CAMERA)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
|
||||||
when (requestCode) {
|
|
||||||
REQUEST_CAMERA ->
|
|
||||||
if (grantResults.isPermissionGranted)
|
|
||||||
bcode.bindToLifecycle(this)
|
|
||||||
else
|
|
||||||
dismissAllowingStateLoss()
|
|
||||||
}
|
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStop() {
|
|
||||||
super.onStop()
|
|
||||||
bcode.unbind()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBarcodeResult(result: Result): Boolean {
|
|
||||||
if ((parentFragment as? BarcodeResultListener)?.onBarcodeResult(result) == true) {
|
|
||||||
handler.postDelayed(500) {
|
|
||||||
dismiss()
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
} else if ((activity as? BarcodeResultListener)?.onBarcodeResult(result) == true) {
|
|
||||||
handler.postDelayed(500) {
|
|
||||||
dismiss()
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBarcodeScanCancelled() {
|
|
||||||
//Ignore: BarcodeView will never emit this event
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCancel(dialog: DialogInterface) {
|
|
||||||
(parentFragment as? BarcodeResultListener)?.onBarcodeScanCancelled()
|
|
||||||
(activity as? BarcodeResultListener)?.onBarcodeScanCancelled()
|
|
||||||
super.onCancel(dialog)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
private const val KEY_FORMATS = "formats"
|
|
||||||
private const val KEY_INVERTED = "inverted"
|
|
||||||
|
|
||||||
private const val REQUEST_CAMERA = 0xbb_ca
|
|
||||||
|
|
||||||
fun show(
|
|
||||||
fm: FragmentManager,
|
|
||||||
formats: List<BarcodeFormat> = listOf(BarcodeFormat.QR_CODE),
|
|
||||||
barcodeInverted: Boolean = false,
|
|
||||||
tag: String? = null
|
|
||||||
) = BarcodeBottomSheet().apply {
|
|
||||||
arguments = bundleOf(
|
|
||||||
KEY_FORMATS to formats,
|
|
||||||
KEY_INVERTED to barcodeInverted
|
|
||||||
)
|
|
||||||
|
|
||||||
show(fm, tag)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
package com.kroegerama.kaiteki.bcode.ui
|
|
||||||
|
|
||||||
import android.content.DialogInterface
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.os.Handler
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.Window
|
|
||||||
import androidx.core.os.bundleOf
|
|
||||||
import androidx.core.os.postDelayed
|
|
||||||
import androidx.fragment.app.DialogFragment
|
|
||||||
import androidx.fragment.app.FragmentManager
|
|
||||||
import com.google.zxing.BarcodeFormat
|
|
||||||
import com.google.zxing.Result
|
|
||||||
import com.kroegerama.kaiteki.bcode.*
|
|
||||||
import kotlinx.android.synthetic.main.dlg_barcode.*
|
|
||||||
|
|
||||||
open class BarcodeDialog : DialogFragment(), BarcodeResultListener {
|
|
||||||
|
|
||||||
private val formats: List<BarcodeFormat>? by lazy {
|
|
||||||
arguments?.getSerializable(KEY_FORMATS) as List<BarcodeFormat>
|
|
||||||
}
|
|
||||||
|
|
||||||
private val barcodeInverted by lazy {
|
|
||||||
arguments?.getBoolean(KEY_INVERTED, false) ?: false
|
|
||||||
}
|
|
||||||
|
|
||||||
private val handler = Handler()
|
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
|
||||||
inflater.inflate(R.layout.dlg_barcode, container, false).also {
|
|
||||||
dialog?.window?.run {
|
|
||||||
requestFeature(Window.FEATURE_NO_TITLE)
|
|
||||||
requestFeature(Window.FEATURE_SWIPE_TO_DISMISS)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
||||||
super.onViewCreated(view, savedInstanceState)
|
|
||||||
|
|
||||||
formats?.let(bcode::setFormats)
|
|
||||||
bcode.setBarcodeInverted(barcodeInverted)
|
|
||||||
bcode.setBarcodeResultListener(this)
|
|
||||||
|
|
||||||
if (requireContext().hasCameraPermission) {
|
|
||||||
bcode.bindToLifecycle(this)
|
|
||||||
} else {
|
|
||||||
requestCameraPermission(REQUEST_CAMERA)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
|
||||||
when (requestCode) {
|
|
||||||
REQUEST_CAMERA ->
|
|
||||||
if (grantResults.isPermissionGranted)
|
|
||||||
bcode.bindToLifecycle(this)
|
|
||||||
else
|
|
||||||
dismissAllowingStateLoss()
|
|
||||||
}
|
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBarcodeScanCancelled() {
|
|
||||||
//Ignore: BarcodeView will never emit this event
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStop() {
|
|
||||||
super.onStop()
|
|
||||||
bcode.unbind()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStart() {
|
|
||||||
super.onStart()
|
|
||||||
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBarcodeResult(result: Result): Boolean {
|
|
||||||
if ((parentFragment as? BarcodeResultListener)?.onBarcodeResult(result) == true) {
|
|
||||||
handler.postDelayed(500) {
|
|
||||||
dismiss()
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
} else if ((activity as? BarcodeResultListener)?.onBarcodeResult(result) == true) {
|
|
||||||
handler.postDelayed(500) {
|
|
||||||
dismiss()
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCancel(dialog: DialogInterface) {
|
|
||||||
(parentFragment as? BarcodeResultListener)?.onBarcodeScanCancelled()
|
|
||||||
(activity as? BarcodeResultListener)?.onBarcodeScanCancelled()
|
|
||||||
super.onCancel(dialog)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
private const val KEY_FORMATS = "formats"
|
|
||||||
private const val KEY_INVERTED = "inverted"
|
|
||||||
|
|
||||||
private const val REQUEST_CAMERA = 0xbd_ca
|
|
||||||
|
|
||||||
fun show(
|
|
||||||
fm: FragmentManager,
|
|
||||||
formats: List<BarcodeFormat> = listOf(BarcodeFormat.QR_CODE),
|
|
||||||
barcodeInverted: Boolean = false,
|
|
||||||
tag: String? = null
|
|
||||||
) = BarcodeDialog().apply {
|
|
||||||
arguments = bundleOf(
|
|
||||||
KEY_FORMATS to formats,
|
|
||||||
KEY_INVERTED to barcodeInverted
|
|
||||||
)
|
|
||||||
|
|
||||||
show(fm, tag)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
package com.kroegerama.kaiteki.bcode.ui
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.os.bundleOf
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import com.google.zxing.BarcodeFormat
|
|
||||||
import com.google.zxing.Result
|
|
||||||
import com.kroegerama.kaiteki.bcode.*
|
|
||||||
import kotlinx.android.synthetic.main.dlg_barcode.*
|
|
||||||
|
|
||||||
class BarcodeFragment : Fragment(), BarcodeResultListener {
|
|
||||||
|
|
||||||
private val formats: List<BarcodeFormat>? by lazy {
|
|
||||||
arguments?.getSerializable(KEY_FORMATS) as List<BarcodeFormat>
|
|
||||||
}
|
|
||||||
|
|
||||||
private val barcodeInverted by lazy {
|
|
||||||
arguments?.getBoolean(KEY_INVERTED, false) ?: false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
|
||||||
inflater.inflate(R.layout.dlg_barcode, container, false)
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
||||||
super.onViewCreated(view, savedInstanceState)
|
|
||||||
|
|
||||||
formats?.let(bcode::setFormats)
|
|
||||||
bcode.setBarcodeInverted(barcodeInverted)
|
|
||||||
bcode.setBarcodeResultListener(this)
|
|
||||||
|
|
||||||
if (requireContext().hasCameraPermission) {
|
|
||||||
bcode.bindToLifecycle(this)
|
|
||||||
} else {
|
|
||||||
requestCameraPermission(REQUEST_CAMERA)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
|
||||||
when (requestCode) {
|
|
||||||
REQUEST_CAMERA ->
|
|
||||||
if (grantResults.isPermissionGranted)
|
|
||||||
bcode.bindToLifecycle(this)
|
|
||||||
}
|
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStop() {
|
|
||||||
super.onStop()
|
|
||||||
bcode.unbind()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBarcodeResult(result: Result): Boolean {
|
|
||||||
if ((parentFragment as? BarcodeResultListener)?.onBarcodeResult(result) == true) {
|
|
||||||
return true
|
|
||||||
} else if ((activity as? BarcodeResultListener)?.onBarcodeResult(result) == true) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBarcodeScanCancelled() {
|
|
||||||
//Ignore: BarcodeView will never emit this event
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val KEY_FORMATS = "formats"
|
|
||||||
private const val KEY_INVERTED = "inverted"
|
|
||||||
|
|
||||||
private const val REQUEST_CAMERA = 0xbf_ca
|
|
||||||
|
|
||||||
fun makeInstance(
|
|
||||||
formats: List<BarcodeFormat> = listOf(BarcodeFormat.QR_CODE),
|
|
||||||
barcodeInverted: Boolean = false
|
|
||||||
) = BarcodeFragment().apply {
|
|
||||||
arguments = bundleOf(
|
|
||||||
KEY_FORMATS to formats,
|
|
||||||
KEY_INVERTED to barcodeInverted
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,197 +0,0 @@
|
|||||||
package com.kroegerama.kaiteki.bcode.views
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.res.Resources
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.graphics.Matrix
|
|
||||||
import android.os.Handler
|
|
||||||
import android.os.HandlerThread
|
|
||||||
import android.util.*
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.Surface
|
|
||||||
import android.view.TextureView
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.FrameLayout
|
|
||||||
import androidx.camera.core.*
|
|
||||||
import androidx.lifecycle.LifecycleOwner
|
|
||||||
import com.google.zxing.BarcodeFormat
|
|
||||||
import com.google.zxing.DecodeHintType
|
|
||||||
import com.google.zxing.MultiFormatReader
|
|
||||||
import com.google.zxing.Result
|
|
||||||
import com.kroegerama.kaiteki.bcode.*
|
|
||||||
import com.kroegerama.kaiteki.bcode.R
|
|
||||||
import kotlin.math.max
|
|
||||||
|
|
||||||
class BarcodeView @JvmOverloads constructor(
|
|
||||||
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
|
||||||
) : FrameLayout(context, attrs, defStyleAttr), ResultListener {
|
|
||||||
|
|
||||||
private val textureView: TextureView
|
|
||||||
private val resultView: ResultPointView
|
|
||||||
|
|
||||||
private var bufferSize = SizeF(0f, 0f)
|
|
||||||
|
|
||||||
private var listener: BarcodeResultListener? = null
|
|
||||||
|
|
||||||
private val barcodeReader by lazy { MultiFormatReader() }
|
|
||||||
|
|
||||||
private val analyzer by lazy { BarcodeAnalyzer(this, barcodeReader) }
|
|
||||||
|
|
||||||
private val resultDebouncer = Debouncer(500)
|
|
||||||
|
|
||||||
init {
|
|
||||||
LayoutInflater.from(context).inflate(R.layout.barcode_view, this)
|
|
||||||
|
|
||||||
keepScreenOn = true
|
|
||||||
|
|
||||||
textureView = findViewById(R.id.textureView)
|
|
||||||
resultView = findViewById(R.id.resultView)
|
|
||||||
|
|
||||||
attrs.handleArguments(context, Style.BarcodeView, defStyleAttr, 0) {
|
|
||||||
resultView.showResultPoints = getBoolean(Style.BarcodeView_showResultPoints, true)
|
|
||||||
resultView.setResultPointColor(getColor(Style.BarcodeView_resultPointColor, Color.GREEN))
|
|
||||||
val defaultSize =
|
|
||||||
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8f, Resources.getSystem().displayMetrics)
|
|
||||||
resultView.setPointSize(getDimension(Style.BarcodeView_resultPointSize, defaultSize))
|
|
||||||
analyzer.inverted = getBoolean(Style.BarcodeView_barcodeInverted, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
textureView.addOnLayoutChangeListener { _, _, _, _, _, _, _, _, _ ->
|
|
||||||
updateTransform()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResult(result: Result, imageWidth: Int, imageHeight: Int, imageRotation: Int) {
|
|
||||||
resultView.setResult(result, imageWidth, imageHeight, imageRotation)
|
|
||||||
|
|
||||||
val d = resultDebouncer {
|
|
||||||
listener?.onBarcodeResult(result)
|
|
||||||
}
|
|
||||||
if (d == true) {
|
|
||||||
// dialog/fragment will be dismissed -> do not send any more events
|
|
||||||
listener = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onNoResult() {
|
|
||||||
resultView.clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setBarcodeResultListener(listener: BarcodeResultListener) {
|
|
||||||
this.listener = listener
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* enable scanning of inverted barcodes (e.g. white QR Code on black background)
|
|
||||||
*/
|
|
||||||
fun setBarcodeInverted(inverted: Boolean) {
|
|
||||||
analyzer.inverted = inverted
|
|
||||||
}
|
|
||||||
|
|
||||||
fun bindToLifecycle(owner: LifecycleOwner) {
|
|
||||||
textureView.post { startPreview(owner) }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun unbind() {
|
|
||||||
resultView.clear()
|
|
||||||
listener = null
|
|
||||||
CameraX.unbindAll()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setFormats(formats: List<BarcodeFormat>) = barcodeReader.setHints(
|
|
||||||
mapOf(
|
|
||||||
DecodeHintType.POSSIBLE_FORMATS to formats
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
private fun startPreview(owner: LifecycleOwner) {
|
|
||||||
val metrics = DisplayMetrics().also { textureView.display.getRealMetrics(it) }
|
|
||||||
val screenSize = Size(metrics.widthPixels, metrics.heightPixels)
|
|
||||||
val screenAspectRatio = Rational(metrics.widthPixels, metrics.heightPixels)
|
|
||||||
val screenRotation = textureView.display.rotation
|
|
||||||
|
|
||||||
val previewConfig = PreviewConfig.Builder().apply {
|
|
||||||
setLensFacing(CameraX.LensFacing.BACK)
|
|
||||||
setTargetResolution(screenSize / 2)
|
|
||||||
setTargetAspectRatio(screenAspectRatio)
|
|
||||||
setTargetRotation(screenRotation)
|
|
||||||
}.build()
|
|
||||||
|
|
||||||
val preview = Preview(previewConfig).apply {
|
|
||||||
setOnPreviewOutputUpdateListener(::previewOutputUpdated)
|
|
||||||
}
|
|
||||||
|
|
||||||
val analysisConfig = ImageAnalysisConfig.Builder().apply {
|
|
||||||
setLensFacing(CameraX.LensFacing.BACK)
|
|
||||||
setTargetResolution(screenSize / 2)
|
|
||||||
setTargetAspectRatio(screenAspectRatio)
|
|
||||||
setTargetRotation(textureView.display.rotation)
|
|
||||||
|
|
||||||
setImageReaderMode(ImageAnalysis.ImageReaderMode.ACQUIRE_LATEST_IMAGE)
|
|
||||||
val analyzerThread = HandlerThread("BarcodeAnalyzer").apply { start() }
|
|
||||||
setCallbackHandler(Handler(analyzerThread.looper))
|
|
||||||
}.build()
|
|
||||||
|
|
||||||
val analysis = ImageAnalysis(analysisConfig).apply { analyzer = this@BarcodeView.analyzer }
|
|
||||||
|
|
||||||
CameraX.bindToLifecycle(owner, preview, analysis)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun previewOutputUpdated(output: Preview.PreviewOutput) {
|
|
||||||
// https://github.com/android/camera/blob/848cf1e2c8404599050d79086dee1d0c8951b66e/CameraXBasic/app/src/main/java/com/android/example/cameraxbasic/utils/AutoFitPreviewBuilder.kt#L100
|
|
||||||
(textureView.parent as? ViewGroup)?.apply {
|
|
||||||
val idx = indexOfChild(textureView)
|
|
||||||
removeView(textureView)
|
|
||||||
addView(textureView, idx)
|
|
||||||
textureView.surfaceTexture = output.surfaceTexture
|
|
||||||
}
|
|
||||||
|
|
||||||
bufferSize = SizeF(output.textureSize.height.toFloat(), output.textureSize.width.toFloat())
|
|
||||||
updateTransform()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateTransform() {
|
|
||||||
val viewFinderWidth = textureView.width.toFloat()
|
|
||||||
val viewFinderHeight = textureView.height.toFloat()
|
|
||||||
val viewFinderRotation = when (textureView.display.rotation) {
|
|
||||||
Surface.ROTATION_0 -> 0
|
|
||||||
Surface.ROTATION_90 -> 90
|
|
||||||
Surface.ROTATION_180 -> 180
|
|
||||||
Surface.ROTATION_270 -> 270
|
|
||||||
else -> return
|
|
||||||
}
|
|
||||||
val matrix = Matrix()
|
|
||||||
val centerX = viewFinderWidth / 2f
|
|
||||||
val centerY = viewFinderHeight / 2f
|
|
||||||
|
|
||||||
matrix.postRotate(-viewFinderRotation.toFloat(), centerX, centerY)
|
|
||||||
|
|
||||||
val bufferRatio = bufferSize.width / bufferSize.height
|
|
||||||
val viewRatio = viewFinderWidth / viewFinderHeight
|
|
||||||
|
|
||||||
if (bufferRatio > viewRatio) {
|
|
||||||
val factor = bufferRatio / viewRatio
|
|
||||||
matrix.preScale(factor, 1f, centerX, centerY)
|
|
||||||
} else {
|
|
||||||
val factor = viewRatio / bufferRatio
|
|
||||||
matrix.preScale(1f, factor, centerX, centerY)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (viewFinderRotation % 180 != 0) {
|
|
||||||
if (bufferRatio > viewRatio) {
|
|
||||||
val s = 1f / bufferRatio
|
|
||||||
matrix.preScale(s, s, centerX, centerY)
|
|
||||||
} else {
|
|
||||||
val s = max(bufferRatio, 1f / viewRatio)
|
|
||||||
matrix.preScale(s, s, centerX, centerY)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// val dbgScale = .95f
|
|
||||||
// matrix.preScale(dbgScale, dbgScale, centerX, centerY)
|
|
||||||
|
|
||||||
textureView.setTransform(matrix)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private operator fun Size.div(other: Int): Size = Size(width / other, height / other)
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
package com.kroegerama.kaiteki.bcode.views
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.res.Resources
|
|
||||||
import android.graphics.*
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.util.TypedValue
|
|
||||||
import android.view.View
|
|
||||||
import androidx.annotation.ColorInt
|
|
||||||
import com.google.zxing.Result
|
|
||||||
import com.kroegerama.kaiteki.bcode.BuildConfig
|
|
||||||
import com.kroegerama.kaiteki.bcode.Style
|
|
||||||
import com.kroegerama.kaiteki.bcode.handleArguments
|
|
||||||
import kotlin.math.max
|
|
||||||
|
|
||||||
class ResultPointView @JvmOverloads constructor(
|
|
||||||
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
|
||||||
) : View(context, attrs, defStyleAttr) {
|
|
||||||
|
|
||||||
private val pPoints = Paint().apply {
|
|
||||||
style = Paint.Style.STROKE
|
|
||||||
color = Color.GREEN
|
|
||||||
strokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8f, Resources.getSystem().displayMetrics)
|
|
||||||
strokeCap = Paint.Cap.ROUND
|
|
||||||
}
|
|
||||||
|
|
||||||
private var resultPoints = floatArrayOf()
|
|
||||||
private var rect = RectF()
|
|
||||||
|
|
||||||
var showResultPoints = true
|
|
||||||
set(value) {
|
|
||||||
field = value
|
|
||||||
invalidate()
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
attrs.handleArguments(context, Style.ResultPointView, defStyleAttr, 0) {
|
|
||||||
showResultPoints = getBoolean(Style.ResultPointView_showResultPoints, showResultPoints)
|
|
||||||
|
|
||||||
pPoints.color = getColor(Style.ResultPointView_resultPointColor, pPoints.color)
|
|
||||||
pPoints.strokeWidth =
|
|
||||||
getDimension(Style.ResultPointView_resultPointSize, pPoints.strokeWidth)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setResultPointColor(@ColorInt color: Int) {
|
|
||||||
pPoints.color = color
|
|
||||||
invalidate()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setPointSize(size: Float) {
|
|
||||||
pPoints.strokeWidth = size
|
|
||||||
}
|
|
||||||
|
|
||||||
fun clear() {
|
|
||||||
resultPoints = floatArrayOf()
|
|
||||||
|
|
||||||
postInvalidate()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setResult(result: Result, imageWidth: Int, imageHeight: Int, imageRotation: Int) {
|
|
||||||
if (!showResultPoints) return
|
|
||||||
|
|
||||||
val localMatrix = createMatrix(imageWidth.toFloat(), imageHeight.toFloat(), imageRotation)
|
|
||||||
|
|
||||||
resultPoints = result.resultPoints.flatMap { listOf(it.x, it.y) }.toFloatArray()
|
|
||||||
localMatrix.mapPoints(resultPoints)
|
|
||||||
|
|
||||||
if (BuildConfig.DEBUG) {
|
|
||||||
rect = RectF(0f, 0f, imageWidth.toFloat(), imageHeight.toFloat())
|
|
||||||
localMatrix.mapRect(rect)
|
|
||||||
}
|
|
||||||
|
|
||||||
postInvalidate()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createMatrix(imageWidth: Float, imageHeight: Float, imageRotation: Int) = Matrix().apply {
|
|
||||||
preTranslate((width - imageWidth) / 2f, (height - imageHeight) / 2f)
|
|
||||||
preRotate(imageRotation.toFloat(), imageWidth / 2f, imageHeight / 2f)
|
|
||||||
|
|
||||||
val wScale: Float
|
|
||||||
val hScale: Float
|
|
||||||
|
|
||||||
if (imageRotation % 180 == 0) {
|
|
||||||
wScale = width.toFloat() / imageWidth
|
|
||||||
hScale = height.toFloat() / imageHeight
|
|
||||||
} else {
|
|
||||||
wScale = height.toFloat() / imageWidth
|
|
||||||
hScale = width.toFloat() / imageHeight
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
val scale = max(wScale, hScale)
|
|
||||||
preScale(scale, scale, imageWidth / 2f, imageHeight / 2f)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDraw(canvas: Canvas) {
|
|
||||||
if (showResultPoints) canvas.drawPoints(resultPoints, pPoints)
|
|
||||||
|
|
||||||
if (BuildConfig.DEBUG) canvas.drawRect(rect, pPoints)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:parentTag="android.widget.FrameLayout">
|
|
||||||
|
|
||||||
<TextureView
|
|
||||||
android:id="@+id/textureView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
|
|
||||||
<com.kroegerama.kaiteki.bcode.views.ResultPointView
|
|
||||||
android:id="@+id/resultView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
</merge>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<com.kroegerama.kaiteki.bcode.views.BarcodeView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/bcode"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
app:resultPointColor="#09E85E"
|
|
||||||
app:resultPointSize="8dp"
|
|
||||||
app:showResultPoints="true" />
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<attr name="showResultPoints" format="boolean" />
|
|
||||||
<attr name="resultPointColor" format="color" />
|
|
||||||
<attr name="resultPointSize" format="dimension" />
|
|
||||||
|
|
||||||
<declare-styleable name="ResultPointView">
|
|
||||||
<attr name="showResultPoints" />
|
|
||||||
<attr name="resultPointColor" />
|
|
||||||
<attr name="resultPointSize" />
|
|
||||||
</declare-styleable>
|
|
||||||
|
|
||||||
<declare-styleable name="BarcodeView">
|
|
||||||
<attr name="showResultPoints" />
|
|
||||||
<attr name="resultPointColor" />
|
|
||||||
<attr name="resultPointSize" />
|
|
||||||
<attr name="barcodeInverted" format="boolean" />
|
|
||||||
</declare-styleable>
|
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
143
build.gradle
143
build.gradle
@@ -2,21 +2,21 @@
|
|||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
kotlin_version = '1.4.31'
|
kotlin_version = '1.5.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
|
||||||
google()
|
google()
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.1.3'
|
classpath 'com.android.tools.build:gradle:4.2.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath 'com.google.gms:google-services:4.3.5'
|
classpath 'com.google.gms:google-services:4.3.5'
|
||||||
classpath 'com.google.firebase:perf-plugin:1.3.5'
|
classpath 'com.google.firebase:perf-plugin:1.3.5'
|
||||||
|
|
||||||
// Add the Firebase Crashlytics Gradle plugin.
|
// Add the Firebase Crashlytics Gradle plugin.
|
||||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.1'
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.2'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
@@ -25,12 +25,145 @@ buildscript {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
|
||||||
google()
|
google()
|
||||||
maven { url 'https://jitpack.io' }
|
maven { url 'https://jitpack.io' }
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// gradle.projectsEvaluated {
|
||||||
|
// tasks.withType(JavaCompile) {
|
||||||
|
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task buildBase() {
|
||||||
|
doFirst {
|
||||||
|
copy {
|
||||||
|
from 'dynamic__base/src/main/java/it/integry'
|
||||||
|
into 'app/src/main/java/it/integry'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependsOn "app:build"
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
copy {
|
||||||
|
from 'app/build/outputs/apk/release'
|
||||||
|
into 'dist/release/_base'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task buildFrudis() {
|
||||||
|
doFirst {
|
||||||
|
copy {
|
||||||
|
from 'dynamic_frudis/src/main/java/it/integry'
|
||||||
|
into 'app/src/main/java/it/integry'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependsOn "app:build"
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
copy {
|
||||||
|
from 'app/build/outputs/apk/release'
|
||||||
|
into 'dist/release/frudis'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task buildGramm() {
|
||||||
|
doFirst {
|
||||||
|
copy {
|
||||||
|
from 'dynamic_gramm/src/main/java/it/integry'
|
||||||
|
into 'app/src/main/java/it/integry'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependsOn "app:build"
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
copy {
|
||||||
|
from 'app/build/outputs/apk/release'
|
||||||
|
into 'dist/release/gramm'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task buildIme() {
|
||||||
|
doFirst {
|
||||||
|
copy {
|
||||||
|
from 'dynamic_ime/src/main/java/it/integry'
|
||||||
|
into 'app/src/main/java/it/integry'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependsOn "app:build"
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
copy {
|
||||||
|
from 'app/build/outputs/apk/release'
|
||||||
|
into 'dist/release/ime'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task buildSaporiVeriPV() {
|
||||||
|
doFirst {
|
||||||
|
copy {
|
||||||
|
from 'dynamic_saporiveri_pv/src/main/java/it/integry'
|
||||||
|
into 'app/src/main/java/it/integry'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependsOn "app:build"
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
copy {
|
||||||
|
from 'app/build/outputs/apk/release'
|
||||||
|
into 'dist/release/saporiveri_pv'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task buildSaporiVeri() {
|
||||||
|
doFirst {
|
||||||
|
copy {
|
||||||
|
from 'dynamic_saporiveri/src/main/java/it/integry'
|
||||||
|
into 'app/src/main/java/it/integry'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependsOn "app:build"
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
copy {
|
||||||
|
from 'app/build/outputs/apk/release'
|
||||||
|
into 'dist/release/saporiveri'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task buildVGAlimenti() {
|
||||||
|
doFirst {
|
||||||
|
copy {
|
||||||
|
from 'dynamic_vgalimenti/src/main/java/it/integry'
|
||||||
|
into 'app/src/main/java/it/integry'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependsOn "app:build"
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
copy {
|
||||||
|
from 'app/build/outputs/apk/release'
|
||||||
|
into 'dist/release/vgalimenti'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,59 +2,14 @@
|
|||||||
|
|
||||||
SET nome_azienda=%1
|
SET nome_azienda=%1
|
||||||
|
|
||||||
rem setlocal enabledelayedexpansion
|
|
||||||
rem set INTEXTFILE=build.gradle
|
|
||||||
rem set OUTTEXTFILE=build_out.gradle
|
|
||||||
rem set SEARCHTEXT=:dynamic__base
|
|
||||||
rem set REPLACETEXT=:dynamic_%nome_azienda%
|
|
||||||
rem set OUTPUTLINE=
|
|
||||||
|
|
||||||
rem cd app
|
|
||||||
|
|
||||||
rem for /f "tokens=1,* delims=<3D>" %%A in ( '"findstr /n ^^ %INTEXTFILE%"') do (
|
|
||||||
rem SET string=%%A
|
|
||||||
rem for /f "delims=: tokens=1,*" %%a in ("!string!") do set "string=%%b"
|
|
||||||
rem if "!string!" == "" (
|
|
||||||
rem echo.>>%OUTTEXTFILE%
|
|
||||||
rem ) else (
|
|
||||||
rem SET modified=!string:%SEARCHTEXT%=%REPLACETEXT%!
|
|
||||||
rem echo !modified! >> %OUTTEXTFILE%
|
|
||||||
rem )
|
|
||||||
rem )
|
|
||||||
rem del %INTEXTFILE%
|
|
||||||
rem rename %OUTTEXTFILE% %INTEXTFILE%
|
|
||||||
|
|
||||||
rem cd ..
|
|
||||||
|
|
||||||
rem RMDIR app\build\generated /S /Q
|
|
||||||
rem RMDIR app\build\intermediates /S /Q
|
|
||||||
rem RMDIR app\build\reports /S /Q
|
|
||||||
rem RMDIR app\build\test-results /S /Q
|
|
||||||
rem RMDIR app\build\tmp /S /Q
|
|
||||||
|
|
||||||
XCOPY dynamic_%nome_azienda%\src\main\java\it\integry app\src\main\java\it\integry\ /E /Y
|
XCOPY dynamic_%nome_azienda%\src\main\java\it\integry app\src\main\java\it\integry\ /E /Y
|
||||||
CALL gradlew app:build --stacktrace
|
CALL gradlew app:build --stacktrace
|
||||||
|
|
||||||
RMDIR app\src\main\java\it\integry\wms\ /S /Q
|
RMDIR app\src\main\java\it\integry\wms\ /S /Q
|
||||||
|
|
||||||
rem cd app
|
MKDIR dist
|
||||||
|
MKDIR dist\release
|
||||||
|
MKDIR dist\release\%nome_azienda%
|
||||||
|
|
||||||
rem for /f "tokens=1,* delims=<3D>" %%A in ( '"findstr /n ^^ %INTEXTFILE%"') do (
|
MOVE app\build\outputs\apk\release\*.apk dist\release\%nome_azienda%\
|
||||||
rem SET string=%%A
|
MOVE app\build\outputs\apk\release\*.txt dist\release\%nome_azienda%\
|
||||||
rem for /f "delims=: tokens=1,*" %%a in ("!string!") do set "string=%%b"
|
|
||||||
rem if "!string!" == "" (
|
|
||||||
rem echo.>>%OUTTEXTFILE%
|
|
||||||
rem ) else (
|
|
||||||
rem SET modified=!string:%REPLACETEXT%=%SEARCHTEXT%!
|
|
||||||
rem echo !modified! >> %OUTTEXTFILE%
|
|
||||||
rem )
|
|
||||||
rem )
|
|
||||||
rem del %INTEXTFILE%
|
|
||||||
rem rename %OUTTEXTFILE% %INTEXTFILE%
|
|
||||||
rem
|
|
||||||
rem cd ..
|
|
||||||
|
|
||||||
MKDIR app\build\outputs\apk\release\%nome_azienda%
|
|
||||||
|
|
||||||
MOVE app\build\outputs\apk\release\*.apk app\build\outputs\apk\release\%nome_azienda%\
|
|
||||||
MOVE app\build\outputs\apk\release\*.txt app\build\outputs\apk\release\%nome_azienda%\
|
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
apply plugin: 'com.android.dynamic-feature'
|
apply plugin: 'com.android.dynamic-feature'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 30
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = '1.8'
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = '1.8'
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
apply plugin: 'com.android.dynamic-feature'
|
apply plugin: 'com.android.dynamic-feature'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 30
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,30 @@
|
|||||||
apply plugin: "com.android.dynamic-feature"
|
apply plugin: "com.android.dynamic-feature"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 30
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
|
||||||
implementation project(":app")
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
testImplementation 'junit:junit:4.13.1'
|
implementation project(':app')
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
|
||||||
androidTestImplementation 'androidx.annotation:annotation:1.1.0'
|
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
apply plugin: 'com.android.dynamic-feature'
|
apply plugin: 'com.android.dynamic-feature'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 30
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
apply plugin: 'com.android.dynamic-feature'
|
apply plugin: 'com.android.dynamic-feature'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 30
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
apply plugin: 'com.android.dynamic-feature'
|
apply plugin: 'com.android.dynamic-feature'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 30
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
apply plugin: 'com.android.dynamic-feature'
|
apply plugin: 'com.android.dynamic-feature'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 30
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
}
|
}
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
|
distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-all.zip
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user