forked from jens/Automation
close notification action
This commit is contained in:
parent
e6a7e2c5b5
commit
724192e80b
@ -160,7 +160,10 @@ public class Action
|
||||
{
|
||||
StringBuilder returnString = new StringBuilder();
|
||||
|
||||
switch(getAction())
|
||||
|
||||
try
|
||||
{
|
||||
switch (getAction())
|
||||
{
|
||||
case setWifi:
|
||||
if (this.getParameter1())
|
||||
@ -253,47 +256,68 @@ public class Action
|
||||
returnString.append(action.toString());
|
||||
}
|
||||
|
||||
if(this.getAction().equals(Action_Enum.triggerUrl))
|
||||
if (this.getAction().equals(Action_Enum.triggerUrl))
|
||||
{
|
||||
String[] components = parameter2.split(";");
|
||||
if(components.length >= 3)
|
||||
if (components.length >= 3)
|
||||
{
|
||||
returnString.append(": " + components[2]);
|
||||
|
||||
if(parameter1)
|
||||
if (parameter1)
|
||||
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.usingAuthentication) + ".");
|
||||
}
|
||||
else
|
||||
returnString.append(": " + components[0]);
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.startOtherActivity))
|
||||
else if (this.getAction().equals(Action_Enum.startOtherActivity))
|
||||
{
|
||||
returnString.append(": " + parameter2.replace(Action.intentPairSeperator, "/"));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.sendTextMessage))
|
||||
else if (this.getAction().equals(Action_Enum.sendTextMessage))
|
||||
{
|
||||
String[] components = parameter2.split(Actions.smsSeparator);
|
||||
if(components.length >= 2)
|
||||
if (components.length >= 2)
|
||||
{
|
||||
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.toNumber) + " " + components[0]);
|
||||
|
||||
returnString.append(". " + Miscellaneous.getAnyContext().getResources().getString(R.string.message) + ": " + components[1]);
|
||||
}
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.setScreenBrightness))
|
||||
else if (this.getAction().equals(Action_Enum.setScreenBrightness))
|
||||
{
|
||||
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.to) + " ");
|
||||
|
||||
if(parameter1)
|
||||
if (parameter1)
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.brightnessAuto));
|
||||
else
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.brightnessManual));
|
||||
|
||||
returnString.append(" / " + Integer.parseInt(parameter2) + "%");
|
||||
}
|
||||
else if (this.getAction().equals(Action_Enum.closeNotification))
|
||||
{
|
||||
returnString.append(" " + Miscellaneous.getAnyContext().getResources().getString(R.string.from) + " ");
|
||||
|
||||
String parts[] = this.getParameter2().split(Action.actionParameter2Split);
|
||||
if (parts[0].equals("-1"))
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.anyApp));
|
||||
else
|
||||
if (parameter2 != null && parameter2.length() > 0)
|
||||
returnString.append(parts[0]);
|
||||
|
||||
if (!StringUtils.isBlank(parts[2]))
|
||||
returnString.append(", " + Miscellaneous.getAnyContext().getResources().getString(R.string.title) + " " + parts[1] + " " + parts[2]);
|
||||
|
||||
if (!StringUtils.isBlank(parts[3]))
|
||||
returnString.append(", " + Miscellaneous.getAnyContext().getResources().getString(R.string.text) + " " + parts[2] + " " + parts[3]);
|
||||
|
||||
}
|
||||
else if (parameter2 != null && parameter2.length() > 0)
|
||||
returnString.append(": " + parameter2.replace(Action.actionParameter2Split, "; "));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
returnString.append(": " + Miscellaneous.getAnyContext().getResources().getString(R.string.error));
|
||||
}
|
||||
|
||||
return returnString.toString();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user