Put all strings into res -> German translation should be relatively easy
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package de.frajul.endlessroll.entities.tools;
|
||||
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.StringRes;
|
||||
|
||||
import de.frajul.endlessroll.R;
|
||||
|
||||
@ -10,21 +11,23 @@ import de.frajul.endlessroll.R;
|
||||
|
||||
public enum ToolUpgradeType {
|
||||
|
||||
NONE("None", "", R.drawable.tools_rampbutton), TIME("Time", "s", R.drawable.clock), RADIUS(
|
||||
"Radius", "%", R.drawable.radius), FORCE("Force", "%", R.drawable.magnet_field);
|
||||
NONE(R.string.tool_upgrade_none, "", R.drawable.tools_rampbutton), TIME(R.string.tool_upgrade_time, "s", R.drawable.clock), RADIUS(
|
||||
R.string.tool_upgrade_radius, "%", R.drawable.radius), FORCE(R.string.tool_upgrade_force, "%", R.drawable.magnet_field);
|
||||
|
||||
private String name;
|
||||
@StringRes
|
||||
private int name;
|
||||
private String unit;
|
||||
@DrawableRes
|
||||
private int drawable;
|
||||
|
||||
ToolUpgradeType(String name, String unit, @DrawableRes int drawable) {
|
||||
ToolUpgradeType(@StringRes int name, String unit, @DrawableRes int drawable) {
|
||||
this.name = name;
|
||||
this.unit = unit;
|
||||
this.drawable = drawable;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@StringRes
|
||||
public int getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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() {
|
||||
|
Reference in New Issue
Block a user