Power: added extra field for other information
This commit is contained in:
parent
84c0d8abb3
commit
383341c72a
7 changed files with 55 additions and 25 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"/>
|
||||
|
||||
<EditText
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -51,11 +50,12 @@
|
|||
android:layout_alignEnd="@+id/nameEdit"
|
||||
android:layout_toRightOf="@+id/keywordsText"
|
||||
android:layout_toEndOf="@+id/keywordsText"
|
||||
android:hint="@string/keywordsPowerHint" />
|
||||
android:inputType="textCapSentences" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/name"
|
||||
android:id="@+id/nameText"
|
||||
|
@ -70,6 +70,7 @@
|
|||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/keywords"
|
||||
android:id="@+id/keywordsText"
|
||||
|
@ -122,7 +123,6 @@
|
|||
android:ems="10"
|
||||
android:id="@+id/distanceNumEdit"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/number10"
|
||||
android:focusableInTouchMode="true" />
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -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" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/impact"
|
||||
android:id="@+id/attackText"
|
||||
android:id="@+id/impactText"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_below="@+id/vsLayout"
|
||||
android:layout_alignParentLeft="true"
|
||||
|
@ -189,6 +188,7 @@
|
|||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/objective"
|
||||
android:id="@+id/objectiveText"
|
||||
|
@ -203,14 +203,38 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/objectiveEdit"
|
||||
android:hint="@string/objectiveHint"
|
||||
android:layout_below="@+id/distanceLayout"
|
||||
android:layout_alignParentRight="true"
|
||||
android:capitalize="sentences"
|
||||
android:inputType="textMultiLine"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_toRightOf="@+id/objectiveText"
|
||||
android:layout_toEndOf="@+id/objectiveText" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/other"
|
||||
android:id="@+id/otherText"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_below="@+id/impactEdit"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignBottom="@+id/otherEdit"
|
||||
android:layout_marginRight="10dp" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textMultiLine"
|
||||
android:ems="10"
|
||||
android:id="@+id/otherEdit"
|
||||
android:layout_below="@+id/impactEdit"
|
||||
android:layout_alignRight="@+id/vsLayout"
|
||||
android:layout_alignEnd="@+id/vsLayout"
|
||||
android:layout_alignLeft="@+id/impactEdit"
|
||||
android:layout_alignStart="@+id/impactEdit" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -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"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -198,4 +198,7 @@
|
|||
<string name="save_changes">¿Guardar los cambios?</string>
|
||||
<string name="no">No</string>
|
||||
<string name="power_same_name">No puede ser guardado. Otro poder ya tiene ese nombre</string>
|
||||
<string name="import_completed">Importación completada sin errores</string>
|
||||
<string name="vs">contra</string>
|
||||
<string name="power_already_exists">El poder %s ya existe y no ha sido importado</string>
|
||||
</resources>
|
|
@ -54,7 +54,7 @@
|
|||
<string name="powerNameHint">Blasting charm</string>
|
||||
<string name="keywordsPowerHint">Magic, fire, weapon</string>
|
||||
<string name="number10" translatable="false">10</string>
|
||||
<string name="vs" translatable="false">VS</string>
|
||||
<string name="vs">VS</string>
|
||||
<string name="save">Save</string>
|
||||
<string name="impactEditHint">1d6 + mod. CHAR and you become invisible</string>
|
||||
<string name="impact">Impact</string>
|
||||
|
@ -211,7 +211,7 @@
|
|||
<string name="save_changes">Save changes?</string>
|
||||
<string name="no">No</string>
|
||||
<string name="power_same_name">Can\'t be saved. Another power already has that name.</string>
|
||||
<string name="power_already_exists">The power %s already exists and hasn\'t been copied</string>
|
||||
<string name="power_already_exists">The power %s already exists and hasn\'t been imported</string>
|
||||
<string name="import_completed">Import completed without errors</string>
|
||||
|
||||
</resources>
|
||||
|
|
Reference in a new issue