diff --git a/app/build.gradle b/app/build.gradle index d8ed060..0bc1625 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,9 +3,8 @@ apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion "21.1.2" - defaultConfig { - applicationId "com.ddns.kauron.dungeonmanager" + applicationId 'com.kauron.dungeonmanager' minSdkVersion 15 targetSdkVersion 21 versionCode 1 @@ -17,9 +16,11 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + productFlavors { + } } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) + compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:21.0.3' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 966317e..34c8a62 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="com.kauron.dungeonmanager" > + android:value=".MainActivity" /> diff --git a/app/src/main/java/com/ddns/kauron/dungeonmanager/HealthDialogFragment.java b/app/src/main/java/com/kauron/dungeonmanager/HealthDialogFragment.java similarity index 76% rename from app/src/main/java/com/ddns/kauron/dungeonmanager/HealthDialogFragment.java rename to app/src/main/java/com/kauron/dungeonmanager/HealthDialogFragment.java index 61c819a..c9c58b0 100644 --- a/app/src/main/java/com/ddns/kauron/dungeonmanager/HealthDialogFragment.java +++ b/app/src/main/java/com/kauron/dungeonmanager/HealthDialogFragment.java @@ -1,4 +1,4 @@ -package com.ddns.kauron.dungeonmanager; +package com.kauron.dungeonmanager; import android.app.Activity; @@ -40,20 +40,20 @@ public class HealthDialogFragment extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder.setMessage(R.string.new_energies_message) - .setTitle(R.string.new_energies) - .setPositiveButton(R.string.me, new DialogInterface.OnClickListener() { + builder.setMessage(com.ddns.kauron.dungeonmanager.R.string.new_energies_message) + .setTitle(com.ddns.kauron.dungeonmanager.R.string.new_energies) + .setPositiveButton(com.ddns.kauron.dungeonmanager.R.string.me, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { mListener.heal(HealthDialogFragment.this, true); } }) - .setNegativeButton(R.string.other, new DialogInterface.OnClickListener() { + .setNegativeButton(com.ddns.kauron.dungeonmanager.R.string.other, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { mListener.heal(HealthDialogFragment.this, false); } }) - .setNeutralButton(R.string.cancel, new DialogInterface.OnClickListener() { + .setNeutralButton(com.ddns.kauron.dungeonmanager.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); diff --git a/app/src/main/java/com/ddns/kauron/dungeonmanager/Introduction.java b/app/src/main/java/com/kauron/dungeonmanager/Introduction.java similarity index 80% rename from app/src/main/java/com/ddns/kauron/dungeonmanager/Introduction.java rename to app/src/main/java/com/kauron/dungeonmanager/Introduction.java index 83d4c10..7b8e6e1 100644 --- a/app/src/main/java/com/ddns/kauron/dungeonmanager/Introduction.java +++ b/app/src/main/java/com/kauron/dungeonmanager/Introduction.java @@ -1,4 +1,4 @@ -package com.ddns.kauron.dungeonmanager; +package com.kauron.dungeonmanager; import android.content.SharedPreferences; import android.support.v7.app.ActionBarActivity; @@ -21,18 +21,18 @@ public class Introduction extends ActionBarActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getSupportActionBar().setDisplayHomeAsUpEnabled(true); - setContentView(R.layout.activity_introduction); - name = (EditText) findViewById(R.id.editNameIntro); - level = (EditText) findViewById(R.id.editLevelIntro); + setContentView(com.ddns.kauron.dungeonmanager.R.layout.activity_introduction); + name = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.editNameIntro); + level = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.editLevelIntro); - fue = (EditText) findViewById(R.id.FUE); - con = (EditText) findViewById(R.id.CON); - des = (EditText) findViewById(R.id.DES); - sab = (EditText) findViewById(R.id.SAB); - intel = (EditText) findViewById(R.id.INT); - car = (EditText) findViewById(R.id.CAR); + fue = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.FUE); + con = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.CON); + des = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.DES); + sab = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.SAB); + intel = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.INT); + car = (EditText) findViewById(com.ddns.kauron.dungeonmanager.R.id.CAR); - classSpinner = (Spinner) findViewById(R.id.classSpinner); + classSpinner = (Spinner) findViewById(com.ddns.kauron.dungeonmanager.R.id.classSpinner); classSpinner.setAdapter( new ArrayAdapter<>( this, @@ -41,7 +41,7 @@ public class Introduction extends ActionBarActivity { ) ); - raceSpinner = (Spinner) findViewById(R.id.raceSpinner); + raceSpinner = (Spinner) findViewById(com.ddns.kauron.dungeonmanager.R.id.raceSpinner); raceSpinner.setAdapter( new ArrayAdapter<>( this, @@ -55,7 +55,7 @@ public class Introduction extends ActionBarActivity { @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); + getMenuInflater().inflate(com.ddns.kauron.dungeonmanager.R.menu.menu_introduction, menu); return true; } @@ -67,13 +67,13 @@ public class Introduction extends ActionBarActivity { int id = item.getItemId(); //noinspection SimplifiableIfStatement - if (id == R.id.action_finish) { + if (id == com.ddns.kauron.dungeonmanager.R.id.action_finish) { if(finished()) { this.finish(); } else { Toast.makeText( getApplicationContext(), - R.string.missing_info_error, + com.ddns.kauron.dungeonmanager.R.string.missing_info_error, Toast.LENGTH_LONG ).show(); } diff --git a/app/src/main/java/com/ddns/kauron/dungeonmanager/MainActivity.java b/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java similarity index 65% rename from app/src/main/java/com/ddns/kauron/dungeonmanager/MainActivity.java rename to app/src/main/java/com/kauron/dungeonmanager/MainActivity.java index ab1db2c..747d9c0 100644 --- a/app/src/main/java/com/ddns/kauron/dungeonmanager/MainActivity.java +++ b/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java @@ -1,4 +1,4 @@ -package com.ddns.kauron.dungeonmanager; +package com.kauron.dungeonmanager; import android.app.AlertDialog; import android.app.DialogFragment; @@ -31,7 +31,7 @@ public class MainActivity extends ActionBarActivity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); + setContentView(com.ddns.kauron.dungeonmanager.R.layout.activity_main); undo = false; invalidateOptionsMenu(); } @@ -39,13 +39,13 @@ public class MainActivity extends ActionBarActivity @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); + getMenuInflater().inflate(com.ddns.kauron.dungeonmanager.R.menu.menu_main, menu); return true; } @Override public boolean onPrepareOptionsMenu (Menu menu) { - menu.findItem(R.id.action_undo).setVisible(undo); + menu.findItem(com.ddns.kauron.dungeonmanager.R.id.action_undo).setVisible(undo); return true; } @@ -59,10 +59,10 @@ public class MainActivity extends ActionBarActivity int id = item.getItemId(); //noinspection SimplifiableIfStatement - if (id == R.id.action_cure) { + if (id == com.ddns.kauron.dungeonmanager.R.id.action_cure) { showHealthDialog(); return true; - } else if (id == R.id.action_edit_basics) { + } else if (id == com.ddns.kauron.dungeonmanager.R.id.action_edit_basics) { //TODO: try this startChildActivity() SharedPreferences p = getSharedPreferences("basics", MODE_PRIVATE); Intent intent = new Intent(this, Introduction.class); @@ -72,19 +72,19 @@ public class MainActivity extends ActionBarActivity )); restoreData(); return true; - } else if (id == R.id.action_undo) { + } else if (id == com.ddns.kauron.dungeonmanager.R.id.action_undo) { undo(); return true; - } else if (id == R.id.action_reset) { + } else if (id == com.ddns.kauron.dungeonmanager.R.id.action_reset) { AlertDialog.Builder alert = new AlertDialog.Builder(this); - alert.setTitle(getString(R.string.reset_confirmation_title)); - alert.setMessage(getString(R.string.reset_confirmation)); + alert.setTitle(getString(com.ddns.kauron.dungeonmanager.R.string.reset_confirmation_title)); + alert.setMessage(getString(com.ddns.kauron.dungeonmanager.R.string.reset_confirmation)); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Toast.makeText( getApplicationContext(), - R.string.message_reset, + com.ddns.kauron.dungeonmanager.R.string.message_reset, Toast.LENGTH_LONG ).show(); getSharedPreferences("basics", MODE_PRIVATE).edit().clear().apply(); @@ -146,14 +146,14 @@ public class MainActivity extends ActionBarActivity if (hasCured == Player.NOT_CURED) { Toast.makeText( getApplicationContext(), - R.string.no_curative_efforts_error, + com.ddns.kauron.dungeonmanager.R.string.no_curative_efforts_error, Toast.LENGTH_LONG ).show(); } else { if(hasCured == Player.MAXED){ Toast.makeText( getApplicationContext(), - R.string.maxed_curative, + com.ddns.kauron.dungeonmanager.R.string.maxed_curative, Toast.LENGTH_LONG ).show(); } @@ -168,18 +168,18 @@ public class MainActivity extends ActionBarActivity public void damage(final View view){ AlertDialog.Builder alert = new AlertDialog.Builder(this); - alert.setTitle(getString(R.string.suffer_damage)); + alert.setTitle(getString(com.ddns.kauron.dungeonmanager.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); + input.setHint(com.ddns.kauron.dungeonmanager.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); + Button pg = (Button) findViewById(com.ddns.kauron.dungeonmanager.R.id.pgCurrent); try { int preValue = Integer.parseInt(pg.getText().toString()); int damage = Integer.parseInt(input.getText().toString()); @@ -212,26 +212,26 @@ public class MainActivity extends ActionBarActivity private void healthStatusCheck() { int status = player.getState(); int lastState = player.getLastState(); - Button pg = (Button) findViewById(R.id.pgCurrent); + Button pg = (Button) findViewById(com.ddns.kauron.dungeonmanager.R.id.pgCurrent); pg.setText(String.valueOf(player.getPg())); if (status == Player.MUERTO) { pg.setTextColor(Color.BLACK); pg.setBackgroundColor(Color.RED); AlertDialog.Builder alert = new AlertDialog.Builder(this); - alert.setTitle(getString(R.string.reset_confirmation_title)); - alert.setMessage(getString(R.string.reset_confirmation)); - alert.setPositiveButton(R.string.action_undo, new DialogInterface.OnClickListener() { + alert.setTitle(getString(com.ddns.kauron.dungeonmanager.R.string.reset_confirmation_title)); + alert.setMessage(getString(com.ddns.kauron.dungeonmanager.R.string.reset_confirmation)); + alert.setPositiveButton(com.ddns.kauron.dungeonmanager.R.string.action_undo, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { undo(); } }); - alert.setNegativeButton(R.string.die, new DialogInterface.OnClickListener() { + alert.setNegativeButton(com.ddns.kauron.dungeonmanager.R.string.die, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Toast.makeText( getApplicationContext(), - R.string.message_death, + com.ddns.kauron.dungeonmanager.R.string.message_death, Toast.LENGTH_LONG ).show(); getSharedPreferences("basics", MODE_PRIVATE).edit().clear().apply(); @@ -246,7 +246,7 @@ public class MainActivity extends ActionBarActivity if(lastState != Player.SAME) { Toast.makeText( getApplicationContext(), - R.string.state_changed_debilitado, + com.ddns.kauron.dungeonmanager.R.string.state_changed_debilitado, Toast.LENGTH_LONG ).show(); } @@ -256,13 +256,13 @@ public class MainActivity extends ActionBarActivity if(lastState != Player.SAME) { Toast.makeText( getApplicationContext(), - R.string.state_changed_malherido, + com.ddns.kauron.dungeonmanager.R.string.state_changed_malherido, Toast.LENGTH_LONG ).show(); } } else { pg.setTextColor(getResources().getColor( - R.color.abc_primary_text_material_dark + com.ddns.kauron.dungeonmanager.R.color.abc_primary_text_material_dark )); pg.setBackgroundColor(android.R.drawable.btn_default); } @@ -281,9 +281,9 @@ public class MainActivity extends ActionBarActivity } if(player == null) { 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.getString("playerName", getString(com.ddns.kauron.dungeonmanager.R.string.adventurer_name)), + p.getString("className", getString(com.ddns.kauron.dungeonmanager.R.string.class_name)), + p.getString("raceName", getString(com.ddns.kauron.dungeonmanager.R.string.race_name)), p.getInt("level", 1), new int[] { p.getInt("fue", 10), @@ -296,9 +296,9 @@ public class MainActivity extends ActionBarActivity new int[18], new Power[4]); } else { - player.setName(p.getString("playerName", getString(R.string.adventurer_name))); - player.setClassName(p.getString("className", getString(R.string.class_name))); - player.setRaceName(p.getString("raceName", getString(R.string.race_name))); + player.setName(p.getString("playerName", getString(com.ddns.kauron.dungeonmanager.R.string.adventurer_name))); + player.setClassName(p.getString("className", getString(com.ddns.kauron.dungeonmanager.R.string.class_name))); + player.setRaceName(p.getString("raceName", getString(com.ddns.kauron.dungeonmanager.R.string.race_name))); player.setLevel(p.getInt("level", 1)); //TODO: restore pg player.setAtk(new int[]{ @@ -313,45 +313,45 @@ public class MainActivity extends ActionBarActivity updateCurativeString(); } //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())); + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.nameText)).setText(player.getName()); + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.raceText)).setText(player.getRaceName()); + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.classText)).setText(player.getClassName()); + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.lvl)).setText(String.valueOf(player.getLevel())); - ((Button) findViewById(R.id.pgCurrent)).setText(String.valueOf(player.getPg())); + ((Button) findViewById(com.ddns.kauron.dungeonmanager.R.id.pgCurrent)).setText(String.valueOf(player.getPg())); //attacks - ((TextView) findViewById(R.id.FUE)).setText( - getString(R.string.FUE) + ":" + player.getFue() + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.FUE)).setText( + getString(com.ddns.kauron.dungeonmanager.R.string.FUE) + ":" + player.getFue() ); - ((TextView) findViewById(R.id.CON)).setText( - getString(R.string.CON) + ":" + player.getCon() + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.CON)).setText( + getString(com.ddns.kauron.dungeonmanager.R.string.CON) + ":" + player.getCon() ); - ((TextView) findViewById(R.id.DES)).setText( - getString(R.string.DES) + ":" + player.getDes() + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.DES)).setText( + getString(com.ddns.kauron.dungeonmanager.R.string.DES) + ":" + player.getDes() ); - ((TextView) findViewById(R.id.INT)).setText( - getString(R.string.INT) + ":" + player.getInt() + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.INT)).setText( + getString(com.ddns.kauron.dungeonmanager.R.string.INT) + ":" + player.getInt() ); - ((TextView) findViewById(R.id.SAB)).setText( - getString(R.string.SAB) + ":" + player.getSab() + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.SAB)).setText( + getString(com.ddns.kauron.dungeonmanager.R.string.SAB) + ":" + player.getSab() ); - ((TextView) findViewById(R.id.CAR)).setText( - getString(R.string.CAR) + ":" + player.getCar() + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.CAR)).setText( + getString(com.ddns.kauron.dungeonmanager.R.string.CAR) + ":" + player.getCar() ); //defenses - ((TextView) findViewById(R.id.CA)).setText( - getString(R.string.CA) + ": " + player.getCa() + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.CA)).setText( + getString(com.ddns.kauron.dungeonmanager.R.string.CA) + ": " + player.getCa() ); - ((TextView) findViewById(R.id.FORT)).setText( - getString(R.string.FORT) + ": " + player.getFort() + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.FORT)).setText( + getString(com.ddns.kauron.dungeonmanager.R.string.FORT) + ": " + player.getFort() ); - ((TextView) findViewById(R.id.REF)).setText( - getString(R.string.REF) + ": " + player.getRef() + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.REF)).setText( + getString(com.ddns.kauron.dungeonmanager.R.string.REF) + ": " + player.getRef() ); - ((TextView) findViewById(R.id.VOL)).setText( - getString(R.string.VOL) + ": " + player.getVol() + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.VOL)).setText( + getString(com.ddns.kauron.dungeonmanager.R.string.VOL) + ": " + player.getVol() ); @@ -368,22 +368,22 @@ public class MainActivity extends ActionBarActivity // } private void updateCurativeString() { - ((TextView) findViewById(R.id.curativeEffortsText)).setText( - getString(R.string.curative_display_text1) + " " + + ((TextView) findViewById(com.ddns.kauron.dungeonmanager.R.id.curativeEffortsText)).setText( + getString(com.ddns.kauron.dungeonmanager.R.string.curative_display_text1) + " " + player.getCurativeEfforts() + " " + - getString(R.string.curative_display_text2) + " " + + getString(com.ddns.kauron.dungeonmanager.R.string.curative_display_text2) + " " + player.getMaxCurativeEfforts() + " " + - getString(R.string.curative_display_text3) + getString(com.ddns.kauron.dungeonmanager.R.string.curative_display_text3) ); } private void undo() { String message = ""; if(undoObject == CURRENT_PG){ - ((Button) findViewById(R.id.pgCurrent)).setText(String.valueOf(undoPreviousValue)); + ((Button) findViewById(com.ddns.kauron.dungeonmanager.R.id.pgCurrent)).setText(String.valueOf(undoPreviousValue)); player.setPg(undoPreviousValue); undoObject = NULL; - message = getString(R.string.action_undo_current_pg); + message = getString(com.ddns.kauron.dungeonmanager.R.string.action_undo_current_pg); } Toast.makeText( getApplicationContext(), diff --git a/app/src/main/java/com/ddns/kauron/dungeonmanager/Player.java b/app/src/main/java/com/kauron/dungeonmanager/Player.java similarity index 99% rename from app/src/main/java/com/ddns/kauron/dungeonmanager/Player.java rename to app/src/main/java/com/kauron/dungeonmanager/Player.java index f2efe60..acc986e 100644 --- a/app/src/main/java/com/ddns/kauron/dungeonmanager/Player.java +++ b/app/src/main/java/com/kauron/dungeonmanager/Player.java @@ -1,4 +1,4 @@ -package com.ddns.kauron.dungeonmanager; +package com.kauron.dungeonmanager; public class Player { diff --git a/app/src/main/java/com/ddns/kauron/dungeonmanager/Power.java b/app/src/main/java/com/kauron/dungeonmanager/Power.java similarity index 92% rename from app/src/main/java/com/ddns/kauron/dungeonmanager/Power.java rename to app/src/main/java/com/kauron/dungeonmanager/Power.java index cd91777..1237ac6 100644 --- a/app/src/main/java/com/ddns/kauron/dungeonmanager/Power.java +++ b/app/src/main/java/com/kauron/dungeonmanager/Power.java @@ -1,4 +1,4 @@ -package com.ddns.kauron.dungeonmanager; +package com.kauron.dungeonmanager; public class Power { public static final int DIARIO = 1, A_VOLUNTAD = 2, ENCUENTRO = 3, OPORTUNIDAD = 4; diff --git a/app/src/main/res/layout/activity_introduction.xml b/app/src/main/res/layout/activity_introduction.xml index bc0a3ac..0b10890 100644 --- a/app/src/main/res/layout/activity_introduction.xml +++ b/app/src/main/res/layout/activity_introduction.xml @@ -4,7 +4,7 @@ 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"> + tools:context="com.ddns.kauron.com.kauron.dungeonmanager.Introduction"> + tools:context="com.kauron.dungeonmanager.Introduction">