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.support.v7.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Spinner; import android.widget.Spinner;
@ -21,7 +20,6 @@ public class Introduction extends ActionBarActivity {
private EditText name, level; private EditText name, level;
private EditText fue, con, des, sab, intel, car; private EditText fue, con, des, sab, intel, car;
private Spinner classSpinner, raceSpinner; private Spinner classSpinner, raceSpinner;
private boolean first;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -57,8 +55,6 @@ public class Introduction extends ActionBarActivity {
Player.RACE_STRINGS Player.RACE_STRINGS
) )
); );
first = getIntent().getExtras() == null || getIntent().getExtras().getBoolean("first_time");
} }
@ -88,22 +84,6 @@ public class Introduction extends ActionBarActivity {
//noinspection SimplifiableIfStatement //noinspection SimplifiableIfStatement
if (id == R.id.action_save) { if (id == R.id.action_save) {
if(finished()) {
finish();
} else {
Toast.makeText(
getApplicationContext(),
R.string.missing_info_error,
Toast.LENGTH_LONG
).show();
}
return true;
}
return super.onOptionsItemSelected(item);
}
public void finishButton(View view){
if(finished()) { if(finished()) {
finish(); finish();
} else { } else {
@ -111,6 +91,9 @@ public class Introduction extends ActionBarActivity {
Snackbar.with(getApplicationContext()).text(R.string.missing_info_error), this Snackbar.with(getApplicationContext()).text(R.string.missing_info_error), this
); );
} }
return true;
}
return super.onOptionsItemSelected(item);
} }
private boolean finished() { private boolean finished() {
@ -171,6 +154,7 @@ public class Introduction extends ActionBarActivity {
ed.putInt("con", con); ed.putInt("con", con);
ed.putInt("des", des); ed.putInt("des", des);
//TEMP //TEMP
ed.putBoolean("new", true);
ed.apply(); ed.apply();
} else { } else {
return false; return false;

View file

@ -4,13 +4,11 @@ import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.InputType; import android.text.InputType;
import android.view.Menu; import android.view.Menu;
@ -39,7 +37,6 @@ public class MainActivity extends ActionBarActivity {
private Button pgCurrent; private Button pgCurrent;
private TextView currentPg, currentXp, currentCurativeEfforts, lvl; private TextView currentPg, currentXp, currentCurativeEfforts, lvl;
private SharedPreferences p; private SharedPreferences p;
private Toolbar toolbar;
@Override @Override
@ -47,7 +44,7 @@ public class MainActivity extends ActionBarActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
//Initializing activity (setting toolbar as actionbar) //Initializing activity (setting toolbar as actionbar)
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
//Loading player //Loading player
@ -73,7 +70,6 @@ public class MainActivity extends ActionBarActivity {
currentXp = (TextView) findViewById(R.id.currentXp); currentXp = (TextView) findViewById(R.id.currentXp);
currentCurativeEfforts = (TextView) findViewById(R.id.currentCurativeEfforts); currentCurativeEfforts = (TextView) findViewById(R.id.currentCurativeEfforts);
//TODO: do not change progressbar background
xpBar.getProgressDrawable() xpBar.getProgressDrawable()
.setColorFilter(getResources().getColor(R.color.px_bar), PorterDuff.Mode.SRC_IN); .setColorFilter(getResources().getColor(R.color.px_bar), PorterDuff.Mode.SRC_IN);
curativeEffortsBar.getProgressDrawable() curativeEffortsBar.getProgressDrawable()
@ -303,6 +299,7 @@ public class MainActivity extends ActionBarActivity {
pgUpdate(); pgUpdate();
invalidateOptionsMenu(); invalidateOptionsMenu();
} catch (Exception e) { } 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())); pgCurrent.setText(String.valueOf(player.getPg()));
if (status == Player.MUERTO) { if (status == Player.MUERTO) {
pgCurrent.setTextColor(Color.BLACK); pgCurrent.setTextColor(Color.BLACK);
pgCurrent.setBackgroundColor(Color.RED); pgCurrent.setBackgroundColor(getResources().getColor(R.color.red));
AlertDialog.Builder alert = new AlertDialog.Builder(this); AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle(getString(R.string.reset_confirmation_title)); alert.setTitle(getString(R.string.reset_confirmation_title));
@ -365,9 +362,9 @@ public class MainActivity extends ActionBarActivity {
alert.show(); alert.show();
} else if (status == Player.DEBILITADO) { } else if (status == Player.DEBILITADO) {
pgCurrent.setBackgroundColor(android.R.drawable.btn_default); pgCurrent.setBackgroundColor(android.R.drawable.btn_default);
pgCurrent.setTextColor(Color.RED); pgCurrent.setTextColor(getResources().getColor(R.color.red));
pgBar.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN); pgBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.red), PorterDuff.Mode.SRC_IN);
negPgBar.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN); negPgBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.red), PorterDuff.Mode.SRC_IN);
if(lastState != Player.SAME) { if(lastState != Player.SAME) {
SnackbarManager.show( SnackbarManager.show(
Snackbar Snackbar
@ -377,9 +374,9 @@ public class MainActivity extends ActionBarActivity {
} }
} else if (status == Player.MALHERIDO) { } else if (status == Player.MALHERIDO) {
pgCurrent.setBackgroundColor(android.R.drawable.btn_default); pgCurrent.setBackgroundColor(android.R.drawable.btn_default);
pgCurrent.setTextColor(Color.YELLOW); pgCurrent.setTextColor(getResources().getColor(R.color.yellow));
pgBar.getProgressDrawable().setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_IN); pgBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.yellow), PorterDuff.Mode.SRC_IN);
negPgBar.getProgressDrawable().setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_IN); negPgBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.yellow), PorterDuff.Mode.SRC_IN);
if(lastState != Player.SAME) { if(lastState != Player.SAME) {
SnackbarManager.show( SnackbarManager.show(
Snackbar Snackbar
@ -388,42 +385,28 @@ public class MainActivity extends ActionBarActivity {
); );
} }
} else { } else {
pgCurrent.setTextColor(Color.GREEN); pgCurrent.setTextColor(getResources().getColor(R.color.green));
pgCurrent.setBackgroundColor(android.R.drawable.btn_default); pgCurrent.setBackgroundColor(android.R.drawable.btn_default);
pgBar.getProgressDrawable().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN); pgBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.green), PorterDuff.Mode.SRC_IN);
negPgBar.getProgressDrawable().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN); negPgBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.green), PorterDuff.Mode.SRC_IN);
} }
} }
private void restoreData(){ private void restoreData(){
if (player == null) { if (player == null) {
player = new Player( player = new Player( p );
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]);
} else { } else {
player.setName(p.getString("playerName", getString(R.string.adventurer_name))); player.setName(p.getString(Player.NAME, player.getName()));
player.setClassInt(p.getInt("classInt", Player.NULL)); player.setClassInt(p.getInt(Player.CLASS, player.getClassInt()));
player.setRaceInt(p.getInt("raceInt", Player.NULL)); player.setRaceInt(p.getInt(Player.RACE, player.getRaceInt()));
player.setPx(p.getInt("px", player.getPx())); player.setPx(p.getInt(Player.PX, player.getPx()));
player.setAtk(new int[]{ player.setAtk(new int[]{
p.getInt("fue", 10), p.getInt("fue", player.getFue()),
p.getInt("con", 10), p.getInt("con", player.getCon()),
p.getInt("des", 10), p.getInt("des", player.getDes()),
p.getInt("int", 10), p.getInt("int", player.getInt()),
p.getInt("sab", 10), p.getInt("sab", player.getSab()),
p.getInt("car", 10) p.getInt("car", player.getCar())
}); });
} }
pxUpdate(); pxUpdate();
@ -440,17 +423,7 @@ public class MainActivity extends ActionBarActivity {
pgBar.setMax(player.getMaxPg()); pgBar.setMax(player.getMaxPg());
negPgBar.setMax(player.getMaxPg() / 2); negPgBar.setMax(player.getMaxPg() / 2);
// incrementProgressBar(
// pgBar, currentPg,
// 100, true, player.getMaxPg(),
// true, player.getPg()
// );
curativeEffortsBar.setMax(player.getMaxCurativeEfforts()); curativeEffortsBar.setMax(player.getMaxCurativeEfforts());
// incrementProgressBar(
// curativeEffortsBar, currentCurativeEfforts,
// 100, true, player.getMaxCurativeEfforts(),
// true, player.getCurativeEfforts()
// );
pgUpdate(); pgUpdate();
ceUpdate(); ceUpdate();
//set restored values to the respective fields //set restored values to the respective fields
@ -553,90 +526,4 @@ public class MainActivity extends ActionBarActivity {
dialog.show(); dialog.show();
input.requestFocus(); 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; 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"; public static final String NAME = "playerName", CLASS = "classInt", RACE = "raceInt", PX = "px";
@ -107,15 +111,35 @@ class Player {
private int level; private int level;
//TODO: use dice dialogs //TODO: use dice dialogs
private int[] atk, def, abilities; private int[] atk, def, abilities;
private boolean[] abilitiesTrained;
//TODO: implement fully operational powers displayed as cards //TODO: implement fully operational powers displayed as cards
private Power[] powers; 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*/ /** Constructor for creating a new character*/
Player( Player( String name, int classInt, int raceInt,
String name, int classInt, int raceInt, int px, int[] atk, Power[] powers){
int px, int[] atk, int[] abilities,
Power[] powers
){
this.name = name; this.name = name;
this.px = px; this.px = px;
setLevel(); setLevel();
@ -127,28 +151,22 @@ class Player {
pg = maxPg; pg = maxPg;
curativeEfforts = maxCurativeEfforts; curativeEfforts = maxCurativeEfforts;
this.abilities = abilities;
this.powers = powers; this.powers = powers;
} }
/** Constructor for restoring the Player in the middle of the game*/ /** Constructor for restoring the Player in the middle of the game*/
Player( Player( int pg, int px, int curativeEfforts, int classInt, int raceInt, int[] atk, String name, Power[] powers) {
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;
this.px = px; this.px = px;
setLevel(); setLevel();
setState(); setAtk(atk);
this.curativeEfforts = curativeEfforts;
this.maxCurativeEfforts = maxCurativeEfforts;
this.classInt = classInt; this.classInt = classInt;
this.raceInt = raceInt; this.raceInt = raceInt;
setClass();
this.name = name; this.name = name;
this.atk = atk;
this.def = def;
this.abilities = abilities;
this.powers = powers; this.powers = powers;
this.pg = pg;
this.curativeEfforts = curativeEfforts;
setState();
} }
int getPx() {return px;} int getPx() {return px;}
@ -167,11 +185,8 @@ class Player {
int getLevel() {return level;} int getLevel() {return level;}
void setLevel() { void setLevel() {
for (int i = 0; i < LEVEL_PX.length; i++){ for (int i = 0; i < LEVEL_PX.length; i++)
if(px < LEVEL_PX[i]) { if(px < LEVEL_PX[i]) {level = i; return;}
level = i; return;
}
}
level = LEVEL_PX.length; level = LEVEL_PX.length;
} }

View file

@ -1,6 +1,8 @@
package com.kauron.dungeonmanager; package com.kauron.dungeonmanager;
class Power { import java.io.Serializable;
class Power implements Serializable{
/**frequencies*/ /**frequencies*/
public static final int OPORTUNIDAD = 1, A_VOLUNTAD = 2, ENCUENTRO = 3, DIARIO = 4; public static final int OPORTUNIDAD = 1, A_VOLUNTAD = 2, ENCUENTRO = 3, DIARIO = 4;
public static final String[] FREQ = {"Nada", "Oportunidad", "A voluntad", "Encuentro", "Diario"}; 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.support.v7.app.ActionBarActivity;
import android.os.Bundle; import android.os.Bundle;
import android.view.Menu; import android.support.v7.widget.Toolbar;
import android.view.MenuItem; import android.view.View;
public class PowerEditor extends ActionBarActivity { public class PowerEditor extends ActionBarActivity {
@ -14,28 +14,10 @@ public class PowerEditor extends ActionBarActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_power_editor); setContentView(R.layout.activity_power_editor);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
} }
public void saveClick(View view) {
@Override //TODO: save powers
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);
} }
} }

View file

@ -76,24 +76,10 @@ public class Welcome extends ActionBarActivity {
for ( int i = elements; i < n; i++ ) { for ( int i = elements; i < n; i++ ) {
SharedPreferences sav = getSharedPreferences(p.getString("player" + i, ""), MODE_PRIVATE); SharedPreferences sav = getSharedPreferences(p.getString("player" + i, ""), MODE_PRIVATE);
if (sav.contains(Player.NAME)) if (sav.contains(Player.NAME))
adapter.add( adapter.add( new Player( sav ) );
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]
));
} }
//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 ) { } else if ( n != 0 ) {
playerList.setVisibility(View.VISIBLE); playerList.setVisibility(View.VISIBLE);
findViewById(R.id.help_text).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 //TODO: fill the information for the player creation
SharedPreferences sav = getSharedPreferences(p.getString("player" + i, ""), MODE_PRIVATE); SharedPreferences sav = getSharedPreferences(p.getString("player" + i, ""), MODE_PRIVATE);
if (sav.contains(Player.NAME)) if (sav.contains(Player.NAME))
players[i] = new Player( players[i] = new Player( sav );
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]
);
} }
playerList.setAdapter(new PlayerAdapter(this, players)); 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,29 +13,23 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<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:text="Character creation"/> android:text="@string/character_creation"
</RelativeLayout> android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</android.support.v7.widget.Toolbar> </android.support.v7.widget.Toolbar>
<ScrollView <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:paddingLeft="@dimen/activity_horizontal_margin" 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"> 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_width="fill_parent"
@ -183,7 +177,8 @@
android:layout_below="@+id/thirdLayout" android:layout_below="@+id/thirdLayout"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:visibility="gone"> android:visibility="visible"
android:id="@+id/fourthLayout">
<Button <Button
android:layout_width="match_parent" android:layout_width="match_parent"
@ -194,10 +189,10 @@
<ListView <ListView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/listView" /> android:id="@+id/powerList"
android:choiceMode="none" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
</ScrollView>
</LinearLayout> </LinearLayout>

View file

@ -1,6 +1,33 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
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:orientation="vertical">
<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">
<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:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin"
@ -9,34 +36,195 @@
<EditText <EditText
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/editText" android:id="@+id/nameEdit"
android:capitalize="words"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:capitalize="words" /> android:layout_toEndOf="@+id/keywordsText"
android:layout_toRightOf="@+id/keywordsText"
android:hint="@string/powerNameHint" />
<EditText <EditText
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/editText2" android:id="@+id/keywordsEdit"
android:capitalize="words" android:capitalize="words"
android:layout_below="@+id/editText" 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_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignRight="@+id/editText" android:layout_above="@+id/keywordsEdit"
android:layout_alignEnd="@+id/editText" /> android:layout_toLeftOf="@+id/nameEdit"
android:layout_toStartOf="@+id/nameEdit"
android:gravity="center_vertical" />
<EditText <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_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/editText3" android:layout_below="@+id/keywordsEdit"
android:capitalize="words"
android:layout_below="@+id/editText2"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignRight="@+id/editText2" android:id="@+id/linearLayout">
android:layout_alignEnd="@+id/editText2" />
<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> </RelativeLayout>
</ScrollView>
</LinearLayout>

View file

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

View file

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

View file

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

View file

@ -2,4 +2,10 @@
<!-- Default screen margins, per the Android Design guidelines. --> <!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen> <dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_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> </resources>

View file

@ -91,4 +91,18 @@
<string name="zero" translatable="false">0</string> <string name="zero" translatable="false">0</string>
<string name="no_players">No players, please add one</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="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> </resources>

View file

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