Implementato splashscreen.
Implementato blocco quando si usano etichette anonime che non sono dell'anno corrente.
This commit is contained in:
parent
924eadeab0
commit
3b88a8ca56
5
.idea/assetWizardSettings.xml
generated
5
.idea/assetWizardSettings.xml
generated
@ -3,6 +3,11 @@
|
||||
<component name="WizardSettings">
|
||||
<option name="children">
|
||||
<map>
|
||||
<entry key="imageWizard">
|
||||
<value>
|
||||
<PersistentState />
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="vectorWizard">
|
||||
<value>
|
||||
<PersistentState>
|
||||
|
||||
@ -19,24 +19,20 @@
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".gest.accettazione_ordine_inevaso.AccettazioneOrdineInevasoActivity"
|
||||
android:theme="@style/Light"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustNothing" />
|
||||
<activity
|
||||
android:name=".gest.vendita_ordine_inevaso.VenditaOrdineInevasoActivity"
|
||||
android:theme="@style/Light"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustNothing" />
|
||||
<activity
|
||||
android:name=".gest.login.LoginActivity"
|
||||
@ -52,12 +48,24 @@
|
||||
android:label="@string/activity_contenuto_bancale_title"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light" />
|
||||
|
||||
<meta-data
|
||||
android:name="io.fabric.ApiKey"
|
||||
android:value="26f0d16c00d20fe74582627c831f26e30646a187" />
|
||||
<meta-data
|
||||
android:name="firebase_crashlytics_collection_enabled"
|
||||
android:value="true" />
|
||||
|
||||
<activity
|
||||
android:name=".SplashActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/SplashTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@ -55,11 +55,6 @@ public class MainActivity extends AppCompatActivity
|
||||
|
||||
//ExceptionsHandler.init(this);
|
||||
|
||||
PermissionsHelper.askPermissions(this);
|
||||
|
||||
if(SettingsManager.i().user.username == null && SettingsManager.i().user.password == null){
|
||||
startLoginActivity();
|
||||
} else {
|
||||
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_main, null, false);
|
||||
setContentView(mBinding.getRoot());
|
||||
|
||||
@ -82,7 +77,6 @@ public class MainActivity extends AppCompatActivity
|
||||
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void startLoginActivity(){
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
package it.integry.integrywmsnative;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.os.Handler;
|
||||
import android.text.SpannableString;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.PermissionsHelper;
|
||||
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
|
||||
@BindView(R.id.app_version_textview)
|
||||
TextView appVersionTextView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_splash);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
initAppVersion();
|
||||
|
||||
|
||||
PermissionsHelper.askPermissions(this, () -> {
|
||||
init();
|
||||
}, permanentlyDenied -> {
|
||||
if(permanentlyDenied) {
|
||||
DialogSimpleMessageHelper.makeErrorDialog(this,
|
||||
new SpannableString(getText(R.string.permissions_permanrntly_denied)), null, () -> {
|
||||
this.finish();
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void initAppVersion() {
|
||||
try {
|
||||
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
String version = pInfo.versionName;
|
||||
appVersionTextView.setText("v" + version);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
if(SettingsManager.i().user.username == null && SettingsManager.i().user.password == null){
|
||||
startLoginActivity();
|
||||
} else {
|
||||
startMainActivity();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void startLoginActivity(){
|
||||
Intent myIntent = new Intent(this, LoginActivity.class);
|
||||
startActivity(myIntent);
|
||||
this.finish();
|
||||
}
|
||||
|
||||
private void startMainActivity(){
|
||||
new Handler().postDelayed(() -> {
|
||||
Intent myIntent = new Intent(this, MainActivity.class);
|
||||
startActivity(myIntent);
|
||||
this.finish();
|
||||
}, 3000);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -4,6 +4,7 @@ import com.annimon.stream.Stream;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
@ -131,6 +132,18 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer{
|
||||
mtbColtToCreate.setSerCollo(customSerCollo);
|
||||
}
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int currentYear = calendar.get(Calendar.YEAR);
|
||||
|
||||
|
||||
String fullYear = "20" + UtilityBarcode.getAnnoColloFromULAnonima(barcode);
|
||||
|
||||
|
||||
|
||||
if(!fullYear.equalsIgnoreCase("" + currentYear)){
|
||||
onFailed.run(new Exception("Per continuare scansiona un'etichetta dell'anno corrente"));
|
||||
}
|
||||
|
||||
mtbColtToCreate
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
|
||||
|
||||
@ -9,10 +9,11 @@ import com.emreeran.permissionlivedata.Status;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public class PermissionsHelper {
|
||||
|
||||
public static void askPermissions(AppCompatActivity activity) {
|
||||
public static void askPermissions(AppCompatActivity activity, Runnable onPermissionsConfirmed, RunnableArgs<Boolean> onPermissionsDenied) {
|
||||
|
||||
PermissionLiveData permissionLiveData = PermissionLiveData.create(
|
||||
activity,
|
||||
@ -23,14 +24,17 @@ public class PermissionsHelper {
|
||||
permissionLiveData.observe(activity, permission -> {
|
||||
if (permission.getStatus() == Status.RECEIVED) {
|
||||
if (permission.getGranted()) {
|
||||
onPermissionsConfirmed.run();
|
||||
//UtilityToast.showToast("Permission " + permission.getName() + " was granted.");
|
||||
} else if (permission.getShouldShowRequestPermissionRationale()) {
|
||||
UtilityToast.showToast("Permission " + permission.getName() + " was denied without ask never again checked.");
|
||||
onPermissionsDenied.run(true);
|
||||
//UtilityToast.showToast("Permission " + permission.getName() + " was denied without ask never again checked.");
|
||||
} else {
|
||||
UtilityToast.showToast("Permission " + permission.getName() + " was denied.");
|
||||
onPermissionsDenied.run(false);
|
||||
//UtilityToast.showToast("Permission " + permission.getName() + " was denied.");
|
||||
}
|
||||
} else if (permission.getStatus() == Status.PENDING) {
|
||||
UtilityToast.showToast(String.format("Pending request for %s", permission.getName()));
|
||||
//UtilityToast.showToast(String.format("Pending request for %s", permission.getName()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -49,6 +49,15 @@ public class UtilityBarcode {
|
||||
|
||||
|
||||
|
||||
public static Integer getAnnoColloFromULAnonima(String barcode) {
|
||||
if(barcode != null){
|
||||
return Integer.parseInt(barcode.substring(1, 3));
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String convertITF14toEAN13(String barcodeITF14) {
|
||||
String barcodeEAN13 = null;
|
||||
|
||||
|
||||
7
app/src/main/res/drawable/splash_background.xml
Normal file
7
app/src/main/res/drawable/splash_background.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@color/colorPrimary"/>
|
||||
|
||||
|
||||
</layer-list>
|
||||
73
app/src/main/res/layout/activity_splash.xml
Normal file
73
app/src/main/res/layout/activity_splash.xml
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorPrimary"
|
||||
tools:context=".SplashActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/logo_integry_completo_1024w"
|
||||
android:adjustViewBounds="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/guideline_left"
|
||||
app:layout_constraintRight_toLeftOf="@+id/guideline_right" />
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline_left"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.25" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.75" />
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline_left_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.3" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline_right_progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.7" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar2"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateTint="@android:color/white"
|
||||
app:layout_constraintLeft_toRightOf="@+id/guideline_left_progress"
|
||||
app:layout_constraintRight_toLeftOf="@+id/guideline_right_progress"
|
||||
app:layout_constraintTop_toBottomOf="@id/imageView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_version_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="v 1.0.0"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_marginBottom="24dp"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -163,5 +163,6 @@
|
||||
|
||||
<string name="level">Livello</string>
|
||||
<string name="not_valid">Non valido</string>
|
||||
<string name="permissions_permanrntly_denied"><![CDATA[Sono stati negati tutti i permessi necessari al funzionamento dell\'applicazione. L\'applicazione verrà adesso chiusa.]]></string>
|
||||
|
||||
</resources>
|
||||
@ -171,6 +171,6 @@
|
||||
<string name="too_much_lu_found_message">Multiple LU found</string>
|
||||
<string name="ask_print_message">Do you want print the label?</string>
|
||||
<string name="ask_position_of_lu_message">Please scan a <b>Position</b> barcode</string>
|
||||
<string name="title_activity_splash">SplashActivity</string>
|
||||
<string name="permissions_permanrntly_denied">Please note that all permissions are required. Application will close now.</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@ -17,6 +17,10 @@
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="SplashTheme" parent="AppTheme.NoActionBar">
|
||||
<item name="android:windowBackground">@drawable/splash_background</item>
|
||||
</style>
|
||||
|
||||
<style name="Light" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge">
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user