1
0
Fork 0

PowerDisplay: impact not showing and blank fields not hiding fixed

This commit is contained in:
kauron 2015-07-19 23:49:37 +02:00
parent c8c0306e45
commit c87641a921
3 changed files with 22 additions and 9 deletions

View file

@ -19,9 +19,9 @@ import com.nispok.snackbar.SnackbarManager;
public class PowerEditor extends ActionBarActivity { public class PowerEditor extends ActionBarActivity {
private EditText [] edits = new EditText[6]; 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 int[] ints = new int[5];
private String originalName; private String originalName;

View file

@ -590,8 +590,13 @@ public class ShowPlayer extends ActionBarActivity {
((TextView) dialog.findViewById(R.id.freqText)).setText(power.getFrequencyString()); ((TextView) dialog.findViewById(R.id.freqText)).setText(power.getFrequencyString());
else dialog.findViewById(R.id.freqText).setVisibility(View.GONE); else dialog.findViewById(R.id.freqText).setVisibility(View.GONE);
((TextView) dialog.findViewById(R.id.keywordsText)).setText(power.getKeywords()); if (!power.getKeywords().isEmpty())
((TextView) dialog.findViewById(R.id.distanceText)).setText(String.valueOf(power.getDistance())); ((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()) if (!power.getObjective().isEmpty())
((TextView) dialog.findViewById(R.id.objectiveText)).setText(power.getObjective()); ((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()); ((TextView) dialog.findViewById(R.id.otherText)).setText(power.getOther());
String[] attack = getResources().getStringArray(R.array.attack); if (power.getAtk() != 0) {
String[] defense = getResources().getStringArray(R.array.defense); String[] attack = getResources().getStringArray(R.array.attack);
((TextView) dialog.findViewById(R.id.impactText)).setText(attack[power.getAtk()] String[] defense;
+ " " + getResources().getString(R.string.vs) + " " + defense[power.getDef()]); 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); final Button useButton = (Button) dialog.findViewById(R.id.useButton);

View file

@ -129,7 +129,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Constitución contra Reflejos" tools:text="Constitución contra Reflejos"
android:id="@+id/impactText"/> android:id="@+id/attackText"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout