1
0
Fork 0

Imrpoved undo

This commit is contained in:
Carlos Galindo 2015-03-04 23:51:47 +01:00
parent 0670be555f
commit 06673bdcd0
16 changed files with 35 additions and 27 deletions

View file

@ -12,9 +12,9 @@
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
@ -25,7 +25,7 @@
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
@ -34,12 +34,12 @@
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
@ -88,6 +88,7 @@
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-21.0.3" level="project" />
</component>
</module>

View file

@ -23,4 +23,5 @@ android {
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:cardview-v7:21.0.3'
}

View file

@ -64,6 +64,7 @@ public class Introduction extends ActionBarActivity {
@Override
public void onBackPressed() {
super.onBackPressed();
Toast.makeText(
getApplicationContext(),
R.string.message_no_back_button_intro,

View file

@ -57,7 +57,6 @@ public class MainActivity extends ActionBarActivity{
.setColorFilter(Color.parseColor("#62BACE"), PorterDuff.Mode.SRC_IN);
curativeEffortsBar.getProgressDrawable()
.setColorFilter(Color.parseColor("#FFD700"), PorterDuff.Mode.SRC_IN);
//TODO: use the negative PG bar, not curativeEfforts one
undo = false;
//begin
restoreData();
@ -77,7 +76,11 @@ public class MainActivity extends ActionBarActivity{
@Override
public boolean onPrepareOptionsMenu (Menu menu) {
menu.findItem(R.id.action_undo).setVisible(undo);
menu.findItem(R.id.action_undo).setEnabled(undo);
if (undo)
menu.findItem(R.id.action_undo).getIcon().setAlpha(255);
else
menu.findItem(R.id.action_undo).getIcon().setAlpha(128);
return true;
}
@ -120,7 +123,6 @@ public class MainActivity extends ActionBarActivity{
//levelUp
//TODO: update defenses
//TODO: add attack points when necessary
//TODO: update currentPg button
//TODO: improve leveling up
player.setMaxPgOnLevelUp();
lvl.setText(
@ -496,11 +498,13 @@ public class MainActivity extends ActionBarActivity{
undoObject = NULL;
message = getString(R.string.action_undo_current_pg);
}
Toast.makeText(
getApplicationContext(),
message,
Toast.LENGTH_LONG
).show();
if (!message.isEmpty()) {
Toast.makeText(
getApplicationContext(),
message,
Toast.LENGTH_LONG
).show();
}
pgUpdate();
undo = false;
invalidateOptionsMenu();
@ -599,7 +603,6 @@ public class MainActivity extends ActionBarActivity{
}
//TODO: show on screen the max pg's
// if(progressBar.getId() == R.id.pgBar) {
// double rate = (double)current / progressBar.getMax() * (negative ? -1:1);
// if (rate <= 0) {

View file

@ -217,7 +217,7 @@ public class Player {
public void setRaceInt(int raceInt) {this.raceInt= raceInt;}
public int getRaceInt() {return raceInt;}
//TODO: implement time in the app
//TODO: implement turns (for bonuses and continuous damage in the app
public void rest(boolean isLong) {
if(isLong) {
pg = maxPg;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -1,6 +1,8 @@
<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:paddingLeft="@dimen/activity_horizontal_margin"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
@ -22,11 +24,11 @@
android:onClick="onNewClick" />
<Button
android:layout_width="match_parent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/load_character"
android:id="@+id/loadCharacter"
android:onClick="onLoadClick"
android:layout_marginTop="10dp" />
android:onClick="onLoadClick" />
</LinearLayout>

View file

@ -1,12 +1,12 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
<!--TODO: create fancy responsive toasts-->
<!--TODO: create fancy responsive toasts for undo's-->
<item
android:id="@+id/action_undo"
android:title="@string/action_undo"
android:orderInCategory="1"
app:showAsAction="never"
app:showAsAction="ifRoom"
android:icon="@drawable/ic_action_undo"/>
<item
android:id="@+id/action_cure"

View file

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files