Added day of week placeholder

This commit is contained in:
M66B 2023-10-08 16:45:21 +02:00
parent e3207ef0b7
commit 08a7011335
4 changed files with 11 additions and 0 deletions

View File

@ -48,12 +48,14 @@ import org.json.JSONObject;
import java.io.Serializable;
import java.text.Collator;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
@ -211,6 +213,8 @@ public class EntityAnswer implements Serializable {
}
}
text = text.replace("$weekday$", new SimpleDateFormat("EEEE").format(new Date()));
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
for (String key : prefs.getAll().keySet())
if (key.startsWith(PREF_PLACEHOLDER)) {

View File

@ -365,6 +365,9 @@ public class FragmentAnswer extends FragmentBase {
} else if (itemId == R.id.menu_placeholder_date) {
onMenuPlaceholder("$date$");
return true;
} else if (itemId == R.id.menu_placeholder_weekday) {
onMenuPlaceholder("$weekday$");
return true;
}
}
return super.onOptionsItemSelected(item);

View File

@ -25,6 +25,9 @@
<item
android:id="@+id/menu_placeholder_date"
android:title="@string/title_answer_placeholder_date" />
<item
android:id="@+id/menu_placeholder_weekday"
android:title="@string/title_answer_placeholder_weekday" />
</menu>
</item>
</menu>

View File

@ -1907,6 +1907,7 @@
<string name="title_answer_placeholder_firstname">Sender\'s first name</string>
<string name="title_answer_placeholder_lastname">Sender\'s last name</string>
<string name="title_answer_placeholder_date">Current date</string>
<string name="title_answer_placeholder_weekday">Day of week</string>
<string name="title_rule_noop">No action</string>
<string name="title_rule_seen">Mark read</string>