#Version 23.8 en testBeta
This commit is contained in:
parent
27b9a694c8
commit
0986f34e71
|
@ -7,8 +7,8 @@ android {
|
|||
applicationId "verdnatura.es.repartoverdnatura"
|
||||
minSdkVersion 19
|
||||
//targetSdkVersion 28
|
||||
versionCode 36
|
||||
versionName "23.6"
|
||||
versionCode 40
|
||||
versionName "23.8Beta"
|
||||
//versionName "23.2Beta" Madrid 33
|
||||
|
||||
|
||||
|
@ -20,9 +20,10 @@ android {
|
|||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
/* getByName("release") {
|
||||
getByName("release") {
|
||||
applicationIdSuffix = ".sfusion"
|
||||
}
|
||||
/*
|
||||
getByName("debug") {
|
||||
applicationIdSuffix = ".sfusion"
|
||||
}*/
|
||||
|
|
|
@ -36,19 +36,23 @@
|
|||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"/>
|
||||
<activity
|
||||
android:name=".Tickets"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"/>
|
||||
<activity
|
||||
android:name=".SignActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"/>
|
||||
<activity
|
||||
android:name=".InfoActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"/>
|
||||
<activity
|
||||
android:name=".ConfigureActivity"
|
||||
android:configChanges="orientation"
|
||||
|
@ -60,23 +64,28 @@
|
|||
<activity
|
||||
android:name=".LoadVanActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"/>
|
||||
<activity
|
||||
android:name=".UnLoadVanActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"/>
|
||||
<activity
|
||||
android:name=".ExpeditionScanActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"/>
|
||||
<activity
|
||||
android:name=".ExpeditionInfoActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"/>
|
||||
<activity
|
||||
android:name=".ExpeditionSummaryActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"/>
|
||||
|
||||
<receiver android:name=".NetworkStateReveiver">
|
||||
<intent-filter>
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.content.Intent
|
|||
import android.media.MediaPlayer
|
||||
import android.os.Bundle
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.util.Log.d
|
||||
import android.view.View
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.*
|
||||
|
@ -75,9 +74,19 @@ class ExpeditionSummaryActivity : AppCompatActivity() {
|
|||
val bundle = intent.extras
|
||||
try {
|
||||
if (bundle != null) {
|
||||
route = bundle.getSerializable("route") as Ruta
|
||||
|
||||
if (bundle.get("app") == "picking") {
|
||||
/* Utils.saveTokenUser(this,bundle.get("token").toString())
|
||||
Utils.saveUserPass(this,bundle.get("user").toString(),bundle.get("password").toString())
|
||||
Utils.saveIdUser(this,bundle.get("userId").toString())*/
|
||||
|
||||
routeOfLoad = bundle.get("routeId").toString()
|
||||
} else {
|
||||
route = bundle.getSerializable("route") as Ruta
|
||||
routeOfLoad = route!!.id.toString()
|
||||
}
|
||||
}
|
||||
routeOfLoad = route!!.id.toString()
|
||||
|
||||
|
||||
} catch (e: Exception) {
|
||||
routeOfLoad = ""
|
||||
|
@ -374,7 +383,7 @@ class ExpeditionSummaryActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
txtScan!!.setText("")
|
||||
txtScan!!.requestFocus()
|
||||
txtScan!!.requestFocus()
|
||||
|
||||
}
|
||||
|
||||
|
@ -466,11 +475,13 @@ class ExpeditionSummaryActivity : AppCompatActivity() {
|
|||
textAddressSelected!!.text =
|
||||
if (checked == totalChecks) {
|
||||
listExpeditionSummary.get(positionSelected!! + 1).address
|
||||
|
||||
} else {
|
||||
listExpeditionSummary.get(positionSelected!!).address
|
||||
|
||||
}
|
||||
//positionSelected = positionSelected!! + 1
|
||||
if (checked == totalChecks)
|
||||
positionSelected = positionSelected!! + 1
|
||||
|
||||
}
|
||||
onResume()
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
package verdnatura.es.repartoverdnatura;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
@ -18,6 +23,7 @@ import retrofit2.Response;
|
|||
import verdnatura.es.repartoverdnatura.INTERFACES.RestClient;
|
||||
import verdnatura.es.repartoverdnatura.INTERFACES.RestClientSalix;
|
||||
import verdnatura.es.repartoverdnatura.MODELS.LoginSalix;
|
||||
import verdnatura.es.repartoverdnatura.MODELS.Version;
|
||||
import verdnatura.es.repartoverdnatura.UTILS.ApiUtils;
|
||||
import verdnatura.es.repartoverdnatura.UTILS.ApiUtilsSalix;
|
||||
import verdnatura.es.repartoverdnatura.UTILS.Utils;
|
||||
|
@ -29,6 +35,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||
private EditText txtUser, txtPassword;
|
||||
private CheckBox checkVerPass;
|
||||
|
||||
final LoginActivity that = this;
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
|
@ -85,7 +92,6 @@ public class LoginActivity extends AppCompatActivity {
|
|||
final String password = txtPassword.getText().toString();
|
||||
LoginSalix ls = new LoginSalix(user, password, "", false, "");
|
||||
|
||||
final LoginActivity that = this;
|
||||
|
||||
restClientSalix.loginSalix(Utils.getMapSalix(user, password), ls).enqueue(new Callback<LoginSalix>() {
|
||||
@Override
|
||||
|
@ -123,7 +129,6 @@ public class LoginActivity extends AppCompatActivity {
|
|||
final String user = txtUser.getText().toString();
|
||||
final String password = txtPassword.getText().toString();
|
||||
|
||||
final LoginActivity that = this;
|
||||
|
||||
restClient.worker_getId(Utils.getMap(user, password)).enqueue(new Callback<String>() {
|
||||
@Override
|
||||
|
@ -154,7 +159,69 @@ public class LoginActivity extends AppCompatActivity {
|
|||
|
||||
}
|
||||
|
||||
public void checkVersion(){
|
||||
|
||||
String[] userData = new String[1];
|
||||
userData[0] = "delivery";
|
||||
|
||||
|
||||
//sergio: se cambia llamada Callback porque requeria un objeto y se le pasaba un true o false
|
||||
restClient.getVersion(Utils.getMapWhitUser(this),userData).enqueue(new Callback<Version>() {
|
||||
//restClient.getVersion(Utils.getMapWhitUser(this),userData).enqueue(new Callback<String>() {
|
||||
@Override
|
||||
public void onResponse(Call<Version> call, Response<Version> response) {
|
||||
if (response.isSuccessful()){
|
||||
final Version v = response.body();
|
||||
|
||||
PackageManager manager = that.getPackageManager();
|
||||
try{
|
||||
PackageInfo info = manager.getPackageInfo(that.getPackageName(), 0);
|
||||
|
||||
|
||||
|
||||
if (!v.getVersion().equals(info.versionName)){
|
||||
AlertDialog.Builder builderVersion = new AlertDialog.Builder(that);
|
||||
builderVersion.setMessage("Existe una nueva versión. Se recomienda actualizar.");
|
||||
builderVersion.setCancelable(false);
|
||||
builderVersion.setPositiveButton(
|
||||
"Actualizar",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(v.getUrl())));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if (!v.getVersionIsCritical().equals("1")){
|
||||
builderVersion.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
startActivity(new Intent(that, MainActivity.class));
|
||||
}
|
||||
});
|
||||
}else{
|
||||
builderVersion.setMessage("Existe una nueva versión. Es necesario actualizar para un correcto funcionamiento");
|
||||
}
|
||||
AlertDialog alertVersion = builderVersion.create();
|
||||
alertVersion.show();
|
||||
}else{
|
||||
startActivity(new Intent(that, MainActivity.class));
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<Version> call, Throwable t) {
|
||||
}
|
||||
});
|
||||
}
|
||||
public void deviceLog_add() {
|
||||
|
||||
Utils.progressBar.show(this, "Añadiendo log");
|
||||
|
@ -166,7 +233,6 @@ public class LoginActivity extends AppCompatActivity {
|
|||
data[1] = Utils.getAppVersion(this);
|
||||
data[2] = Utils.getAndroid_id(this);
|
||||
|
||||
final LoginActivity that = this;
|
||||
|
||||
restClient.deviceLog_add(Utils.getMap(user, password), data).enqueue(new Callback<Void>() {
|
||||
@Override
|
||||
|
@ -174,7 +240,8 @@ public class LoginActivity extends AppCompatActivity {
|
|||
Utils.progressBar.getDialog().dismiss();
|
||||
if (response.isSuccessful()) {
|
||||
|
||||
startActivity(new Intent(that, MainActivity.class));
|
||||
//startActivity(new Intent(that, MainActivity.class));
|
||||
checkVersion();
|
||||
txtUser.setText("");
|
||||
txtPassword.setText("");
|
||||
|
||||
|
@ -182,7 +249,6 @@ public class LoginActivity extends AppCompatActivity {
|
|||
} else {
|
||||
Utils.showErrorDialog(that, that.getResources().getString(R.string.log_incorrect));
|
||||
//Utils.showErrorDialog(that,response.message().toString());
|
||||
startActivity(new Intent(that, MainActivity.class));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,12 +67,6 @@ public class MainActivity<RouteLoaded> extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
//Tarea #4602
|
||||
/* Bundle extras = getIntent().getExtras();
|
||||
if (extras!=null)
|
||||
{d("VERDNATURA::","el token es "+ extras.getString("token"));
|
||||
Toast.makeText(this,"token es "+extras.getString("token"),Toast.LENGTH_LONG).show();}
|
||||
else{d("VERDNATURA::","no token es");}*/
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
@ -162,7 +156,8 @@ public class MainActivity<RouteLoaded> extends AppCompatActivity {
|
|||
ViewGroup.LayoutParams params = listViewRutas.getLayoutParams();
|
||||
params.height = (heightCellRoute * (listaRutas.size()));
|
||||
listViewRutas.setLayoutParams(params);
|
||||
checkVersion();
|
||||
//Se actualiza por ScaleFusion. Hay redmine para pasar a LoginActivity
|
||||
// checkVersion();
|
||||
LocalStorage.checkDateForClear(that);
|
||||
|
||||
// getExpeditions();
|
||||
|
@ -191,10 +186,10 @@ public class MainActivity<RouteLoaded> extends AppCompatActivity {
|
|||
}
|
||||
|
||||
public void goToExpeditionInfo(View v){
|
||||
|
||||
|
||||
/*
|
||||
Intent i = new Intent(this,ExpeditionInfoActivity.class);
|
||||
startActivity(i);
|
||||
startActivity(i);*/
|
||||
Utils.startPicking(this,"log");
|
||||
|
||||
}
|
||||
|
||||
|
@ -391,7 +386,8 @@ public class MainActivity<RouteLoaded> extends AppCompatActivity {
|
|||
}
|
||||
|
||||
public void goToInfo(View v){
|
||||
startActivity(new Intent(this,InfoActivity.class));
|
||||
// startActivity(new Intent(this,InfoActivity.class));
|
||||
Utils.startPicking(this,"info");
|
||||
}
|
||||
public void goToFound(View v){
|
||||
startActivity(new Intent(this,ExpeditionScanActivity.class));
|
||||
|
|
|
@ -38,10 +38,10 @@ public class Utils {
|
|||
|
||||
public static String getAppVersion(Context context) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
String version="";
|
||||
String version = "";
|
||||
try {
|
||||
|
||||
version=packageManager.getPackageInfo(context.getPackageName(), 0).versionName;
|
||||
version = packageManager.getPackageInfo(context.getPackageName(), 0).versionName;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -121,6 +121,7 @@ public class Utils {
|
|||
AlertDialog alert11 = builder1.create();
|
||||
alert11.show();
|
||||
}
|
||||
|
||||
public static void showInputDialogExpedition(final Context context, String title) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(title);
|
||||
|
@ -128,25 +129,26 @@ public class Utils {
|
|||
// Set up the input
|
||||
final EditText input = new EditText(context);
|
||||
// Specify the type of input expected; this, for example, sets the input as a password, and will mask the text
|
||||
input.setInputType(InputType.TYPE_CLASS_NUMBER );
|
||||
builder.setView(input);
|
||||
input.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
builder.setView(input);
|
||||
|
||||
// Set up the buttons
|
||||
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Log.d("VERDNATURA::",input.getText().toString());
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Log.d("VERDNATURA::", input.getText().toString());
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
builder.show();
|
||||
}
|
||||
|
||||
public static void saveIdUser(Context context, String idUser) {
|
||||
sp = context.getSharedPreferences("delivery", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
|
@ -169,7 +171,6 @@ public class Utils {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public static String getIdUserLogin(Context context) {
|
||||
sp = context.getSharedPreferences("deliveryLogin", Activity.MODE_PRIVATE);
|
||||
return sp.getString("idUserLogin", "nouser");
|
||||
|
@ -189,10 +190,12 @@ public class Utils {
|
|||
sp = context.getSharedPreferences("delivery", Activity.MODE_PRIVATE);
|
||||
return sp.getString("user", "nouser");
|
||||
}
|
||||
|
||||
public static String getPass(Context context) {
|
||||
sp = context.getSharedPreferences("delivery", Activity.MODE_PRIVATE);
|
||||
return sp.getString("pass", "");
|
||||
}
|
||||
|
||||
public static String getIdUser(Context context) {
|
||||
sp = context.getSharedPreferences("delivery", Activity.MODE_PRIVATE);
|
||||
return sp.getString("idUser", "nouser");
|
||||
|
@ -205,13 +208,15 @@ public class Utils {
|
|||
editor.commit();
|
||||
}
|
||||
|
||||
public static void startPicking(Context context) {
|
||||
public static void startPicking(Context context, String option) {
|
||||
|
||||
Intent i = new Intent();
|
||||
i.setClassName("es.verdnatura", "es.verdnatura.presentation.view.feature.login.activity.LoginActivity");
|
||||
i.putExtra("token", "sergiodt");
|
||||
i.putExtra("user", getIdUserLogin(context));
|
||||
i.putExtra("pass", getPass(context));
|
||||
//i.setClassName("es.verdnatura", "es.verdnatura.presentation.view.feature.login.activity.LoginActivity")
|
||||
|
||||
i.setClassName("es.verdnatura", "es.verdnatura.presentation.view.feature.main.activity.MainActivity");
|
||||
i.putExtra("user", getUser(context));
|
||||
i.putExtra("password", getPass(context));
|
||||
i.putExtra("menu", option);
|
||||
context.startActivity(i);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue