Compare commits

..

6 Commits

Author SHA1 Message Date
cb430b957f fixes 2021-09-07 10:01:30 +02:00
b6a0f6dd91 fixes 2021-09-02 17:56:17 +02:00
bc32cbc179 encoding related typos 2021-09-02 10:48:50 +02:00
d9cc604bdd gradle update 2021-09-01 21:28:36 +02:00
db21011b7f Notification fixed 2021-08-31 23:13:59 +02:00
dc35c8b7fb stacked notification almost fixed 2021-08-31 18:53:26 +02:00
13 changed files with 89 additions and 36 deletions

View File

@ -11,8 +11,8 @@ android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
useLibrary 'org.apache.http.legacy'
versionCode 111
versionName "1.6.41"
versionCode 112
versionName "1.6.42"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 111,
"versionName": "1.6.41-googlePlay",
"versionCode": 112,
"versionName": "1.6.42-googlePlay",
"outputFile": "app-googlePlayFlavor-release.apk"
}
],

View File

@ -1,11 +1,14 @@
package com.jens.automation2;
import android.annotation.SuppressLint;
import android.app.Notification;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import android.os.Parcelable;
import android.service.notification.StatusBarNotification;
import android.telephony.TelephonyManager;
import android.util.Log;
@ -34,6 +37,8 @@ import static com.jens.automation2.Trigger.triggerParameter2Split;
import static com.jens.automation2.receivers.NotificationListener.EXTRA_TEXT;
import static com.jens.automation2.receivers.NotificationListener.EXTRA_TITLE;
import androidx.core.app.NotificationCompat;
import org.apache.commons.lang3.StringUtils;
@ -796,13 +801,13 @@ public class Rule implements Comparable<Rule>
String myApp = params[0];
String myTitleDir = params[1];
String myTitle = params[2];
String requiredTitle = params[2];
String myTextDir = params[3];
String myText;
String requiredText;
if (params.length >= 5)
myText = params[4];
requiredText = params[4];
else
myText = "";
requiredText = "";
if(oneTrigger.getTriggerParameter())
{
@ -815,8 +820,8 @@ public class Rule implements Comparable<Rule>
if(getLastExecution() == null || sbn.getPostTime() > this.lastExecution.getTimeInMillis())
{
String notificationApp = sbn.getPackageName();
String notificationTitle = sbn.getNotification().extras.getString(EXTRA_TITLE);
String notificationText = sbn.getNotification().extras.getString(EXTRA_TEXT);
String notificationTitle = null;
String notificationText = null;
Miscellaneous.logEvent("i", "NotificationCheck", "Checking if this notification matches our rule " + this.getName() + ". App: " + notificationApp + ", title: " + notificationTitle + ", text: " + notificationText, 5);
@ -829,9 +834,20 @@ public class Rule implements Comparable<Rule>
}
}
if (!StringUtils.isEmpty(myTitle))
/*
If there are multiple notifications ("stacked") title or text might be null:
https://stackoverflow.com/questions/28047767/notificationlistenerservice-not-reading-text-of-stacked-notifications
*/
Bundle extras = sbn.getNotification().extras;
// T I T L E
if (extras.containsKey(EXTRA_TITLE))
notificationTitle = sbn.getNotification().extras.getString(EXTRA_TITLE);
if (!StringUtils.isEmpty(requiredTitle))
{
if (!Miscellaneous.compare(myTitleDir, myTitle, notificationTitle))
if (!Miscellaneous.compare(myTitleDir, requiredTitle, notificationTitle))
{
Miscellaneous.logEvent("i", "NotificationCheck", "Notification title does not match rule.", 5);
continue;
@ -840,9 +856,14 @@ public class Rule implements Comparable<Rule>
else
Miscellaneous.logEvent("i", "NotificationCheck", "A required title for a notification trigger was not specified.", 5);
if (!StringUtils.isEmpty(myText))
// T E X T
if (extras.containsKey(EXTRA_TEXT))
notificationText = sbn.getNotification().extras.getString(EXTRA_TEXT);
if (!StringUtils.isEmpty(requiredText))
{
if (!Miscellaneous.compare(myTextDir, myText, notificationText))
if (!Miscellaneous.compare(myTextDir, requiredText, notificationText))
{
Miscellaneous.logEvent("i", "NotificationCheck", "Notification text does not match rule.", 5);
continue;
@ -877,15 +898,15 @@ public class Rule implements Comparable<Rule>
return false;
}
if (myTitle.length() > 0)
if (requiredTitle.length() > 0)
{
if (!Miscellaneous.compare(myTitleDir, title, myTitle))
if (!Miscellaneous.compare(myTitleDir, title, requiredTitle))
return false;
}
if (myText.length() > 0)
if (requiredText.length() > 0)
{
if (!Miscellaneous.compare(myTextDir, text, myText))
if (!Miscellaneous.compare(myTextDir, text, requiredText))
return false;
}
}

View File

@ -88,13 +88,12 @@ public class ActivityManageRule extends Activity
final static int requestCodeActionStartActivityEdit = 3001;
final static int requestCodeTriggerNfcTagAdd = 4000;
final static int requestCodeTriggerNfcTagEdit = 4001;
final static int requestCodeActionSpeakTextAdd = 5000;
final static int requestCodeActionSpeakTextEdit = 1001;
final static int requestCodeActionSpeakTextAdd = 5101;
final static int requestCodeActionSpeakTextEdit = 5102;
final static int requestCodeTriggerBluetoothAdd = 6000;
final static int requestCodeTriggerBluetoothEdit = 6001;
final static int requestCodeActionScreenBrightnessAdd = 401;
final static int requestCodeActionScreenBrightnessEdit = 402;
final static int requestCodeActionSendTextMessage = 7001;
final static int requestCodeTriggerNotificationAdd = 8000;
final static int requestCodeTriggerNfcNotificationEdit = 8001;
final static int requestCodeActionPlaySoundAdd = 501;
@ -104,6 +103,7 @@ public class ActivityManageRule extends Activity
final static int requestCodeTriggerWifiAdd = 723;
final static int requestCodeTriggerWifiEdit = 724;
final static int requestCodeActionSendTextMessageAdd = 5001;
final static int requestCodeActionSendTextMessageEdit = 5002;
final static int requestCodeActionVibrateAdd = 801;
final static int requestCodeActionVibrateEdit = 802;
@ -315,7 +315,7 @@ public class ActivityManageRule extends Activity
Intent activitySendTextMessageIntent = new Intent(ActivityManageRule.this, ActivityManageActionSendTextMessage.class);
ActivityManageActionSendTextMessage.resultingAction = a;
activitySendTextMessageIntent.putExtra("edit", true);
startActivityForResult(activitySendTextMessageIntent, requestCodeActionSendTextMessage);
startActivityForResult(activitySendTextMessageIntent, requestCodeActionSendTextMessageEdit);
break;
case setScreenBrightness:
Intent activityEditScreenBrightnessIntent = new Intent(ActivityManageRule.this, ActivityManageActionBrightnessSetting.class);
@ -1224,8 +1224,8 @@ public class ActivityManageRule extends Activity
{
if(resultCode == RESULT_OK)
{
//add SpeakText
ruleToEdit.getActionSet().add(ActivityManageActionSendTextMessage.resultingAction);
//edit SpeakText
newAction = ActivityManageActionSpeakText.resultingAction;
this.refreshActionList();
}
}
@ -1315,17 +1315,25 @@ public class ActivityManageRule extends Activity
this.refreshActionList();
}
}
//TODO: Check with has data been changed or something like that.
/*try
else if(requestCode == requestCodeActionSendTextMessageAdd)
{
Miscellaneous.logEvent("i", "ActivityManageSpecificRule", getResources().getString(R.string.noDataChangedReadingAnyway), 4);
XmlFileInterface.readFile();
if(resultCode == RESULT_OK)
{
//add SendTextMessage
ruleToEdit.getActionSet().add(ActivityManageActionSendTextMessage.resultingAction);
this.refreshActionList();
}
}
catch (FileNotFoundException e)
else if(requestCode == requestCodeActionSendTextMessageEdit)
{
Miscellaneous.logEvent("e", "ActivityManageSpecificRule", getResources().getString(R.string.errorReadingPoisAndRulesFromFile) + ": " + Log.getStackTraceString(e), 5);
}*/
if(resultCode == RESULT_OK)
{
//edit SendTextMessage
newAction = ActivityManageActionSendTextMessage.resultingAction;
//ruleToEdit.getActionSet().add(ActivityManageActionSendTextMessage.resultingAction);
this.refreshActionList();
}
}
}
protected Dialog getActionTypeDialog()

View File

@ -145,7 +145,7 @@ public class ActivityManageTriggerWifi extends Activity
wifiList.add(wifi.SSID.replaceAll("\"+$", "").replaceAll("^\"+", ""));
}
if (wifiList.size() > 0)
if (wifiList.size() > 0)
{
spinnerWifiList.setEnabled(true);
Collections.sort(wifiList);

View File

@ -447,6 +447,14 @@ public class Miscellaneous extends Service
public static boolean compare(String direction, String needle, String haystack)
{
// If only one of needle or haystack is null
if(
(needle == null && haystack != null)
||
(needle != null && haystack == null)
)
return false;
switch(direction)
{
case Trigger.directionEquals:

View File

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.1'
classpath 'com.android.tools.build:gradle:7.0.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -0,0 +1,4 @@
* Fehler im Benachrichtigungsauslöser behoben
* WLAN Liste laden für API > 30 (soweit möglich)
* Fehler behoben beim Hinzufügen/Ändern der SMS-senden Aktion
* Fehler behoben beim Ändern der Text-sprechen Aktion

View File

@ -39,7 +39,7 @@ Mögliche Aktionen:
* SMS verschicken
* Sounddatei abspielen.
Es ist ziemlich schwierig diese Anwendung über die vielen verschiedenen Geräte sowie die vielen Änderungen an Android Versionen am Laufen zu halten. Ich kann vieles im Emulator testen, aber eben nicht alles.
Es ist ziemlich schwierig diese Anwendung über die vielen verschiedenen Geräte und Android Versionen am Laufen zu halten. Ich kann vieles im Emulator testen, aber eben nicht alles.
Wenn also eine bestimmte Funktion nicht so tut wie sie sollte - lassen Sie es mich wissen. Über die Jahre habe ich noch alle Fehler behoben, die mir vernünftig gemeldet wurden. Aber dafür bin ich auf Ihre Mithilfe angewiesen.
Wenn Sie ein Problem mit der Anwendung haben und mich dazu kontaktieren möchten, updaten Sie bitte vorher auf die neueste Version und schauen Sie, ob Ihr Problem darin auch besteht.

View File

@ -1 +1 @@
Automatisieren Sie Dinge auf Ihrem Gerät, indem Sie Regeln anlegen.
Automatisieren Sie Dinge auf Ihrem Gerät, indem Sie Regeln anlegen.

View File

@ -0,0 +1,4 @@
* Fixed bug in notification trigger.
* Load wifi list for API > 30 (as far as possible)
* Fixed a bug when adding/editing sendTextMessage action
* Fixed a bug when editing speakText action

View File

@ -0,0 +1,4 @@
* Error fijo en el gatillo de notificación.
* Lista de wifi de carga para API > 30 (en la medida de lo posible)
* Arregló un error al añadir/editar sendTextMessage acción
* Arregló un error al editar la acción de TalkText

View File

@ -0,0 +1,4 @@
* Corretto bug nel trigger di notifica.
* Carica elenco wifi per API > 30 (per quanto possibile)
* Corretto un bug quando si aggiunge / modifica l'azione di sendTextMessage
* Corretto un bug quando si modifica l'azione del testo