kauron/DungeonManager
kauron
/
DungeonManager
Archived
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,37 +384,32 @@ 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);
SnackbarManager.show(
Snackbar.with(context).text(String.format(getString(R.string.lost_hp), damage))
.actionLabel(R.string.action_undo) // action button label
.actionListener(new ActionClickListener() {
@Override
public void onActionClicked(Snackbar snackbar) {
SnackbarManager.show(
Snackbar
.with(activity)
.text(R.string.restored)
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
);
player.setHp(undoPreviousValue);
p.edit().putInt("pg", player.getHp()).apply();
hpUpdate();
invalidateOptionsMenu();
}
})
.actionColor(getResources().getColor(R.color.yellow))
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
,activity); // action button's
p.edit().putInt("pg", player.getHp()).apply();
hpUpdate();
invalidateOptionsMenu();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "There was an error", Toast.LENGTH_LONG).show();
}
final int undoPreviousValue = player.getHp();
player.losePg(input.getValue());
SnackbarManager.show(
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
public void onActionClicked(Snackbar snackbar) {
SnackbarManager.show(
Snackbar
.with(activity)
.text(R.string.restored)
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
);
player.setHp(undoPreviousValue);
p.edit().putInt("pg", player.getHp()).apply();
hpUpdate();
invalidateOptionsMenu();
}
})
.actionColor(getResources().getColor(R.color.yellow))
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
,activity); // action button's
p.edit().putInt("pg", player.getHp()).apply();
hpUpdate();
invalidateOptionsMenu();
}
});

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;
@ -156,20 +156,23 @@ public class Welcome extends ActionBarActivity {
}),
activity
);
} else if(which==1) {
//TODO: edit the player
/**TEMP*/
Toast.makeText(
activity, "Editor not implemented yet", Toast.LENGTH_LONG)
.show();
} else {
//TODO: export as files
/**TEMP*/
Toast.makeText(
activity, "Exporting feature not implemented yet", Toast.LENGTH_LONG)
.show();
} else if(which==1) {
//TODO: edit the player
/**TEMP*/
Toast.makeText(
activity, "Editor not implemented yet", Toast.LENGTH_LONG)
.show();
} 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"