1
0
Fork 0

Powers: now all fields are optional, except the names

Made display scrollable
This commit is contained in:
kauron 2015-07-19 19:12:38 +02:00
parent 3d794a925a
commit 8f9f27a8c4
3 changed files with 168 additions and 152 deletions

View file

@ -59,13 +59,15 @@ class Power implements Serializable{
String getKeywords() {return keywords;} String getKeywords() {return keywords;}
String getTypeString() {return ACTIONS[action];} String getActionString() {return ACTIONS[action];}
String getFrequencyString() {return FREQ[freq];} String getFrequencyString() {return FREQ[freq];}
String getRangeString() {return RANGES[range];} String getRangeString() {return RANGES[range];}
int getAtk() {return atk;} int getAtk() {return atk;}
int getDef() {return def;} int getDef() {return def;}
int getFreq() {return freq;} int getFreq() {return freq;}
int getAction() {return action;}
int getRange() {return range;}
String getDistance() {return distance;} String getDistance() {return distance;}
String getName(){return name;} String getName(){return name;}

View file

@ -577,13 +577,30 @@ public class ShowPlayer extends ActionBarActivity {
nameText.setBackgroundColor(color); nameText.setBackgroundColor(color);
((TextView) nameText).setText(power.getName()); ((TextView) nameText).setText(power.getName());
((TextView) dialog.findViewById(R.id.typeText)).setText(power.getTypeString());
if (power.getAction() != 0)
((TextView) dialog.findViewById(R.id.actionText)).setText(power.getActionString());
else dialog.findViewById(R.id.actionText).setVisibility(View.GONE);
if (power.getRange() != 0)
((TextView) dialog.findViewById(R.id.rangeText)).setText(power.getRangeString() + " "); ((TextView) dialog.findViewById(R.id.rangeText)).setText(power.getRangeString() + " ");
else dialog.findViewById(R.id.rangeText).setVisibility(View.GONE);
if (power.getFreq() != 0)
((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);
((TextView) dialog.findViewById(R.id.keywordsText)).setText(power.getKeywords()); ((TextView) dialog.findViewById(R.id.keywordsText)).setText(power.getKeywords());
((TextView) dialog.findViewById(R.id.distanceText)).setText(String.valueOf(power.getDistance())); ((TextView) dialog.findViewById(R.id.distanceText)).setText(String.valueOf(power.getDistance()));
if (!power.getObjective().isEmpty())
((TextView) dialog.findViewById(R.id.objectiveText)).setText(power.getObjective()); ((TextView) dialog.findViewById(R.id.objectiveText)).setText(power.getObjective());
else dialog.findViewById(R.id.objectiveLayout).setVisibility(View.GONE);
if (!power.getImpact().isEmpty())
((TextView) dialog.findViewById(R.id.impactText)).setText(power.getImpact()); ((TextView) dialog.findViewById(R.id.impactText)).setText(power.getImpact());
else dialog.findViewById(R.id.impactLayout).setVisibility(View.GONE);
((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); String[] attack = getResources().getStringArray(R.array.attack);

View file

@ -19,21 +19,27 @@
android:textColor="@color/white" android:textColor="@color/white"
android:id="@+id/nameText" /> android:id="@+id/nameText" />
<RelativeLayout <ScrollView android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_marginBottom="@dimen/activity_vertical_margin" android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Daily" tools:text="Daily"
android:id="@+id/freqText" android:id="@+id/freqText"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginRight="25dp" android:layout_marginRight="25dp"
android:textColor="@color/black" android:textColor="@color/black"
android:textStyle="bold" /> android:textStyle="bold" />
@ -44,10 +50,13 @@
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Fire, arcana" tools:text="Fire, arcana"
android:id="@+id/keywordsText" android:id="@+id/keywordsText"
android:layout_toRightOf="@+id/freqText"
android:textColor="@color/black" android:textColor="@color/black"
android:layout_toEndOf="@+id/freqText"
android:textStyle="bold" /> android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -55,10 +64,7 @@
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Standard action" tools:text="Standard action"
android:textColor="@color/black" android:textColor="@color/black"
android:id="@+id/typeText" android:id="@+id/actionText"
android:layout_below="@+id/keywordsText"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginRight="25dp" android:layout_marginRight="25dp"
android:textStyle="bold" /> android:textStyle="bold" />
@ -69,18 +75,19 @@
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Ranged " tools:text="Ranged "
android:id="@+id/rangeText" android:id="@+id/rangeText"
android:textStyle="bold" android:textStyle="bold"/>
android:layout_alignTop="@+id/typeText"
android:layout_toRightOf="@+id/typeText"
android:layout_toEndOf="@+id/typeText" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/black" android:textColor="@color/black"
tools:text="8" tools:text="8"
android:id="@+id/distanceText" android:id="@+id/distanceText"/>
android:layout_toRightOf="@+id/rangeText" </LinearLayout>
android:layout_alignTop="@+id/rangeText"/>
<LinearLayout
android:id="@+id/objectiveLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView <TextView
android:textColor="@color/black" android:textColor="@color/black"
@ -90,11 +97,22 @@
android:text="@string/objective" android:text="@string/objective"
android:paddingRight="3sp" android:paddingRight="3sp"
android:id="@+id/objective" android:id="@+id/objective"
android:layout_below="@+id/distanceText"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="one creature"
android:textColor="@color/black"
android:id="@+id/objectiveText"/>
</LinearLayout>
<LinearLayout
android:id="@+id/attackLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -103,10 +121,22 @@
android:paddingRight="3sp" android:paddingRight="3sp"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/black" android:textColor="@color/black"
android:id="@+id/attack" android:id="@+id/attack"/>
android:layout_below="@+id/objectiveText"
android:layout_alignParentLeft="true" <TextView
android:layout_alignParentStart="true" /> android:layout_width="wrap_content"
android:textColor="@color/black"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Constitución contra Reflejos"
android:id="@+id/attackText"/>
</LinearLayout>
<LinearLayout
android:id="@+id/impactLayout"
android:background="@color/darkened_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -116,53 +146,23 @@
android:text="@string/impact" android:text="@string/impact"
android:paddingRight="3sp" android:paddingRight="3sp"
android:textStyle="bold" android:textStyle="bold"
android:id="@+id/impact" android:id="@+id/impact"/>
android:layout_below="@+id/attack"
android:background="@color/darkened_text"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:textColor="@color/black"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Constitución contra Reflejos"
android:id="@+id/attackText"
android:layout_below="@+id/objectiveText"
android:layout_toRightOf="@+id/attack"
android:layout_toEndOf="@+id/attack" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="one creature"
android:textColor="@color/black"
android:id="@+id/objectiveText"
android:layout_below="@+id/distanceText"
android:layout_toRightOf="@+id/objective"
android:layout_toEndOf="@+id/objective" />
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/darkened_text"
android:textColor="@color/black" android:textColor="@color/black"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="1d8" tools:text="1d8"
android:id="@+id/impactText" android:id="@+id/impactText"/>
android:layout_below="@+id/attackText" </LinearLayout>
android:layout_toRightOf="@+id/impact"
android:layout_toEndOf="@+id/impact" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:textColor="@color/black" android:textColor="@color/black"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/otherText" android:id="@+id/otherText"
android:layout_below="@+id/impactText" android:layout_below="@+id/impactText"
tools:text="If you are reading this the description has been displayed" tools:text="Other text"/>
android:layout_alignParentLeft="true"/>
<Button <Button
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -171,10 +171,7 @@
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:textStyle="bold" android:textStyle="bold"
android:id="@+id/useButton" android:id="@+id/useButton"
android:layout_gravity="right" android:layout_gravity="right" />
android:layout_below="@+id/otherText" </LinearLayout>
android:layout_alignParentRight="true" </ScrollView>
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout> </LinearLayout>