1
0
Fork 0

Minor debugging

Added TODO's and scrollview's to the main activity
This commit is contained in:
Carlos Galindo 2015-02-25 21:55:20 +01:00
parent d6daf98b74
commit 8a781561e3
9 changed files with 291 additions and 264 deletions

View file

@ -7,8 +7,8 @@ android {
applicationId 'com.kauron.dungeonmanager' applicationId 'com.kauron.dungeonmanager'
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 21 targetSdkVersion 21
versionCode 1 versionCode 2
versionName "1.0" versionName '0.2'
} }
buildTypes { buildTypes {
release { release {

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kauron.dungeonmanager" > package="com.kauron.dungeonmanager">
<application <application
android:allowBackup="true" android:allowBackup="true"

View file

@ -91,7 +91,7 @@ public class Introduction extends ActionBarActivity {
int classInt = classSpinner.getSelectedItemPosition(); int classInt = classSpinner.getSelectedItemPosition();
int raceInt = raceSpinner.getSelectedItemPosition(); int raceInt = raceSpinner.getSelectedItemPosition();
int pxInt = 0; int pxInt = -1;
if (!level.getText().toString().isEmpty()) if (!level.getText().toString().isEmpty())
pxInt = Integer.parseInt(level.getText().toString()); pxInt = Integer.parseInt(level.getText().toString());
@ -114,7 +114,7 @@ public class Introduction extends ActionBarActivity {
!nameString.isEmpty() && !nameString.isEmpty() &&
classInt != Player.NULL && classInt != Player.NULL &&
raceInt != Player.NULL && raceInt != Player.NULL &&
pxInt != 0 && pxInt != -1 &&
car != 0 && car != 0 &&
fue != 0 && fue != 0 &&
con != 0 && con != 0 &&

View file

@ -117,6 +117,9 @@ public class MainActivity extends ActionBarActivity{
try { try {
if (player.addPx(Integer.parseInt(input.getText().toString()))) { if (player.addPx(Integer.parseInt(input.getText().toString()))) {
//levelUp //levelUp
//TODO: update defenses
//TODO: add attack points when necessary
//TODO: update currentPg button
player.setMaxPgOnLevelUp(); player.setMaxPgOnLevelUp();
((TextView) findViewById(R.id.lvl)).setText( ((TextView) findViewById(R.id.lvl)).setText(
String.valueOf(player.getLevel()) String.valueOf(player.getLevel())
@ -133,6 +136,14 @@ public class MainActivity extends ActionBarActivity{
}); });
alert.show(); alert.show();
return true; return true;
} else if (id == R.id.action_download) {
//TODO: create self-updater
Toast.makeText(
getApplicationContext(),
"This function is not ready yet",
Toast.LENGTH_LONG
).show();
return true;
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
@ -457,7 +468,7 @@ public class MainActivity extends ActionBarActivity{
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (input.getText().toString().isEmpty()){ if (input.getText().toString().isEmpty()) {
Toast.makeText( Toast.makeText(
getApplicationContext(), getApplicationContext(),
R.string.empty_field, R.string.empty_field,
@ -471,4 +482,8 @@ public class MainActivity extends ActionBarActivity{
}); });
dialog.show(); dialog.show();
} }
//TODO: show on screen the max pg's
//TODO: show the current px and progress bar
} }

View file

@ -11,12 +11,14 @@ public class Player {
"Sacerdote Rúnico", "Señor de la guerra" "Sacerdote Rúnico", "Señor de la guerra"
}; };
/** public static final int NULL = 0;
* Values for classes
*/ // /**
public static final int NULL = 0, ARDIENTE = 1, BRUJO = 2, BUSCADOR = 3, CLÉRIGO = 4, // * Values for classes
EXPLORADOR = 5, GUERRERO = 6, MAGO = 7, MENTE_DE_BATALLA = 8, MONJE = 9, PALADÍN = 10, // */
PÍCARO = 11, PSIÓNICO = 12, SACERDOTE_RÚNICO = 13, SEÑOR_DE_LA_GUERRA = 14; // public static final int ARDIENTE = 1, BRUJO = 2, BUSCADOR = 3, CLÉRIGO = 4,
// EXPLORADOR = 5, GUERRERO = 6, MAGO = 7, MENTE_DE_BATALLA = 8, MONJE = 9, PALADÍN = 10,
// PÍCARO = 11, PSIÓNICO = 12, SACERDOTE_RÚNICO = 13, SEÑOR_DE_LA_GUERRA = 14;
/** /**
* Values for level - px computation * Values for level - px computation
@ -68,12 +70,12 @@ public class Player {
public static final int CA = 0, FORT = 1, REF = 2, VOL = 3; public static final int CA = 0, FORT = 1, REF = 2, VOL = 3;
//TODO: develop abilities //TODO: develop abilities
/** // /**
* Values for abilities // * Values for abilities
*/ // */
public static final int ACROBACIAS = 1, AGUANTE = 2, ARCANOS = 3, ATLETISMO = 4, DIPLOMACIA = 5, // public static final int ACROBACIAS = 1, AGUANTE = 2, ARCANOS = 3, ATLETISMO = 4, DIPLOMACIA = 5,
DUNGEONS = 6, ENGAÑAR = 7, HISTORIA = 8, HURTO = 9, INTIMIDAR = 10, NATURALEZA = 11, // DUNGEONS = 6, ENGAÑAR = 7, HISTORIA = 8, HURTO = 9, INTIMIDAR = 10, NATURALEZA = 11,
PERCEPCIÓN = 12, PERSPICACIA = 13, RECURSOS = 14, RELIGIÓN = 15, SANAR = 16, SIGILO = 17; // PERCEPCIÓN = 12, PERSPICACIA = 13, RECURSOS = 14, RELIGIÓN = 15, SANAR = 16, SIGILO = 17;
/** /**
* Names for the abilities * Names for the abilities
@ -96,8 +98,9 @@ public class Player {
private int classInt, raceInt; private int classInt, raceInt;
private String name; private String name;
private int level; private int level;
//TODO: use dice class
private int[] atk, def, abilities; private int[] atk, def, abilities;
//TODO: implement fully operational powers displayed as cards
private Power[] powers; private Power[] powers;
public Player( public Player(

View file

@ -6,6 +6,7 @@ public class Power {
private boolean used; private boolean used;
private int type; private int type;
private String name; private String name;
private int atk, def, damage;
public Power(String name, int type){ public Power(String name, int type){

View file

@ -1,136 +1,237 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/pgCurrent"
android:textSize="40sp"
android:onClick="damage"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/pgCurrent"
android:onClick="selectPlayer"
android:id="@+id/scroll1">
<RelativeLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/basicInfoContainer">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/adventurer_name"
android:id="@+id/nameText"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/race_name"
android:id="@+id/raceText"
android:layout_alignTop="@+id/classText"
android:layout_toRightOf="@+id/classText"
android:layout_toEndOf="@+id/classText"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/class_name"
android:id="@+id/classText"
android:layout_below="@+id/nameText"
android:layout_alignParentStart="false"
android:layout_alignParentLeft="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/level"
android:id="@+id/lvlText"
android:layout_alignParentBottom="false"
android:layout_toRightOf="@+id/raceText"
android:layout_toEndOf="@+id/raceText"
android:layout_alignTop="@+id/raceText"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/lvl"
android:layout_alignParentBottom="false"
android:layout_toRightOf="@+id/lvlText"
android:layout_toEndOf="@+id/lvlText"
android:layout_alignTop="@+id/lvlText"
android:layout_marginLeft="10dp" />
</RelativeLayout>
</HorizontalScrollView>
<LinearLayout <LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/scroll1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="@+id/curativeEffortsContainer">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/curativeEffortsText"/>
</LinearLayout>
<LinearLayout
android:id="@+id/attackContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_below="@+id/curativeEffortsContainer"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
<TextView
android:id="@+id/titleAttack"
android:text="@string/attack"
android:textAllCaps="true"
android:drawableBottom="?android:attr/listChoiceBackgroundIndicator"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="?android:textColorSecondary"
android:textSize="14sp"
android:gravity="center_vertical"
android:paddingLeft="8dip"
android:paddingRight="8dip"/>
<HorizontalScrollView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
<GridLayout android:orientation="horizontal">
<Button
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/attackGrid" android:textAppearance="?android:attr/textAppearanceMedium"
android:columnCount="3" android:id="@+id/pgCurrent"
android:textSize="40sp"
android:onClick="damage" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="selectPlayer"
android:id="@+id/scroll1">
<RelativeLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/basicInfoContainer">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/adventurer_name"
android:id="@+id/nameText"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/race_name"
android:id="@+id/raceText"
android:layout_alignTop="@+id/classText"
android:layout_toRightOf="@+id/classText"
android:layout_toEndOf="@+id/classText"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/class_name"
android:id="@+id/classText"
android:layout_below="@+id/nameText"
android:layout_alignParentStart="false"
android:layout_alignParentLeft="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/level"
android:id="@+id/lvlText"
android:layout_alignParentBottom="false"
android:layout_toRightOf="@+id/raceText"
android:layout_toEndOf="@+id/raceText"
android:layout_alignTop="@+id/raceText"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/lvl"
android:layout_alignParentBottom="false"
android:layout_toRightOf="@+id/lvlText"
android:layout_toEndOf="@+id/lvlText"
android:layout_alignTop="@+id/lvlText"
android:layout_marginLeft="10dp" />
</RelativeLayout>
</HorizontalScrollView>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/curativeEffortsContainer">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/curativeEffortsText"/>
</LinearLayout>
<LinearLayout
android:id="@+id/attackContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/titleAttack"
android:text="@string/attack"
android:textAllCaps="true"
android:drawableBottom="?android:attr/listChoiceBackgroundIndicator"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="?android:textColorSecondary"
android:textSize="14sp"
android:gravity="center_vertical"
android:paddingLeft="8dip"
android:paddingRight="8dip"/>
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<GridLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/attackGrid"
android:columnCount="3"
android:rowCount="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="0"
android:layout_column="0"
android:id="@+id/FUE"
android:hint="@string/FUE" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="1"
android:layout_column="0"
android:id="@+id/CON"
android:hint="@string/CON" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="0"
android:layout_column="1"
android:id="@+id/DES"
android:hint="@string/DES" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="1"
android:layout_column="1"
android:id="@+id/INT"
android:hint="@string/INT" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="0"
android:layout_column="2"
android:id="@+id/SAB"
android:hint="@string/SAB" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="1"
android:layout_column="2"
android:id="@+id/CAR"
android:hint="@string/CAR" />
</GridLayout>
</HorizontalScrollView>
</LinearLayout>
<LinearLayout
android:id="@+id/defenseContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/titleDefense"
android:text="@string/defense"
android:textAllCaps="true"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="?android:textColorSecondary"
android:textSize="14sp"
android:gravity="center_vertical"
android:paddingLeft="8dip"
android:paddingRight="8dip"/>
<GridLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/defenseGrid"
android:columnCount="2"
android:rowCount="2"> android:rowCount="2">
<TextView <TextView
@ -138,144 +239,45 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace" android:typeface="monospace"
android:ems="4" android:ems="5"
android:layout_row="0" android:layout_row="0"
android:layout_column="0" android:layout_column="0"
android:id="@+id/FUE" android:id="@+id/CA"
android:hint="@string/FUE" /> android:hint="@string/CA" />
<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/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace" android:typeface="monospace"
android:ems="4" android:ems="5"
android:layout_row="0"
android:layout_column="1"
android:id="@+id/FORT"
android:hint="@string/FORT" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="5"
android:layout_row="1" android:layout_row="1"
android:layout_column="0" android:layout_column="0"
android:id="@+id/CON" android:id="@+id/REF"
android:hint="@string/CON" /> android:hint="@string/REF" />
<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/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace" android:typeface="monospace"
android:ems="4" android:ems="5"
android:layout_row="0"
android:layout_column="1"
android:id="@+id/DES"
android:hint="@string/DES" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="1" android:layout_row="1"
android:layout_column="1" android:layout_column="1"
android:id="@+id/INT" android:id="@+id/VOL"
android:hint="@string/INT" /> android:hint="@string/VOL" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="0"
android:layout_column="2"
android:id="@+id/SAB"
android:hint="@string/SAB" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="4"
android:layout_row="1"
android:layout_column="2"
android:id="@+id/CAR"
android:hint="@string/CAR" />
</GridLayout> </GridLayout>
</HorizontalScrollView> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/defenseContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_below="@+id/attackContainer"
android:orientation="vertical">
<TextView
android:id="@+id/titleDefense"
android:text="@string/defense"
android:textAllCaps="true"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="?android:textColorSecondary"
android:textSize="14sp"
android:gravity="center_vertical"
android:paddingLeft="8dip"
android:paddingRight="8dip"/>
<GridLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/defenseGrid"
android:columnCount="2"
android:rowCount="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="5"
android:layout_row="0"
android:layout_column="0"
android:id="@+id/CA"
android:hint="@string/CA" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="5"
android:layout_row="0"
android:layout_column="1"
android:id="@+id/FORT"
android:hint="@string/FORT" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="5"
android:layout_row="1"
android:layout_column="0"
android:id="@+id/REF"
android:hint="@string/REF" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:typeface="monospace"
android:ems="5"
android:layout_row="1"
android:layout_column="1"
android:id="@+id/VOL"
android:hint="@string/VOL" />
</GridLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -56,6 +56,11 @@
android:orderInCategory="20" android:orderInCategory="20"
app:showAsAction="never" app:showAsAction="never"
android:icon="@drawable/ic_action_edit"/> android:icon="@drawable/ic_action_edit"/>
<item
android:id="@+id/action_download"
android:title="@string/action_download"
android:orderInCategory="25"
app:showAsAction="never"/>
<item <item
android:id="@+id/action_reset" android:id="@+id/action_reset"
android:title="@string/action_reset" android:title="@string/action_reset"

View file

@ -71,4 +71,5 @@
<string name="empty_field">Please input something</string> <string name="empty_field">Please input something</string>
<string name="dialog_resolve_max_pg_title">Alert</string> <string name="dialog_resolve_max_pg_title">Alert</string>
<string name="dialog_resolve_max_pg_message">Couldn\'t compute your max PG based on your level</string> <string name="dialog_resolve_max_pg_message">Couldn\'t compute your max PG based on your level</string>
<string name="action_download">Update app</string>
</resources> </resources>