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); mView.getBackground().setAlpha(0);
int black = getContext().getResources().getColor(R.color.black); int black = getContext().getResources().getColor(R.color.black);
name .setTextColor(black); name .setTextColor ( black ) ;
keywords .setTextColor(black); keywords .setTextColor ( black ) ;
frequency .setTextColor(black); frequency .setTextColor ( black ) ;
range .setTextColor(black); range .setTextColor ( black ) ;
//name.setPaintFlags(name.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
} else {
mView.getBackground().setAlpha((position % 2) * 50 + 205);
} }
} }
return mView; return mView;

View file

@ -23,6 +23,7 @@ import android.widget.AdapterView;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ListView; import android.widget.ListView;
import android.widget.NumberPicker;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -370,9 +371,11 @@ public class ShowPlayer extends ActionBarActivity {
alert.setTitle(R.string.suffer_damage); alert.setTitle(R.string.suffer_damage);
// Set an EditText view to get user input // Set an EditText view to get user input
final EditText input = new EditText(this); final NumberPicker input = new NumberPicker (this);
input.setInputType(InputType.TYPE_CLASS_NUMBER); input.setMinValue(0);
input.setHint(R.string.suffer_damage_hint); input.setMaxValue(player.getMaxHp() * 3);
input.setValue(0);
input.setWrapSelectorWheel(false);
alert.setView(input); alert.setView(input);
@ -381,37 +384,32 @@ public class ShowPlayer extends ActionBarActivity {
alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int whichButton) {
try { final int undoPreviousValue = player.getHp();
final int undoPreviousValue = player.getHp(); player.losePg(input.getValue());
int damage = Integer.parseInt(input.getText().toString()); SnackbarManager.show(
player.losePg(damage); Snackbar.with(context).text(String.format(getString(R.string.lost_hp), input.getValue()))
SnackbarManager.show( .actionLabel(R.string.action_undo) // action button label
Snackbar.with(context).text(String.format(getString(R.string.lost_hp), damage)) .actionListener(new ActionClickListener() {
.actionLabel(R.string.action_undo) // action button label @Override
.actionListener(new ActionClickListener() { public void onActionClicked(Snackbar snackbar) {
@Override SnackbarManager.show(
public void onActionClicked(Snackbar snackbar) { Snackbar
SnackbarManager.show( .with(activity)
Snackbar .text(R.string.restored)
.with(activity) .duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
.text(R.string.restored) );
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE) player.setHp(undoPreviousValue);
); p.edit().putInt("pg", player.getHp()).apply();
player.setHp(undoPreviousValue); hpUpdate();
p.edit().putInt("pg", player.getHp()).apply(); invalidateOptionsMenu();
hpUpdate(); }
invalidateOptionsMenu(); })
} .actionColor(getResources().getColor(R.color.yellow))
}) .duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
.actionColor(getResources().getColor(R.color.yellow)) ,activity); // action button's
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE) p.edit().putInt("pg", player.getHp()).apply();
,activity); // action button's hpUpdate();
p.edit().putInt("pg", player.getHp()).apply(); invalidateOptionsMenu();
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.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
@ -156,20 +156,23 @@ public class Welcome extends ActionBarActivity {
}), }),
activity activity
); );
} else if(which==1) { } else if(which==1) {
//TODO: edit the player //TODO: edit the player
/**TEMP*/ /**TEMP*/
Toast.makeText( Toast.makeText(
activity, "Editor not implemented yet", Toast.LENGTH_LONG) activity, "Editor not implemented yet", Toast.LENGTH_LONG)
.show(); .show();
} else { } else {
//TODO: export as files //TODO: export as files
/**TEMP*/ /**TEMP*/
Toast.makeText( startActivity(new Intent(
activity, "Exporting feature not implemented yet", Toast.LENGTH_LONG) getApplicationContext(), TabsViewPagerFragmentActivity.class
.show(); ).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:layout_height="wrap_content"
android:id="@+id/powerList" android:id="@+id/powerList"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:choiceMode="none" /> android:choiceMode="none" />
<TextView <TextView
android:layout_height="wrap_content" android:layout_height="wrap_content"