Refactoring splash screen
This commit is contained in:
parent
d4bd92ec90
commit
fbe095b7f7
13
.idea/runConfigurations.xml
generated
13
.idea/runConfigurations.xml
generated
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<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.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@ -53,8 +53,9 @@ android {
|
||||
android.buildFeatures.dataBinding true
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
|
||||
}
|
||||
productFlavors {
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:name=".gest.main.MainActivity"
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustNothing">
|
||||
<intent-filter>
|
||||
|
||||
@ -4,6 +4,8 @@ import android.app.Application;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.context.AppContext;
|
||||
import it.integry.integrywmsnative.core.data_store.db.RoomModule;
|
||||
|
||||
@ -17,7 +19,8 @@ public class MainApplication extends Application {
|
||||
public static MainApplicationModule appModule;
|
||||
public static RoomModule roomModule;
|
||||
|
||||
private AppContext appContext = new AppContext(this);
|
||||
@Inject
|
||||
AppContext appContext;
|
||||
|
||||
|
||||
|
||||
@ -27,16 +30,15 @@ public class MainApplication extends Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
appModule = new MainApplicationModule(MainApplication.this, this);
|
||||
appModule = new MainApplicationModule(this);
|
||||
roomModule = new RoomModule(this);
|
||||
appComponent = DaggerMainApplicationComponent.builder()
|
||||
.mainApplicationModule(appModule)
|
||||
.roomModule(roomModule)
|
||||
.build();
|
||||
|
||||
appComponent.inject(appContext);
|
||||
appComponent.inject(this);
|
||||
|
||||
appContext.init();
|
||||
res = getResources();
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,10 @@ import it.integry.integrywmsnative.core.context.AppContext;
|
||||
import it.integry.integrywmsnative.core.data_store.db.RoomModule;
|
||||
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingComponent;
|
||||
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingModule;
|
||||
import it.integry.integrywmsnative.gest.main.MainActivityComponent;
|
||||
import it.integry.integrywmsnative.gest.main.MainActivityModule;
|
||||
import it.integry.integrywmsnative.gest.main.MainFragmentComponent;
|
||||
import it.integry.integrywmsnative.gest.main.MainFragmentModule;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoComponent;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoModule;
|
||||
import it.integry.integrywmsnative.gest.picking_libero.PickingLiberoComponent;
|
||||
@ -49,7 +53,9 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
// Definition of the Application graph
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
SplashActivityModule.class,
|
||||
MainApplicationModule.class,
|
||||
MainFragmentModule.class,
|
||||
RoomModule.class,
|
||||
MainActivityModule.class,
|
||||
PVOrdineAcquistoGrigliaModule.class,
|
||||
@ -70,10 +76,13 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
VersamentoMerceModule.class,
|
||||
DialogAskMagazzinoProssimitaModule.class,
|
||||
DialogChooseBatchLotModule.class,
|
||||
DialogRowInfoProdFabbisognoLineeProdModule.class})
|
||||
DialogRowInfoProdFabbisognoLineeProdModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
SplashActivityComponent.Factory splashActivityComponent();
|
||||
MainActivityComponent.Factory mainActivityComponent();
|
||||
MainFragmentComponent.Factory mainFragmentComponent();
|
||||
PVOrdineAcquistoGrigliaComponent.Factory pvOrdineAcquistoGrigliaComponent();
|
||||
PVOrdineAcquistoEditComponent.Factory pvOrdineAcquistoEditComponent();
|
||||
PickingLiberoComponent.Factory pickingLiberoComponent();
|
||||
@ -97,6 +106,7 @@ public interface MainApplicationComponent {
|
||||
ProdRientroMerceOrderDetailComponent.Factory prodRientroMerceOrderDetailComponent();
|
||||
|
||||
|
||||
void inject(AppContext appContext);
|
||||
void inject(MainApplication mainApplication);
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
}
|
||||
|
||||
@ -1,13 +1,16 @@
|
||||
package it.integry.integrywmsnative;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.context.AppContext;
|
||||
import it.integry.integrywmsnative.core.context.MainContext;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||
import it.integry.integrywmsnative.core.menu.MenuRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
@ -23,11 +26,9 @@ import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabb
|
||||
@Module
|
||||
public class MainApplicationModule {
|
||||
|
||||
private final Context mContext;
|
||||
private final Application mApplication;
|
||||
|
||||
public MainApplicationModule(Context context, Application application) {
|
||||
this.mContext = context;
|
||||
public MainApplicationModule(Application application) {
|
||||
this.mApplication = application;
|
||||
}
|
||||
|
||||
@ -37,10 +38,30 @@ public class MainApplicationModule {
|
||||
return mApplication;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
AppContext providesAppContext() {
|
||||
return new AppContext(mApplication);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MainContext providesMainContextNew(MenuService menuService) {
|
||||
return new MainContext(mApplication.getApplicationContext(), menuService);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliDataRecoverService provideColliDataRecoverService() {
|
||||
return new ColliDataRecoverService();
|
||||
ColliDataRecoverService colliDataRecoverService = new ColliDataRecoverService(mApplication.getApplicationContext());
|
||||
colliDataRecoverService.init();
|
||||
return colliDataRecoverService;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MenuService provideMenuService(MenuRESTConsumer menuRESTConsumer) {
|
||||
return new MenuService(menuRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ -61,6 +82,12 @@ public class MainApplicationModule {
|
||||
return new ArticoloRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MenuRESTConsumer provideMenuRESTConsumer() {
|
||||
return new MenuRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MagazzinoRESTConsumer provideMagazzinoRESTConsumer() {
|
||||
@ -110,5 +137,4 @@ public class MainApplicationModule {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
@ -12,22 +13,29 @@ import androidx.databinding.DataBindingUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.context.MainContext;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.PermissionsHelper;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityContext;
|
||||
import it.integry.integrywmsnative.core.utility.UtilitySettings;
|
||||
import it.integry.integrywmsnative.databinding.ActivitySplashBinding;
|
||||
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
||||
import it.integry.integrywmsnative.gest.main.MainActivity;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
public class SplashActivity extends BaseActivity {
|
||||
public class SplashActivity extends BaseActivity implements MainContext.Listener {
|
||||
|
||||
|
||||
private ActivitySplashBinding mBinding;
|
||||
|
||||
private MainContext mainContext = new MainContext(this);
|
||||
// private MainContext mainContext = new MainContext(this);
|
||||
|
||||
@Inject
|
||||
MainContext mainContext;
|
||||
|
||||
private RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult;
|
||||
|
||||
@ -35,32 +43,23 @@ public class SplashActivity extends BaseActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
MainApplication.appComponent
|
||||
.splashActivityComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mainContext.setListener(this);
|
||||
|
||||
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_splash, null, false);
|
||||
setContentView(mBinding.getRoot());
|
||||
|
||||
UtilityContext.initMainActivity(this);
|
||||
|
||||
initAppVersion();
|
||||
|
||||
initAppVersion();
|
||||
initPermissions(this::init);
|
||||
}
|
||||
|
||||
private void initPermissions(Runnable onComplete) {
|
||||
PermissionsHelper.askPermissions(this, () -> {
|
||||
onComplete.run();
|
||||
}, permanentlyDenied -> {
|
||||
if(permanentlyDenied) {
|
||||
DialogSimpleMessageView.makeErrorDialog(new SpannableString(getText(R.string.permissions_permanently_denied)), null, () -> {
|
||||
this.finish();
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
} else {
|
||||
initPermissions(onComplete);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void initAppVersion() {
|
||||
try {
|
||||
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
@ -68,7 +67,7 @@ public class SplashActivity extends BaseActivity {
|
||||
|
||||
String debugText = "";
|
||||
|
||||
if(BuildConfig.DEBUG) debugText += "\n[DEBUG VERSION]";
|
||||
if (BuildConfig.DEBUG) debugText += "\n[DEBUG VERSION]";
|
||||
|
||||
mBinding.appVersionTextview.setText("v" + version + debugText);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
@ -76,15 +75,39 @@ public class SplashActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void initPermissions(Runnable onComplete) {
|
||||
PermissionsHelper.askPermissions(this, onComplete, permanentlyDenied -> {
|
||||
if (permanentlyDenied) {
|
||||
onError(new SpannableString(getText(R.string.permissions_permanently_denied)));
|
||||
|
||||
} else {
|
||||
initPermissions(onComplete);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void init() {
|
||||
if(!SettingsManager.i().isUserLoggedIn()){
|
||||
if (!SettingsManager.i().isUserLoggedIn()) {
|
||||
startLoginActivity();
|
||||
} else {
|
||||
mainContext.init(this::startMainActivity);
|
||||
mainContext.init();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDBDataLoading(String item) {
|
||||
mBinding.loadingInfoTextview.setText("Caricamento " + item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMenuLoading() {
|
||||
mBinding.loadingInfoTextview.setText("Caricamento menù");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContextInitialized() {
|
||||
startMainActivity();
|
||||
}
|
||||
|
||||
|
||||
public void setOnRequestPermissionsResult(RunnableArgsss<Integer, String[], List<Integer>> onRequestPermissionResult) {
|
||||
@ -95,9 +118,9 @@ public class SplashActivity extends BaseActivity {
|
||||
@Override
|
||||
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<>();
|
||||
for(int i = 0; i < grantResults.length; i++) {
|
||||
for (int i = 0; i < grantResults.length; i++) {
|
||||
grantResultsList.add(grantResults[i]);
|
||||
}
|
||||
|
||||
@ -106,20 +129,28 @@ public class SplashActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void startLoginActivity(){
|
||||
private void startLoginActivity() {
|
||||
this.finish();
|
||||
Intent myIntent = new Intent(this, LoginActivity.class);
|
||||
startActivity(myIntent);
|
||||
}
|
||||
|
||||
private void startMainActivity(){
|
||||
private void startMainActivity() {
|
||||
this.finish();
|
||||
Intent myIntent = new Intent(this, MainActivity.class);
|
||||
startActivity(myIntent);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onError(Spanned message) {
|
||||
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
message, null, this::finish, R.string.logout, () -> {
|
||||
UtilitySettings.logout(() -> {
|
||||
MainApplication.exit();
|
||||
});
|
||||
})
|
||||
.show(this.getSupportFragmentManager(), "tag");
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface SplashActivityComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
|
||||
SplashActivityComponent create();
|
||||
}
|
||||
|
||||
void inject(SplashActivity mainActivity);
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative;
|
||||
|
||||
import dagger.Module;
|
||||
|
||||
@Module(subcomponents = SplashActivityComponent.class)
|
||||
public class SplashActivityModule {
|
||||
}
|
||||
@ -1,33 +1,27 @@
|
||||
package it.integry.integrywmsnative.core.barcode_reader;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.barcode_base_android_library.exception.BarcodeAdapterNotFoundException;
|
||||
import it.integry.barcode_base_android_library.interfaces.BarcodeReaderInterface;
|
||||
import it.integry.honeywellscannerlibrary.HoneyWellBarcodeReader;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import it.integry.keyobardemulatorscannerlibrary.KeyboardEmulatorBarcodeReader;
|
||||
import it.integry.pointmobilescannerlibrary.PointMobileBarcodeReader;
|
||||
import it.integry.zebrascannerlibrary.ZebraBarcodeReader;
|
||||
|
||||
public class BarcodeManager {
|
||||
|
||||
private static AppCompatActivity context;
|
||||
|
||||
private static BarcodeReaderInterface mCurrentBarcodeInterface;
|
||||
private static List<BarcodeCallbackDTO> mBarcodeCallbacksStacktrace = new ArrayList<>();
|
||||
private static final List<BarcodeCallbackDTO> mBarcodeCallbacksStacktrace = new ArrayList<>();
|
||||
|
||||
private static boolean mEnabled = true;
|
||||
|
||||
|
||||
private static Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{
|
||||
private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{
|
||||
PointMobileBarcodeReader.class,
|
||||
ZebraBarcodeReader.class,
|
||||
HoneyWellBarcodeReader.class,
|
||||
@ -35,73 +29,60 @@ public class BarcodeManager {
|
||||
};
|
||||
|
||||
|
||||
public static void init(AppCompatActivity context) {
|
||||
BarcodeManager.context = context;
|
||||
public static void init(Context applicationContext) throws Exception {
|
||||
|
||||
initBarcodeReader();
|
||||
initBarcodeReader(applicationContext);
|
||||
}
|
||||
|
||||
private static void initBarcodeReader() {
|
||||
private static void initBarcodeReader(Context applicationContext) throws Exception {
|
||||
|
||||
for (Class<? extends BarcodeReaderInterface> readerInterface : registeredBarcodeReaderInterfaces){
|
||||
for (Class<? extends BarcodeReaderInterface> readerInterface : registeredBarcodeReaderInterfaces) {
|
||||
|
||||
Constructor<?> cons = null;
|
||||
try {
|
||||
cons = Class.forName(readerInterface.getName()).getConstructors()[0];
|
||||
BarcodeReaderInterface object = (BarcodeReaderInterface) cons.newInstance(context);
|
||||
Constructor<?> cons = Class.forName(readerInterface.getName()).getConstructors()[0];
|
||||
BarcodeReaderInterface object = (BarcodeReaderInterface) cons.newInstance(applicationContext);
|
||||
|
||||
if(object.isRightAdapter()) {
|
||||
mCurrentBarcodeInterface = object;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
UtilityExceptions.defaultException(context,e);
|
||||
if (object.isRightAdapter()) {
|
||||
mCurrentBarcodeInterface = object;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(mCurrentBarcodeInterface != null) {
|
||||
if (mCurrentBarcodeInterface != null) {
|
||||
|
||||
try {
|
||||
mCurrentBarcodeInterface.init(() -> {
|
||||
|
||||
mCurrentBarcodeInterface.register(data -> {
|
||||
BarcodeCallbackDTO callback = getValidCallback();
|
||||
if(callback != null && mEnabled) {
|
||||
callback.getOnScanSuccessfull().run(data);
|
||||
}
|
||||
}, ex -> {
|
||||
BarcodeCallbackDTO callback = getValidCallback();
|
||||
if(callback != null && mEnabled) {
|
||||
callback.getOnScanFailed().run(ex);
|
||||
}
|
||||
});
|
||||
mCurrentBarcodeInterface.init(() -> {
|
||||
|
||||
mCurrentBarcodeInterface.register(data -> {
|
||||
BarcodeCallbackDTO callback = getValidCallback();
|
||||
if (callback != null && mEnabled) {
|
||||
callback.getOnScanSuccessfull().run(data);
|
||||
}
|
||||
}, ex -> {
|
||||
BarcodeCallbackDTO callback = getValidCallback();
|
||||
if (callback != null && mEnabled) {
|
||||
callback.getOnScanFailed().run(ex);
|
||||
}
|
||||
});
|
||||
} catch (BarcodeAdapterNotFoundException ex) {
|
||||
UtilityExceptions.defaultException(context, ex);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static BarcodeCallbackDTO getValidCallback() {
|
||||
|
||||
if(mBarcodeCallbacksStacktrace.size() > 0) {
|
||||
return mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() -1);
|
||||
if (mBarcodeCallbacksStacktrace.size() > 0) {
|
||||
return mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() - 1);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean onKeyDown(int keyCode, KeyEvent keyEvent){
|
||||
public static boolean onKeyDown(int keyCode, KeyEvent keyEvent) {
|
||||
if (mCurrentBarcodeInterface != null)
|
||||
mCurrentBarcodeInterface.onKeyEvent(keyEvent);
|
||||
mCurrentBarcodeInterface.onKeyEvent(keyEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -113,8 +94,8 @@ public class BarcodeManager {
|
||||
|
||||
int newID = -1;
|
||||
|
||||
if(mBarcodeCallbacksStacktrace.size() > 0) {
|
||||
newID = mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() -1).getID() + 1;
|
||||
if (mBarcodeCallbacksStacktrace.size() > 0) {
|
||||
newID = mBarcodeCallbacksStacktrace.get(mBarcodeCallbacksStacktrace.size() - 1).getID() + 1;
|
||||
} else {
|
||||
newID = 1;
|
||||
}
|
||||
@ -131,7 +112,7 @@ public class BarcodeManager {
|
||||
//Rimuovo la callback con l'ID trovato e tutte quelle con >ID in modo che rimuovo tutte le call aggiunte successivamente
|
||||
|
||||
for (int i = 0; i < mBarcodeCallbacksStacktrace.size(); i++) {
|
||||
if(mBarcodeCallbacksStacktrace.get(i).getID() == ID || callbackObjFound) {
|
||||
if (mBarcodeCallbacksStacktrace.get(i).getID() == ID || callbackObjFound) {
|
||||
mBarcodeCallbacksStacktrace.remove(i);
|
||||
|
||||
callbackObjFound = true;
|
||||
|
||||
@ -7,6 +7,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.class_router.exceptions.MethodPathNotRegisteredException;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
|
||||
public class ClassRouter {
|
||||
|
||||
@ -21,8 +22,8 @@ public class ClassRouter {
|
||||
|
||||
private static List<Pair<PATH, Object>> mRouteClasses = new ArrayList<>();
|
||||
|
||||
public static void init(Context context) {
|
||||
ClassRouter.context = context;
|
||||
public static void init() {
|
||||
// ClassRouter.context = context;
|
||||
}
|
||||
|
||||
private static boolean checkIClassExists(PATH path) {
|
||||
@ -51,9 +52,7 @@ public class ClassRouter {
|
||||
|
||||
try {
|
||||
mRouteClasses.add(new Pair<>(path, clazz.newInstance()));
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InstantiationException e) {
|
||||
} catch (IllegalAccessException | InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -77,7 +76,7 @@ public class ClassRouter {
|
||||
return (T)instance;
|
||||
|
||||
} catch (MethodPathNotRegisteredException ex) {
|
||||
// UtilityExceptions.defaultException(null, ex, true);
|
||||
UtilityExceptions.defaultException(null, ex, true);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@ -32,6 +32,8 @@ public class BaseMenuConfiguration {
|
||||
@IdRes
|
||||
private int mGroupId;
|
||||
|
||||
private String codMenu;
|
||||
|
||||
private List<MenuItem> mItems = new ArrayList<>();
|
||||
|
||||
public @IdRes int getGroupId() {
|
||||
@ -52,6 +54,15 @@ public class BaseMenuConfiguration {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMenu() {
|
||||
return codMenu;
|
||||
}
|
||||
|
||||
public MenuGroup setCodMenu(String codMenu) {
|
||||
this.codMenu = codMenu;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MenuItem> getItems() {
|
||||
return mItems;
|
||||
}
|
||||
@ -67,6 +78,7 @@ public class BaseMenuConfiguration {
|
||||
@StringRes private int mTitleText;
|
||||
@DrawableRes private int mTitleIcon;
|
||||
@DrawableRes private int mDrawerIcon;
|
||||
private String codMenu;
|
||||
private RunnableWithReturn<Fragment> fragmentFactory;
|
||||
|
||||
public int getID() {
|
||||
@ -105,6 +117,15 @@ public class BaseMenuConfiguration {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMenu() {
|
||||
return codMenu;
|
||||
}
|
||||
|
||||
public MenuItem setCodMenu(String codMenu) {
|
||||
this.codMenu = codMenu;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RunnableWithReturn<Fragment> getFragmentFactory() {
|
||||
return fragmentFactory;
|
||||
}
|
||||
|
||||
@ -24,9 +24,11 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.purchase)
|
||||
.setGroupId(R.id.nav_group_acquisto)
|
||||
.setCodMenu("MM008")
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_accettazione)
|
||||
.setCodMenu("MG044")
|
||||
.setTitleText(R.string.accettazione_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_accettazione)
|
||||
.setDrawerIcon(R.drawable.ic_black_download)
|
||||
@ -34,6 +36,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_resi_fornitore)
|
||||
.setCodMenu("MG045")
|
||||
.setTitleText(R.string.fragment_ultime_arrivi_fornitore_title)
|
||||
.setTitleIcon(R.drawable.ic_latest_delivery)
|
||||
.setDrawerIcon(R.drawable.ic_black_latest_delivery)
|
||||
@ -42,9 +45,11 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.checkout)
|
||||
.setGroupId(R.id.nav_group_spedizione)
|
||||
.setCodMenu("MM010")
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_spedizione)
|
||||
.setCodMenu("MG046")
|
||||
.setTitleText(R.string.vendita_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_spedizione)
|
||||
.setDrawerIcon(R.drawable.ic_black_upload)
|
||||
@ -52,6 +57,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_free_picking)
|
||||
.setCodMenu("MG047")
|
||||
.setTitleText(R.string.free_picking)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_picking_libero)
|
||||
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
|
||||
@ -59,6 +65,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_resi_cliente)
|
||||
.setCodMenu("MG048")
|
||||
.setTitleText(R.string.fragment_ultime_consegne_cliente_title)
|
||||
.setTitleIcon(R.drawable.ic_latest_delivery_customer)
|
||||
.setDrawerIcon(R.drawable.ic_black_latest_delivery)
|
||||
@ -66,9 +73,11 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
).addGroup(new MenuGroup()
|
||||
.setGroupText(R.string.manufacture)
|
||||
.setGroupId(R.id.nav_group_produzione)
|
||||
.setCodMenu("MM009")
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_ordine_produzione)
|
||||
.setCodMenu("MG049")
|
||||
.setTitleText(R.string.prod_ordine_produzione_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_accettazione_produzione)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
@ -76,6 +85,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_ordine_lavorazione)
|
||||
.setCodMenu("MG050")
|
||||
.setTitleText(R.string.prod_ordine_lavorazione_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_lavorazione)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
@ -83,6 +93,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_free_lav_picking)
|
||||
.setCodMenu("MG051")
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.free_lav_picking)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_libero)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_barcode_scanner)
|
||||
@ -90,6 +101,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_posizionamento_da_ord)
|
||||
.setCodMenu("MG052")
|
||||
.setTitleText(R.string.prod_fabbisogno_linee_prod_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_merce)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_load_shelf)
|
||||
@ -97,6 +109,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_versamento_materiale)
|
||||
.setCodMenu("MG053")
|
||||
.setTitleText(R.string.prod_versamento_materiale_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_materiale)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
@ -104,6 +117,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_recupero_materiale)
|
||||
.setCodMenu("MG054")
|
||||
.setTitleText(R.string.prod_recupero_materiale_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_recupero_materiale)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
@ -113,9 +127,11 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.internal_handling)
|
||||
.setGroupId(R.id.nav_group_movimentazione_interna)
|
||||
.setCodMenu("MM011")
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_versamento_merce)
|
||||
.setCodMenu("MG055")
|
||||
.setTitleText(R.string.versamento_merce_fragment_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_versamento_merce)
|
||||
.setDrawerIcon(R.drawable.ic_black_load_shelf)
|
||||
@ -123,6 +139,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_rettifica_giacenze)
|
||||
.setCodMenu("MG056")
|
||||
.setTitleText(R.string.rettifica_giacenze_fragment_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_rettifica_giacenze)
|
||||
.setDrawerIcon(R.drawable.ic_black_empty_box)
|
||||
|
||||
@ -7,8 +7,10 @@ import com.orhanobut.logger.AndroidLogAdapter;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.settings.Stash;
|
||||
@ -18,20 +20,26 @@ import it.integry.integrywmsnative.core.utility.UtilitySettings;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityToast;
|
||||
|
||||
@Singleton
|
||||
public class AppContext {
|
||||
|
||||
//Note: this is the Application Context NOT the Activity Context
|
||||
private final Context mContext;
|
||||
private final Context mApplicationContext;
|
||||
|
||||
@Inject
|
||||
AppDatabase mAppDatabase;
|
||||
|
||||
public AppContext(Context context) {
|
||||
this.mContext = context;
|
||||
this.mApplicationContext = context;
|
||||
|
||||
MainApplication.appComponent
|
||||
.inject(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Inject
|
||||
public void init() {
|
||||
this.initUtilities();
|
||||
|
||||
@ -45,8 +53,8 @@ public class AppContext {
|
||||
|
||||
|
||||
private void initSettings() {
|
||||
Stash.init(mContext);
|
||||
SettingsManager.init(mContext);
|
||||
Stash.init(mApplicationContext);
|
||||
SettingsManager.init(mApplicationContext);
|
||||
}
|
||||
|
||||
private void initCrashlytics() {
|
||||
@ -64,9 +72,9 @@ public class AppContext {
|
||||
}
|
||||
|
||||
private void initUtilities() {
|
||||
UtilityContext.initApplicationContext(mContext);
|
||||
UtilityResources.init(mContext);
|
||||
UtilityToast.init(mContext);
|
||||
UtilityContext.initApplicationContext(mApplicationContext);
|
||||
UtilityResources.init(mApplicationContext);
|
||||
UtilityToast.init(mApplicationContext);
|
||||
UtilitySettings.init(mAppDatabase);
|
||||
}
|
||||
|
||||
|
||||
@ -4,45 +4,51 @@ import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.text.SpannedString;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.ConnectException;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecover;
|
||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilitySettings;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
@Singleton
|
||||
public class MainContext {
|
||||
|
||||
private final AppCompatActivity mContext;
|
||||
private final Context applicationContext;
|
||||
private final MenuService menuService;
|
||||
|
||||
public MainContext(AppCompatActivity context) {
|
||||
this.mContext = context;
|
||||
private Listener mListener;
|
||||
|
||||
public MainContext(Context applicationContext, MenuService menuService) {
|
||||
this.applicationContext = applicationContext;
|
||||
this.menuService = menuService;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
|
||||
public void init(Runnable onContextInitialized) {
|
||||
try {
|
||||
BarcodeManager.init(applicationContext);
|
||||
} catch (Exception exception) {
|
||||
|
||||
BarcodeManager.init(mContext);
|
||||
}
|
||||
|
||||
this.initDBData(() -> {
|
||||
onContextInitialized.run();
|
||||
this.initMenu(() -> {
|
||||
|
||||
this.initReflections();
|
||||
if (mListener != null) mListener.onContextInitialized();
|
||||
});
|
||||
});
|
||||
|
||||
this.initReflections();
|
||||
|
||||
this.initServerStatusChecker();
|
||||
|
||||
ColliDataRecover.init(mContext);
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +57,13 @@ public class MainContext {
|
||||
}
|
||||
|
||||
private void initDBData(Runnable onComplete) {
|
||||
SettingsManager.loadDBVariables(onComplete, ex -> {
|
||||
|
||||
|
||||
SettingsManager.loadDBVariables(item -> {
|
||||
if (mListener != null) mListener.onDBDataLoading(item);
|
||||
},
|
||||
onComplete,
|
||||
ex -> {
|
||||
|
||||
Spanned message = null;
|
||||
|
||||
@ -63,18 +75,21 @@ public class MainContext {
|
||||
message = new SpannableString(ex.getMessage());
|
||||
}
|
||||
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
message, null, mContext::finish, R.string.logout, () -> {
|
||||
UtilitySettings.logout();
|
||||
MainApplication.exit();
|
||||
})
|
||||
.show(mContext.getSupportFragmentManager(), "tag");
|
||||
if (mListener != null) mListener.onError(message);
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void initMenu(Runnable onComplete) {
|
||||
if (mListener != null) mListener.onMenuLoading();
|
||||
this.menuService.init(onComplete, ex -> {
|
||||
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
|
||||
});
|
||||
}
|
||||
|
||||
private void initReflections() {
|
||||
ClassRouter.init(mContext);
|
||||
ClassRouter.init();
|
||||
|
||||
try {
|
||||
String initMethod = "init";
|
||||
@ -87,14 +102,29 @@ public class MainContext {
|
||||
// for static methods we can use null as instance of class
|
||||
final Object newInstance = dynamicContextClass.newInstance();
|
||||
|
||||
m.invoke(newInstance, (Context) mContext);
|
||||
m.invoke(newInstance, applicationContext);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
UtilityExceptions.defaultException(mContext, e, true);
|
||||
// UtilityExceptions.defaultException(mContext, e, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public MainContext setListener(Listener listener) {
|
||||
this.mListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface Listener {
|
||||
void onDBDataLoading(String item);
|
||||
|
||||
void onMenuLoading();
|
||||
|
||||
void onContextInitialized();
|
||||
|
||||
void onError(Spanned message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,235 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.data_recover;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
|
||||
public class ColliDataRecover {
|
||||
|
||||
public static class RecoverDTO {
|
||||
private int id;
|
||||
private int numCollo;
|
||||
private String serCollo;
|
||||
private String dataCollo;
|
||||
private String gestioneCollo;
|
||||
private String filtro;
|
||||
|
||||
private List<OrdineUscitaInevasoDTO> testateOrdini;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public RecoverDTO setId(int id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getNumCollo() {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public RecoverDTO setNumCollo(int numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerCollo() {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public RecoverDTO setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public RecoverDTO setDataCollo(String dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestioneCollo() {
|
||||
return gestioneCollo;
|
||||
}
|
||||
|
||||
public RecoverDTO setGestioneCollo(String gestioneCollo) {
|
||||
this.gestioneCollo = gestioneCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFiltro() {
|
||||
return filtro;
|
||||
}
|
||||
|
||||
public RecoverDTO setFiltro(String filtro) {
|
||||
this.filtro = filtro;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<OrdineUscitaInevasoDTO> getTestateOrdini() {
|
||||
return testateOrdini;
|
||||
}
|
||||
|
||||
public RecoverDTO setTestateOrdini(List<OrdineUscitaInevasoDTO> testateOrdini) {
|
||||
this.testateOrdini = testateOrdini;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MtbColt getMtbColt() {
|
||||
return new MtbColt()
|
||||
.setNumCollo(getNumCollo())
|
||||
.setSerCollo(getSerCollo())
|
||||
.setGestione(getGestioneCollo())
|
||||
.setDataCollo(getDataCollo())
|
||||
.setFiltroOrdini(getFiltro());
|
||||
}
|
||||
}
|
||||
|
||||
private static AppCompatActivity mContext;
|
||||
|
||||
private static List<RecoverDTO> mtbColtsSessions = new ArrayList<>();
|
||||
|
||||
public static void init(AppCompatActivity context) {
|
||||
mContext = context;
|
||||
|
||||
if(isFilePresent(CommonConst.Files.RECOVER_COLLO_FILE)) {
|
||||
loadLocalFile();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean thereIsAnExistantSession() {
|
||||
return mtbColtsSessions != null && mtbColtsSessions.size() > 0;
|
||||
}
|
||||
|
||||
public static List<Integer> getAllSessionIDs() {
|
||||
if(thereIsAnExistantSession()) {
|
||||
|
||||
return Stream.of(mtbColtsSessions)
|
||||
.map(RecoverDTO::getId)
|
||||
.toList();
|
||||
|
||||
} else return null;
|
||||
}
|
||||
|
||||
public static RecoverDTO getSession(Integer sessionID) {
|
||||
|
||||
if(sessionID == null) return null;
|
||||
|
||||
return getIfExists(sessionID);
|
||||
}
|
||||
|
||||
private static RecoverDTO getIfExists(int id) {
|
||||
Optional<RecoverDTO> recoverDTOOptional = Stream.of(mtbColtsSessions)
|
||||
.filter(x -> x.getId() == id)
|
||||
.findSingle();
|
||||
|
||||
|
||||
return recoverDTOOptional.isPresent() ? recoverDTOOptional.get() : null;
|
||||
}
|
||||
|
||||
public static int startNewSession(MtbColt mtbColtSession, List<OrdineUscitaInevasoDTO> testateOrdini) {
|
||||
Integer newId = null;
|
||||
|
||||
while(newId == null) {
|
||||
int randomId = new Random().nextInt(1000);
|
||||
RecoverDTO dto = getIfExists(randomId);
|
||||
if(dto == null) newId = randomId;
|
||||
}
|
||||
|
||||
|
||||
RecoverDTO recoverDTO = new RecoverDTO()
|
||||
.setId(newId)
|
||||
.setDataCollo(mtbColtSession.getDataColloS())
|
||||
.setNumCollo(mtbColtSession.getNumCollo())
|
||||
.setSerCollo(mtbColtSession.getSerCollo())
|
||||
.setGestioneCollo(mtbColtSession.getGestione())
|
||||
.setFiltro(mtbColtSession.getFiltroOrdini())
|
||||
.setTestateOrdini(testateOrdini);
|
||||
|
||||
mtbColtsSessions.add(recoverDTO);
|
||||
updateLocalFile();
|
||||
return newId;
|
||||
}
|
||||
|
||||
public static void closeSession(int ID) {
|
||||
RecoverDTO dto = getIfExists(ID);
|
||||
|
||||
if(dto != null) {
|
||||
mtbColtsSessions.remove(dto);
|
||||
updateLocalFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void loadLocalFile() {
|
||||
InputStream inputStream;
|
||||
|
||||
Gson gson = new Gson();
|
||||
|
||||
try {
|
||||
inputStream = mContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
|
||||
|
||||
byte[] bytes = new byte[inputStream.available()];
|
||||
inputStream.read(bytes);
|
||||
inputStream.close();
|
||||
|
||||
String jsonString = new String(bytes);
|
||||
|
||||
Type listType = new TypeToken<ArrayList<RecoverDTO>>(){}.getType();
|
||||
mtbColtsSessions = gson.fromJson(jsonString, listType);
|
||||
|
||||
if(mtbColtsSessions == null) mtbColtsSessions = new ArrayList<>();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
UtilityExceptions.defaultException(mContext, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void updateLocalFile() {
|
||||
FileOutputStream outputStream;
|
||||
|
||||
Gson gson = new Gson();
|
||||
String jsonText = gson.toJson(mtbColtsSessions);
|
||||
|
||||
try {
|
||||
outputStream = mContext.openFileOutput(CommonConst.Files.RECOVER_COLLO_FILE, Context.MODE_PRIVATE);
|
||||
outputStream.write(jsonText.getBytes());
|
||||
outputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
UtilityExceptions.defaultException(mContext, e);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isFilePresent(String fileName) {
|
||||
String path = mContext.getFilesDir().getAbsolutePath() + "/" + fileName;
|
||||
File file = new File(path);
|
||||
return file.exists();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -2,8 +2,6 @@ package it.integry.integrywmsnative.core.data_recover;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.android.gms.common.util.IOUtils;
|
||||
@ -24,22 +22,20 @@ import javax.inject.Singleton;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
|
||||
@Singleton
|
||||
public class ColliDataRecoverService {
|
||||
|
||||
|
||||
private AppCompatActivity mContext;
|
||||
private final Context mApplicationContext;
|
||||
private List<ColliDataRecoverDTO> mtbColtsSessions = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
public ColliDataRecoverService() {
|
||||
public ColliDataRecoverService(Context applicationContext) {
|
||||
this.mApplicationContext = applicationContext;
|
||||
}
|
||||
|
||||
public void init(AppCompatActivity appCompatActivity) {
|
||||
this.mContext = appCompatActivity;
|
||||
|
||||
@Inject
|
||||
public void init() {
|
||||
if(isFilePresent(CommonConst.Files.RECOVER_COLLO_FILE)) {
|
||||
loadLocalFile();
|
||||
}
|
||||
@ -114,7 +110,7 @@ public class ColliDataRecoverService {
|
||||
Gson gson = new Gson();
|
||||
|
||||
try {
|
||||
inputStream = mContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
|
||||
inputStream = mApplicationContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
|
||||
|
||||
byte[] bytes = IOUtils.readInputStreamFully(inputStream);
|
||||
String jsonString = new String(bytes);
|
||||
@ -125,7 +121,7 @@ public class ColliDataRecoverService {
|
||||
inputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
UtilityExceptions.defaultException(mContext, e);
|
||||
// UtilityExceptions.defaultException(mContext, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,17 +133,17 @@ public class ColliDataRecoverService {
|
||||
String jsonText = gson.toJson(mtbColtsSessions);
|
||||
|
||||
try {
|
||||
outputStream = mContext.openFileOutput(CommonConst.Files.RECOVER_COLLO_FILE, Context.MODE_PRIVATE);
|
||||
outputStream = mApplicationContext.openFileOutput(CommonConst.Files.RECOVER_COLLO_FILE, Context.MODE_PRIVATE);
|
||||
outputStream.write(jsonText.getBytes());
|
||||
outputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
UtilityExceptions.defaultException(mContext, e);
|
||||
// UtilityExceptions.defaultException(mContext, e);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFilePresent(String fileName) {
|
||||
String path = mContext.getFilesDir().getAbsolutePath() + "/" + fileName;
|
||||
String path = mApplicationContext.getFilesDir().getAbsolutePath() + "/" + fileName;
|
||||
File file = new File(path);
|
||||
return file.exists();
|
||||
}
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package it.integry.integrywmsnative.core.menu;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.StbMenu;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class MenuRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void retrieveMenu(String rootCodOpz, RunnableArgs<StbMenu> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MenuRESTConsumerService menuRESTConsumerService = RESTBuilder.getService(MenuRESTConsumerService.class);
|
||||
menuRESTConsumerService.retrieveMenuConfig(rootCodOpz).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<StbMenu>> call, Response<ServiceRESTResponse<StbMenu>> response) {
|
||||
analyzeAnswer(response, "retrieveMenu", (m) -> {
|
||||
onComplete.run(response.body().getEntity());
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<StbMenu>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package it.integry.integrywmsnative.core.menu;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.StbMenu;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface MenuRESTConsumerService {
|
||||
|
||||
@GET("retrieveMenuConfig")
|
||||
Call<ServiceRESTResponse<StbMenu>> retrieveMenuConfig(@Query("rootCodOpz") String rootCodOpz);
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package it.integry.integrywmsnative.core.menu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.StbMenu;
|
||||
|
||||
@Singleton
|
||||
public class MenuService {
|
||||
|
||||
private static final String MENU_COD_OPZ = "MM007";
|
||||
|
||||
private final MenuRESTConsumer menuRESTConsumer;
|
||||
|
||||
private List<StbMenu> mInternalCachedMenu;
|
||||
|
||||
@Inject
|
||||
public MenuService(MenuRESTConsumer menuRESTConsumer) {
|
||||
this.menuRESTConsumer = menuRESTConsumer;
|
||||
}
|
||||
|
||||
public void init(Runnable onMenuInitialized, RunnableArgs<Exception> onFailed) {
|
||||
menuRESTConsumer.retrieveMenu(MENU_COD_OPZ, menu -> {
|
||||
if(menu != null) this.mInternalCachedMenu = menu.getStbMenuChildren();
|
||||
onMenuInitialized.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
public void getMenu() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,217 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class StbMenu extends EntityBase {
|
||||
|
||||
public StbMenu() {
|
||||
this.type = "stb_menu";
|
||||
}
|
||||
|
||||
private String codOpz;
|
||||
private String codParent;
|
||||
private String tipoAzienda;
|
||||
private String descrizione;
|
||||
private String descrizioneEstesa;
|
||||
private String entityName;
|
||||
private String flagAttivo;
|
||||
private String flagPrinterSetup;
|
||||
private String gestName;
|
||||
private String note;
|
||||
private String objectType;
|
||||
private String openType;
|
||||
private String parameter;
|
||||
private String pictureMenu;
|
||||
private String pictureSelect;
|
||||
private Integer pos;
|
||||
private Integer posCliente;
|
||||
private Integer posTipoAzienda;
|
||||
private String urlDescrizione;
|
||||
|
||||
private final List<StbMenu> stbMenuChildren = new ArrayList<>();
|
||||
|
||||
public String getCodOpz() {
|
||||
return codOpz;
|
||||
}
|
||||
|
||||
public StbMenu setCodOpz(String codOpz) {
|
||||
this.codOpz = codOpz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodParent() {
|
||||
return codParent;
|
||||
}
|
||||
|
||||
public StbMenu setCodParent(String codParent) {
|
||||
this.codParent = codParent;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTipoAzienda() {
|
||||
return tipoAzienda;
|
||||
}
|
||||
|
||||
public StbMenu setTipoAzienda(String tipoAzienda) {
|
||||
this.tipoAzienda = tipoAzienda;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public StbMenu setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizioneEstesa() {
|
||||
return descrizioneEstesa;
|
||||
}
|
||||
|
||||
public StbMenu setDescrizioneEstesa(String descrizioneEstesa) {
|
||||
this.descrizioneEstesa = descrizioneEstesa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getEntityName() {
|
||||
return entityName;
|
||||
}
|
||||
|
||||
public StbMenu setEntityName(String entityName) {
|
||||
this.entityName = entityName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagAttivo() {
|
||||
return flagAttivo;
|
||||
}
|
||||
|
||||
public StbMenu setFlagAttivo(String flagAttivo) {
|
||||
this.flagAttivo = flagAttivo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagPrinterSetup() {
|
||||
return flagPrinterSetup;
|
||||
}
|
||||
|
||||
public StbMenu setFlagPrinterSetup(String flagPrinterSetup) {
|
||||
this.flagPrinterSetup = flagPrinterSetup;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestName() {
|
||||
return gestName;
|
||||
}
|
||||
|
||||
public StbMenu setGestName(String gestName) {
|
||||
this.gestName = gestName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public StbMenu setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getObjectType() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
public StbMenu setObjectType(String objectType) {
|
||||
this.objectType = objectType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOpenType() {
|
||||
return openType;
|
||||
}
|
||||
|
||||
public StbMenu setOpenType(String openType) {
|
||||
this.openType = openType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getParameter() {
|
||||
return parameter;
|
||||
}
|
||||
|
||||
public StbMenu setParameter(String parameter) {
|
||||
this.parameter = parameter;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPictureMenu() {
|
||||
return pictureMenu;
|
||||
}
|
||||
|
||||
public StbMenu setPictureMenu(String pictureMenu) {
|
||||
this.pictureMenu = pictureMenu;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPictureSelect() {
|
||||
return pictureSelect;
|
||||
}
|
||||
|
||||
public StbMenu setPictureSelect(String pictureSelect) {
|
||||
this.pictureSelect = pictureSelect;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPos() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
public StbMenu setPos(Integer pos) {
|
||||
this.pos = pos;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPosCliente() {
|
||||
return posCliente;
|
||||
}
|
||||
|
||||
public StbMenu setPosCliente(Integer posCliente) {
|
||||
this.posCliente = posCliente;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPosTipoAzienda() {
|
||||
return posTipoAzienda;
|
||||
}
|
||||
|
||||
public StbMenu setPosTipoAzienda(Integer posTipoAzienda) {
|
||||
this.posTipoAzienda = posTipoAzienda;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public StbMenu setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUrlDescrizione() {
|
||||
return urlDescrizione;
|
||||
}
|
||||
|
||||
public StbMenu setUrlDescrizione(String urlDescrizione) {
|
||||
this.urlDescrizione = urlDescrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<StbMenu> getStbMenuChildren() {
|
||||
return stbMenuChildren;
|
||||
}
|
||||
}
|
||||
@ -30,12 +30,12 @@ public class SettingsManager {
|
||||
|
||||
private static Context mContext;
|
||||
|
||||
public static void init(Context context){
|
||||
public static void init(Context context) {
|
||||
mContext = context;
|
||||
|
||||
settingsModelIstance = (SettingsModel) Stash.getObject(TAG, SettingsModel.class);
|
||||
|
||||
if(settingsModelIstance == null) {
|
||||
if (settingsModelIstance == null) {
|
||||
settingsModelIstance = new SettingsModel();
|
||||
|
||||
settingsModelIstance.setServer(new SettingsModel.Server());
|
||||
@ -49,31 +49,28 @@ public class SettingsManager {
|
||||
|
||||
}
|
||||
|
||||
public static SettingsModel i(){
|
||||
public static SettingsModel i() {
|
||||
return settingsModelIstance;
|
||||
}
|
||||
public static DBSettingsModel iDB(){
|
||||
|
||||
public static DBSettingsModel iDB() {
|
||||
return dbSettingsModelIstance;
|
||||
}
|
||||
|
||||
public static boolean isFirstStart(){
|
||||
public static boolean isFirstStart() {
|
||||
return firstStart;
|
||||
}
|
||||
public static boolean isInstanceAvailable(){
|
||||
|
||||
public static boolean isInstanceAvailable() {
|
||||
return i() != null;
|
||||
}
|
||||
|
||||
public static void update(){
|
||||
public static void update() {
|
||||
Stash.put(TAG, settingsModelIstance);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void loadDBVariables(Runnable onComplete, RunnableArgs<Exception> onFailed){
|
||||
public static void loadDBVariables(RunnableArgs<String> onProgress, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
dbSettingsModelIstance = new DBSettingsModel();
|
||||
|
||||
Trace perfTrace = UtilityFirebase.getNewPerformanceTrace("db_load_vars");
|
||||
@ -86,26 +83,41 @@ public class SettingsManager {
|
||||
|
||||
RunnableArgs<Exception> tmpOnFailed = ex -> {
|
||||
perfTrace.putAttribute("failed", "true");
|
||||
if(!(ex instanceof SocketTimeoutException)) onFailed.run(ex);
|
||||
else onFailed.run(new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!"));
|
||||
if (!(ex instanceof SocketTimeoutException)) onFailed.run(ex);
|
||||
else
|
||||
onFailed.run(new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!"));
|
||||
};
|
||||
|
||||
loadDatiAzienda(() ->
|
||||
loadAvailableProfiles(() ->
|
||||
loadAvailableCodMdeps(() ->
|
||||
loadAvailablePosizioni(() ->
|
||||
loadGestSetupValues(tmpOnComplete, tmpOnFailed) ,tmpOnFailed), tmpOnFailed), tmpOnFailed), tmpOnFailed);
|
||||
onProgress.run("dati azienda");
|
||||
loadDatiAzienda(() -> {
|
||||
|
||||
onProgress.run("profili");
|
||||
loadAvailableProfiles(() -> {
|
||||
|
||||
onProgress.run("depositi");
|
||||
loadAvailableCodMdeps(() -> {
|
||||
|
||||
onProgress.run("posizioni");
|
||||
loadAvailablePosizioni(() -> {
|
||||
|
||||
onProgress.run("impostazioni");
|
||||
loadGestSetupValues(tmpOnComplete, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
}
|
||||
|
||||
private static void loadDatiAzienda(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
SystemRESTConsumer.getAzienda(datiAzienda -> {
|
||||
SettingsManager.iDB().setDatiAzienda(datiAzienda);
|
||||
|
||||
if(onComplete != null) onComplete.run();
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
private static void loadAvailableProfiles(Runnable onComplete, RunnableArgs<Exception> onFailed){
|
||||
private static void loadAvailableProfiles(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
SystemRESTConsumer.getAvailableProfiles(new ISimpleOperationCallback<List<String>>() {
|
||||
@Override
|
||||
public void onSuccess(List<String> availableProfiles) {
|
||||
@ -118,7 +130,7 @@ public class SettingsManager {
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
//BOH
|
||||
if(onFailed != null) onFailed.run(ex);
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -129,34 +141,34 @@ public class SettingsManager {
|
||||
public void onSuccess(List<AvailableCodMdepsDTO> availableCodMdeps) {
|
||||
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
|
||||
|
||||
if(availableCodMdeps == null || availableCodMdeps.size() == 0) {
|
||||
if (availableCodMdeps == null || availableCodMdeps.size() == 0) {
|
||||
onFailed.run(new Exception(mContext.getText(R.string.no_codmdep_available).toString()));
|
||||
return;
|
||||
}
|
||||
|
||||
boolean codMdepExistsAnymore = false;
|
||||
|
||||
if(settingsModelIstance.getUserSession().getDepo() != null){
|
||||
for(AvailableCodMdepsDTO availableCodMdepDTO : availableCodMdeps){
|
||||
if (settingsModelIstance.getUserSession().getDepo() != null) {
|
||||
for (AvailableCodMdepsDTO availableCodMdepDTO : availableCodMdeps) {
|
||||
//Controllo se il codMdep salvato esiste ancora
|
||||
if(availableCodMdepDTO.getCodMdep().equalsIgnoreCase(settingsModelIstance.getUserSession().getDepo().getCodMdep())) {
|
||||
if (availableCodMdepDTO.getCodMdep().equalsIgnoreCase(settingsModelIstance.getUserSession().getDepo().getCodMdep())) {
|
||||
codMdepExistsAnymore = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!codMdepExistsAnymore){
|
||||
if (!codMdepExistsAnymore) {
|
||||
settingsModelIstance.getUserSession().setDepo(availableCodMdeps.get(0));
|
||||
}
|
||||
|
||||
if(onComplete != null) onComplete.run();
|
||||
if (onComplete != null) onComplete.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
//BOH
|
||||
if(onFailed != null) onFailed.run(ex);
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -164,12 +176,12 @@ public class SettingsManager {
|
||||
|
||||
private static void loadAvailablePosizioni(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
PosizioniRESTConsumer.getAvailablePosizioni(availablePosizioni -> {
|
||||
dbSettingsModelIstance.setAvailablePosizioni(availablePosizioni);
|
||||
dbSettingsModelIstance.setAvailablePosizioni(availablePosizioni);
|
||||
|
||||
if(onComplete != null) onComplete.run();
|
||||
}, ex -> {
|
||||
if(onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -270,16 +282,16 @@ public class SettingsManager {
|
||||
|
||||
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
||||
dbSettingsModelIstance.setDefaultCausaleRettificaGiacenze(getValueFromList(list, "SETUP", "DEFAULT_CAUSALE_RETTIFICA_GIACENZE", String.class));
|
||||
dbSettingsModelIstance.setEnableCheckPartitaMagCheckPickingV(getValueFromList(list, "SETUP","ENABLE_CHECK_PARTITA_MAG_PICKING_V", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagMultiClienteOrdV(getValueFromList(list, "SETUP","FLAG_MULTI_CLIENTE_ORD_VENDITA", Boolean.class));
|
||||
dbSettingsModelIstance.setDefaultCodAnag(getValueFromList(list, "SETUP","COD_ANAG_DEFAULT", String.class));
|
||||
dbSettingsModelIstance.setDefaultCriterioDistribuzione(getValueFromList(list, "SETUP","DEFAULT_CRITERIO_DISTRIBUZIONE", String.class));
|
||||
dbSettingsModelIstance.setEnableCheckPartitaMagCheckPickingV(getValueFromList(list, "SETUP", "ENABLE_CHECK_PARTITA_MAG_PICKING_V", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagMultiClienteOrdV(getValueFromList(list, "SETUP", "FLAG_MULTI_CLIENTE_ORD_VENDITA", Boolean.class));
|
||||
dbSettingsModelIstance.setDefaultCodAnag(getValueFromList(list, "SETUP", "COD_ANAG_DEFAULT", String.class));
|
||||
dbSettingsModelIstance.setDefaultCriterioDistribuzione(getValueFromList(list, "SETUP", "DEFAULT_CRITERIO_DISTRIBUZIONE", String.class));
|
||||
dbSettingsModelIstance.setFlagAskClienteInPickingLibero(getValueFromList(list, "PICKING_LIBERO", "FLAG_ASK_CLIENTE", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagAllowEmptyClienteInPickingLibero(getValueFromList(list, "PICKING_LIBERO", "FLAG_ALLOW_EMPTY_CLIENTE", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagCanAddExtraItemSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_ITEMS", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagCanAutoOpenNewULAccettazione(getValueFromList(list, "ACCETTAZIONE", "FLAG_AUTO_OPEN_NEW_UL", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagCanAddExtraQuantitySpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_QUANTITY", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagEnableCheckDepositoSpedizione(getValueFromList(list,"SPEDIZIONE", "ENABLE_CHECK_DEPOSITO", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagEnableCheckDepositoSpedizione(getValueFromList(list, "SPEDIZIONE", "ENABLE_CHECK_DEPOSITO", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagForceAllToColli(getValueFromList(list, "SETUP", "FLAG_FORCE_ALL_TO_COLLI", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagAskPesoColloSpedizione(getValueFromList(list, "SETUP", "FLAG_ASK_PESO_COLLO", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagUseNewPickingListSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_NEW_PICKING_LIST", Boolean.class));
|
||||
@ -292,27 +304,27 @@ public class SettingsManager {
|
||||
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) {
|
||||
if (onNumCnfInputChanged != null) {
|
||||
dbSettingsModelIstance.setOnNumCnfInputChanged(onNumCnfInputChanged);
|
||||
}
|
||||
|
||||
if(onComplete != null) onComplete.run();
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, onFailed);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static <T>T getValueFromList(List<StbGestSetup> stbGestSetupList, String section, String keySectionName, Class<T> clazz) {
|
||||
public static <T> T getValueFromList(List<StbGestSetup> stbGestSetupList, String section, String keySectionName, Class<T> clazz) {
|
||||
|
||||
StbGestSetup value = Stream.of(stbGestSetupList)
|
||||
.filter(x -> x.getSection().equalsIgnoreCase(section) && x.getKeySection().equalsIgnoreCase(keySectionName))
|
||||
.findFirst().get();
|
||||
|
||||
if(clazz == String.class) {
|
||||
if (clazz == String.class) {
|
||||
return clazz.cast(value.getValue());
|
||||
} else if(clazz == Boolean.class) {
|
||||
} else if (clazz == Boolean.class) {
|
||||
return clazz.cast("S".equalsIgnoreCase(value.getValue()));
|
||||
} else if(clazz == Integer.class && value.getValue() != null) {
|
||||
} else if (clazz == Integer.class && value.getValue() != null) {
|
||||
return clazz.cast(Integer.parseInt(value.getValue()));
|
||||
} else return null;
|
||||
|
||||
|
||||
@ -17,22 +17,18 @@ import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
public class UtilityExceptions {
|
||||
|
||||
|
||||
public static void defaultException(Context context, Exception ex, Dialog progressDialog){
|
||||
public static void defaultException(Context context, Exception ex, Dialog progressDialog) {
|
||||
defaultException(context, ex);
|
||||
if(progressDialog != null) progressDialog.dismiss();
|
||||
if (progressDialog != null) progressDialog.dismiss();
|
||||
}
|
||||
|
||||
public static void defaultException(Context context, Exception ex, Dialog progressDialog, boolean sendMail){
|
||||
defaultException(context, ex, sendMail);
|
||||
if(progressDialog != null) progressDialog.dismiss();
|
||||
}
|
||||
public static void defaultException(Context context, Exception ex){
|
||||
public static void defaultException(Context context, Exception ex) {
|
||||
defaultException(context, ex, false);
|
||||
}
|
||||
|
||||
public static void defaultException(Context context, Exception ex, boolean sendEmail){
|
||||
public static void defaultException(Context context, Exception ex, boolean sendEmail) {
|
||||
|
||||
if(ex.getMessage() != null) {
|
||||
if (ex.getMessage() != null) {
|
||||
Logger.e(ex, ex.getMessage());
|
||||
} else {
|
||||
Logger.e(ex, "Errore");
|
||||
@ -40,27 +36,27 @@ public class UtilityExceptions {
|
||||
|
||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
||||
|
||||
if(errorMessage == null) {
|
||||
if (errorMessage == null) {
|
||||
errorMessage = ex.getMessage();
|
||||
|
||||
if(ex.getCause() != null) errorMessage += "<br />" + ex.getCause().getMessage();
|
||||
if (ex.getCause() != null) errorMessage += "<br />" + ex.getCause().getMessage();
|
||||
}
|
||||
|
||||
FragmentManager fm = null;
|
||||
|
||||
if(context != null && context instanceof FragmentActivity) {
|
||||
if (context instanceof FragmentActivity) {
|
||||
fm = ((FragmentActivity) context).getSupportFragmentManager();
|
||||
} else if(UtilityContext.getMainActivity() != null) {
|
||||
} else if (UtilityContext.getMainActivity() != null) {
|
||||
fm = UtilityContext.getMainActivity().getSupportFragmentManager();
|
||||
}
|
||||
|
||||
if(fm != null) {
|
||||
if (fm != null) {
|
||||
DialogSimpleMessageView.makeErrorDialog(new SpannableString(errorMessage), null, null)
|
||||
.show(fm, "tag");
|
||||
}
|
||||
|
||||
if(!BuildConfig.DEBUG) {
|
||||
// if(sendEmail) UtilityLogger.errorMe(ex);
|
||||
if (!BuildConfig.DEBUG) {
|
||||
if (sendEmail) UtilityLogger.errorMe(ex);
|
||||
FirebaseCrashlytics.getInstance().recordException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,11 +12,14 @@ public class UtilitySettings {
|
||||
mAppDatabase = appDatabase;
|
||||
}
|
||||
|
||||
public static void logout(){
|
||||
public static void logout(Runnable onComplete){
|
||||
SettingsManager.i().setUser(null);
|
||||
SettingsManager.i().setUserSession(null);
|
||||
UtilityThread.executeParallel(mAppDatabase::clearAllTables);
|
||||
SettingsManager.update();
|
||||
UtilityThread.executeParallel(() -> {
|
||||
mAppDatabase.clearAllTables();
|
||||
onComplete.run();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
package it.integry.integrywmsnative.gest.login;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.context.MainContext;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityWindow;
|
||||
import it.integry.integrywmsnative.databinding.ActivityLoginBinding;
|
||||
@ -14,7 +12,6 @@ import it.integry.integrywmsnative.gest.login.viewmodel.LoginViewModel;
|
||||
|
||||
public class LoginActivity extends BaseActivity {
|
||||
|
||||
private MainContext mainContext = new MainContext(this);
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -22,7 +19,7 @@ public class LoginActivity extends BaseActivity {
|
||||
UtilityWindow.maximizeToFullScreen(this);
|
||||
|
||||
ActivityLoginBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_login);
|
||||
LoginViewModel loginViewModel = new LoginViewModel(this, mainContext);
|
||||
LoginViewModel loginViewModel = new LoginViewModel(this);
|
||||
binding.setLoginViewModel(loginViewModel);
|
||||
}
|
||||
|
||||
|
||||
@ -12,9 +12,8 @@ import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.MainActivity;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.context.MainContext;
|
||||
import it.integry.integrywmsnative.SplashActivity;
|
||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
import it.integry.integrywmsnative.core.di.BindableString;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
||||
@ -47,15 +46,12 @@ public class LoginViewModel {
|
||||
public BindableString codAziendaError = new BindableString();
|
||||
|
||||
|
||||
|
||||
private LoginActivity mActivity;
|
||||
private MainContext mMainContext;
|
||||
|
||||
private Dialog mProgress;
|
||||
|
||||
public LoginViewModel(LoginActivity activity, MainContext mainContext) {
|
||||
public LoginViewModel(LoginActivity activity) {
|
||||
this.mActivity = activity;
|
||||
this.mMainContext = mainContext;
|
||||
|
||||
loginButtonEnabled.set(true);
|
||||
|
||||
@ -66,7 +62,6 @@ public class LoginViewModel {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean validate() {
|
||||
if (username.isEmpty() || username.get().length() < 3) {
|
||||
usernameError.set(mActivity.getText(R.string.username_error_not_valid).toString());
|
||||
@ -82,9 +77,8 @@ public class LoginViewModel {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void login(boolean areValidData){
|
||||
if(areValidData){
|
||||
public void login(boolean areValidData) {
|
||||
if (areValidData) {
|
||||
loginButtonEnabled.set(false);
|
||||
|
||||
mProgress = UtilityProgress.createDefaultProgressDialog(mActivity);
|
||||
@ -112,7 +106,7 @@ public class LoginViewModel {
|
||||
|
||||
UtilityServer.isEmsApiAvailable(host, port, value1 -> {
|
||||
|
||||
if(value1){ //Is online
|
||||
if (value1) { //Is online
|
||||
loginHelper.doLogin(host, port, new ISimpleOperationCallback<LoginDTO>() {
|
||||
@Override
|
||||
public void onSuccess(final LoginDTO loginDTO) {
|
||||
@ -169,7 +163,7 @@ public class LoginViewModel {
|
||||
public void onSuccess(List<AvailableCodMdepsDTO> availableCodMdeps) {
|
||||
SettingsManager.iDB().setAvailableCodMdep(availableCodMdeps);
|
||||
|
||||
if(availableCodMdeps == null || availableCodMdeps.size() == 0) {
|
||||
if (availableCodMdeps == null || availableCodMdeps.size() == 0) {
|
||||
onLoginFailed(Html.fromHtml(String.format(mActivity.getText(R.string.no_codmdep_available).toString())));
|
||||
return;
|
||||
}
|
||||
@ -177,7 +171,7 @@ public class LoginViewModel {
|
||||
SettingsManager.i().getUserSession().setDepo(availableCodMdeps.get(0));
|
||||
|
||||
|
||||
if(onComplete != null) onComplete.run();
|
||||
if (onComplete != null) onComplete.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -189,7 +183,7 @@ public class LoginViewModel {
|
||||
}
|
||||
|
||||
|
||||
private void onLoginFailed(final Spanned message){
|
||||
private void onLoginFailed(final Spanned message) {
|
||||
mProgress.dismiss();
|
||||
loginButtonEnabled.set(true);
|
||||
mActivity.runOnUiThread(() -> DialogSimpleMessageView.makeErrorDialog(
|
||||
@ -200,7 +194,7 @@ public class LoginViewModel {
|
||||
}
|
||||
|
||||
|
||||
private void onLoginSuccess(final String title, final Spanned message, final String host, final int port, final List<String> availableProfiles){
|
||||
private void onLoginSuccess(final String title, final Spanned message, final String host, final int port, final List<String> availableProfiles) {
|
||||
mProgress.dismiss();
|
||||
mActivity.runOnUiThread(() -> DialogSimpleMessageView.makeSuccessDialog(
|
||||
title,
|
||||
@ -210,8 +204,8 @@ public class LoginViewModel {
|
||||
.show(mActivity.getSupportFragmentManager(), "tag"));
|
||||
}
|
||||
|
||||
private void showProfileDBSelectionDialog(final String host, final int port, final List<String> availableProfiles){
|
||||
if(availableProfiles != null && availableProfiles.size() == 1 ) {
|
||||
private void showProfileDBSelectionDialog(final String host, final int port, final List<String> availableProfiles) {
|
||||
if (availableProfiles != null && availableProfiles.size() == 1) {
|
||||
SettingsManager.i().getUserSession().setProfileDB(availableProfiles.get(0));
|
||||
|
||||
loadDepo(host, port, this::onLoginCompleted);
|
||||
@ -238,19 +232,16 @@ public class LoginViewModel {
|
||||
|
||||
public void onLoginCompleted() {
|
||||
loginButtonEnabled.set(true);
|
||||
|
||||
SettingsManager.update();
|
||||
|
||||
Dialog loadingProgress = UtilityProgress.createDefaultProgressDialog(mActivity);
|
||||
mMainContext.init(() -> {
|
||||
loadingProgress.dismiss();
|
||||
mActivity.finish();
|
||||
|
||||
Intent myIntent = new Intent(mActivity, MainActivity.class);
|
||||
mActivity.startActivity(myIntent);
|
||||
});
|
||||
|
||||
startSplashActivity();
|
||||
}
|
||||
|
||||
|
||||
private void startSplashActivity() {
|
||||
mActivity.finish();
|
||||
Intent myIntent = new Intent(mActivity, SplashActivity.class);
|
||||
mActivity.startActivity(myIntent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package it.integry.integrywmsnative;
|
||||
package it.integry.integrywmsnative.gest.main;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
@ -25,6 +25,8 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.class_router.BaseCustomConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
|
||||
@ -47,7 +49,6 @@ import it.integry.integrywmsnative.core.utility.UtilityContext;
|
||||
import it.integry.integrywmsnative.core.utility.UtilitySettings;
|
||||
import it.integry.integrywmsnative.databinding.ActivityMainBinding;
|
||||
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
||||
import it.integry.integrywmsnative.gest.main.MainFragment;
|
||||
import it.integry.integrywmsnative.gest.settings.MainSettingsFragment;
|
||||
|
||||
public class MainActivity extends BaseActivity
|
||||
@ -73,7 +74,7 @@ public class MainActivity extends BaseActivity
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mColliDataRecoverService.init(this);
|
||||
// mColliDataRecoverService.init(this);
|
||||
|
||||
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_main, null, false);
|
||||
setContentView(mBinding.getRoot());
|
||||
@ -184,9 +185,10 @@ public class MainActivity extends BaseActivity
|
||||
|
||||
case R.id.nav_logout:
|
||||
ServerStatusChecker.dispose();
|
||||
UtilitySettings.logout();
|
||||
UtilitySettings.logout(() -> {
|
||||
startLoginActivity();
|
||||
});
|
||||
|
||||
startLoginActivity();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package it.integry.integrywmsnative;
|
||||
package it.integry.integrywmsnative.gest.main;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package it.integry.integrywmsnative;
|
||||
package it.integry.integrywmsnative.gest.main;
|
||||
|
||||
import dagger.Module;
|
||||
|
||||
@ -20,7 +20,9 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.MainActivity;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.class_router.BaseCustomConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||
@ -28,7 +30,8 @@ import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfigurati
|
||||
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.IOrdiniVendita;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecover;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverDTO;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
@ -53,6 +56,9 @@ import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
*/
|
||||
public class MainFragment extends Fragment implements ITitledFragment, IScrollableFragment {
|
||||
|
||||
@Inject
|
||||
ColliDataRecoverService colliDataRecoverService;
|
||||
|
||||
private FragmentMainBinding mBindings;
|
||||
|
||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||
@ -81,6 +87,11 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
Bundle savedInstanceState) {
|
||||
this.mLayoutInflater = inflater;
|
||||
|
||||
MainApplication.appComponent
|
||||
.mainFragmentComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_main, container, false);
|
||||
|
||||
|
||||
@ -94,7 +105,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
mToolbar.setNestedScrollView(mBindings.fragmentMainScrollview);
|
||||
|
||||
init();
|
||||
initGestMenu();
|
||||
initGestMenuOLD();
|
||||
initVersion();
|
||||
}
|
||||
|
||||
@ -134,12 +145,12 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
}
|
||||
|
||||
private void initRecuperoCollo() {
|
||||
if (ColliDataRecover.thereIsAnExistantSession()) {
|
||||
if (colliDataRecoverService.thereIsAnExistantSession()) {
|
||||
startRecoverMode();
|
||||
|
||||
List<Exception> generatedErrors = new ArrayList<>();
|
||||
|
||||
Iterator<Integer> sessionsIterator = ColliDataRecover.getAllSessionIDs().iterator();
|
||||
Iterator<Integer> sessionsIterator = colliDataRecoverService.getAllSessionIDs().iterator();
|
||||
|
||||
cyclicRecover(sessionsIterator, () -> {
|
||||
|
||||
@ -157,7 +168,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
|
||||
RunnableArgss<Exception, Integer> tmpOnFailed = (ex, recoveredMtbColtID) -> {
|
||||
if (ex.getMessage().contains("Dati entity mtb_colt non trovati") || ex.getMessage().contains("Dati collo non corretti") || (ex.getMessage().contains("Il collo numero") && ex.getMessage().contains("non esiste"))) {
|
||||
ColliDataRecover.closeSession(recoveredMtbColtID);
|
||||
colliDataRecoverService.closeSession(recoveredMtbColtID);
|
||||
onFailed.run(ex);
|
||||
} else {
|
||||
onFailed.run(ex);
|
||||
@ -168,7 +179,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
|
||||
if (sessionsIterator.hasNext()) {
|
||||
Integer recoveredMtbColtID = sessionsIterator.next();
|
||||
ColliDataRecover.RecoverDTO recoveredMtbColtDto = ColliDataRecover.getSession(recoveredMtbColtID);
|
||||
ColliDataRecoverDTO recoveredMtbColtDto = colliDataRecoverService.getSession(recoveredMtbColtID);
|
||||
MtbColt recoveredMtbColt = recoveredMtbColtDto.getMtbColt();
|
||||
|
||||
if (recoveredMtbColt != null && (recoveredMtbColt.getGestioneEnum() == GestioneEnum.VENDITA || recoveredMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && !UtilityString.isNullOrEmpty(recoveredMtbColt.getFiltroOrdini())) {
|
||||
@ -178,7 +189,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
ColliMagazzinoRESTConsumer.updateDataFineStatic(recoveredMtbColt, () -> {
|
||||
ordiniVendita.distribuisciCollo(recoveredMtbColt, recoveredMtbColtDto.getTestateOrdini(),
|
||||
mtbColts -> {
|
||||
ColliDataRecover.closeSession(recoveredMtbColtID);
|
||||
colliDataRecoverService.closeSession(recoveredMtbColtID);
|
||||
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
}, ex -> {
|
||||
@ -189,7 +200,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
tmpOnFailed.run(ex, recoveredMtbColtID);
|
||||
});
|
||||
} else {
|
||||
ColliDataRecover.closeSession(recoveredMtbColtID);
|
||||
colliDataRecoverService.closeSession(recoveredMtbColtID);
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
}
|
||||
|
||||
@ -227,7 +238,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
}
|
||||
|
||||
|
||||
private void initGestMenu() {
|
||||
private void initGestMenuOLD() {
|
||||
ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION);
|
||||
if (customConfiguration == null) {
|
||||
// MainApplication.exit();
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.gest.main;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface MainFragmentComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
|
||||
MainFragmentComponent create();
|
||||
}
|
||||
|
||||
void inject(MainFragment mainActivity);
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative.gest.main;
|
||||
|
||||
import dagger.Module;
|
||||
|
||||
@Module(subcomponents = MainFragmentComponent.class)
|
||||
public class MainFragmentModule {
|
||||
}
|
||||
@ -61,6 +61,20 @@
|
||||
app:layout_constraintRight_toLeftOf="@+id/guideline_right_progress"
|
||||
app:layout_constraintTop_toBottomOf="@id/imageView" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/loading_info_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
tools:text="Caricamento DB"
|
||||
app:layout_constraintTop_toBottomOf="@id/progressBar2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:textColor="@android:color/white"
|
||||
android:alpha="0.7"
|
||||
android:layout_marginTop="12dp"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/app_version_textview"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context="it.integry.integrywmsnative.MainActivity">
|
||||
tools:context="it.integry.integrywmsnative.gest.main.MainActivity">
|
||||
|
||||
<it.integry.integrywmsnative.ui.ElevatedToolbar
|
||||
android:id="@+id/elevated_toolbar"
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context="it.integry.integrywmsnative.MainActivity"
|
||||
tools:context="it.integry.integrywmsnative.gest.main.MainActivity"
|
||||
tools:showIn="@layout/app_bar_main">
|
||||
|
||||
<FrameLayout
|
||||
|
||||
@ -349,4 +349,5 @@
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="rientro_merce_fragment_title">Ret of processing goods</string>
|
||||
<string name="title_dynamic_agricoper">Agricoper customizations</string>
|
||||
<string name="title_dynamicfeature">Module Title</string>
|
||||
</resources>
|
||||
|
||||
@ -7,8 +7,6 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
@ -21,8 +19,8 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
|
||||
@ -11,7 +11,7 @@ public interface BarcodeReaderInterface {
|
||||
|
||||
boolean isRightAdapter();
|
||||
|
||||
void init(Runnable onDeviceReady) throws BarcodeAdapterNotFoundException;
|
||||
void init(Runnable onDeviceReady) throws BarcodeAdapterNotFoundException, Exception;
|
||||
|
||||
void deinit();
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
buildscript {
|
||||
ext {
|
||||
kotlin_version = '1.5.0'
|
||||
kotlin_version = '1.5.21'
|
||||
}
|
||||
|
||||
repositories {
|
||||
@ -10,7 +10,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.2.2'
|
||||
classpath 'com.android.tools.build:gradle:7.0.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'com.google.gms:google-services:4.3.5'
|
||||
classpath 'com.google.firebase:perf-plugin:1.3.5'
|
||||
|
||||
@ -1,18 +1,17 @@
|
||||
apply plugin: 'com.android.dynamic-feature'
|
||||
plugins {
|
||||
id 'com.android.dynamic-feature'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
|
||||
@ -1,21 +1,25 @@
|
||||
apply plugin: 'com.android.dynamic-feature'
|
||||
|
||||
plugins {
|
||||
id 'com.android.dynamic-feature'
|
||||
}
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
compileSdk 30
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
applicationId "com.example.dynamicfeature"
|
||||
minSdk 21
|
||||
targetSdk 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
apply plugin: 'com.android.dynamic-feature'
|
||||
plugins {
|
||||
id 'com.android.dynamic-feature'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
}
|
||||
compileOptions {
|
||||
|
||||
@ -1,20 +1,19 @@
|
||||
apply plugin: "com.android.dynamic-feature"
|
||||
plugins {
|
||||
id 'com.android.dynamic-feature'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
apply plugin: 'com.android.dynamic-feature'
|
||||
plugins {
|
||||
id 'com.android.dynamic-feature'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
@ -7,9 +9,6 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
apply plugin: 'com.android.dynamic-feature'
|
||||
plugins {
|
||||
id 'com.android.dynamic-feature'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
@ -7,9 +9,6 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
}
|
||||
compileOptions {
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
apply plugin: 'com.android.dynamic-feature'
|
||||
plugins {
|
||||
id 'com.android.dynamic-feature'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
@ -7,9 +9,6 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
}
|
||||
compileOptions {
|
||||
|
||||
@ -1,17 +1,16 @@
|
||||
apply plugin: 'com.android.dynamic-feature'
|
||||
plugins {
|
||||
id 'com.android.dynamic-feature'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,8 +30,6 @@ org.gradle.daemon=true
|
||||
org.gradle.configureondemand=true
|
||||
# Enable parallel builds
|
||||
org.gradle.parallel=true
|
||||
# Enable Build Cache
|
||||
android.enableBuildCache=true
|
||||
# Enable simple gradle caching
|
||||
org.gradle.caching=true
|
||||
# Increase memory allotted to JVM
|
||||
|
||||
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
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
|
||||
|
||||
@ -6,8 +6,6 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@ -21,8 +19,8 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
|
||||
@ -1,16 +1,13 @@
|
||||
package it.integry.honeywellscannerlibrary;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.view.KeyEvent;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.honeywell.aidc.AidcManager;
|
||||
import com.honeywell.aidc.BarcodeFailureEvent;
|
||||
import com.honeywell.aidc.BarcodeReadEvent;
|
||||
import com.honeywell.aidc.BarcodeReader;
|
||||
import com.honeywell.aidc.InvalidScannerNameException;
|
||||
import com.honeywell.aidc.ScannerUnavailableException;
|
||||
import com.honeywell.aidc.UnsupportedPropertyException;
|
||||
|
||||
@ -26,7 +23,7 @@ import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
|
||||
public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
|
||||
|
||||
private final AppCompatActivity mContext;
|
||||
private final Context mContext;
|
||||
private AidcManager manager;
|
||||
private BarcodeReader barcodeReader;
|
||||
|
||||
@ -35,7 +32,7 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
|
||||
|
||||
private static final String TAG = HoneyWellBarcodeReader.class.getName();
|
||||
|
||||
public HoneyWellBarcodeReader(final AppCompatActivity context) {
|
||||
public HoneyWellBarcodeReader(final Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@ -64,11 +61,8 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
|
||||
barcodeReader = manager.createBarcodeReader();
|
||||
registerListenersInternal();
|
||||
}
|
||||
catch (InvalidScannerNameException e){
|
||||
Toast.makeText(mContext, "Invalid Scanner Name Exception: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
catch (Exception e){
|
||||
Toast.makeText(mContext, "Exception: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
// throw new Exception("Invalid Scanner Name Exception: " + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@ -114,7 +108,7 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
|
||||
}
|
||||
|
||||
|
||||
private void registerListenersInternal() {
|
||||
private void registerListenersInternal() throws Exception {
|
||||
// register bar code event listener
|
||||
barcodeReader.addBarcodeListener(new BarcodeReader.BarcodeListener() {
|
||||
@Override
|
||||
@ -134,7 +128,7 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
|
||||
barcodeReader.setProperty(BarcodeReader.PROPERTY_TRIGGER_CONTROL_MODE,
|
||||
BarcodeReader.TRIGGER_CONTROL_MODE_CLIENT_CONTROL);
|
||||
} catch (UnsupportedPropertyException e) {
|
||||
Toast.makeText(mContext, "Failed to apply properties", Toast.LENGTH_SHORT).show();
|
||||
throw new Exception("Failed to apply properties");
|
||||
}
|
||||
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
@ -169,7 +163,7 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
|
||||
|
||||
private void dispatchEvent(BarcodeReadEvent barcodeReadEvent)
|
||||
{
|
||||
mContext.runOnUiThread(() -> {
|
||||
// mContext.runOnUiThread(() -> {
|
||||
|
||||
BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO()
|
||||
.setByteValue(barcodeReadEvent.getBarcodeData().getBytes())
|
||||
@ -178,6 +172,6 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
|
||||
.setName(HoneywellBarcodeTypeMapper.map(barcodeReadEvent.getCodeId()).toString());
|
||||
|
||||
mOnScanSuccessfull.run(barcodeScanDTO);
|
||||
});
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,8 +6,6 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
@ -21,8 +19,8 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
|
||||
@ -1,12 +1,8 @@
|
||||
package it.integry.keyobardemulatorscannerlibrary;
|
||||
|
||||
import android.view.KeyCharacterMap;
|
||||
import android.content.Context;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import it.integry.barcode_base_android_library.exception.BarcodeAdapterNotFoundException;
|
||||
import it.integry.barcode_base_android_library.extension.RunnableArgs;
|
||||
import it.integry.barcode_base_android_library.interfaces.BarcodeReaderInterface;
|
||||
@ -22,7 +18,7 @@ public class KeyboardEmulatorBarcodeReader implements BarcodeReaderInterface {
|
||||
private long mLastCharInsertTime = 0;
|
||||
|
||||
|
||||
public KeyboardEmulatorBarcodeReader(AppCompatActivity context) {
|
||||
public KeyboardEmulatorBarcodeReader(Context applicationContext) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -6,8 +6,6 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -20,8 +18,8 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
|
||||
@ -5,8 +5,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import device.common.DecodeResult;
|
||||
@ -20,7 +18,7 @@ import it.integry.barcode_base_android_library.model.BarcodeType;
|
||||
|
||||
public class PointMobileBarcodeReader implements BarcodeReaderInterface {
|
||||
|
||||
private AppCompatActivity mContext;
|
||||
private final Context mApplicationContext;
|
||||
private static ScanManager mScanManager;
|
||||
private static DecodeResult mDecodeResult;
|
||||
|
||||
@ -29,8 +27,8 @@ public class PointMobileBarcodeReader implements BarcodeReaderInterface {
|
||||
|
||||
private static String TAG = PointMobileBarcodeReader.class.getName();
|
||||
|
||||
public PointMobileBarcodeReader(AppCompatActivity context) {
|
||||
this.mContext = context;
|
||||
public PointMobileBarcodeReader(Context applicationContext) {
|
||||
this.mApplicationContext = applicationContext;
|
||||
|
||||
mScanManager = new ScanManager();
|
||||
mDecodeResult = new DecodeResult();
|
||||
|
||||
@ -6,8 +6,6 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -20,8 +18,8 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user