diff --git a/app/src/main/java/com/kauron/dungeonmanager/PowerEditor.java b/app/src/main/java/com/kauron/dungeonmanager/PowerEditor.java index dad7161..0ca6642 100644 --- a/app/src/main/java/com/kauron/dungeonmanager/PowerEditor.java +++ b/app/src/main/java/com/kauron/dungeonmanager/PowerEditor.java @@ -19,9 +19,9 @@ import com.nispok.snackbar.SnackbarManager; public class PowerEditor extends ActionBarActivity { private EditText [] edits = new EditText[6]; - private Spinner [] spinners = new Spinner[6]; + private Spinner [] spinners = new Spinner[5]; - private String[] strings = new String[5]; + private String[] strings = new String[6]; private int[] ints = new int[5]; private String originalName; diff --git a/app/src/main/java/com/kauron/dungeonmanager/ShowPlayer.java b/app/src/main/java/com/kauron/dungeonmanager/ShowPlayer.java index 0a51c09..bca5399 100644 --- a/app/src/main/java/com/kauron/dungeonmanager/ShowPlayer.java +++ b/app/src/main/java/com/kauron/dungeonmanager/ShowPlayer.java @@ -590,8 +590,13 @@ public class ShowPlayer extends ActionBarActivity { ((TextView) dialog.findViewById(R.id.freqText)).setText(power.getFrequencyString()); else dialog.findViewById(R.id.freqText).setVisibility(View.GONE); - ((TextView) dialog.findViewById(R.id.keywordsText)).setText(power.getKeywords()); - ((TextView) dialog.findViewById(R.id.distanceText)).setText(String.valueOf(power.getDistance())); + if (!power.getKeywords().isEmpty()) + ((TextView) dialog.findViewById(R.id.keywordsText)).setText(power.getKeywords()); + else dialog.findViewById(R.id.keywordsText).setVisibility(View.GONE); + + if (!power.getDistance().isEmpty()) + ((TextView) dialog.findViewById(R.id.distanceText)).setText(power.getDistance()); + else dialog.findViewById(R.id.distanceText).setVisibility(View.GONE); if (!power.getObjective().isEmpty()) ((TextView) dialog.findViewById(R.id.objectiveText)).setText(power.getObjective()); @@ -603,10 +608,18 @@ public class ShowPlayer extends ActionBarActivity { ((TextView) dialog.findViewById(R.id.otherText)).setText(power.getOther()); - String[] attack = getResources().getStringArray(R.array.attack); - String[] defense = getResources().getStringArray(R.array.defense); - ((TextView) dialog.findViewById(R.id.impactText)).setText(attack[power.getAtk()] - + " " + getResources().getString(R.string.vs) + " " + defense[power.getDef()]); + if (power.getAtk() != 0) { + String[] attack = getResources().getStringArray(R.array.attack); + String[] defense; + String text = attack[power.getAtk()]; + if (power.getDef() != 0) { + defense = getResources().getStringArray(R.array.defense); + text += " " + getString(R.string.vs) + " " + defense[power.getDef()]; + } + ((TextView) dialog.findViewById(R.id.attackText)).setText(text); + } else { + dialog.findViewById(R.id.attackLayout).setVisibility(View.GONE); + } final Button useButton = (Button) dialog.findViewById(R.id.useButton); diff --git a/app/src/main/res/layout/attack_display.xml b/app/src/main/res/layout/attack_display.xml index 64d52fc..f2e3803 100644 --- a/app/src/main/res/layout/attack_display.xml +++ b/app/src/main/res/layout/attack_display.xml @@ -129,7 +129,7 @@ android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" tools:text="ConstituciĆ³n contra Reflejos" - android:id="@+id/impactText"/> + android:id="@+id/attackText"/>