diff --git a/app/src/main/java/com/kauron/dungeonmanager/HealthDialogFragment.java b/app/src/main/java/com/kauron/dungeonmanager/HealthDialogFragment.java
deleted file mode 100644
index 209c3a8..0000000
--- a/app/src/main/java/com/kauron/dungeonmanager/HealthDialogFragment.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.kauron.dungeonmanager;
-
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.DialogFragment;
-import android.content.DialogInterface;
-import android.os.Bundle;
-
-public class HealthDialogFragment extends DialogFragment {
- //TODO: convert to method and dialog, without class
-
- static HealthDialogFragment newInstance(int curativeEfforts) {
- HealthDialogFragment f = new HealthDialogFragment();
- Bundle args = new Bundle();
- args.putInt("curativeEfforts", curativeEfforts);
- f.setArguments(args);
-
- return f;
- }
-
- public interface HealthDialogListener {
- public void heal(DialogFragment dialog, boolean uses);
- }
-
-
- HealthDialogListener mListener;
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- try{
- mListener = (HealthDialogListener) activity;
- }catch(ClassCastException e){
- throw new ClassCastException(activity.toString() + " must implement HealthDialogListener");
- }
- }
-
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- builder.setMessage(com.kauron.dungeonmanager.R.string.new_energies_message)
- .setTitle(com.kauron.dungeonmanager.R.string.new_energies)
- .setPositiveButton(com.kauron.dungeonmanager.R.string.me, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- mListener.heal(HealthDialogFragment.this, true);
- }
- })
- .setNegativeButton(com.kauron.dungeonmanager.R.string.other, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- mListener.heal(HealthDialogFragment.this, false);
- }
- })
- .setNeutralButton(com.kauron.dungeonmanager.R.string.cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- dialog.cancel();
- }
- });
- return builder.create();
- }
-}
diff --git a/app/src/main/java/com/kauron/dungeonmanager/Introduction.java b/app/src/main/java/com/kauron/dungeonmanager/Introduction.java
index f439f6d..d4e28f9 100644
--- a/app/src/main/java/com/kauron/dungeonmanager/Introduction.java
+++ b/app/src/main/java/com/kauron/dungeonmanager/Introduction.java
@@ -67,7 +67,7 @@ public class Introduction extends ActionBarActivity {
int id = item.getItemId();
//noinspection SimplifiableIfStatement
- if (id == com.kauron.dungeonmanager.R.id.action_finish) {
+ if (id == com.kauron.dungeonmanager.R.id.action_save) {
if(finished()) {
this.finish();
} else {
diff --git a/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java b/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java
index bec0bd3..9339be7 100644
--- a/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java
+++ b/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java
@@ -19,8 +19,7 @@ import android.widget.TextView;
import android.widget.Toast;
-public class MainActivity extends ActionBarActivity
- implements HealthDialogFragment.HealthDialogListener{
+public class MainActivity extends ActionBarActivity{
public static final int CURRENT_PG = 1, NULL = 0;
@@ -49,8 +48,6 @@ public class MainActivity extends ActionBarActivity
return true;
}
-
-
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
@@ -60,7 +57,15 @@ public class MainActivity extends ActionBarActivity
//noinspection SimplifiableIfStatement
if (id == com.kauron.dungeonmanager.R.id.action_cure) {
- showHealthDialog();
+ if(player.getMaxPg() <= player.getPg()){
+ Toast.makeText(
+ getApplicationContext(),
+ R.string.maxed_curative,
+ Toast.LENGTH_LONG
+ ).show();
+ } else {
+ healDialog();
+ }
return true;
} else if (id == com.kauron.dungeonmanager.R.id.action_edit_basics) {
//TODO: try this startChildActivity()
@@ -76,7 +81,6 @@ public class MainActivity extends ActionBarActivity
undo();
return true;
} else if (id == com.kauron.dungeonmanager.R.id.action_reset) {
-
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle(getString(com.kauron.dungeonmanager.R.string.reset_confirmation_title));
alert.setMessage(getString(com.kauron.dungeonmanager.R.string.reset_confirmation));
@@ -99,50 +103,22 @@ public class MainActivity extends ActionBarActivity
});
alert.show();
-// } else if (id == R.id.action_save) {
-// saveData();
-// } else if (id == R.id.action_load) {
-// restoreData();
}
return super.onOptionsItemSelected(item);
}
- public void showHealthDialog(){
- DialogFragment dialog = HealthDialogFragment.newInstance(player.getCurativeEfforts());
- dialog.show(getFragmentManager(), "HealthDialogFragment");
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- Log.e("UTIL", "pause");
- }
-
@Override
protected void onResume() {
super.onResume();
- Log.e("UTIL", "resume");
restoreData();
healthStatusCheck();
updateCurativeString();
}
- @Override
- protected void onStop() {
- super.onStop();
- Log.e("UTIL", "stop");
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- Log.e("UTIL", "destroy");
- }
-
- @Override
- public void heal(DialogFragment dialog, boolean uses) {
- int hasCured = player.recoverPg(Player.USE_CURATIVE_EFFORT, uses);
+ public void heal(boolean usesEffort
+ ) {
+ int hasCured = player.recoverPg(Player.USE_CURATIVE_EFFORT, usesEffort);
if (hasCured == Player.NOT_CURED) {
Toast.makeText(
getApplicationContext(),
@@ -166,6 +142,30 @@ public class MainActivity extends ActionBarActivity
}
}
+ public void healDialog() {
+ AlertDialog.Builder alert = new AlertDialog.Builder(this);
+ alert.setMessage(com.kauron.dungeonmanager.R.string.new_energies_message)
+ .setTitle(com.kauron.dungeonmanager.R.string.new_energies)
+ .setPositiveButton(com.kauron.dungeonmanager.R.string.me, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id) {
+ heal(true);
+ }
+ })
+ .setNegativeButton(com.kauron.dungeonmanager.R.string.other, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ heal(false);
+ }
+ })
+ .setNeutralButton(com.kauron.dungeonmanager.R.string.cancel, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ dialog.cancel();
+ }
+ });
+ alert.show();
+ }
+
public void damage(final View view){
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle(getString(com.kauron.dungeonmanager.R.string.suffer_damage));
@@ -310,8 +310,8 @@ public class MainActivity extends ActionBarActivity
});
}
-
- player.setPg(p.getInt("pg", player.getMaxPg()));
+ player.setCurativeEffort(p.getInt("curativeEfforts", player.getCurativeEfforts()));
+ player.setPg(p.getInt("pg", player.getPg()));
healthStatusCheck();
updateCurativeString();
//set restored values to the respective fields
@@ -371,11 +371,11 @@ public class MainActivity extends ActionBarActivity
private void updateCurativeString() {
((TextView) findViewById(com.kauron.dungeonmanager.R.id.curativeEffortsText)).setText(
- getString(com.kauron.dungeonmanager.R.string.curative_display_text1) + " " +
- player.getCurativeEfforts() + " " +
- getString(com.kauron.dungeonmanager.R.string.curative_display_text2) + " " +
- player.getMaxCurativeEfforts() + " " +
- getString(com.kauron.dungeonmanager.R.string.curative_display_text3)
+ getString(
+ R.string.curative_display_text,
+ player.getCurativeEfforts(),
+ player.getMaxCurativeEfforts()
+ )
);
}
diff --git a/app/src/main/res/drawable-hdpi/ic_action_heal.png b/app/src/main/res/drawable-hdpi/ic_action_heal.png
index 733fbf6..245cdfb 100644
Binary files a/app/src/main/res/drawable-hdpi/ic_action_heal.png and b/app/src/main/res/drawable-hdpi/ic_action_heal.png differ
diff --git a/app/src/main/res/drawable-hdpi/ic_action_time.png b/app/src/main/res/drawable-hdpi/ic_action_time.png
new file mode 100644
index 0000000..95276a3
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_action_time.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_action_heal.png b/app/src/main/res/drawable-mdpi/ic_action_heal.png
index f437950..118570d 100644
Binary files a/app/src/main/res/drawable-mdpi/ic_action_heal.png and b/app/src/main/res/drawable-mdpi/ic_action_heal.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_action_time.png b/app/src/main/res/drawable-mdpi/ic_action_time.png
new file mode 100644
index 0000000..cf2e79f
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_action_time.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_action_heal.png b/app/src/main/res/drawable-xhdpi/ic_action_heal.png
index 3cdb749..d947f3f 100644
Binary files a/app/src/main/res/drawable-xhdpi/ic_action_heal.png and b/app/src/main/res/drawable-xhdpi/ic_action_heal.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_action_time.png b/app/src/main/res/drawable-xhdpi/ic_action_time.png
new file mode 100644
index 0000000..56b9258
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_action_time.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_heal.png b/app/src/main/res/drawable-xxhdpi/ic_action_heal.png
index 77aa7b4..55a3ddf 100644
Binary files a/app/src/main/res/drawable-xxhdpi/ic_action_heal.png and b/app/src/main/res/drawable-xxhdpi/ic_action_heal.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_time.png b/app/src/main/res/drawable-xxhdpi/ic_action_time.png
new file mode 100644
index 0000000..186b1a0
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_action_time.png differ
diff --git a/app/src/main/res/menu/menu_introduction.xml b/app/src/main/res/menu/menu_introduction.xml
index 007941c..25e5e12 100644
--- a/app/src/main/res/menu/menu_introduction.xml
+++ b/app/src/main/res/menu/menu_introduction.xml
@@ -2,8 +2,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.kauron.dungeonmanager.Introduction">
-
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
index 4acb6ab..e3f355d 100644
--- a/app/src/main/res/menu/menu_main.xml
+++ b/app/src/main/res/menu/menu_main.xml
@@ -5,13 +5,50 @@
android:id="@+id/action_undo"
android:title="@string/action_undo"
android:orderInCategory="1"
- app:showAsAction="always"
+ app:showAsAction="never"
android:icon="@drawable/ic_action_undo"/>
+ android:icon="@drawable/ic_action_heal"
+ app:showAsAction="ifRoom"/>
+
+ -
+
+
+
-
Curar
Editar personaje
- Hecho
+ PG Máx.
Nombre
Cancelar
Clase
@@ -17,6 +17,7 @@
No
No te quedan esfuerzos curativos
Ok
+ Guardar
Raza
Indica el daño sufrido
Editar personaje
@@ -24,16 +25,10 @@
Máx. esfuerzos curativos
PG perdidos
Deshacer
- Guardar
Acción deshecha
- Dragones y Mazmorras
- Cargar
Esfuerzos curativos
PG
Borrar datos
- Te quedan
- de
- esfuerzos curativos diarios
Morir
Has muerto
Los datos han sido borrados
@@ -45,8 +40,8 @@
FUE
INT
SAB
- Te has caído al suelo debilitado, no puedes moverte ni hacer nada.
- ¡Sólo tienes la mitad de la vida!
+ Te has caído al suelo inconsciente, no puedes hacer nada.
+ Estás maltrecho
¿Quién va a usar un esfuerzo curativo?
Yo
Otro
@@ -56,4 +51,11 @@
FORT
REF
VOL
+ Avanzar tiempo
+ Día
+ Fin de encuentro
+ Descanso largo
+ Descanso corto
+ Turno siguiente
+ Tienes %1$d de %2$d esfuerzos curativos
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d8ad45b..d5cda7b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -13,36 +13,37 @@
VOL
Defense
Curative efforts
- You have
- out of
- daily curative efforts.
- Load
- Dungeons and Dragons
- Save
+ You have %1$d out of %2$d curative efforts
Reset
All the data has been cleared
Are you sure?
All data will be lost!
Action undone
Edit character
+ Time events
+ Next turn
+ Short rest
+ Long rest
+ Next day
+ Encounter ended
Adventurer name
You have less than half of your maximum health
Who is using a curative effort?
Class
Race
- You have fainted. You can\'t move or do anything!
+ You have fainted. You can\'t do anything!
Cancel
Ok
Yes
No
Suffer damage
- Your character has died
+ You have died
You have
curative efforts
New energies
Edit character
- Done
+ Save
Level
Max curative efforts
@@ -61,4 +62,5 @@
INT
CAR
SAB
+ Save