Localize notification actions

This commit is contained in:
José Rebelo 2025-01-12 18:09:17 +00:00
parent 32721afffe
commit 69e8b678c2
6 changed files with 15 additions and 11 deletions

View File

@ -219,20 +219,20 @@ public class DebugActivity extends AbstractGBActivity {
// DISMISS action
NotificationSpec.Action dismissAction = new NotificationSpec.Action();
dismissAction.title = "Dismiss";
dismissAction.title = getString(R.string.dismiss);
dismissAction.type = NotificationSpec.Action.TYPE_SYNTECTIC_DISMISS;
notificationSpec.attachedActions.add(dismissAction);
if (notificationSpec.type == NotificationType.GENERIC_SMS) {
// REPLY action
NotificationSpec.Action replyAction = new NotificationSpec.Action();
replyAction.title = "Reply";
replyAction.title = getString(R.string._pebble_watch_reply);
replyAction.type = NotificationSpec.Action.TYPE_SYNTECTIC_REPLY_PHONENR;
notificationSpec.attachedActions.add(replyAction);
} else if (notificationSpec.type == NotificationType.CONVERSATIONS) {
// REPLY action
NotificationSpec.Action replyAction = new NotificationSpec.Action();
replyAction.title = "Reply";
replyAction.title = getString(R.string._pebble_watch_reply);
replyAction.type = NotificationSpec.Action.TYPE_WEARABLE_REPLY;
notificationSpec.attachedActions.add(replyAction);
}

View File

@ -24,6 +24,7 @@ import android.content.Intent;
import java.util.ArrayList;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
import nodomain.freeyourgadget.gadgetbridge.model.NotificationType;
@ -55,15 +56,15 @@ public class AlarmClockReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (ALARM_ALERT_ACTION.equals(action) || GOOGLE_CLOCK_ALARM_ALERT_ACTION.equals(action)) {
sendAlarm(true);
sendAlarm(context, true);
} else if (ALARM_DONE_ACTION.equals(action) || GOOGLE_CLOCK_ALARM_DONE_ACTION.equals(action)) {
sendAlarm(false);
sendAlarm(context, false);
}
}
private synchronized void sendAlarm(boolean on) {
private synchronized void sendAlarm(Context context, boolean on) {
dismissLastAlarm();
if (on) {
NotificationSpec notificationSpec = new NotificationSpec();
@ -75,7 +76,7 @@ public class AlarmClockReceiver extends BroadcastReceiver {
// DISMISS ALL action
NotificationSpec.Action dismissAllAction = new NotificationSpec.Action();
dismissAllAction.title = "Dismiss All";
dismissAllAction.title = context.getString(R.string.notifications_dismiss_all);
dismissAllAction.type = NotificationSpec.Action.TYPE_SYNTECTIC_DISMISS_ALL;
notificationSpec.attachedActions.add(dismissAllAction);

View File

@ -33,6 +33,7 @@ import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
import nodomain.freeyourgadget.gadgetbridge.database.PeriodicExporter;
@ -148,7 +149,7 @@ public class IntentApiReceiver extends BroadcastReceiver {
if (notificationSpec.type == NotificationType.GENERIC_SMS) {
// REPLY action
NotificationSpec.Action replyAction = new NotificationSpec.Action();
replyAction.title = "Reply";
replyAction.title = context.getString(R.string._pebble_watch_reply);
replyAction.type = NotificationSpec.Action.TYPE_SYNTECTIC_REPLY_PHONENR;
notificationSpec.attachedActions.add(replyAction);
}

View File

@ -460,7 +460,7 @@ public class NotificationListener extends NotificationListenerService {
// DISMISS action
NotificationSpec.Action dismissAction = new NotificationSpec.Action();
dismissAction.title = "Dismiss";
dismissAction.title = getString(R.string.dismiss);
dismissAction.type = NotificationSpec.Action.TYPE_SYNTECTIC_DISMISS;
notificationSpec.attachedActions.add(dismissAction);

View File

@ -31,6 +31,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
import nodomain.freeyourgadget.gadgetbridge.model.NotificationType;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
@ -77,13 +78,13 @@ public class SMSReceiver extends BroadcastReceiver {
// REPLY action
NotificationSpec.Action replyAction = new NotificationSpec.Action();
replyAction.title = "Reply";
replyAction.title = context.getString(R.string._pebble_watch_reply);
replyAction.type = NotificationSpec.Action.TYPE_SYNTECTIC_REPLY_PHONENR;
notificationSpec.attachedActions.add(replyAction);
// DISMISS ALL action
NotificationSpec.Action dismissAllAction = new NotificationSpec.Action();
dismissAllAction.title = "Dismiss All";
dismissAllAction.title = context.getString(R.string.notifications_dismiss_all);
dismissAllAction.type = NotificationSpec.Action.TYPE_SYNTECTIC_DISMISS_ALL;
notificationSpec.attachedActions.add(dismissAllAction);

View File

@ -1295,6 +1295,7 @@
<string name="Delete">Delete</string>
<string name="ok">OK</string>
<string name="dismiss">Dismiss</string>
<string name="notifications_dismiss_all">Dismiss All</string>
<string name="start">Start</string>
<string name="stop">Stop</string>
<string name="status">Status</string>