Fossil Hybrid HR: Make hardcoded strings translatable

This commit is contained in:
Arjan Schrijver 2021-07-16 12:12:58 +02:00 committed by Gitea
parent d4b5796267
commit ceddaa0e8a
4 changed files with 24 additions and 11 deletions

View File

@ -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();
}

View File

@ -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<String, String> getAvailableWidgetTypes(Context context) {
LinkedHashMap<String, String> 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;
}

View File

@ -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" />
</RelativeLayout>
<RelativeLayout
@ -49,20 +49,20 @@
android:id="@+id/button_set_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Select background image" />
android:text="@string/button_watchface_select_image" />
<Button
android:id="@+id/button_add_widget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add widget" />
android:text="@string/button_watchface_add_widget" />
<Button
android:id="@+id/button_watchface_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="Watchface settings" />
android:text="@string/button_watchface_settings" />
</LinearLayout>
</ScrollView>

View File

@ -1204,4 +1204,15 @@
<string name="qhybrid_pref_title_external_intents">Allow dangerous external intents</string>
<string name="qhybrid_pref_summary_external_intents">Allows other Android apps to upload/overwrite files</string>
<string name="devicetype_amazfit_trex_pro">Amazfit T-Rex Pro</string>
<string name="button_watchface_edit_name">Edit name</string>
<string name="button_watchface_select_image">Select background image</string>
<string name="button_watchface_add_widget">Add widget</string>
<string name="button_watchface_settings">Watchface settings</string>
<string name="watchface_dialog_title_set_name">Set watchface name</string>
<string name="watchface_toast_settings_incomplete">Settings incomplete, widget not added</string>
<string name="watchface_dialog_title_add_widget">Add widget</string>
<string name="watchface_widget_type_date">Date</string>
<string name="watchface_widget_type_weather">Weather</string>
<string name="watchface_widget_type_steps">Steps</string>
<string name="watchface_widget_type_heart_rate">Heart rate</string>
</resources>