close notification action

This commit is contained in:
jens 2022-01-15 01:41:00 +01:00
parent 724192e80b
commit 4b84a0c2f5
9 changed files with 19 additions and 12 deletions

View File

@ -299,16 +299,16 @@ public class Action
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.from) + " ");
String parts[] = this.getParameter2().split(Action.actionParameter2Split);
if (parts[0].equals("-1"))
if (parts[0].equals(Trigger.anyAppString))
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.anyApp));
else
returnString.append(parts[0]);
if (!StringUtils.isBlank(parts[2]))
returnString.append(", " + Miscellaneous.getAnyContext().getResources().getString(R.string.title) + " " + parts[1] + " " + parts[2]);
returnString.append(", " + Miscellaneous.getAnyContext().getResources().getString(R.string.ifString) + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.title) + " " + Trigger.getMatchString(parts[1]) + " " + parts[2]);
if (!StringUtils.isBlank(parts[3]))
returnString.append(", " + Miscellaneous.getAnyContext().getResources().getString(R.string.text) + " " + parts[2] + " " + parts[3]);
if (parts.length > 4 && !StringUtils.isBlank(parts[4]))
returnString.append(", " + Miscellaneous.getAnyContext().getResources().getString(R.string.ifString) + " " + Miscellaneous.getAnyContext().getResources().getString(R.string.text) + " " + Trigger.getMatchString(parts[3]) + " " + parts[4]);
}
else if (parameter2 != null && parameter2.length() > 0)

View File

@ -299,7 +299,7 @@ public class ActivityManageActionCloseNotification extends Activity
{
String app;
if(tvSelectedApplication.getText().toString().equalsIgnoreCase(getResources().getString(R.string.anyApp)))
app = "-1";
app = Trigger.anyAppString;
else
app = tvSelectedApplication.getText().toString();
@ -359,7 +359,7 @@ public class ActivityManageActionCloseNotification extends Activity
else
text = "";
if(!app.equals("-1"))
if(!app.equals(Trigger.anyAppString))
tvSelectedApplication.setText(app);
for(int i = 0; i < directions.length; i++)

View File

@ -312,7 +312,7 @@ public class ActivityManageTriggerNotification extends Activity
{
String app;
if(tvSelectedApplication.getText().toString().equalsIgnoreCase(getResources().getString(R.string.anyApp)))
app = "-1";
app = Trigger.anyAppString;
else
app = tvSelectedApplication.getText().toString();
@ -367,7 +367,7 @@ public class ActivityManageTriggerNotification extends Activity
else
text = "";
if(!app.equals("-1"))
if(!app.equals(Trigger.anyAppString))
tvSelectedApplication.setText(app);
for(int i = 0; i < directions.length; i++)

View File

@ -37,6 +37,8 @@ public class Trigger
Rule parentRule = null;
Calendar lastTimeNotApplied = null;
final static String anyAppString = "-1";
public boolean applies(Object triggeringObject, Context context)
{
boolean result = true;
@ -169,7 +171,7 @@ public class Trigger
Miscellaneous.logEvent("i", "NotificationCheck", "Checking if this notification matches our rule " + this.getParentRule().getName() + ". App: " + notificationApp + ", title: " + notificationTitle + ", text: " + notificationText, 5);
if (!myApp.equals("-1"))
if (!myApp.equals(anyAppString))
{
if (!notificationApp.equalsIgnoreCase(myApp))
{
@ -243,7 +245,7 @@ public class Trigger
String title = NotificationListener.getLastNotification().getTitle();
String text = NotificationListener.getLastNotification().getText();
if (!myApp.equals("-1"))
if (!myApp.equals(anyAppString))
{
if (!app.equalsIgnoreCase(myApp))
return false;
@ -1466,7 +1468,7 @@ public class Trigger
StringBuilder triggerBuilder = new StringBuilder();
String appString;
if (app.equalsIgnoreCase("-1"))
if (app.equalsIgnoreCase(anyAppString))
appString = Miscellaneous.getAnyContext().getResources().getString(R.string.anyApp);
else
appString = "app " + app;
@ -1486,7 +1488,7 @@ public class Trigger
}
else
{
setTriggerParameter2("-1" + triggerParameter2Split + directionEquals + triggerParameter2Split + triggerParameter2Split + directionEquals + triggerParameter2Split + triggerParameter2Split);
setTriggerParameter2(anyAppString + triggerParameter2Split + directionEquals + triggerParameter2Split + triggerParameter2Split + directionEquals + triggerParameter2Split + triggerParameter2Split);
}
break;
case deviceOrientation:

View File

@ -668,4 +668,5 @@
<string name="comparisonCaseInsensitive">Groß-/Kleinschreibung ist egal.</string>
<string name="notificationCloseActionExplanation">Wenn Sie keine Kriterien angeben, werden ALLE Benachrichtigungen geschlossen. Es wird also empfohlen, zumindest eine Anwendung zu spezifizieren und/oder Titel oder Text anzugeben.</string>
<string name="profileWarning">Die Einstellungen, die Sie hier vornehmen, können dazu führen, dass Sie bestimmte Dinge auf Ihrem Telefon nicht mehr mitbekommen. Sie können sogar Ihren Wecker zum Schweigen bringen. Was auch immer Sie hier einstellen - es wird empfohlen, es zu testen.</string>
<string name="ifString">falls</string>
</resources>

View File

@ -667,4 +667,5 @@
<string name="closeNotifications">Cerrar notificación(es)</string>
<string name="comparisonCaseInsensitive">Las comparaciones se realizan sin distinción de mayúsculas y minúsculas</string>
<string name="profileWarning">La configuración que realice aquí puede hacer que ya no note ciertas cosas de su teléfono. Incluso puede silenciar su alarma de despertar. Así que hagas lo que hagas, se recomienda que lo pruebes.</string>
<string name="ifString">si</string>
</resources>

View File

@ -668,4 +668,5 @@
<string name="closeNotifications">Chiudi notifica(e)</string>
<string name="notificationCloseActionExplanation">Se non specifichi alcun criterio, questa azione chiuderà TUTTE le notifiche. Quindi si consiglia di specificare almeno i criteri per almeno 1 di applicazione, titolo o testo.</string>
<string name="profileWarning">Le impostazioni che fai qui possono far sì che tu non noti più certe cose dal tuo telefono. Possono anche mettere a tacere la sveglia. Quindi, qualunque cosa tu faccia, ti consigliamo di testarlo.</string>
<string name="ifString">se</string>
</resources>

View File

@ -666,4 +666,5 @@
<string name="closeNotifications">Melding(en) sluiten</string>
<string name="comparisonCaseInsensitive">Vergelijkingen worden gedaan case-INsensitief</string>
<string name="profileWarning">De instellingen die je hier maakt kunnen ervoor zorgen dat je bepaalde dingen niet meer van je telefoon merkt. Ze kunnen zelfs je wekker dempen. Dus wat je ook doet - het wordt aanbevolen om het te testen.</string>
<string name="ifString">als</string>
</resources>

View File

@ -764,4 +764,5 @@
<string name="closeNotifications">Close notification(s)</string>
<string name="comparisonCaseInsensitive">Comparisons are done case-INsensitive</string>
<string name="profileWarning">The settings you can adjust here, can cause that you don\'t notice certain things from your phone anymore. They may even silence your wakeup alarm. So whatever you do - it is recommended you test it.</string>
<string name="ifString">if</string>
</resources>