1
0
Fork 0

Changed damage for a NumberPicker and other minor changes

Added shortcut in Welcome for testing Tabs
Reverted PowerList divider to default
Deleted PowerList's alpha changes depending on the position
This commit is contained in:
Carlos Galindo 2015-05-13 08:18:50 +02:00
parent f96ace7d3b
commit 6ab167fb6d
4 changed files with 53 additions and 58 deletions

View file

@ -37,14 +37,10 @@ class PowerAdapter extends ArrayAdapter<Power> {
mView.getBackground().setAlpha(0);
int black = getContext().getResources().getColor(R.color.black);
name .setTextColor(black);
keywords .setTextColor(black);
frequency .setTextColor(black);
range .setTextColor(black);
//name.setPaintFlags(name.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
} else {
mView.getBackground().setAlpha((position % 2) * 50 + 205);
name .setTextColor ( black ) ;
keywords .setTextColor ( black ) ;
frequency .setTextColor ( black ) ;
range .setTextColor ( black ) ;
}
}
return mView;

View file

@ -23,6 +23,7 @@ import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.NumberPicker;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
@ -370,9 +371,11 @@ public class ShowPlayer extends ActionBarActivity {
alert.setTitle(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);
final NumberPicker input = new NumberPicker (this);
input.setMinValue(0);
input.setMaxValue(player.getMaxHp() * 3);
input.setValue(0);
input.setWrapSelectorWheel(false);
alert.setView(input);
@ -381,12 +384,10 @@ public class ShowPlayer extends ActionBarActivity {
alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
try {
final int undoPreviousValue = player.getHp();
int damage = Integer.parseInt(input.getText().toString());
player.losePg(damage);
player.losePg(input.getValue());
SnackbarManager.show(
Snackbar.with(context).text(String.format(getString(R.string.lost_hp), damage))
Snackbar.with(context).text(String.format(getString(R.string.lost_hp), input.getValue()))
.actionLabel(R.string.action_undo) // action button label
.actionListener(new ActionClickListener() {
@Override
@ -409,9 +410,6 @@ public class ShowPlayer extends ActionBarActivity {
p.edit().putInt("pg", player.getHp()).apply();
hpUpdate();
invalidateOptionsMenu();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "There was an error", Toast.LENGTH_LONG).show();
}
}
});

View file

@ -4,8 +4,8 @@ import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
@ -165,6 +165,9 @@ public class Welcome extends ActionBarActivity {
} else {
//TODO: export as files
/**TEMP*/
startActivity(new Intent(
getApplicationContext(), TabsViewPagerFragmentActivity.class
).putExtra("player", position));
Toast.makeText(
activity, "Exporting feature not implemented yet", Toast.LENGTH_LONG)
.show();

View file

@ -220,8 +220,6 @@
android:layout_height="wrap_content"
android:id="@+id/powerList"
android:layout_gravity="center_horizontal"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:choiceMode="none" />
<TextView
android:layout_height="wrap_content"