From ceddaa0e8a154bbe452d38963ac8c9a79edd90b4 Mon Sep 17 00:00:00 2001 From: Arjan Schrijver Date: Fri, 16 Jul 2021 12:12:58 +0200 Subject: [PATCH] Fossil Hybrid HR: Make hardcoded strings translatable --- .../qhybrid/HybridHRWatchfaceDesignerActivity.java | 6 +++--- .../devices/qhybrid/HybridHRWatchfaceWidget.java | 10 ++++++---- .../layout/activity_hybridhr_watchface_designer.xml | 8 ++++---- app/src/main/res/values/strings.xml | 11 +++++++++++ 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceDesignerActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceDesignerActivity.java index 4567668cd..d906b3f2c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceDesignerActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceDesignerActivity.java @@ -174,7 +174,7 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem setWatchfaceName(input.getText().toString()); } }) - .setTitle("Set watchface name") + .setTitle(R.string.watchface_dialog_title_set_name) .show(); } else if (v.getId() == R.id.button_set_background) { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); @@ -436,7 +436,7 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem selectedPosX = Integer.parseInt(posX.getText().toString()); selectedPosY = Integer.parseInt(posY.getText().toString()); } catch (NumberFormatException e) { - GB.toast("Settings incomplete, widget not added", Toast.LENGTH_SHORT, GB.WARN); + GB.toast(getString(R.string.watchface_toast_settings_incomplete), Toast.LENGTH_SHORT, GB.WARN); LOG.warn("Error parsing input", e); return; } @@ -453,7 +453,7 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem renderWatchfacePreview(); } }) - .setTitle("Add widget") + .setTitle(R.string.watchface_dialog_title_add_widget) .show(); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceWidget.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceWidget.java index c21833762..1b1ec1156 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceWidget.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceWidget.java @@ -23,6 +23,8 @@ import android.graphics.BitmapFactory; import java.io.IOException; import java.util.LinkedHashMap; +import nodomain.freeyourgadget.gadgetbridge.R; + public class HybridHRWatchfaceWidget { private String widgetType; private int posX; @@ -36,10 +38,10 @@ public class HybridHRWatchfaceWidget { public static LinkedHashMap getAvailableWidgetTypes(Context context) { LinkedHashMap widgetTypes = new LinkedHashMap<>(); - widgetTypes.put("widgetDate", "Date"); - widgetTypes.put("widgetWeather", "Weather"); - widgetTypes.put("widgetSteps", "Steps"); - widgetTypes.put("widgetHR", "Heart rate"); + widgetTypes.put("widgetDate", context.getString(R.string.watchface_widget_type_date)); + widgetTypes.put("widgetWeather", context.getString(R.string.watchface_widget_type_weather)); + widgetTypes.put("widgetSteps", context.getString(R.string.watchface_widget_type_steps)); + widgetTypes.put("widgetHR", context.getString(R.string.watchface_widget_type_heart_rate)); return widgetTypes; } diff --git a/app/src/main/res/layout/activity_hybridhr_watchface_designer.xml b/app/src/main/res/layout/activity_hybridhr_watchface_designer.xml index d40eacc96..909eeba4f 100644 --- a/app/src/main/res/layout/activity_hybridhr_watchface_designer.xml +++ b/app/src/main/res/layout/activity_hybridhr_watchface_designer.xml @@ -29,7 +29,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" - android:text="Edit name" /> + android:text="@string/button_watchface_edit_name" /> + android:text="@string/button_watchface_select_image" />