Change strings in checkInReward to make them translatable

This commit is contained in:
AlbrechtRoehm 2017-01-24 11:52:51 +01:00
parent 4c65e79356
commit bf5e70f749
2 changed files with 11 additions and 6 deletions

View file

@ -473,4 +473,6 @@ To start, which parts of your life do you want to improve?</string>
<string name="dont_keep_activities_warning">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.</string>
<string name="inbox">Inbox</string>
<string name="FAQ">Frequently Asked Questions</string>
<string name="checkInRewardEarned">You earned a %1$s as a reward for your devotion to improving your life.</string>
<string name="nextPrizeUnlocks">Your next prize unlocks at %1$d Check-Ins</string>
</resources>

View file

@ -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<String, Boolean> 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);