From 383341c72a75f043a0299e1f72e5c688704db347 Mon Sep 17 00:00:00 2001 From: kauron Date: Sun, 19 Jul 2015 20:33:10 +0200 Subject: [PATCH] Power: added extra field for other information --- .../java/com/kauron/dungeonmanager/Power.java | 16 ++++--- .../kauron/dungeonmanager/PowerEditor.java | 5 +- .../com/kauron/dungeonmanager/ShowPlayer.java | 2 +- .../main/res/layout/activity_power_editor.xml | 48 ++++++++++++++----- app/src/main/res/layout/attack_display.xml | 2 +- app/src/main/res/values-es/strings.xml | 3 ++ app/src/main/res/values/strings.xml | 4 +- 7 files changed, 55 insertions(+), 25 deletions(-) diff --git a/app/src/main/java/com/kauron/dungeonmanager/Power.java b/app/src/main/java/com/kauron/dungeonmanager/Power.java index 2911c55..8d7ee6f 100644 --- a/app/src/main/java/com/kauron/dungeonmanager/Power.java +++ b/app/src/main/java/com/kauron/dungeonmanager/Power.java @@ -27,16 +27,17 @@ class Power implements Serializable{ private boolean used; private int freq, action, range; - private String name, impact, objective, distance; + private String name, impact, objective, distance, other; private String keywords; //fire, spell... private int atk, def; //constants from Player to denote atk and defense Power ( SharedPreferences p ) { - this.name = p.getString("s0", "Name"); - this.keywords = p.getString("s1", "Keywords"); - this.impact = p.getString("s2", "2d10"); - this.distance = p.getString("s3", "10"); - this.objective = p.getString("s4", "One creature"); + this.name = p.getString("s0", "Power"); + this.keywords = p.getString("s1", ""); + this.impact = p.getString("s2", ""); + this.distance = p.getString("s3", ""); + this.objective = p.getString("s4", ""); + this.other = p.getString("s5", ""); this.used = p.getBoolean("used", false); @@ -73,7 +74,7 @@ class Power implements Serializable{ String getName(){return name;} String getImpact() {return impact;} String getObjective() {return objective;} - String getOther() {return "";} + String getOther() {return other;} //TODO: add other element to include further description @@ -111,6 +112,7 @@ class Power implements Serializable{ e.putString("s2", impact); e.putString("s3", distance); e.putString("s4", objective); + e.putString("s5", other); e.putBoolean("used", used); e.putInt("i0", freq); e.putInt("i1", range); diff --git a/app/src/main/java/com/kauron/dungeonmanager/PowerEditor.java b/app/src/main/java/com/kauron/dungeonmanager/PowerEditor.java index 3f8c172..5e7b81b 100644 --- a/app/src/main/java/com/kauron/dungeonmanager/PowerEditor.java +++ b/app/src/main/java/com/kauron/dungeonmanager/PowerEditor.java @@ -18,8 +18,8 @@ import com.nispok.snackbar.SnackbarManager; public class PowerEditor extends ActionBarActivity { - private EditText [] edits = new EditText[5]; - private Spinner [] spinners = new Spinner[5]; + private EditText [] edits = new EditText[6]; + private Spinner [] spinners = new Spinner[6]; private String[] strings = new String[5]; private int[] ints = new int[5]; @@ -80,6 +80,7 @@ public class PowerEditor extends ActionBarActivity { edits[2] = (EditText) findViewById(R.id.impactEdit); edits[3] = (EditText) findViewById(R.id.distanceNumEdit); edits[4] = (EditText) findViewById(R.id.objectiveEdit); + edits[5] = (EditText) findViewById(R.id.otherEdit); //Spinners spinners[0] = (Spinner) findViewById(R.id.freqSpinner); diff --git a/app/src/main/java/com/kauron/dungeonmanager/ShowPlayer.java b/app/src/main/java/com/kauron/dungeonmanager/ShowPlayer.java index e2e6e8f..0a51c09 100644 --- a/app/src/main/java/com/kauron/dungeonmanager/ShowPlayer.java +++ b/app/src/main/java/com/kauron/dungeonmanager/ShowPlayer.java @@ -605,7 +605,7 @@ public class ShowPlayer extends ActionBarActivity { String[] attack = getResources().getStringArray(R.array.attack); String[] defense = getResources().getStringArray(R.array.defense); - ((TextView) dialog.findViewById(R.id.attackText)).setText(attack[power.getAtk()] + ((TextView) dialog.findViewById(R.id.impactText)).setText(attack[power.getAtk()] + " " + getResources().getString(R.string.vs) + " " + defense[power.getDef()]); final Button useButton = (Button) dialog.findViewById(R.id.useButton); diff --git a/app/src/main/res/layout/activity_power_editor.xml b/app/src/main/res/layout/activity_power_editor.xml index dbe1a39..d4b97f1 100644 --- a/app/src/main/res/layout/activity_power_editor.xml +++ b/app/src/main/res/layout/activity_power_editor.xml @@ -33,13 +33,12 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/nameEdit" - android:capitalize="sentences" + android:inputType="textShortMessage" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:layout_toEndOf="@+id/keywordsText" - android:layout_toRightOf="@+id/keywordsText" - android:hint="@string/powerNameHint"/> + android:layout_toRightOf="@+id/keywordsText"/> + android:inputType="textCapSentences" /> @@ -167,18 +167,17 @@ android:layout_below="@+id/vsLayout" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" - android:capitalize="sentences" - android:hint="@string/impactEditHint" - android:layout_toRightOf="@+id/attackText" - android:layout_toEndOf="@+id/attackText" /> + android:layout_toRightOf="@+id/impactText" + android:layout_toEndOf="@+id/impactText" /> + + + diff --git a/app/src/main/res/layout/attack_display.xml b/app/src/main/res/layout/attack_display.xml index f2e3803..64d52fc 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/attackText"/> + android:id="@+id/impactText"/> ¿Guardar los cambios? No No puede ser guardado. Otro poder ya tiene ese nombre + Importación completada sin errores + contra + El poder %s ya existe y no ha sido importado \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c7460b7..e5bc454 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -54,7 +54,7 @@ Blasting charm Magic, fire, weapon 10 - VS + VS Save 1d6 + mod. CHAR and you become invisible Impact @@ -211,7 +211,7 @@ Save changes? No Can\'t be saved. Another power already has that name. - The power %s already exists and hasn\'t been copied + The power %s already exists and hasn\'t been imported Import completed without errors