diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6ac8b4a..7c1069c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -18,11 +18,11 @@ - + + + + diff --git a/app/src/main/java/com/kauron/dungeonmanager/Introduction.java b/app/src/main/java/com/kauron/dungeonmanager/Introduction.java index 22ebf13..9344b6d 100644 --- a/app/src/main/java/com/kauron/dungeonmanager/Introduction.java +++ b/app/src/main/java/com/kauron/dungeonmanager/Introduction.java @@ -20,19 +20,19 @@ public class Introduction extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - setContentView(com.kauron.dungeonmanager.R.layout.activity_introduction); - name = (EditText) findViewById(com.kauron.dungeonmanager.R.id.editNameIntro); - level = (EditText) findViewById(com.kauron.dungeonmanager.R.id.editPxIntro); +// getSupportActionBar().setDisplayHomeAsUpEnabled(true); + setContentView(R.layout.activity_introduction); + name = (EditText) findViewById(R.id.editNameIntro); + name.requestFocus(); + level = (EditText) findViewById(R.id.editPxIntro); + 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.kauron.dungeonmanager.R.id.FUE); - con = (EditText) findViewById(com.kauron.dungeonmanager.R.id.CON); - des = (EditText) findViewById(com.kauron.dungeonmanager.R.id.DES); - sab = (EditText) findViewById(com.kauron.dungeonmanager.R.id.SAB); - intel = (EditText) findViewById(com.kauron.dungeonmanager.R.id.INT); - car = (EditText) findViewById(com.kauron.dungeonmanager.R.id.CAR); - - classSpinner = (Spinner) findViewById(com.kauron.dungeonmanager.R.id.classSpinner); + classSpinner = (Spinner) findViewById(R.id.classSpinner); classSpinner.setAdapter( new ArrayAdapter<>( this, @@ -41,7 +41,7 @@ public class Introduction extends ActionBarActivity { ) ); - raceSpinner = (Spinner) findViewById(com.kauron.dungeonmanager.R.id.raceSpinner); + raceSpinner = (Spinner) findViewById(R.id.raceSpinner); raceSpinner.setAdapter( new ArrayAdapter<>( this, @@ -55,10 +55,19 @@ 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(com.kauron.dungeonmanager.R.menu.menu_introduction, menu); + getMenuInflater().inflate(R.menu.menu_introduction, menu); return true; } + @Override + public void onBackPressed() { + Toast.makeText( + getApplicationContext(), + R.string.message_no_back_button_intro, + Toast.LENGTH_LONG + ).show(); + } + @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will @@ -67,13 +76,13 @@ public class Introduction extends ActionBarActivity { int id = item.getItemId(); //noinspection SimplifiableIfStatement - if (id == com.kauron.dungeonmanager.R.id.action_save) { + if (id == R.id.action_save) { if(finished()) { this.finish(); } else { Toast.makeText( getApplicationContext(), - com.kauron.dungeonmanager.R.string.missing_info_error, + R.string.missing_info_error, Toast.LENGTH_LONG ).show(); } diff --git a/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java b/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java index fc54e9e..5fb0184 100644 --- a/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java +++ b/app/src/main/java/com/kauron/dungeonmanager/MainActivity.java @@ -9,7 +9,6 @@ import android.graphics.PorterDuff; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.text.InputType; -import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -100,6 +99,7 @@ public class MainActivity extends ActionBarActivity{ Toast.LENGTH_LONG ).show(); getSharedPreferences("basics", MODE_PRIVATE).edit().clear().apply(); + player = null; restoreData(); } }); @@ -155,6 +155,7 @@ public class MainActivity extends ActionBarActivity{ } }); alert.show(); + input.requestFocus(); return true; } else if (id == R.id.action_download) { //TODO: create self-updater @@ -395,8 +396,8 @@ public class MainActivity extends ActionBarActivity{ ((ProgressBar) findViewById(R.id.xpBar)) .setProgress(player.getPx() - Player.LEVEL_PX[player.getLevel() - 1]); ProgressBar curativeEffortsBar = (ProgressBar) findViewById(R.id.curativeEffortsBar); - curativeEffortsBar.setProgress(player.getCurativeEfforts()); curativeEffortsBar.setMax(player.getMaxCurativeEfforts()); + curativeEffortsBar.setProgress(player.getCurativeEfforts()); healthStatusCheck(); updateCurativeString(); //set restored values to the respective fields @@ -443,12 +444,9 @@ public class MainActivity extends ActionBarActivity{ } private void updateCurativeString() { - ((TextView) findViewById(R.id.curativeEffortsText)).setText( - getString( - R.string.curative_display_text, - player.getCurativeEfforts(), - player.getMaxCurativeEfforts() - ) + ((TextView) findViewById(R.id.currentCurativeEfforts)).setText( + player.getCurativeEfforts() + " / " + + player.getMaxCurativeEfforts() ); } @@ -480,24 +478,6 @@ public class MainActivity extends ActionBarActivity{ input.setHint(R.string.dialog_resolve_max_pg_hint); input.setInputType(InputType.TYPE_CLASS_NUMBER); input.setImeOptions(EditorInfo.IME_ACTION_DONE); - input.setOnKeyListener(new View.OnKeyListener() { - @Override - public boolean onKey(View v, int keyCode, KeyEvent event) { - if(keyCode == KeyEvent.FLAG_EDITOR_ACTION) { - if (input.getText().toString().isEmpty()){ - Toast.makeText( - getApplicationContext(), - R.string.empty_field, - Toast.LENGTH_LONG - ).show(); - pgDialog(); - } else { - player.setMaxPg(Integer.parseInt(input.getText().toString())); - } - } - return false; - } - }); dialog .setView(input) .setCancelable(false) @@ -519,10 +499,11 @@ public class MainActivity extends ActionBarActivity{ } }); dialog.show(); + input.requestFocus(); } + //TODO: show on screen the max pg's //TODO: show in the bars the max and current values - //TODO: create secondary thread to move slower the value of the - //TODO: show the current px and progress bar + //TODO: create secondary thread to move slower the value of the progressBar } \ No newline at end of file diff --git a/app/src/main/java/com/kauron/dungeonmanager/Player.java b/app/src/main/java/com/kauron/dungeonmanager/Player.java index c55c187..5f09625 100644 --- a/app/src/main/java/com/kauron/dungeonmanager/Player.java +++ b/app/src/main/java/com/kauron/dungeonmanager/Player.java @@ -252,8 +252,4 @@ public class Player { public static int getModifier(int i) { return i / 2 - 5; } - - public int getTotalModifier(int i) { - return getModifier(i) + level / 2; - } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_introduction.xml b/app/src/main/res/layout/activity_introduction.xml index 633ccb6..d432d58 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.com.kauron.dungeonmanager.Introduction"> + tools:context=".Introduction"> + android:hint="@string/adventurer_name" + android:nextFocusDown="@+id/editPxIntro" + android:nextFocusForward="@+id/editPxIntro"/> + android:layout_weight="1" + android:nextFocusDown="@+id/FUE" + android:nextFocusForward="@+id/FUE" + android:nextFocusLeft="@+id/FUE" + android:nextFocusRight="@+id/FUE" + android:nextFocusUp="@+id/FUE"/> + android:id="@+id/raceSpinner"/> + android:hint="@string/FUE" + android:nextFocusDown="@+id/DES"/> + android:hint="@string/CON" + android:nextFocusDown="@+id/INT" /> + android:hint="@string/DES" + android:nextFocusDown="@+id/SAB"/> + android:hint="@string/INT" + android:nextFocusDown="@+id/CAR"/> + android:hint="@string/SAB" + android:nextFocusDown="@+id/CON"/> + android:hint="@string/CAR"/> diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 48469ca..172b09f 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -93,20 +93,36 @@ - + android:orientation="horizontal"> + + + + + - + android:orientation="horizontal"> - + + + - + android:orientation="horizontal"> + + + + + VOL Defense Curative efforts - You have %1$d out of %2$d curative efforts Reset All the data has been cleared Are you sure? @@ -72,4 +71,5 @@ Alert Couldn\'t compute your max PG based on your level Update app + You can\'t go back. Fill the information and press the save button.