export quick action name if custom

This commit is contained in:
veliymolfar 2020-02-20 14:18:38 +02:00
parent e3c9cce6b1
commit 89df698065
2 changed files with 9 additions and 3 deletions

View file

@ -960,7 +960,9 @@ public class SettingsHelper {
String paramsString = object.getString("params");
HashMap<String, String> params = gson.fromJson(paramsString, type);
QuickAction quickAction = new QuickAction(actionType);
quickAction.setName(name);
if (!name.isEmpty()) {
quickAction.setName(name);
}
quickAction.setParams(params);
items.add(quickAction);
}
@ -986,7 +988,8 @@ public class SettingsHelper {
try {
for (QuickAction action : items) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("name", action.getName(app));
jsonObject.put("name", action.hasCustomName(app)
? action.getName(app) : "");
jsonObject.put("type", action.getType());
jsonObject.put("params", gson.toJson(action.getParams(), type));
jsonArray.put(jsonObject);

View file

@ -157,5 +157,8 @@ public class QuickAction {
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
}
}
public boolean hasCustomName(Context context) {
return !getName(context).equals(context.getString(nameRes));
}
}