kauron/DungeonManager
kauron
/
DungeonManager
Archived
1
0
Fork 0

Initial commit

This commit is contained in:
Carlos Galindo 2015-02-20 20:47:22 +01:00
commit 0677fbf059
70 changed files with 1418 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build

1
.idea/.name Normal file
View File

@ -0,0 +1 @@
DungeonManager

23
.idea/compiler.xml Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

5
.idea/encodings.xml Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>

19
.idea/gradle.xml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.2.1" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View File

@ -0,0 +1,14 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
<inspection_tool class="AndroidLintButtonOrder" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintDeprecated" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintRelativeOverlap" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintRtlHardcoded" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
</inspection_tool>
</profile>
</component>

View File

@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>

10
.idea/misc.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

10
.idea/modules.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/DungeonManager.iml" filepath="$PROJECT_DIR$/DungeonManager.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,5 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>

7
.idea/vcs.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
</project>

21
DungeonManager.iml Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

91
app/app.iml Normal file
View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<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="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
<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" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<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$/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" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<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" />
</component>
</module>

25
app/build.gradle Normal file
View File

@ -0,0 +1,25 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.ddns.kauron.dungeonmanager"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}

17
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\Carlos\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -0,0 +1,13 @@
package com.ddns.kauron.dungeonmanager;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ddns.kauron.dungeonmanager" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Introduction"
android:parentActivityName=".MainActivity"
android:label="@string/title_activity_introduction" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.ddns.kauron.dungeonmanager.MainActivity" />
</activity>
</application>
</manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

View File

@ -0,0 +1,66 @@
package com.ddns.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 {
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 curativeEffort(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) {
String message = getString(R.string.new_energies1) +
" " + getArguments().getInt("curativeEfforts") + " " +
getString(R.string.new_energies2);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(message)
.setTitle(R.string.new_energies_title)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
mListener.curativeEffort(HealthDialogFragment.this, true);
}
})
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
mListener.curativeEffort(HealthDialogFragment.this, false);
}
})
.setNeutralButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
return builder.create();
}
}

View File

@ -0,0 +1,102 @@
package com.ddns.kauron.dungeonmanager;
import android.content.SharedPreferences;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.Toast;
public class Introduction extends ActionBarActivity {
EditText name, className, raceName, level, maxPg;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.activity_introduction);
name = (EditText) findViewById(R.id.editNameIntro);
className = (EditText) findViewById(R.id.editClassIntro);
raceName = (EditText) findViewById(R.id.editRaceIntro);
level = (EditText) findViewById(R.id.editLevelIntro);
maxPg = (EditText) findViewById(R.id.editMaxPgIntro);
}
@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_introduction, 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_finish) {
if(finished()) {
this.finish();
} else {
Toast.makeText(
getApplicationContext(),
R.string.missing_info_error,
Toast.LENGTH_LONG
).show();
}
return true;
}
return super.onOptionsItemSelected(item);
}
//TODO: fix this
private boolean finished() {
SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
SharedPreferences.Editor ed = p.edit();
String nameString = name.getText().toString();
String classString = className.getText().toString();
String raceString = raceName.getText().toString();
int levelInt = 0, maxPgInt = 0;
try {
levelInt = Integer.parseInt(level.getText().toString());
maxPgInt = Integer.parseInt(level.getText().toString());
} catch (Exception e) {}
if(getIntent().getExtras().getBoolean("first_time")) {
if (!nameString.isEmpty() &&
!classString.isEmpty() &&
!raceString.isEmpty() &&
levelInt != 0 &&
maxPgInt != 0) {
//first save it all
ed.putString("playerName", nameString);
ed.putString("className", classString);
ed.putString("raceName", raceString);
if(p.getInt("pg", Integer.MIN_VALUE) == Integer.MIN_VALUE)
ed.putInt("pg", maxPgInt);
ed.putInt("level", levelInt);
ed.putInt("maxPg", maxPgInt);
ed.putBoolean("saved", true);
ed.apply();
return true;
} else {
return false;
}
} else {
if(!nameString.isEmpty()) ed.putString("playerName", nameString);
if(!classString.isEmpty()) ed.putString("className", classString);
if(!raceString.isEmpty()) ed.putString("raceName", raceString);
if(levelInt != 0) ed.putInt("level", levelInt);
if(maxPgInt != 0) ed.putInt("maxPg", maxPgInt);
ed.apply();
return true;
}
}
}

View File

@ -0,0 +1,209 @@
package com.ddns.kauron.dungeonmanager;
import android.app.AlertDialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.text.InputType;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends ActionBarActivity
implements HealthDialogFragment.HealthDialogListener{
public static final int CURRENT_PG = 1, NULL = 0;
public Player player;
private boolean undo;
private int undoObject, undoPreviousValue;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
restoreData();
undo = false;
invalidateOptionsMenu();
}
@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_main, menu);
return true;
}
@Override
public boolean onPrepareOptionsMenu (Menu menu) {
menu.findItem(R.id.action_undo).setVisible(undo);
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_cure) {
showHealthDialog();
return true;
} else if (id == R.id.action_edit_basics) {
SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
Intent intent = new Intent(this, Introduction.class);
startActivity(intent.putExtra(
"first_time",
!p.getBoolean("saved", false)
));
restoreData();
return true;
} else if (id == R.id.action_undo) {
String message = "";
if(undoObject == CURRENT_PG){
((Button) findViewById(R.id.pgCurrent)).setText(String.valueOf(undoPreviousValue));
undoObject = NULL;
message = getString(R.string.action_undo_current_pg);
}
Toast.makeText(
getApplicationContext(),
message,
Toast.LENGTH_LONG
).show();
undo = false;
invalidateOptionsMenu();
return true;
} else if (id == R.id.action_calendar_activity) {
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("title", R.string.dungeons_and_dragons);
startActivity(intent);
} else if (id == R.id.action_save) {
saveData();
}
return super.onOptionsItemSelected(item);
}
public void showHealthDialog(){
DialogFragment dialog = HealthDialogFragment.newInstance(player.getCurativeEfforts());
dialog.show(getFragmentManager(), "HealthDialogFragment");
}
@Override
public void curativeEffort(DialogFragment dialog, boolean uses) {
int hasCured = player.recoverPg(Player.USE_CURATIVE_EFFORT, uses);
if (hasCured == Player.NOT_CURED) {
Toast.makeText(
getApplicationContext(),
R.string.no_curative_efforts_error,
Toast.LENGTH_LONG
).show();
} else {
if(hasCured == Player.MAXED){
Toast.makeText(
getApplicationContext(),
R.string.maxed_curative,
Toast.LENGTH_LONG
).show();
}
healthStatusCheck();
}
}
public void onCurrentPgClick(final View view){
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle(getString(R.string.suffer_damage));
// Set an EditText view to get user input
final EditText input = new EditText(this);
input.setInputType(InputType.TYPE_CLASS_NUMBER);
input.setHint(R.string.suffer_damage_hint);
alert.setView(input);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
Button pg = (Button) findViewById(R.id.pgCurrent);
try {
int preValue = Integer.parseInt(pg.getText().toString());
int damage = Integer.parseInt(input.getText().toString());
player.losePg(damage);
pg.setText(
String.valueOf(player.getPg())
);
//finished correctly, then apply values to undo's
healthStatusCheck();
undo = true;
undoPreviousValue = preValue;
undoObject = CURRENT_PG;
invalidateOptionsMenu();
} catch (Exception e) {}
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Canceled.
}
});
alert.show();
}
private void healthStatusCheck(){
int status = player.getState();
Button pg = (Button) findViewById(R.id.pgCurrent);
pg.setText(String.valueOf(player.getPg()));
if (status == Player.MUERTO) {
pg.setText("");
} else if (status == Player.DEBILITADO)
pg.setTextColor(Color.RED);
else if (status == Player.MALHERIDO)
pg.setTextColor(Color.YELLOW);
else pg.setTextColor(getResources().getColor(R.color.abc_primary_text_material_dark));
}
private void restoreData(){
SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE);
//restore state
player = new Player(
p.getString("playerName", getString(R.string.adventurer_name)),
p.getString("className", getString(R.string.class_name)),
p.getString("raceName", getString(R.string.race_name)),
p.getInt("level", 1),
p.getInt("maxPg", 15),
p.getInt("pg", 15),
p.getInt("maxCurativeEfforts", 5),
p.getInt("curativeEfforts", 5),
new int[6],
new int[3],
new int[18],
new Power[4]);
//set restored values to the respective fields
((TextView) findViewById(R.id.nameText)).setText(player.getName());
((TextView) findViewById(R.id.raceText)).setText(player.getRaceName());
((TextView) findViewById(R.id.classText)).setText(player.getClassName());
((TextView) findViewById(R.id.lvl)).setText(String.valueOf(player.getLevel()));
((Button) findViewById(R.id.pgCurrent)).setText(String.valueOf(player.getMaxPg()));
}
private void saveData() {
}
}

View File

@ -0,0 +1,115 @@
package com.ddns.kauron.dungeonmanager;
public class Player {
/**
* Values for attack
*/
public static final int FUE = 1, CON = 2, DES = 3, INT = 4, SAB = 5, CAR = 6;
/**
* Values for defenses
*/
public static final int CA = 1, FORT = 2, REF = 3, VOL = 4;
/**
* Values for abilities
*/
public static final int ACROBACIAS = 1, AGUANTE = 2, ARCANOS = 3, ATLETISMO = 4, DIPLOMACIA = 5,
DUNGEONS = 6, ENGAÑAR = 7, HISTORIA = 8, HURTO = 9, INTIMIDAR = 10, NATURALEZA = 11,
PERCEPCIÓN = 12, PERSPICACIA = 13, RECURSOS = 14, RELIGIÓN = 15, SANAR = 16, SIGILO = 17;
/**
* Names for the abilities
*/
public static final String[] abilityString = new String[] {
"Acrobacias", "Aguante", "Arcanos", "Atletismo", "Diplomacia", "Dungeons", "Engañar",
"Historia", "Hurto", "Intimidar", "Naturaleza", "Percepción", "Perspicacia", "Recursos",
"Religión", "Sanar", "Sigilo"
};
/**
* Values for the current living state
*/
public static final int OK = 1, MALHERIDO = 2, DEBILITADO = 3, MUERTO = 4,
USE_CURATIVE_EFFORT = -1, CURED = 1, NOT_CURED = 0, MAXED = -1;
private int pg, maxPg;
private int state;
private int curativeEfforts, maxCurativeEfforts;
private int[] atk, def, abilities;
private Power[] powers;
private String name, className, raceName;
private int level;
public Player(String name, String className, String raceName, int level, int maxPg, int pg,
int maxCurativeEfforts, int curativeEfforts, int[] atk, int[] def, int[] abilities, Power[] powers){
this.maxPg = maxPg;
this.pg = pg;
setState();
this.name = name;
this.className = className;
this.raceName = raceName;
this.level = level;
this.atk = atk;
this.def = def;
this.abilities = abilities;
this.powers = powers;
this.maxCurativeEfforts = maxCurativeEfforts;
this.curativeEfforts = curativeEfforts;
}
public int getCurativeEfforts() {return curativeEfforts;}
public void setCurativeEffort(int curativeEfforts) {this.curativeEfforts = curativeEfforts;}
public int getLevel() {return level;}
public int getMaxPg() {return maxPg;}
public void setMaxPg(int pg) {this.pg = pg;}
public int getPg() {return pg;}
public void setPg(int pg) {this.pg = pg;}
public void losePg(int damage) {
pg -= damage;
setState();
}
public int recoverPg(int recovered, boolean uses) {
if(recovered == USE_CURATIVE_EFFORT){
if(uses && curativeEfforts <= 0) return NOT_CURED;
else {
if(uses) curativeEfforts--;
pg += maxPg / 4;
}
} else {
pg += recovered;
}
setState();
if (pg > maxPg) {pg = maxPg; return MAXED;}
return CURED;
}
public int getState() {return state;}
private void setState() {
if (pg < maxPg / -2) state = MUERTO;
else if (pg < 0) state = DEBILITADO;
else if(pg < maxPg / 2) state = MALHERIDO;
else state = OK;
}
public String getName() {return name;}
public String getClassName() {return className;}
public String getRaceName() {return raceName;}
public void rest(boolean length) {
if(length) {
curativeEfforts = maxCurativeEfforts;
for(Power p : powers){
if(p != null) p.recover();
}
}
}
}

View File

@ -0,0 +1,24 @@
package com.ddns.kauron.dungeonmanager;
public class Power {
public static final int DIARIO = 1, A_VOLUNTAD = 2, ENCUENTRO = 3, OPORTUNIDAD = 4;
private boolean used;
private int type;
private String name;
public Power(String name, int type){
this.name = name;
this.type = type;
used = false;
}
public String getName(){return name;}
public int getType(){return type;}
public boolean isUsed(){return used;}
public void use(){used = true;}
public void recover(){used = false;}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,77 @@
<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.ddns.kauron.dungeonmanager.Introduction">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/editNameIntro"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:hint="@string/adventurer_name"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/editRaceIntro"
android:layout_below="@+id/editClassIntro"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:hint="@string/race_name" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/editClassIntro"
android:layout_below="@+id/editNameIntro"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:hint="@string/class_name" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/editLevelIntro"
android:hint="@string/level"
android:width="70dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignLeft="@+id/editMaxPgIntro"
android:layout_alignStart="@+id/editMaxPgIntro" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/editMaxPgIntro"
android:layout_below="@+id/editLevelIntro"
android:hint="@string/max_pg"
android:layout_alignLeft="@+id/editMaxEffortIntro"
android:layout_alignStart="@+id/editMaxEffortIntro" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/editMaxEffortIntro"
android:layout_alignTop="@+id/editRaceIntro"
android:layout_toEndOf="@+id/editRaceIntro"
android:hint="@string/max_curative_efforts"
android:layout_toRightOf="@+id/editRaceIntro" />
</RelativeLayout>

View File

@ -0,0 +1,82 @@
<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=".MainActivity">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/pgCurrent"
android:textSize="40sp"
android:onClick="onCurrentPgClick"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/pgCurrent"
android:layout_toStartOf="@+id/pgCurrent"
android:id="@+id/linearLayout">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/adventurer_name"
android:id="@+id/nameText"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/race_name"
android:id="@+id/raceText"
android:layout_alignTop="@+id/classText"
android:layout_toRightOf="@+id/classText"
android:layout_toEndOf="@+id/classText"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/class_name"
android:id="@+id/classText"
android:layout_below="@+id/nameText"
android:layout_alignParentStart="false"
android:layout_alignParentLeft="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/level"
android:id="@+id/lvlText"
android:layout_alignParentBottom="false"
android:layout_toRightOf="@+id/raceText"
android:layout_toEndOf="@+id/raceText"
android:layout_alignTop="@+id/raceText"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/lvl"
android:layout_alignParentBottom="false"
android:layout_toRightOf="@+id/lvlText"
android:layout_toEndOf="@+id/lvlText"
android:layout_alignTop="@+id/lvlText"
android:layout_marginLeft="10dp" />
</RelativeLayout>
</RelativeLayout>

View File

@ -0,0 +1,10 @@
<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="com.ddns.kauron.dungeonmanager.Introduction">
<item android:id="@+id/action_finish"
android:title="@string/action_finish"
android:orderInCategory="100"
android:icon="@drawable/ic_action_done"
app:showAsAction="ifRoom" />
</menu>

View File

@ -0,0 +1,34 @@
<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">
<item
android:id="@+id/action_undo"
android:title="@string/action_undo"
android:orderInCategory="1"
app:showAsAction="always"
android:icon="@drawable/ic_action_undo"/>
<item
android:id="@+id/action_cure"
android:title="@string/action_cure"
android:orderInCategory="2"
app:showAsAction="always"
android:icon="@drawable/ic_action_heal"/>
<item
android:id="@+id/action_save"
android:title="@string/action_save"
android:orderInCategory="3"
app:showAsAction="ifRoom"
android:icon="@drawable/ic_action_save"/>
<item
android:id="@+id/action_edit_basics"
android:title="@string/action_edit_basics"
android:orderInCategory="4"
app:showAsAction="ifRoom"
android:icon="@drawable/ic_action_edit"/>
<item
android:id="@+id/action_calendar_activity"
android:title="@string/action_calendar_activity"
android:orderInCategory="5"
app:showAsAction="never" />
</menu>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">DungeonManager</string>
<string name="action_cure">Curar</string>
<string name="action_edit_basics">Editar personaje</string>
<string name="action_finish">Hecho</string>
<string name="adventurer_name">Nombre</string>
<string name="cancel">Cancelar</string>
<string name="class_name">Clase</string>
<string name="edit_PG_Title">Sufrir daño</string>
<string name="level">Nivel</string>
<string name="max_pg">PG máx.</string>
<string name="maxed_curative">Has llegado a tus PG máximos</string>
<string name="missing_info_error">Tienes que rellenar todos los campos</string>
<string name="new_energies1">Te quedan</string>
<string name="new_energies2">esfuerzos curativos.</string>
<string name="new_energies_title">¿Usar un esfuerzo curativo?</string>
<string name="no">No</string>
<string name="no_curative_efforts_error">No te quedan esfuerzos curativos</string>
<string name="ok">Ok</string>
<string name="race_name">Raza</string>
<string name="suffer_damage">Indica el daño sufrido</string>
<string name="title_activity_introduction">Editar personaje</string>
<string name="yes"></string>
<string name="max_curative_efforts">Esfuerzos curativos</string>
<string name="suffer_damage_hint">PG perdidos</string>
<string name="action_undo">Deshacer</string>
<string name="action_calendar_activity">Crear evento</string>
<string name="action_save">Guardar</string>
<string name="action_undo_current_pg">Acción deshecha</string>
<string name="dungeons_and_dragons">Dragones y Mazmorras</string>
</resources>

View File

@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#5D4037</color>
<color name="primaryDark">#3E2723</color>
</resources>

View File

@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">DungeonManager</string>
<string name="action_cure">Cure</string>
<string name="action_undo">Undo</string>
<string name="dungeons_and_dragons">Dungeons and Dragons</string>
<string name="action_save">Save</string>
<string name="action_calendar_activity">Create event</string>
<string name="action_undo_current_pg">Action undone</string>
<string name="action_edit_basics">Edit character</string>
<string name="adventurer_name">Adventurer name</string>
<string name="class_name">Class</string>
<string name="race_name">Race</string>
<string name="cancel">Cancel</string>
<string name="ok">Ok</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="edit_PG_Title">Suffer damage</string>
<string name="new_energies1">You have</string>
<string name="new_energies2">curative efforts</string>
<string name="new_energies_title">Use a curative effort?</string>
<string name="title_activity_introduction">Edit character</string>
<string name="action_finish">Done</string>
<string name="level">Level</string>
<string name="max_curative_efforts">Curative efforts</string>
<string name="max_pg">Max PG</string>
<string name="missing_info_error">You need to fill all the information</string>
<string name="no_curative_efforts_error">You don\'t have any curative efforts left!</string>
<string name="maxed_curative">You have reached your maximum level of PG</string>
<string name="suffer_damage">Input the damage suffered</string>
<string name="suffer_damage_hint">PG lost</string>
</resources>

View File

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

19
build.gradle Normal file
View File

@ -0,0 +1,19 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}

18
gradle.properties Normal file
View File

@ -0,0 +1,18 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip

164
gradlew vendored Normal file
View File

@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
gradlew.bat vendored Normal file
View File

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

1
settings.gradle Normal file
View File

@ -0,0 +1 @@
include ':app'