1
0
Fork 0

Player load improved

This commit is contained in:
Carlos Galindo 2015-04-21 23:04:23 +02:00
parent 30515a5384
commit 8451167c94
20 changed files with 733 additions and 453 deletions

View file

@ -6,7 +6,6 @@ import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
@ -21,7 +20,6 @@ public class Introduction extends ActionBarActivity {
private EditText name, level;
private EditText fue, con, des, sab, intel, car;
private Spinner classSpinner, raceSpinner;
private boolean first;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -57,8 +55,6 @@ public class Introduction extends ActionBarActivity {
Player.RACE_STRINGS
)
);
first = getIntent().getExtras() == null || getIntent().getExtras().getBoolean("first_time");
}
@ -91,28 +87,15 @@ public class Introduction extends ActionBarActivity {
if(finished()) {
finish();
} else {
Toast.makeText(
getApplicationContext(),
R.string.missing_info_error,
Toast.LENGTH_LONG
).show();
SnackbarManager.show(
Snackbar.with(getApplicationContext()).text(R.string.missing_info_error), this
);
}
return true;
}
return super.onOptionsItemSelected(item);
}
public void finishButton(View view){
if(finished()) {
finish();
} else {
SnackbarManager.show(
Snackbar.with(getApplicationContext()).text(R.string.missing_info_error), this
);
}
}
private boolean finished() {
String nameString = name.getText().toString().trim();
int classInt = classSpinner.getSelectedItemPosition();
@ -171,6 +154,7 @@ public class Introduction extends ActionBarActivity {
ed.putInt("con", con);
ed.putInt("des", des);
//TEMP
ed.putBoolean("new", true);
ed.apply();
} else {
return false;

View file

@ -4,13 +4,11 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.widget.Toolbar;
import android.text.InputType;
import android.view.Menu;
@ -39,7 +37,6 @@ public class MainActivity extends ActionBarActivity {
private Button pgCurrent;
private TextView currentPg, currentXp, currentCurativeEfforts, lvl;
private SharedPreferences p;
private Toolbar toolbar;
@Override
@ -47,7 +44,7 @@ public class MainActivity extends ActionBarActivity {
super.onCreate(savedInstanceState);
//Initializing activity (setting toolbar as actionbar)
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//Loading player
@ -73,7 +70,6 @@ public class MainActivity extends ActionBarActivity {
currentXp = (TextView) findViewById(R.id.currentXp);
currentCurativeEfforts = (TextView) findViewById(R.id.currentCurativeEfforts);
//TODO: do not change progressbar background
xpBar.getProgressDrawable()
.setColorFilter(getResources().getColor(R.color.px_bar), PorterDuff.Mode.SRC_IN);
curativeEffortsBar.getProgressDrawable()
@ -303,6 +299,7 @@ public class MainActivity extends ActionBarActivity {
pgUpdate();
invalidateOptionsMenu();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "There was an error", Toast.LENGTH_LONG).show();
}
}
});
@ -339,7 +336,7 @@ public class MainActivity extends ActionBarActivity {
pgCurrent.setText(String.valueOf(player.getPg()));
if (status == Player.MUERTO) {
pgCurrent.setTextColor(Color.BLACK);
pgCurrent.setBackgroundColor(Color.RED);
pgCurrent.setBackgroundColor(getResources().getColor(R.color.red));
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle(getString(R.string.reset_confirmation_title));
@ -365,9 +362,9 @@ public class MainActivity extends ActionBarActivity {
alert.show();
} else if (status == Player.DEBILITADO) {
pgCurrent.setBackgroundColor(android.R.drawable.btn_default);
pgCurrent.setTextColor(Color.RED);
pgBar.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
negPgBar.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
pgCurrent.setTextColor(getResources().getColor(R.color.red));
pgBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.red), PorterDuff.Mode.SRC_IN);
negPgBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.red), PorterDuff.Mode.SRC_IN);
if(lastState != Player.SAME) {
SnackbarManager.show(
Snackbar
@ -377,9 +374,9 @@ public class MainActivity extends ActionBarActivity {
}
} else if (status == Player.MALHERIDO) {
pgCurrent.setBackgroundColor(android.R.drawable.btn_default);
pgCurrent.setTextColor(Color.YELLOW);
pgBar.getProgressDrawable().setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_IN);
negPgBar.getProgressDrawable().setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_IN);
pgCurrent.setTextColor(getResources().getColor(R.color.yellow));
pgBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.yellow), PorterDuff.Mode.SRC_IN);
negPgBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.yellow), PorterDuff.Mode.SRC_IN);
if(lastState != Player.SAME) {
SnackbarManager.show(
Snackbar
@ -388,42 +385,28 @@ public class MainActivity extends ActionBarActivity {
);
}
} else {
pgCurrent.setTextColor(Color.GREEN);
pgCurrent.setTextColor(getResources().getColor(R.color.green));
pgCurrent.setBackgroundColor(android.R.drawable.btn_default);
pgBar.getProgressDrawable().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN);
negPgBar.getProgressDrawable().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN);
pgBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.green), PorterDuff.Mode.SRC_IN);
negPgBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.green), PorterDuff.Mode.SRC_IN);
}
}
private void restoreData(){
if (player == null) {
player = new Player(
p.getString("playerName", getString(R.string.adventurer_name)),
p.getInt("classInt", Player.NULL),
p.getInt("raceInt", Player.NULL),
p.getInt("px", 0),
new int[]{
p.getInt("fue", 10),
p.getInt("con", 10),
p.getInt("des", 10),
p.getInt("int", 10),
p.getInt("sab", 10),
p.getInt("car", 10)
},
new int[18],
new Power[4]);
player = new Player( p );
} else {
player.setName(p.getString("playerName", getString(R.string.adventurer_name)));
player.setClassInt(p.getInt("classInt", Player.NULL));
player.setRaceInt(p.getInt("raceInt", Player.NULL));
player.setPx(p.getInt("px", player.getPx()));
player.setName(p.getString(Player.NAME, player.getName()));
player.setClassInt(p.getInt(Player.CLASS, player.getClassInt()));
player.setRaceInt(p.getInt(Player.RACE, player.getRaceInt()));
player.setPx(p.getInt(Player.PX, player.getPx()));
player.setAtk(new int[]{
p.getInt("fue", 10),
p.getInt("con", 10),
p.getInt("des", 10),
p.getInt("int", 10),
p.getInt("sab", 10),
p.getInt("car", 10)
p.getInt("fue", player.getFue()),
p.getInt("con", player.getCon()),
p.getInt("des", player.getDes()),
p.getInt("int", player.getInt()),
p.getInt("sab", player.getSab()),
p.getInt("car", player.getCar())
});
}
pxUpdate();
@ -440,17 +423,7 @@ public class MainActivity extends ActionBarActivity {
pgBar.setMax(player.getMaxPg());
negPgBar.setMax(player.getMaxPg() / 2);
// incrementProgressBar(
// pgBar, currentPg,
// 100, true, player.getMaxPg(),
// true, player.getPg()
// );
curativeEffortsBar.setMax(player.getMaxCurativeEfforts());
// incrementProgressBar(
// curativeEffortsBar, currentCurativeEfforts,
// 100, true, player.getMaxCurativeEfforts(),
// true, player.getCurativeEfforts()
// );
pgUpdate();
ceUpdate();
//set restored values to the respective fields
@ -553,90 +526,4 @@ public class MainActivity extends ActionBarActivity {
dialog.show();
input.requestFocus();
}
//TODO: fix incrementeProgressBar
//set up a partial barCommand to raise only between the ratios, then a manager, then another
//if pgBar, change color accordingly with the pg
private void incrementProgressBar(final ProgressBar progressBar, final TextView textView,
final int factor,
final boolean setMax, int max,
final boolean setVal, int end) {
if(factor == 1){
textView.setText(
(progressBar.getProgress() + Player.LEVEL_PX[player.getLevel() - 1])
+ " / " +
(progressBar.getMax() + Player.LEVEL_PX[player.getLevel() - 1])
);
} else {
textView.setText(
(progressBar.getProgress()/factor) + " / " +
(progressBar.getMax()/factor)
);
}
if(setMax) progressBar.setMax(factor*max);
if(!setVal) return;
if(progressBar.getProgress() - end*factor == 0) return;
final Handler handler = new Handler();
final int finalEnd = (end < 0 ? 0 : -1) * end * factor;
final int time = Math.max(2000 / Math.abs(progressBar.getProgress() - finalEnd), 1);
new Thread(new Runnable() {
public void run() {
int current = progressBar.getProgress();
boolean bigger = current < finalEnd;
while ((bigger && current < finalEnd) || (!bigger && current > finalEnd)) {
if(bigger) current += 2;
else current -= 2;
// Update the progress bar and display the
//current value in the text view
final int finalCurrent = Math.abs(current);
handler.post(new Runnable() {
public void run() {
progressBar.setProgress(finalCurrent);
if(factor == 1){
textView.setText(
(finalCurrent + Player.LEVEL_PX[player.getLevel() - 1])
+ " / " +
(progressBar.getMax() + Player.LEVEL_PX[player.getLevel() - 1])
);
} else {
textView.setText((finalCurrent/factor) +" / "+(progressBar.getMax()/factor));
}
}
});
try {
// Sleep for 200 milliseconds.
//Just to display the progress slowly
Thread.sleep(time);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
}
// if(progressBar.getId() == R.id.pgBar) {
// double rate = (double)current / progressBar.getMax() * (negative ? -1:1);
// if (rate <= 0) {
// progressBar.getProgressDrawable()
// .setColorFilter(
// Color.RED,
// PorterDuff.Mode.SRC_IN
// );
// } else if (rate <= 0.5) {
// progressBar.getProgressDrawable()
// .setColorFilter(
// Color.YELLOW,
// PorterDuff.Mode.SRC_IN
// );
// } else {
// progressBar.getProgressDrawable()
// .setColorFilter(
// Color.GREEN,
// PorterDuff.Mode.SRC_IN
// );
// }
// }
}

View file

@ -1,6 +1,10 @@
package com.kauron.dungeonmanager;
class Player {
import android.content.SharedPreferences;
import java.io.Serializable;
class Player implements Serializable {
public static final String NAME = "playerName", CLASS = "classInt", RACE = "raceInt", PX = "px";
@ -107,15 +111,35 @@ class Player {
private int level;
//TODO: use dice dialogs
private int[] atk, def, abilities;
private boolean[] abilitiesTrained;
//TODO: implement fully operational powers displayed as cards
private Power[] powers;
Player (SharedPreferences p) {
this.name = p.getString(NAME, "Player");
this.px = p.getInt(PX, 0);
setLevel();
this.raceInt = p.getInt(RACE, 0);
this.classInt = p.getInt(CLASS, 0);
this.def = new int[4];
setAtk(new int[] {
p.getInt("fue", 10),
p.getInt("con", 10),
p.getInt("des", 10),
p.getInt("int", 10),
p.getInt("sab", 10),
p.getInt("car", 10)}
);
setState();
this.pg = p.getInt( "pg" , maxPg);
this.curativeEfforts = p.getInt( "curativeEfforts" , maxCurativeEfforts );
//TODO: load powers from wherever they are saved
}
/** Constructor for creating a new character*/
Player(
String name, int classInt, int raceInt,
int px, int[] atk, int[] abilities,
Power[] powers
){
Player( String name, int classInt, int raceInt,
int px, int[] atk, Power[] powers){
this.name = name;
this.px = px;
setLevel();
@ -127,28 +151,22 @@ class Player {
pg = maxPg;
curativeEfforts = maxCurativeEfforts;
this.abilities = abilities;
this.powers = powers;
}
/** Constructor for restoring the Player in the middle of the game*/
Player(
int pg, int maxPg, int px, int curativeEfforts, int maxCurativeEfforts, int classInt,
int raceInt, String name, int[] atk, int[] def, int[] abilities, Power[] powers) {
this.pg = pg;
this.maxPg = maxPg;
Player( int pg, int px, int curativeEfforts, int classInt, int raceInt, int[] atk, String name, Power[] powers) {
this.px = px;
setLevel();
setState();
this.curativeEfforts = curativeEfforts;
this.maxCurativeEfforts = maxCurativeEfforts;
setAtk(atk);
this.classInt = classInt;
this.raceInt = raceInt;
setClass();
this.name = name;
this.atk = atk;
this.def = def;
this.abilities = abilities;
this.powers = powers;
this.pg = pg;
this.curativeEfforts = curativeEfforts;
setState();
}
int getPx() {return px;}
@ -167,11 +185,8 @@ class Player {
int getLevel() {return level;}
void setLevel() {
for (int i = 0; i < LEVEL_PX.length; i++){
if(px < LEVEL_PX[i]) {
level = i; return;
}
}
for (int i = 0; i < LEVEL_PX.length; i++)
if(px < LEVEL_PX[i]) {level = i; return;}
level = LEVEL_PX.length;
}

View file

@ -1,6 +1,8 @@
package com.kauron.dungeonmanager;
class Power {
import java.io.Serializable;
class Power implements Serializable{
/**frequencies*/
public static final int OPORTUNIDAD = 1, A_VOLUNTAD = 2, ENCUENTRO = 3, DIARIO = 4;
public static final String[] FREQ = {"Nada", "Oportunidad", "A voluntad", "Encuentro", "Diario"};

View file

@ -2,8 +2,8 @@ package com.kauron.dungeonmanager;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.support.v7.widget.Toolbar;
import android.view.View;
public class PowerEditor extends ActionBarActivity {
@ -14,28 +14,10 @@ public class PowerEditor extends ActionBarActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_power_editor);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_power_editor, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
public void saveClick(View view) {
//TODO: save powers
}
}

View file

@ -76,24 +76,10 @@ public class Welcome extends ActionBarActivity {
for ( int i = elements; i < n; i++ ) {
SharedPreferences sav = getSharedPreferences(p.getString("player" + i, ""), MODE_PRIVATE);
if (sav.contains(Player.NAME))
adapter.add(
new Player(
sav.getString(Player.NAME, "player" + i),
sav.getInt(Player.CLASS, 0),
sav.getInt(Player.RACE, 0),
sav.getInt(Player.PX, 0),
new int[] {
sav.getInt("fue", 10),
sav.getInt("con", 10),
sav.getInt("des", 10),
sav.getInt("int", 10),
sav.getInt("sab", 10),
sav.getInt("car", 10)
},
new int[18],
new Power[4]
));
adapter.add( new Player( sav ) );
}
//int pg, int maxPg, int px, int curativeEfforts, int maxCurativeEfforts, int classInt,
//int raceInt, String name, int[] atk, int[] def, int[] abilities, Power[] powers
} else if ( n != 0 ) {
playerList.setVisibility(View.VISIBLE);
findViewById(R.id.help_text).setVisibility(View.VISIBLE);
@ -103,22 +89,7 @@ public class Welcome extends ActionBarActivity {
//TODO: fill the information for the player creation
SharedPreferences sav = getSharedPreferences(p.getString("player" + i, ""), MODE_PRIVATE);
if (sav.contains(Player.NAME))
players[i] = new Player(
sav.getString(Player.NAME, "player" + i),
sav.getInt(Player.CLASS, 0),
sav.getInt(Player.RACE, 0),
sav.getInt(Player.PX, 0),
new int[] {
sav.getInt("fue", 10),
sav.getInt("con", 10),
sav.getInt("des", 10),
sav.getInt("int", 10),
sav.getInt("sab", 10),
sav.getInt("car", 10)
},
new int[18],
new Power[4]
);
players[i] = new Player( sav );
}
playerList.setAdapter(new PlayerAdapter(this, players));

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

View file

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<layer-list>
<!-- Shadow -->
<item android:top="1dp" android:right="1dp">
<layer-list>
<item>
<shape android:shape="oval">
<solid android:color="#08000000"/>
<padding
android:bottom="3px"
android:left="3px"
android:right="3px"
android:top="3px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#09000000"/>
<padding
android:bottom="2px"
android:left="2px"
android:right="2px"
android:top="2px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#10000000"/>
<padding
android:bottom="2px"
android:left="2px"
android:right="2px"
android:top="2px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#11000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#12000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#13000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#14000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#15000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#16000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
</layer-list>
</item>
<!-- Blue button pressed -->
<item>
<shape android:shape="oval">
<solid android:color="#90CAF9"/>
</shape>
</item>
</layer-list>
</item>
<item android:state_enabled="true">
<layer-list>
<!-- Shadow -->
<item android:top="2dp" android:right="1dp">
<layer-list>
<item>
<shape android:shape="oval">
<solid android:color="#08000000"/>
<padding
android:bottom="4px"
android:left="4px"
android:right="4px"
android:top="4px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#09000000"/>
<padding
android:bottom="2px"
android:left="2px"
android:right="2px"
android:top="2px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#10000000"/>
<padding
android:bottom="2px"
android:left="2px"
android:right="2px"
android:top="2px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#11000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#12000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#13000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#14000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#15000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#16000000"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"
/>
</shape>
</item>
</layer-list>
</item>
<!-- Blue button -->
<item>
<shape android:shape="oval">
<solid android:color="#03A9F4"/>
</shape>
</item>
</layer-list>
</item>
</selector>

View file

@ -13,191 +13,186 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Character creation"/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/character_creation"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</android.support.v7.widget.Toolbar>
<ScrollView
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/firstLayout"
android:orientation="horizontal">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/firstLayout"
android:orientation="horizontal">
android:inputType="textPersonName|textCapWords"
android:layout_weight="0.5"
android:id="@+id/editNameIntro"
android:hint="@string/adventurer_name"
android:nextFocusDown="@+id/editPxIntro"
android:nextFocusForward="@+id/editPxIntro"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName|textCapWords"
android:layout_weight="0.5"
android:id="@+id/editNameIntro"
android:hint="@string/adventurer_name"
android:nextFocusDown="@+id/editPxIntro"
android:nextFocusForward="@+id/editPxIntro"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:id="@+id/editPxIntro"
android:hint="@string/px"
android:layout_weight="1"
android:nextFocusDown="@+id/FUE"
android:nextFocusForward="@+id/FUE"
android:nextFocusLeft="@+id/FUE"
android:nextFocusRight="@+id/FUE"
android:nextFocusUp="@+id/FUE"/>
</LinearLayout>
<LinearLayout
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/secondLayout"
android:layout_below="@+id/firstLayout">
<Spinner
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/classSpinner"
tools:listitem="@android:layout/simple_spinner_dropdown_item"
android:spinnerMode="dropdown" />
<Spinner
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/raceSpinner"
tools:listitem="@android:layout/simple_spinner_dropdown_item"
android:spinnerMode="dropdown" />
</LinearLayout>
<GridLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/secondLayout"
android:id="@+id/thirdLayout"
android:columnCount="3">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="3"
android:layout_row="0"
android:layout_column="0"
android:id="@+id/FUE"
android:hint="@string/FUE"
android:nextFocusDown="@+id/DES"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="3"
android:layout_row="1"
android:layout_column="0"
android:id="@+id/CON"
android:hint="@string/CON"
android:nextFocusDown="@+id/INT" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="3"
android:layout_row="0"
android:layout_column="1"
android:id="@+id/DES"
android:hint="@string/DES"
android:nextFocusDown="@+id/SAB"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="3"
android:layout_row="1"
android:layout_column="1"
android:id="@+id/INT"
android:hint="@string/INT"
android:nextFocusDown="@+id/CAR"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="3"
android:layout_row="0"
android:layout_column="2"
android:id="@+id/SAB"
android:hint="@string/SAB"
android:nextFocusDown="@+id/CON"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="3"
android:imeOptions="actionDone"
android:layout_row="1"
android:layout_column="2"
android:id="@+id/CAR"
android:hint="@string/CAR"/>
</GridLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/thirdLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:visibility="gone">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/new_attack"
android:id="@+id/new_attack_button" />
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView" />
android:inputType="number"
android:id="@+id/editPxIntro"
android:hint="@string/px"
android:layout_weight="1"
android:nextFocusDown="@+id/FUE"
android:nextFocusForward="@+id/FUE"
android:nextFocusLeft="@+id/FUE"
android:nextFocusRight="@+id/FUE"
android:nextFocusUp="@+id/FUE"/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/secondLayout"
android:layout_below="@+id/firstLayout">
<Spinner
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/classSpinner"
tools:listitem="@android:layout/simple_spinner_dropdown_item"
android:spinnerMode="dropdown" />
<Spinner
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/raceSpinner"
tools:listitem="@android:layout/simple_spinner_dropdown_item"
android:spinnerMode="dropdown" />
</LinearLayout>
<GridLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/secondLayout"
android:id="@+id/thirdLayout"
android:columnCount="3">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="3"
android:layout_row="0"
android:layout_column="0"
android:id="@+id/FUE"
android:hint="@string/FUE"
android:nextFocusDown="@+id/DES"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="3"
android:layout_row="1"
android:layout_column="0"
android:id="@+id/CON"
android:hint="@string/CON"
android:nextFocusDown="@+id/INT" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="3"
android:layout_row="0"
android:layout_column="1"
android:id="@+id/DES"
android:hint="@string/DES"
android:nextFocusDown="@+id/SAB"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="3"
android:layout_row="1"
android:layout_column="1"
android:id="@+id/INT"
android:hint="@string/INT"
android:nextFocusDown="@+id/CAR"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="3"
android:layout_row="0"
android:layout_column="2"
android:id="@+id/SAB"
android:hint="@string/SAB"
android:nextFocusDown="@+id/CON"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="3"
android:imeOptions="actionDone"
android:layout_row="1"
android:layout_column="2"
android:id="@+id/CAR"
android:hint="@string/CAR"/>
</GridLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/thirdLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:visibility="visible"
android:id="@+id/fourthLayout">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/new_attack"
android:id="@+id/new_attack_button" />
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/powerList"
android:choiceMode="none" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>

View file

@ -1,42 +1,230 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
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:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.kauron.dungeonmanager.PowerEditor">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:capitalize="words" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText2"
android:capitalize="words"
android:layout_below="@+id/editText"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@+id/editText"
android:layout_alignEnd="@+id/editText" />
<EditText
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:minHeight="?attr/actionBarSize"
android:background="@color/primary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/editText3"
android:capitalize="words"
android:layout_below="@+id/editText2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@+id/editText2"
android:layout_alignEnd="@+id/editText2" />
android:layout_height="wrap_content">
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/power_editor"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</android.support.v7.widget.Toolbar>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.kauron.dungeonmanager.PowerEditor">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/nameEdit"
android:capitalize="words"
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" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/keywordsEdit"
android:capitalize="words"
android:layout_below="@+id/nameEdit"
android:layout_alignRight="@+id/nameEdit"
android:layout_alignEnd="@+id/nameEdit"
android:layout_toRightOf="@+id/keywordsText"
android:layout_toEndOf="@+id/keywordsText"
android:hint="@string/keywordsPowerHint" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/name"
android:id="@+id/nameText"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_above="@+id/keywordsEdit"
android:layout_toLeftOf="@+id/nameEdit"
android:layout_toStartOf="@+id/nameEdit"
android:gravity="center_vertical" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/keywords"
android:id="@+id/keywordsText"
android:layout_below="@+id/nameEdit"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignBottom="@+id/keywordsEdit"
android:gravity="center_vertical"
android:layout_marginRight="10dp" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/keywordsEdit"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="@+id/linearLayout">
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/freqSpinner"
android:layout_weight="1"
android:spinnerMode="dropdown" />
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/rangeSpinner"
android:layout_weight="1"
android:spinnerMode="dropdown" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/distanceNumEdit"
android:layout_weight="0.75"
android:hint="@string/number10"
android:focusableInTouchMode="true" />
</LinearLayout>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/atkSpinner"
android:spinnerMode="dropdown"
android:layout_below="@+id/linearLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/vsText"
android:layout_toStartOf="@+id/vsText" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/defSpinner"
android:spinnerMode="dropdown"
android:layout_below="@+id/linearLayout"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_toRightOf="@+id/vsText"
android:layout_toEndOf="@+id/vsText" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/vs"
android:id="@+id/vsText"
android:gravity="center"
android:layout_below="@+id/linearLayout"
android:layout_centerHorizontal="true"
android:layout_alignBottom="@+id/atkSpinner" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:ems="10"
android:id="@+id/impactEdit"
android:layout_below="@+id/defSpinner"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:hint="@string/impactEditHint"
android:layout_toRightOf="@+id/impactText"
android:layout_toEndOf="@+id/impactText" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/impact"
android:id="@+id/impactText"
android:gravity="center_vertical"
android:layout_below="@+id/atkSpinner"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignBottom="@+id/impactEdit"
android:layout_marginRight="10dp" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/actionTypeSpinner"
android:layout_below="@+id/impactEdit"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:spinnerMode="dropdown" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/objective"
android:id="@+id/objectiveText"
android:gravity="center_vertical"
android:layout_below="@+id/actionTypeSpinner"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginRight="10dp"
android:layout_alignBottom="@+id/objectiveEdit" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/objectiveEdit"
android:capitalize="words"
android:hint="@string/objectiveHint"
android:layout_below="@+id/actionTypeSpinner"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_toRightOf="@+id/objectiveText"
android:layout_toEndOf="@+id/objectiveText" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save"
android:id="@+id/saveButton"
android:layout_below="@+id/objectiveEdit"
android:layout_alignRight="@+id/impactEdit"
android:layout_alignEnd="@+id/impactEdit"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="@android:color/transparent"
android:onClick="saveClick"/>
</RelativeLayout>
</ScrollView>
</LinearLayout>

View file

@ -18,6 +18,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#EEEEEE"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/app_name"
android:id="@+id/title" />

View file

@ -2,6 +2,4 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.kauron.dungeonmanager.PowerEditor">
<item android:id="@+id/action_settings" android:title="@string/action_settings"
android:orderInCategory="100" app:showAsAction="never" />
</menu>

View file

@ -9,12 +9,12 @@
<color name="icons">#FFFFFF</color>
<color name="divider">#B6B6B6</color>
<color name="red">#F00</color>
<color name="yellow">#ff0</color>
<color name="red">#9F0D0A</color>
<color name="yellow">#FFBB00</color>
<color name="green">#0f0</color>
<color name="surges_bar">#FFD700</color>
<color name="px_bar">#62BACE</color>
<color name="surges_bar">#989F2B</color>
<color name="px_bar">#005874</color>
<!--<color name="primary">#5D4037</color>-->
<!--<color name="primaryDark">#3E2723</color>-->
</resources>

View file

@ -2,4 +2,10 @@
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_button_diameter">56dp</dimen>
<dimen name="fab_button_margin_bottom">16dp</dimen>
<dimen name="fab_button_margin_right">16dp</dimen>
<dimen name="elevation_low">1dp</dimen>
<dimen name="elevation_high">8dp</dimen>
</resources>

View file

@ -91,4 +91,18 @@
<string name="zero" translatable="false">0</string>
<string name="no_players">No players, please add one</string>
<string name="help_welcome_text">Press a player to open, long press for options</string>
<string name="character_creation">Character creation</string>
<string name="name">Name</string>
<string name="keywords">Keywords</string>
<string name="powerNameHint">Mordedura visual</string>
<string name="keywordsPowerHint">Arcano, hechizo, psíquico</string>
<string name="number10">10</string>
<string name="vs">VS</string>
<string name="save">Save</string>
<string name="impactEditHint">1d6 + mod. CAR y eres invisible hasta el comienzo del siguiente turno</string>
<string name="impact">Impact</string>
<string name="objective">Objective</string>
<string name="objectiveHint">One creature</string>
<string name="power_editor">Power Editor</string>
<string name="save_player">Save player</string>
</resources>

View file

@ -1,7 +1,7 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorPrimary">@color/primary</item>