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());
((TextView) dialog.findViewById(R.id.rangeText)).setText(power.getRangeString() + " "); if (power.getAction() != 0)
((TextView) dialog.findViewById(R.id.freqText)).setText(power.getFrequencyString()); ((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() + " ");
else dialog.findViewById(R.id.rangeText).setVisibility(View.GONE);
if (power.getFreq() != 0)
((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()));
((TextView) dialog.findViewById(R.id.objectiveText)).setText(power.getObjective());
((TextView) dialog.findViewById(R.id.impactText)).setText(power.getImpact()); if (!power.getObjective().isEmpty())
((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());
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,162 +19,159 @@
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_marginBottom="@dimen/activity_vertical_margin" android:layout_height="match_parent">
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView <LinearLayout
android:layout_width="wrap_content" android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_height="wrap_content" android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:textAppearance="?android:attr/textAppearanceSmall" android:layout_marginRight="@dimen/activity_horizontal_margin"
tools:text="Daily" android:orientation="vertical"
android:id="@+id/freqText" android:layout_width="match_parent"
android:layout_alignParentLeft="true" android:layout_height="wrap_content">
android:layout_alignParentStart="true"
android:layout_marginRight="25dp"
android:textColor="@color/black"
android:textStyle="bold" />
<TextView <LinearLayout
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"
tools:text="Fire, arcana"
android:id="@+id/keywordsText"
android:layout_toRightOf="@+id/freqText"
android:textColor="@color/black"
android:layout_toEndOf="@+id/freqText"
android:textStyle="bold" />
<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="Standard action" tools:text="Daily"
android:textColor="@color/black" android:id="@+id/freqText"
android:id="@+id/typeText" android:layout_marginRight="25dp"
android:layout_below="@+id/keywordsText" android:textColor="@color/black"
android:layout_alignParentLeft="true" android:textStyle="bold" />
android:layout_alignParentStart="true"
android:layout_marginRight="25dp"
android:textStyle="bold" />
<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:textAppearance="?android:attr/textAppearanceSmall"
android:textAppearance="?android:attr/textAppearanceSmall" tools:text="Fire, arcana"
tools:text="Ranged " android:id="@+id/keywordsText"
android:id="@+id/rangeText" android:textColor="@color/black"
android:textStyle="bold" android:textStyle="bold" />
android:layout_alignTop="@+id/typeText" </LinearLayout>
android:layout_toRightOf="@+id/typeText"
android:layout_toEndOf="@+id/typeText" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
tools:text="8"
android:id="@+id/distanceText"
android:layout_toRightOf="@+id/rangeText"
android:layout_alignTop="@+id/rangeText"/>
<TextView <LinearLayout
android:textColor="@color/black" 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:text="@string/objective"
android:paddingRight="3sp"
android:id="@+id/objective"
android:layout_below="@+id/distanceText"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold" />
<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"
android:text="@string/attack" tools:text="Standard action"
android:paddingRight="3sp" android:textColor="@color/black"
android:textStyle="bold" android:id="@+id/actionText"
android:textColor="@color/black" android:layout_marginRight="25dp"
android:id="@+id/attack" android:textStyle="bold" />
android:layout_below="@+id/objectiveText"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:textColor="@color/black" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:textColor="@color/black"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/impact" tools:text="Ranged "
android:paddingRight="3sp" android:id="@+id/rangeText"
android:textStyle="bold" android:textStyle="bold"/>
android:id="@+id/impact" <TextView
android:layout_below="@+id/attack" android:layout_width="wrap_content"
android:background="@color/darkened_text" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:textColor="@color/black"
android:layout_alignParentStart="true" /> tools:text="8"
android:id="@+id/distanceText"/>
</LinearLayout>
<TextView <LinearLayout
android:layout_width="wrap_content" android:id="@+id/objectiveLayout"
android:textColor="@color/black" android:layout_width="wrap_content"
android:layout_height="wrap_content" 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 <TextView
android:layout_width="wrap_content" android:textColor="@color/black"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" android:layout_height="wrap_content"
tools:text="one creature" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/black" android:text="@string/objective"
android:id="@+id/objectiveText" android:paddingRight="3sp"
android:layout_below="@+id/distanceText" android:id="@+id/objective"
android:layout_toRightOf="@+id/objective" android:textStyle="bold" />
android:layout_toEndOf="@+id/objective" />
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/darkened_text" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/black" tools:text="one creature"
android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="@color/black"
tools:text="1d8" android:id="@+id/objectiveText"/>
android:id="@+id/impactText" </LinearLayout>
android:layout_below="@+id/attackText"
android:layout_toRightOf="@+id/impact"
android:layout_toEndOf="@+id/impact" />
<TextView
android:layout_width="wrap_content"
android:textColor="@color/black"
android:layout_height="wrap_content"
android:id="@+id/otherText"
android:layout_below="@+id/impactText"
tools:text="If you are reading this the description has been displayed"
android:layout_alignParentLeft="true"/>
<Button <LinearLayout
android:layout_width="wrap_content" android:id="@+id/attackLayout"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:text="@string/use" android:layout_height="wrap_content">
android:background="@android:color/transparent"
android:textStyle="bold"
android:id="@+id/useButton"
android:layout_gravity="right"
android:layout_below="@+id/otherText"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/attack"
android:paddingRight="3sp"
android:textStyle="bold"
android:textColor="@color/black"
android:id="@+id/attack"/>
<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"/>
</LinearLayout>
<LinearLayout
android:id="@+id/impactLayout"
android:background="@color/darkened_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:textColor="@color/black"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/impact"
android:paddingRight="3sp"
android:textStyle="bold"
android:id="@+id/impact"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="1d8"
android:id="@+id/impactText"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:textColor="@color/black"
android:layout_height="wrap_content"
android:id="@+id/otherText"
android:layout_below="@+id/impactText"
tools:text="Other text"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/use"
android:background="@android:color/transparent"
android:textStyle="bold"
android:id="@+id/useButton"
android:layout_gravity="right" />
</LinearLayout>
</ScrollView>
</LinearLayout> </LinearLayout>