diff --git a/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java b/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java index dc3b5ce..de35808 100644 --- a/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java +++ b/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java @@ -226,6 +226,19 @@ public class Rule implements Comparable return XmlFileInterface.writeFile(); } + + public boolean cloneRule(Context context) + { + Rule newRule = new Rule(); + newRule.setName(this.getName() + " - clone"); + newRule.setRuleActive(this.isRuleActive()); + newRule.setRuleToggle(this.isRuleToggle()); + + newRule.setTriggerSet(this.getTriggerSet()); + newRule.setActionSet(this.getActionSet()); + + return newRule.create(context); + } private boolean checkBeforeSaving(Context context, boolean changeExistingRule) { diff --git a/app/src/main/java/com/jens/automation2/ActivityManagePoi.java b/app/src/main/java/com/jens/automation2/ActivityManagePoi.java index 925593c..fe69a38 100644 --- a/app/src/main/java/com/jens/automation2/ActivityManagePoi.java +++ b/app/src/main/java/com/jens/automation2/ActivityManagePoi.java @@ -257,13 +257,23 @@ public class ActivityManagePoi extends Activity getRadiusConfirmationDialog(text, defaultRadius).show(); } - else if( // we have a bad network signal + else if( // we have a bad network signal and nothing else, GPS result may still come in + locationNetwork != null + && + Calendar.getInstance().getTimeInMillis() + < + (locationSearchStart.getTimeInMillis() + ((long)searchTimeout * 1000)) + ) + { + // Only a network location was found and it is also not very accurate. + } + else if( // we have a bad network signal and nothing else, timeout has expired, nothing else can possibly come in locationNetwork != null && Calendar.getInstance().getTimeInMillis() > (locationSearchStart.getTimeInMillis() + ((long)searchTimeout * 1000)) - ) + ) { // Only a network location was found and it is also not very accurate. @@ -276,13 +286,14 @@ public class ActivityManagePoi extends Activity } else { - String text = String.format(getResources().getString(R.string.noLocationCouldBeFound), searchTimeout); + String text = String.format(getResources().getString(R.string.noLocationCouldBeFound), String.valueOf(searchTimeout)); Miscellaneous.logEvent("i", "POI Manager", text, 2); if(myLocationListenerNetwork != null) myLocationManager.removeUpdates(myLocationListenerNetwork); myLocationManager.removeUpdates(myLocationListenerGps); + progressDialog.dismiss(); getErrorDialog(text).show(); } } @@ -348,7 +359,11 @@ public class ActivityManagePoi extends Activity } }; alertDialogBuilder.setMessage(text); - Looper.prepare(); + alertDialogBuilder.setPositiveButton(getResources().getString(R.string.ok), null); + + if (Looper.myLooper() == null) + Looper.prepare(); + AlertDialog alertDialog = alertDialogBuilder.create(); return alertDialog; diff --git a/app/src/main/java/com/jens/automation2/ActivityPermissions.java b/app/src/main/java/com/jens/automation2/ActivityPermissions.java index d9b1575..e0bd1d4 100644 --- a/app/src/main/java/com/jens/automation2/ActivityPermissions.java +++ b/app/src/main/java/com/jens/automation2/ActivityPermissions.java @@ -2,9 +2,11 @@ package com.jens.automation2; import android.Manifest; import android.app.Activity; +import android.app.AlertDialog; import android.app.NotificationManager; import android.content.ComponentName; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; @@ -929,11 +931,21 @@ public class ActivityPermissions extends Activity } else if (s.equalsIgnoreCase(Manifest.permission.ACCESS_BACKGROUND_LOCATION) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - requiredPermissions.remove(s); - cachedPermissionsToRequest = requiredPermissions; - Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); - intent.setData(Uri.parse("package:" + getPackageName())); - startActivityForResult(intent, requestCodeForPermissionsBackgroundLocation); + AlertDialog dialog = Miscellaneous.messageBox(getResources().getString(R.string.readLocation), getResources().getString(R.string.pleaseGiveBgLocation), ActivityPermissions.this); + dialog.setOnDismissListener(new DialogInterface.OnDismissListener() + { + @Override + public void onDismiss(DialogInterface dialog) + { + requiredPermissions.remove(s); + cachedPermissionsToRequest = requiredPermissions; + Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); + intent.setData(Uri.parse("package:" + getPackageName())); + startActivityForResult(intent, requestCodeForPermissionsBackgroundLocation); + } + }); + dialog.show(); + return; } } diff --git a/app/src/main/java/com/jens/automation2/AutomationService.java b/app/src/main/java/com/jens/automation2/AutomationService.java index e422c2a..7c72206 100644 --- a/app/src/main/java/com/jens/automation2/AutomationService.java +++ b/app/src/main/java/com/jens/automation2/AutomationService.java @@ -343,6 +343,9 @@ public class AutomationService extends Service implements OnInitListener { boolean displayNotification = false; + String rule = ""; + + outerLoop: for(Rule r : Rule.getRuleCollection()) { if(r.isRuleActive()) @@ -355,7 +358,11 @@ public class AutomationService extends Service implements OnInitListener // r.setRuleActive(false); // r.change(AutomationService.this); if(!displayNotification) + { displayNotification = true; + rule = r.getName(); + break outerLoop; + } } } } @@ -363,18 +370,16 @@ public class AutomationService extends Service implements OnInitListener if(displayNotification) { -// Toast.makeText(Miscellaneous.getAnyContext(), "Require more permissions.", Toast.LENGTH_LONG).show(); - // Update notification or show new one that notifiies of the lack or permissions. - Intent intent = new Intent(AutomationService.this, ActivityPermissions.class); PendingIntent pi = PendingIntent.getActivity(AutomationService.this, 0, intent, 0); + + Miscellaneous.logEvent("w", "Features disabled", "Features disabled because of rule " + rule, 5); + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) Miscellaneous.createDismissableNotificationWithDelay(1010, getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, pi); else Miscellaneous.createDismissableNotification(getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, pi); } -// else -// Toast.makeText(Miscellaneous.getAnyContext(), "Have all required permissions.", Toast.LENGTH_LONG).show(); } } @@ -391,6 +396,9 @@ public class AutomationService extends Service implements OnInitListener Intent intent = new Intent(AutomationService.this, ActivityMainTabLayout.class); PendingIntent pi = PendingIntent.getActivity(AutomationService.this, 0, intent, 0); // Miscellaneous.createDismissableNotification(getResources().getString(R.string.settingsReferringToRestrictedFeatures), ActivityPermissions.notificationIdPermissions, pi); + + Miscellaneous.logEvent("w", "Features disabled", "Background location disabled because Google to blame.", 5); + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) Miscellaneous.createDismissableNotificationWithDelay(3300, getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, pi); else @@ -406,6 +414,8 @@ public class AutomationService extends Service implements OnInitListener Intent intent = new Intent(AutomationService.this, ActivityMainTabLayout.class); PendingIntent pi = PendingIntent.getActivity(AutomationService.this, 0, intent, 0); + Miscellaneous.logEvent("w", "Features disabled", "Background location disabled because Google to blame.", 5); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) Miscellaneous.createDismissableNotificationWithDelay(2200, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi); else diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 3ef94c7..332c9e9 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -436,7 +436,6 @@ Automation benötigt Rechte, um auf den Speicher zuzugreifen, um seine Konfiguration und Regeln lesen zu können. Automation benötigt mehr Rechte, um vollständig funktionsfähig zu sein. Klicken Sie auf diesen Text, um mehr zu erfahren und die fehlenden Rechte zu beantragen. Ungültiges Gerät - your app id Maximale Größe der Protokolldatei in Megabyte. Wenn sie größer wird, wird sie rotiert. Maximale Größe des Protokolls [Mb] Telefonprotokoll lesen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 974c62e..4cd5afd 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -43,7 +43,7 @@ Enviar mensaje SMS Importar número del directorio Editar - Texto de enviar + Texto para enviar Contraseña Mostrar en un mapa Cualquier @@ -177,7 +177,7 @@ Ventana incial Metodo de localización Este dispositivo no tiene Bluetooth. Puede continuar pero probablemente no va a funciónar. - Leer protocolo de teléfono + Leer protocolo de llamadas Leer calendario Determinar la posición exacta Determinar la posición aproximada @@ -187,15 +187,15 @@ Vibrar Modificar la configuración sonida Grabar audio - Detecar llamados saliendos - Detecar el estado del dispositivo - Leer la memoria - Escribir a la memoria + Detectar llamadas salientes + Detectar el estado del dispositivo + Leer la almacenamiento + Escribir en el almacenamiento Modificar la configuración del dispositivo - Determinar el estado de la batteria + Determinar el estado de la bateria Modificar la conexión internet Exeder configuración no molestar - Escribir a la memoria + Escribir en el almacenamiento acplicar publicitado el %1$s crea notificación @@ -284,8 +284,8 @@ Elija tipo de actividad Elija tipo de condición Elija tipo de comienzo - Cambiar ajusted Bluetooth - Cambiar ajusted Bluetooth + Cambiar ajustes Bluetooth + Cambiar ajustes Bluetooth Mas ajustes Abrir página con ejemplos Nombre del la\nactivitdad or la action @@ -478,12 +478,12 @@ Incluya las paréntecis en su texto.\n\n[uniqueid] - el número único de su dis Funciones desactivadas Dispositivo no valido. Determinar estado de wifi - Tener dispositivo despierto + Mantener dispositivo activado Cambiar ajustes del dispositivo - Determinar procesos activados + Determinar procesos activos Detectar reinicio del dispositivo - Esta función puede detecar su estado de movimiento (en pie, en bicicleta, en vehiculo). La función no es un parte de Automation, pero de Google Play Services. Técnicamente no da un si/no resultado, pero una certeza con que el estado es probable. Puede configurar el percentaje del cual Automation va a aceptar un resultado. Dos comentarios: 1) Mas de un estado se puede aplicar al mismo tiempo. Por ejemplo puede esta en pie en un autobus. 2) Esta sensor es relativamente caro (bateria). Si posible considere alternativas, por ejemplo bluetooth conexción a tu coche en vez de \"en vehiculo\". - Puede insertar un numero de llamada. Alternativamente puede importar un numero de su directorio. Pero tenga en cuenta: El numero va a serar guardado, no el contacto. Si cambias el numero en su directoria tiene que cambiar la regla tambien. + Esta función puede detectar su estado de movimiento (a pie, en bicicleta, en vehiculo). La función no es parte de Automation, pero de Google Play Services. Técnicamente no da un \"si\" o \"no\" resultado, pero una probabilidad. Puede configurar este porcentaje del cual Automation va a aceptar un resultado. Dos comentarios: 1) Mas de un estado se puede aplicar al mismo tiempo. Por ejemplo puede estar a pie en un autobus. 2) Este sensor es relativamente caro (bateria). Si es posible considere alternativas, por ejemplo bluetooth conexión a su coche en vez de \"en vehiculo\". + Puede insertar un numero de llamada. Alternativamente puede importar un numero de su directorio. Pero tenga en cuenta: El número será guardado, no el contacto. Si cambias el número en su directorio tiene que cambiar la regla también. Encender automation como un servicio Elija la pantalla con que automation enciende. Use existente tag NFC @@ -548,4 +548,14 @@ Incluya las paréntecis en su texto.\n\n[uniqueid] - el número único de su dis Para activar la función que será usada, mas permisos son necesarios. Cliquee continuar para los requisitos. Leer y guardar configuración. CUIDADO: Funciones estan desactivadas, Automation esta en modo limitado. Cliquee aqui para mas informacion. + Para calcular un valor dB para determinar el nivel del ruido de fondo tiene que especificar un valor de referencia fisico. Por favor lea el articulo en Wikipedia para mas información. Este valor será probablemente diferente para todos los dispositivos. Mueva el regulador para cambiar el valor. Cuanto mas alto el valor de referencia menos será el valor dB. Las mediciónes se harán cada %1$s segundos y el resultado aparecerá abajo. Presione atrás cuando encuentre un valor indicado. + El permiso para cambiar ajustes del OS es necesario (incluso cosas simples como activar bluetooth o wifi). Despues de cliquear continuar una ventana aparecerá en la cual tiene que activar eso para Automation. Entonces cliquee el boton atrás. + Mas permisos serán requeridos en un segundo dialogo luego. + Automation necesita acceso al almacenamiento externo para leer su configuración y reglas. + " Automation necesita mas permisos para funcionar en su totalidad. Cliquee en este texto para encontrar mas y requerirlos." + Maximo tamaño del archivo log. Será alternado si es mas alto. + Maximo tamaño del archivo log [Mb] + Esos son los permisos necesarios. + Si usa la condición nivel del ruido fondo: Desafortunadamente iniciando con Android 9 (Pie) Google decidió prohibir aplicaciones de fondo usando el micrófono. Por eso esta condición no tendrá un efecto y no iniciará algo. + Si usa la condición nivel del ruido fondo: Desafortunadamente iniciando con Android 9 (Pie) Google decidió prohibir aplicaciones de fondo usando el micrófono. Por eso esta condición no tendrá un efecto y no iniciará algo. \ No newline at end of file diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 3d5c638..b1c79af 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -214,7 +214,6 @@ Questa applicazione accumula dati di localizzazione per abilitare regole basate sulla posizione insieme al rilevamento della velocità anche quando l\'applicazione è chiusa o non in uso. Questa applicazione accumula dati di localizzazione per determinare se sei attualmente ad una delle posizioni che hai creato. Inoltre, questa funzione è usata per determinare la tua velocità attuale se tale evento è stato attivato nelle regole. Questi rilevamenti sono effettuati anche quando l\'applicazione è chiusa o non in uso (ma solo se il servizio è attivato). Grazie alla infinita sapienza di Google e continui sforzi per proteggere la nostra privacy, nelle regole che possano inviare SMS o coinvolgere lo stato del telefono, sono state rimossi eventi ed azioni rilevanti. - id della tua app Precisone del GPS [m] Comparazione GPS Sensazione tattile (vibrazione al tocco) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 958a394..bde2a03 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -530,7 +530,7 @@ Automation requires access to external storage to read its settings and rules. Automation requires more permissions to fully function. Click on this text to find out more and request them. Invalid device - your app id + your app id Maximum log file size in Megabyte. Will be rotated if bigger. Maximum log file size [Mb] Read phone log @@ -680,5 +680,6 @@ Location found. The suggested minimum radius for locations is %1$d m. Only a location with a limited accuracy could be found. It might not work reliably. The suggested minimum radius for locations is %1$d." Clone - No position could be found after a timeout of %1$o seconds. + No position could be found after a timeout of %1$s seconds. + In the next screen please go to permissions, then location. There select \"Allow all the time\" to allow Automation to determine your location in the background. \ No newline at end of file