Put all strings into res -> German translation should be relatively easy

This commit is contained in:
=
2017-08-03 14:07:53 +02:00
parent 50cbdb6688
commit 0437b0178e
40 changed files with 4469 additions and 7325 deletions

View File

@ -3,6 +3,7 @@ package de.frajul.endlessroll.views;
import android.content.Context;
import android.graphics.Typeface;
import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
@ -34,7 +35,7 @@ public class PriceButton {
currencyView = (ImageView) layout.findViewById(R.id.price_button_currency);
}
public void init(String title, int price, @DrawableRes int currencyDrawable) {
public void init(@StringRes int title, int price, @DrawableRes int currencyDrawable) {
this.title.setText(title);
this.price.setText(price + "");
this.currencyView.setImageDrawable(context.getResources().getDrawable(currencyDrawable));

View File

@ -47,10 +47,10 @@ public class ToolInspector implements View.OnClickListener {
public void update(ToolType toolType, boolean locked) {
this.toolType = toolType;
this.locked = locked;
this.title.setText(locked ? "???" : toolType.getName());
this.title.setText(locked ? R.string.tool_name_unknown : toolType.getName());
this.imageView.setImageDrawable(gameActivity.getResources().getDrawable(
locked ? R.drawable.tools_lockedbutton : toolType.getButtonDrawable()));
priceButton.init("Buy", toolType.getPrice(), R.drawable.currency_star);
priceButton.init(R.string.price_button_buy, toolType.getPrice(), R.drawable.currency_star);
priceButton.setLayoutVisible(toolType.isBought() || locked ? View.GONE : View.VISIBLE);
priceButton.setLayoutEnabled(toolType.getPrice() <= gameActivity.getUser().getStarCount());

View File

@ -48,12 +48,13 @@ public class ToolUpgradeView implements View.OnClickListener {
this.upgrade = toolUpgrade;
this.toolBought = toolBought;
this.availableEnergy = availableEnergy;
this.title.setText(
toolUpgrade.getType().getName() + " (Lv" + toolUpgrade.getCurrentLevel() + ")");
this.title.setText(context.getString(R.string.tool_upgrade_title_format_sd,
context.getString(toolUpgrade.getType().getName()), toolUpgrade.getCurrentLevel()));
this.imageView.setImageDrawable(
context.getResources().getDrawable(toolUpgrade.getType().getDrawable()));
updateValueViews();
priceButton.init("Upgrade", toolUpgrade.getPrice(), R.drawable.currency_energy);
priceButton.init(R.string.price_button_upgrade, toolUpgrade.getPrice(),
R.drawable.currency_energy);
priceButton.setLayoutVisible(isAtMaxLevel() ? View.GONE : View.VISIBLE);
priceButton.setLayoutEnabled(toolBought && toolUpgrade.getPrice() <= availableEnergy);
}
@ -66,8 +67,8 @@ public class ToolUpgradeView implements View.OnClickListener {
String unit = upgrade.getType().getUnit();
valueOld.setText(upgrade.getValueAtCurrentLevel() + unit);
valueNew.setText(upgrade.getValueAtNextLevel() + unit);
if(isAtMaxLevel())
valueNew.setText("Max.");
if (isAtMaxLevel())
valueNew.setText(R.string.tool_upgrade_value_max);
}
private boolean isAtMaxLevel() {