From bf5e70f7494b448fab95e16daeb704018871bf3f Mon Sep 17 00:00:00 2001 From: AlbrechtRoehm Date: Tue, 24 Jan 2017 11:52:51 +0100 Subject: [PATCH] Change strings in checkInReward to make them translatable --- Habitica/res/values/strings.xml | 2 ++ .../helpers/PopupNotificationsManager.java | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Habitica/res/values/strings.xml b/Habitica/res/values/strings.xml index 863adaf99..2df5402c6 100644 --- a/Habitica/res/values/strings.xml +++ b/Habitica/res/values/strings.xml @@ -473,4 +473,6 @@ To start, which parts of your life do you want to improve? It seems like you have the Developer option \"Don\'t keep Activities\" active. Currently this option causes issues with the habitica app, so we suggest disabling it. Inbox Frequently Asked Questions + You earned a %1$s as a reward for your devotion to improving your life. + Your next prize unlocks at %1$d Check-Ins diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/helpers/PopupNotificationsManager.java b/Habitica/src/main/java/com/habitrpg/android/habitica/helpers/PopupNotificationsManager.java index 86be64a8b..16c896344 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/helpers/PopupNotificationsManager.java +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/helpers/PopupNotificationsManager.java @@ -1,5 +1,6 @@ package com.habitrpg.android.habitica.helpers; +import android.content.Context; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; @@ -28,12 +29,14 @@ public class PopupNotificationsManager { private Map seenNotifications; private APIHelper apiHelper; private static PopupNotificationsManager instance; + private Context context; // @TODO: A queue for displaying alert dialogues private PopupNotificationsManager(APIHelper apiHelper) { this.apiHelper = apiHelper; this.seenNotifications = new HashMap<>(); + context.getApplicationContext(); } public static PopupNotificationsManager getInstance(APIHelper apiHelper) { @@ -65,17 +68,17 @@ public class PopupNotificationsManager { earnedString += ", "; } } - youEarnedMessage = "You earned a " + earnedString + " as a reward for your devotion to improving your life."; + youEarnedMessage = context.getString(R.string.checkInRewardEarned,earnedString); } } DataBindingUtils.loadImage(imageView, imageKey); - String message = "Your next prize unlocks at " + notification.data.nextRewardAt + " Check-Ins"; - TextView nextUnlockTextView = (TextView) view.findViewById(R.id.next_unlock_message); - nextUnlockTextView.setText(message); + TextView youEarnedTexView = (TextView) view.findViewById(R.id.you_earned_message); + youEarnedTexView.setText(youEarnedMessage); - TextView youEarnedTexView = (TextView) view.findViewById(R.id.you_earned_message); - youEarnedTexView.setText(youEarnedMessage); + String message = context.getString(R.string.nextPrizeUnlocks,notification.data.nextRewardAt); + TextView nextUnlockTextView = (TextView) view.findViewById(R.id.next_unlock_message); + nextUnlockTextView.setText(message); Button confirmButton = (Button) view.findViewById(R.id.confirm_button);