Show rule absolute time in list

This commit is contained in:
M66B 2024-01-29 10:57:56 +01:00
parent 5137772fa0
commit 6d8824c7ca
1 changed files with 10 additions and 2 deletions

View File

@ -164,9 +164,17 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
conditions.add(new Condition(context.getString(R.string.title_rule_body),
jcondition.getJSONObject("body").optString("value"),
jcondition.getJSONObject("body").optBoolean("regex")));
if (jcondition.has("date"))
if (jcondition.has("date")) {
String range = null;
JSONObject jdate = jcondition.optJSONObject("date");
if (jdate != null && jdate.has("after") && jdate.has("before")) {
long after = jdate.getLong("after");
long before = jdate.getLong("before");
range = DF.format(after) + " - " + DF.format(before);
}
conditions.add(new Condition(context.getString(R.string.title_rule_time_abs),
null, null));
range, null));
}
if (jcondition.has("schedule")) {
String range = null;
JSONObject jschedule = jcondition.optJSONObject("schedule");