Merge remote-tracking branch 'origin/master'
|
@ -19,6 +19,7 @@
|
|||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
</configuration>
|
||||
</facet>
|
||||
|
@ -81,6 +82,7 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
|
|
@ -9,16 +9,23 @@
|
|||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name=".ShowPlayer"
|
||||
android:label="@string/app_name"
|
||||
android:parentActivityName=".Welcome" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".Welcome" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".Display"
|
||||
android:parentActivityName=".Welcome">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".Welcome"/>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".PlayerEditor"
|
||||
android:label="@string/title_activity_player_editor"
|
||||
android:parentActivityName=".Welcome">
|
||||
android:parentActivityName=".Welcome" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".Welcome" />
|
||||
|
@ -28,6 +35,7 @@
|
|||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
|
205
app/src/main/java/com/kauron/dungeonmanager/Display.java
Normal file
|
@ -0,0 +1,205 @@
|
|||
package com.kauron.dungeonmanager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TabHost;
|
||||
import android.widget.TabHost.TabContentFactory;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* The <code>Display</code> class implements the Fragment activity that maintains a TabHost using a ViewPager.
|
||||
*/
|
||||
public class Display extends ActionBarActivity implements TabHost.OnTabChangeListener, ViewPager.OnPageChangeListener {
|
||||
|
||||
private TabHost mTabHost;
|
||||
private ViewPager mViewPager;
|
||||
private HashMap<String, TabInfo> mapTabInfo = new HashMap<String, Display.TabInfo>();
|
||||
private PagerAdapter mPagerAdapter;
|
||||
/**
|
||||
*
|
||||
* Maintains extrinsic info of a tab's construct
|
||||
*/
|
||||
private class TabInfo {
|
||||
private String tag;
|
||||
private Class<?> clss;
|
||||
private Bundle args;
|
||||
private Fragment fragment;
|
||||
TabInfo(String tag, Class<?> clazz, Bundle args) {
|
||||
this.tag = tag;
|
||||
this.clss = clazz;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* A simple factory that returns dummy views to the Tabhost
|
||||
*/
|
||||
class TabFactory implements TabContentFactory {
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
/**
|
||||
* @param context
|
||||
*/
|
||||
public TabFactory(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
/** (non-Javadoc)
|
||||
* @see android.widget.TabHost.TabContentFactory#createTabContent(java.lang.String)
|
||||
*/
|
||||
public View createTabContent(String tag) {
|
||||
View v = new View(mContext);
|
||||
v.setMinimumWidth(0);
|
||||
v.setMinimumHeight(0);
|
||||
return v;
|
||||
}
|
||||
|
||||
}
|
||||
/** (non-Javadoc)
|
||||
* @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle)
|
||||
*/
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// Inflate the layout
|
||||
setContentView(R.layout.display);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
toolbar.setTitle("Kauron");
|
||||
toolbar.setSubtitle("Brujo Tiflin");
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true);
|
||||
// Initialise the TabHost
|
||||
this.initialiseTabHost(savedInstanceState);
|
||||
if (savedInstanceState != null) {
|
||||
mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab")); //set the tab as per the saved state
|
||||
}
|
||||
// Initialise ViewPager
|
||||
this.intialiseViewPager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
if ( mTabHost.getCurrentTabTag().equals("Stats") ) {
|
||||
getMenuInflater().inflate(R.menu.menu_welcome, menu);
|
||||
} else if ( mTabHost.getCurrentTabTag().equals("Powers") ) {
|
||||
getMenuInflater().inflate(R.menu.menu_show_player, menu);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if ( id == R.id.action_add_player ) {
|
||||
Toast.makeText(getApplicationContext(), "it works", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/** (non-Javadoc)
|
||||
* @see android.support.v4.app.FragmentActivity#onSaveInstanceState(android.os.Bundle)
|
||||
*/
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
outState.putString("tab", mTabHost.getCurrentTabTag()); //save the tab selected
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise ViewPager
|
||||
*/
|
||||
private void intialiseViewPager() {
|
||||
|
||||
List<Fragment> fragments = new Vector<>();
|
||||
fragments.add(Fragment.instantiate(this, PlayerDisplay.class.getName()));
|
||||
fragments.add(Fragment.instantiate(this, PowerDisplay.class.getName()));
|
||||
this.mPagerAdapter = new PagerAdapter(super.getSupportFragmentManager(), fragments);
|
||||
//
|
||||
this.mViewPager = (ViewPager)super.findViewById(R.id.viewpager);
|
||||
this.mViewPager.setAdapter(this.mPagerAdapter);
|
||||
this.mViewPager.setOnPageChangeListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the Tab Host
|
||||
*/
|
||||
private void initialiseTabHost(Bundle args) {
|
||||
mTabHost = (TabHost)findViewById(android.R.id.tabhost);
|
||||
mTabHost.setup();
|
||||
TabInfo tabInfo = null;
|
||||
Display.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Stats").setIndicator("Stats"), (tabInfo = new TabInfo("Stats", PlayerDisplay.class, args)));
|
||||
this.mapTabInfo.put(tabInfo.tag, tabInfo);
|
||||
Display.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Powers").setIndicator("Powers"), (tabInfo = new TabInfo("Powers", PowerDisplay.class, args)));
|
||||
this.mapTabInfo.put(tabInfo.tag, tabInfo);
|
||||
// Default to first tab
|
||||
//this.onTabChanged("Tab1");
|
||||
//
|
||||
mTabHost.setOnTabChangedListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Tab content to the Tabhost
|
||||
* @param activity
|
||||
* @param tabHost
|
||||
* @param tabSpec
|
||||
*/
|
||||
private static void AddTab(Display activity, TabHost tabHost, TabHost.TabSpec tabSpec, TabInfo tabInfo) {
|
||||
// Attach a Tab view factory to the spec
|
||||
tabSpec.setContent(activity.new TabFactory(activity));
|
||||
tabHost.addTab(tabSpec);
|
||||
}
|
||||
|
||||
/** (non-Javadoc)
|
||||
* @see android.widget.TabHost.OnTabChangeListener#onTabChanged(java.lang.String)
|
||||
*/
|
||||
public void onTabChanged(String tag) {
|
||||
//TabInfo newTab = this.mapTabInfo.get(tag);
|
||||
int pos = this.mTabHost.getCurrentTab();
|
||||
this.mViewPager.setCurrentItem(pos);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.support.v4.view.ViewPager.OnPageChangeListener#onPageScrolled(int, float, int)
|
||||
*/
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset,
|
||||
int positionOffsetPixels) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.support.v4.view.ViewPager.OnPageChangeListener#onPageSelected(int)
|
||||
*/
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
this.mTabHost.setCurrentTab(position);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.support.v4.view.ViewPager.OnPageChangeListener#onPageScrollStateChanged(int)
|
||||
*/
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.kauron.dungeonmanager;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The <code>PagerAdapter</code> serves the fragments when paging.
|
||||
* @author mwho
|
||||
*/
|
||||
public class PagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
private List<Fragment> fragments;
|
||||
/**
|
||||
* @param fm
|
||||
* @param fragments
|
||||
*/
|
||||
public PagerAdapter(FragmentManager fm, List<Fragment> fragments) {
|
||||
super(fm);
|
||||
this.fragments = fragments;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.support.v4.app.FragmentPagerAdapter#getItem(int)
|
||||
*/
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return this.fragments.get(position);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.support.v4.view.PagerAdapter#getCount()
|
||||
*/
|
||||
@Override
|
||||
public int getCount() {
|
||||
return this.fragments.size();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.kauron.dungeonmanager;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class PlayerDisplay extends Fragment {
|
||||
/** (non-Javadoc)
|
||||
* @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
|
||||
*/
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
if (container == null) {
|
||||
// We have different layouts, and in one of them this
|
||||
// fragment's containing frame doesn't exist. The fragment
|
||||
// may still be created from its saved state, but there is
|
||||
// no reason to try to create its view hierarchy because it
|
||||
// won't be displayed. Note this is not needed -- we could
|
||||
// just run the code below, where we would create and return
|
||||
// the view hierarchy; it would just never be used.
|
||||
return null;
|
||||
}
|
||||
return (LinearLayout) inflater.inflate(R.layout.fragment_player_display, container, false);
|
||||
}
|
||||
}
|
|
@ -89,6 +89,7 @@ class Power implements Serializable{
|
|||
void recover(int type){
|
||||
if(this.freq <= type) used = false;
|
||||
}
|
||||
void setUsed(boolean used) {this.used = used;}
|
||||
|
||||
int getFreqColor(Context context) {
|
||||
switch (freq) {
|
||||
|
|
|
@ -21,15 +21,27 @@ class PowerAdapter extends ArrayAdapter<Power> {
|
|||
|
||||
final Power attack = getItem(position);
|
||||
if ( attack != null ) {
|
||||
((TextView) mView.findViewById(R.id.name)).setText(attack.getName());
|
||||
((TextView) mView.findViewById(R.id.keywords)).setText(attack.getKeywords());
|
||||
((TextView) mView.findViewById(R.id.frequency)).setText(attack.getFrequencyString());
|
||||
((TextView) mView.findViewById(R.id.range_and_distance)).setText(attack.getRangeString() + " " + attack.getDistance());
|
||||
TextView name = (TextView) mView.findViewById(R.id.name);
|
||||
TextView keywords = (TextView) mView.findViewById(R.id.keywords);
|
||||
TextView frequency = (TextView) mView.findViewById(R.id.frequency);
|
||||
TextView range = (TextView) mView.findViewById(R.id.range_and_distance);
|
||||
|
||||
name .setText(attack.getName());
|
||||
keywords .setText(attack.getKeywords());
|
||||
frequency .setText(attack.getFrequencyString());
|
||||
range .setText(attack.getRangeString() + " " + attack.getDistance());
|
||||
|
||||
mView.setBackgroundColor(attack.getFreqColor(getContext()));
|
||||
if (attack.isUsed())
|
||||
|
||||
if (attack.isUsed()) {
|
||||
mView.getBackground().setAlpha(0);
|
||||
else
|
||||
mView.getBackground().setAlpha((position % 2) * 50 + 205);
|
||||
int black = getContext().getResources().getColor(R.color.black);
|
||||
|
||||
name .setTextColor ( black ) ;
|
||||
keywords .setTextColor ( black ) ;
|
||||
frequency .setTextColor ( black ) ;
|
||||
range .setTextColor ( black ) ;
|
||||
}
|
||||
}
|
||||
return mView;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.kauron.dungeonmanager;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class PowerDisplay extends Fragment {
|
||||
/** (non-Javadoc)
|
||||
* @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
|
||||
*/
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
if (container == null) {
|
||||
// We have different layouts, and in one of them this
|
||||
// fragment's containing frame doesn't exist. The fragment
|
||||
// may still be created from its saved state, but there is
|
||||
// no reason to try to create its view hierarchy because it
|
||||
// won't be displayed. Note this is not needed -- we could
|
||||
// just run the code below, where we would create and return
|
||||
// the view hierarchy; it would just never be used.
|
||||
return null;
|
||||
}
|
||||
return (LinearLayout) inflater.inflate(R.layout.fragment_power_display, container, false);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
@ -35,12 +36,7 @@ import java.io.File;
|
|||
import java.util.ArrayList;
|
||||
|
||||
public class ShowPlayer extends ActionBarActivity {
|
||||
|
||||
public static final int CURRENT_PG = 1, NULL = 0;
|
||||
|
||||
public Player player;
|
||||
private boolean undo;
|
||||
private int undoObject, undoPreviousValue;
|
||||
|
||||
private ProgressBar posHpBar, negHpBar, xpBar, surgesBar;
|
||||
private TextView hpText, xpText, surgesText, levelText;
|
||||
|
@ -83,7 +79,6 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
.setColorFilter(getResources().getColor(R.color.px_bar), PorterDuff.Mode.SRC_IN);
|
||||
surgesBar.getProgressDrawable()
|
||||
.setColorFilter(getResources().getColor(R.color.surges_bar), PorterDuff.Mode.SRC_IN);
|
||||
undo = false;
|
||||
|
||||
restoreData();
|
||||
invalidateOptionsMenu();
|
||||
|
@ -176,18 +171,18 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
input.requestFocus();
|
||||
return true;
|
||||
} else if (id == R.id.action_time_long_rest) {
|
||||
PowerAdapter powerAdapter = (PowerAdapter) powerList.getAdapter();
|
||||
PowerAdapter powerAdapter = powerList == null ? null : (PowerAdapter) powerList.getAdapter();
|
||||
if (powerAdapter != null) {
|
||||
for (int i = 0; i < powerAdapter.getCount(); i++) {
|
||||
Power power = powerAdapter.getItem(i);
|
||||
if ( power.getFreq() != Power.AT_WILL) {
|
||||
power.recover(Power.DAILY);
|
||||
power.setUsed(false);
|
||||
getSharedPreferences(p.getString("power" + i, ""), MODE_PRIVATE)
|
||||
.edit().putBoolean("used", false);
|
||||
.edit().putBoolean("used", false).apply();
|
||||
}
|
||||
}
|
||||
powerAdapter.notifyDataSetChanged();
|
||||
//TODO: substitute all calls to refreshList for an update on the single view that changed
|
||||
refreshList();
|
||||
}
|
||||
player.rest(true);
|
||||
SnackbarManager.show(
|
||||
|
@ -203,17 +198,17 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
hpUpdate();
|
||||
surgeUpdate();
|
||||
} else if (id == R.id.action_time_rest) {
|
||||
PowerAdapter powerAdapter = (PowerAdapter) powerList.getAdapter();
|
||||
PowerAdapter powerAdapter = powerList == null ? null : (PowerAdapter) powerList.getAdapter();
|
||||
if (powerAdapter != null) {
|
||||
for (int i = 0; i < powerAdapter.getCount(); i++) {
|
||||
Power power = powerAdapter.getItem(i);
|
||||
if ( power.getFreq() == Power.ENCOUNTER) {
|
||||
power.recover(Power.ENCOUNTER);
|
||||
power.setUsed(false);
|
||||
getSharedPreferences(p.getString("power" + i, ""), MODE_PRIVATE)
|
||||
.edit().putBoolean("used", false);
|
||||
.edit().putBoolean("used", false).apply();
|
||||
}
|
||||
}
|
||||
refreshList();
|
||||
powerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
// player.rest(false); TODO: this isn't needed without action points
|
||||
SnackbarManager.show(
|
||||
|
@ -224,11 +219,22 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
);
|
||||
hpUpdate();
|
||||
surgeUpdate();
|
||||
} else if (id == R.id.action_stats) {
|
||||
statsDialog();
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void statsDialog() {
|
||||
final Dialog dialog = new Dialog(ShowPlayer.this);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setContentView(R.layout.stats_dialog);
|
||||
//TODO: finish him!
|
||||
dialog.show();
|
||||
Toast.makeText(getApplicationContext(), "Not ready yet", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
private void levelUp() {
|
||||
//TODO: improve leveling up by using a sliding guide
|
||||
xpBar.setMax(Player.LEVEL_XP[player.getLevel()] -
|
||||
|
@ -283,7 +289,7 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
.setTitle(R.string.new_energies)
|
||||
.setPositiveButton(R.string.me, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
undoPreviousValue = player.getHp();
|
||||
final int undoPreviousValue = player.getHp();
|
||||
if (heal(true)) { //a surge has been used
|
||||
SnackbarManager.show(
|
||||
Snackbar.with(getApplicationContext())
|
||||
|
@ -318,7 +324,7 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
.setNegativeButton(R.string.other, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
undoPreviousValue = player.getHp();
|
||||
final int undoPreviousValue = player.getHp();
|
||||
heal(false);
|
||||
SnackbarManager.show(
|
||||
Snackbar.with(getApplicationContext())
|
||||
|
@ -365,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);
|
||||
|
||||
|
@ -376,20 +384,24 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
|
||||
alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
try {
|
||||
int preValue = player.getHp();
|
||||
int damage = Integer.parseInt(input.getText().toString());
|
||||
player.losePg(damage);
|
||||
undo = true;
|
||||
undoPreviousValue = preValue;
|
||||
undoObject = CURRENT_PG;
|
||||
final int undoPreviousValue = player.getHp();
|
||||
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
|
||||
public void onActionClicked(Snackbar snackbar) {
|
||||
undo();
|
||||
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))
|
||||
|
@ -398,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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -485,30 +494,6 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Undoes the last change done by the player. Only used in damage().
|
||||
* Healing is undone in the health dialog
|
||||
*/
|
||||
private void undo() {
|
||||
String message = "";
|
||||
if(undoObject == CURRENT_PG){
|
||||
player.setHp(undoPreviousValue);
|
||||
undoObject = NULL;
|
||||
message = getString(R.string.restored);
|
||||
}
|
||||
if (!message.isEmpty()) {
|
||||
SnackbarManager.show(
|
||||
Snackbar
|
||||
.with(this)
|
||||
.text(message)
|
||||
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE)
|
||||
);
|
||||
}
|
||||
hpUpdate();
|
||||
undo = false;
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Launches the PowerEditor to create a new attack inside the current player
|
||||
|
@ -537,23 +522,28 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
//TODO: check which is active (now there is only a power list), so there is only one possibility
|
||||
|
||||
int n = p.getInt("powers",0);
|
||||
if ( n == 0 ) {
|
||||
findViewById(R.id.layout_no_powers).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.layout_powers).setVisibility(View.GONE);
|
||||
} else {
|
||||
findViewById(R.id.layout_no_powers).setVisibility(View.GONE);
|
||||
findViewById(R.id.layout_powers).setVisibility(View.VISIBLE);
|
||||
int elements = 0;
|
||||
powerList = (ListView) findViewById(R.id.powerList);
|
||||
final PowerAdapter adapter = (PowerAdapter) powerList.getAdapter();
|
||||
|
||||
if ( adapter != null )
|
||||
if (adapter != null)
|
||||
elements = adapter.getCount();
|
||||
if ( elements < n && adapter != null ) {
|
||||
for ( int i = elements; i < n; i++ ) {
|
||||
if (elements < n && adapter != null) {
|
||||
for (int i = elements; i < n; i++) {
|
||||
SharedPreferences sav = getSharedPreferences(p.getString("power" + i, ""), MODE_PRIVATE);
|
||||
//TODO: solve error when closing the editor
|
||||
adapter.add( new Power ( sav ) );
|
||||
adapter.add(new Power(sav));
|
||||
}
|
||||
} else if ( n != 0 ) {
|
||||
} else {
|
||||
ArrayList<Power> powers = new ArrayList<>();
|
||||
for (int i = 0; i < n; i++) {
|
||||
SharedPreferences sav = getSharedPreferences(p.getString("power" + i, ""), MODE_PRIVATE);
|
||||
powers.add( new Power(sav) );
|
||||
powers.add(new Power(sav));
|
||||
}
|
||||
|
||||
powerList.setAdapter(new PowerAdapter(this, powers));
|
||||
|
@ -585,14 +575,14 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
String[] attack = getResources().getStringArray(R.array.attack);
|
||||
String[] defense = getResources().getStringArray(R.array.defense);
|
||||
((TextView) dialog.findViewById(R.id.attackText)).setText(attack[power.getAtk()]
|
||||
+ " " + getResources().getString(R.string.vs)
|
||||
+ " " + defense[power.getDef()]);
|
||||
+ " " + getResources().getString(R.string.vs) + " " + defense[power.getDef()]);
|
||||
|
||||
final Button useButton = (Button) dialog.findViewById(R.id.useButton);
|
||||
|
||||
if (power.isUsed()) {
|
||||
useButton.getBackground().setAlpha(128);
|
||||
useButton.setEnabled(false);
|
||||
useButton.setText(R.string.used);
|
||||
useButton.setClickable(false);
|
||||
} else {
|
||||
useButton.setBackgroundColor(color);
|
||||
|
@ -615,18 +605,18 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
refreshList();
|
||||
SnackbarManager.show(
|
||||
Snackbar.with(getApplicationContext())
|
||||
.text(getString(R.string.used) + " " + power.getName())
|
||||
.text(getString(R.string.have_used) + " " + power.getName())
|
||||
.actionListener(new ActionClickListener() {
|
||||
@Override
|
||||
public void onActionClicked(Snackbar snackbar) {
|
||||
power.recover(Power.DAILY);
|
||||
power.setUsed(false);
|
||||
useButton.setBackgroundColor(color);
|
||||
useButton.setTextColor(getResources().getColor(R.color.white));
|
||||
useButton.getBackground().setAlpha(255);
|
||||
useButton.setEnabled(true);
|
||||
useButton.setClickable(true);
|
||||
getSharedPreferences(p.getString("power" + position, ""), MODE_PRIVATE)
|
||||
.edit().putBoolean("used", false).apply();
|
||||
.edit().putBoolean("used", power.isUsed()).apply();
|
||||
refreshList();
|
||||
}
|
||||
})
|
||||
|
@ -638,7 +628,7 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
} else {
|
||||
SnackbarManager.show(
|
||||
Snackbar.with(getApplicationContext())
|
||||
.text(getString(R.string.used) + " " + power.getName())
|
||||
.text(getString(R.string.have_used) + " " + power.getName())
|
||||
.duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE),
|
||||
activity
|
||||
);
|
||||
|
@ -684,7 +674,7 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
+ File.separator + "shared_prefs" + File.separator + name + ".xml").delete())
|
||||
throw new Exception();
|
||||
} catch (Exception e) {
|
||||
Log.e("POWER:DELETION", "Error deleting attack files\n" + e.getMessage() + "\n" + e.getStackTrace().toString());
|
||||
Log.e("POWER:DELETION", "Error deleting attack files\n" + e.getMessage() + "\n");
|
||||
}
|
||||
int max = p.getInt("powers", 0);
|
||||
SharedPreferences.Editor ed = p.edit();
|
||||
|
@ -713,4 +703,5 @@ public class ShowPlayer extends ActionBarActivity {
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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(), Display.class
|
||||
).putExtra("player", position));
|
||||
Toast.makeText(
|
||||
activity, "Exporting feature not implemented yet", Toast.LENGTH_LONG)
|
||||
.show();
|
||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_action_stats.png
Normal file
After Width: | Height: | Size: 784 B |
Before Width: | Height: | Size: 647 B After Width: | Height: | Size: 623 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_stats.png
Normal file
After Width: | Height: | Size: 525 B |
Before Width: | Height: | Size: 460 B After Width: | Height: | Size: 397 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_stats.png
Normal file
After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 871 B After Width: | Height: | Size: 831 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_stats.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
|
@ -210,190 +210,35 @@
|
|||
android:text="Go to abilities"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/layout_powers"
|
||||
android:orientation="vertical">
|
||||
<ListView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
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"
|
||||
android:layout_width="fill_parent"
|
||||
android:id="@+id/help_text"
|
||||
android:text="@string/help_list" />
|
||||
</LinearLayout>
|
||||
|
||||
<!--<LinearLayout-->
|
||||
<!--android:id="@+id/attackContainer"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_marginTop="10dp"-->
|
||||
<!--android:orientation="vertical"-->
|
||||
<!--android:visibility="gone">-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/titleAttack"-->
|
||||
<!--android:text="@string/attack"-->
|
||||
<!--android:textAllCaps="true"-->
|
||||
<!--android:drawableBottom="?android:attr/listChoiceBackgroundIndicator"-->
|
||||
<!--android:layout_marginBottom="5dp"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:textStyle="bold"-->
|
||||
<!--android:textColor="?android:textColorSecondary"-->
|
||||
<!--android:textSize="14sp"-->
|
||||
<!--android:gravity="center_vertical"-->
|
||||
<!--android:paddingLeft="8dip"-->
|
||||
<!--android:paddingRight="8dip"/>-->
|
||||
<!--<HorizontalScrollView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content">-->
|
||||
<!--<GridLayout-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:id="@+id/attackGrid"-->
|
||||
<!--android:columnCount="3"-->
|
||||
<!--android:rowCount="2">-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
|
||||
<!--android:typeface="monospace"-->
|
||||
<!--android:ems="4"-->
|
||||
<!--android:layout_row="0"-->
|
||||
<!--android:layout_column="0"-->
|
||||
<!--android:id="@+id/STR"-->
|
||||
<!--tools:text="@string/FUE" />-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
|
||||
<!--android:typeface="monospace"-->
|
||||
<!--android:ems="4"-->
|
||||
<!--android:layout_row="1"-->
|
||||
<!--android:layout_column="0"-->
|
||||
<!--android:id="@+id/CON"-->
|
||||
<!--tools:text="@string/CON" />-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
|
||||
<!--android:typeface="monospace"-->
|
||||
<!--android:ems="4"-->
|
||||
<!--android:layout_row="0"-->
|
||||
<!--android:layout_column="1"-->
|
||||
<!--android:id="@+id/DEX"-->
|
||||
<!--tools:text="@string/DES" />-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
|
||||
<!--android:typeface="monospace"-->
|
||||
<!--android:ems="4"-->
|
||||
<!--android:layout_row="1"-->
|
||||
<!--android:layout_column="1"-->
|
||||
<!--android:id="@+id/INT"-->
|
||||
<!--tools:text="@string/INT" />-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
|
||||
<!--android:typeface="monospace"-->
|
||||
<!--android:ems="4"-->
|
||||
<!--android:layout_row="0"-->
|
||||
<!--android:layout_column="2"-->
|
||||
<!--android:id="@+id/WIS"-->
|
||||
<!--tools:text="@string/SAB" />-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
|
||||
<!--android:typeface="monospace"-->
|
||||
<!--android:ems="4"-->
|
||||
<!--android:layout_row="1"-->
|
||||
<!--android:layout_column="2"-->
|
||||
<!--android:id="@+id/CHA"-->
|
||||
<!--tools:text="@string/CAR" />-->
|
||||
<!--</GridLayout>-->
|
||||
<!--</HorizontalScrollView>-->
|
||||
<!--</LinearLayout>-->
|
||||
|
||||
<!--<LinearLayout-->
|
||||
<!--android:id="@+id/defenseContainer"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_marginTop="10dp"-->
|
||||
<!--android:visibility="gone"-->
|
||||
<!--android:orientation="vertical">-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/titleDefense"-->
|
||||
<!--android:text="@string/defense"-->
|
||||
<!--android:textAllCaps="true"-->
|
||||
<!--android:layout_marginBottom="5dp"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:textStyle="bold"-->
|
||||
<!--android:textColor="?android:textColorSecondary"-->
|
||||
<!--android:textSize="14sp"-->
|
||||
<!--android:gravity="center_vertical"-->
|
||||
<!--android:paddingLeft="8dip"-->
|
||||
<!--android:paddingRight="8dip"/>-->
|
||||
|
||||
<!--<GridLayout-->
|
||||
<!--android:layout_width="fill_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:id="@+id/defenseGrid"-->
|
||||
<!--android:columnCount="2"-->
|
||||
<!--android:rowCount="2">-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
|
||||
<!--android:typeface="monospace"-->
|
||||
<!--android:ems="5"-->
|
||||
<!--android:layout_row="0"-->
|
||||
<!--android:layout_column="0"-->
|
||||
<!--android:id="@+id/CA"-->
|
||||
<!--tools:text="@string/CA" />-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
|
||||
<!--android:typeface="monospace"-->
|
||||
<!--android:ems="5"-->
|
||||
<!--android:layout_row="0"-->
|
||||
<!--android:layout_column="1"-->
|
||||
<!--android:id="@+id/FORT"-->
|
||||
<!--tools:text="@string/FORT" />-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
|
||||
<!--android:typeface="monospace"-->
|
||||
<!--android:ems="5"-->
|
||||
<!--android:layout_row="1"-->
|
||||
<!--android:layout_column="0"-->
|
||||
<!--android:id="@+id/REF"-->
|
||||
<!--tools:text="@string/REF" />-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:textAppearance="?android:attr/textAppearanceLarge"-->
|
||||
<!--android:typeface="monospace"-->
|
||||
<!--android:ems="5"-->
|
||||
<!--android:layout_row="1"-->
|
||||
<!--android:layout_column="1"-->
|
||||
<!--android:id="@+id/VOL"-->
|
||||
<!--tools:text="@string/VOL" />-->
|
||||
<!--</GridLayout>-->
|
||||
<!--</LinearLayout>-->
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/layout_no_powers">
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="@string/no_powers"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -42,7 +42,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/help_text"
|
||||
android:text="@string/help_welcome_text"
|
||||
android:text="@string/help_list"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
46
app/src/main/res/layout/display.xml
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:background="@color/primary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
|
||||
|
||||
<TabHost
|
||||
android:id="@android:id/tabhost"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<TabWidget
|
||||
android:id="@android:id/tabs"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:background="@color/primary"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@android:id/tabcontent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0"/>
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
</TabHost>
|
||||
</LinearLayout>
|
184
app/src/main/res/layout/fragment_player_display.xml
Normal file
|
@ -0,0 +1,184 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/attackContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleAttack"
|
||||
android:text="Attack"
|
||||
android:textAllCaps="true"
|
||||
android:drawableBottom="?android:attr/listChoiceBackgroundIndicator"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="8dip"
|
||||
android:paddingRight="8dip"/>
|
||||
|
||||
<HorizontalScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<GridLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/attackGrid"
|
||||
android:columnCount="3"
|
||||
android:rowCount="2">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="4"
|
||||
android:layout_row="0"
|
||||
android:layout_column="0"
|
||||
android:id="@+id/STR"
|
||||
android:text="@string/STR" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="4"
|
||||
android:layout_row="1"
|
||||
android:layout_column="0"
|
||||
android:id="@+id/CON"
|
||||
android:text="@string/CON" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="4"
|
||||
android:layout_row="0"
|
||||
android:layout_column="1"
|
||||
android:id="@+id/DEX"
|
||||
android:text="@string/DEX" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="4"
|
||||
android:layout_row="1"
|
||||
android:layout_column="1"
|
||||
android:id="@+id/INT"
|
||||
android:text="@string/INT" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="4"
|
||||
android:layout_row="0"
|
||||
android:layout_column="2"
|
||||
android:id="@+id/WIS"
|
||||
android:text="@string/WIS" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="4"
|
||||
android:layout_row="1"
|
||||
android:layout_column="2"
|
||||
android:id="@+id/CHA"
|
||||
android:text="@string/CHA" />
|
||||
</GridLayout>
|
||||
</HorizontalScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/defenseContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleDefense"
|
||||
android:text="Defense"
|
||||
android:textAllCaps="true"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="8dip"
|
||||
android:paddingRight="8dip"/>
|
||||
|
||||
<GridLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/defenseGrid"
|
||||
android:columnCount="2"
|
||||
android:rowCount="2">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="5"
|
||||
android:layout_row="0"
|
||||
android:layout_column="0"
|
||||
android:id="@+id/CA"
|
||||
android:text="AC" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="5"
|
||||
android:layout_row="0"
|
||||
android:layout_column="1"
|
||||
android:id="@+id/FORT"
|
||||
android:text="FORT" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="5"
|
||||
android:layout_row="1"
|
||||
android:layout_column="0"
|
||||
android:id="@+id/REF"
|
||||
android:text="REF" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="5"
|
||||
android:layout_row="1"
|
||||
android:layout_column="1"
|
||||
android:id="@+id/VOL"
|
||||
android:text="VOL" />
|
||||
</GridLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
9
app/src/main/res/layout/fragment_power_display.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/red">
|
||||
|
||||
</LinearLayout>
|
|
@ -5,8 +5,7 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:background="@color/at_will"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp">
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
tools:text="Happiness"
|
||||
|
|
184
app/src/main/res/layout/stats_dialog.xml
Normal file
|
@ -0,0 +1,184 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/attackContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleAttack"
|
||||
android:text="Attack"
|
||||
android:textAllCaps="true"
|
||||
android:drawableBottom="?android:attr/listChoiceBackgroundIndicator"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="8dip"
|
||||
android:paddingRight="8dip"/>
|
||||
|
||||
<HorizontalScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<GridLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/attackGrid"
|
||||
android:columnCount="3"
|
||||
android:rowCount="2">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="4"
|
||||
android:layout_row="0"
|
||||
android:layout_column="0"
|
||||
android:id="@+id/STR"
|
||||
tools:text="@string/STR" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="4"
|
||||
android:layout_row="1"
|
||||
android:layout_column="0"
|
||||
android:id="@+id/CON"
|
||||
tools:text="@string/CON" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="4"
|
||||
android:layout_row="0"
|
||||
android:layout_column="1"
|
||||
android:id="@+id/DEX"
|
||||
tools:text="@string/DEX" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="4"
|
||||
android:layout_row="1"
|
||||
android:layout_column="1"
|
||||
android:id="@+id/INT"
|
||||
tools:text="@string/INT" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="4"
|
||||
android:layout_row="0"
|
||||
android:layout_column="2"
|
||||
android:id="@+id/WIS"
|
||||
tools:text="@string/WIS" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="4"
|
||||
android:layout_row="1"
|
||||
android:layout_column="2"
|
||||
android:id="@+id/CHA"
|
||||
tools:text="@string/CHA" />
|
||||
</GridLayout>
|
||||
</HorizontalScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/defenseContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleDefense"
|
||||
android:text="Defense"
|
||||
android:textAllCaps="true"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="8dip"
|
||||
android:paddingRight="8dip"/>
|
||||
|
||||
<GridLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/defenseGrid"
|
||||
android:columnCount="2"
|
||||
android:rowCount="2">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="5"
|
||||
android:layout_row="0"
|
||||
android:layout_column="0"
|
||||
android:id="@+id/CA"
|
||||
tools:text="AC" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="5"
|
||||
android:layout_row="0"
|
||||
android:layout_column="1"
|
||||
android:id="@+id/FORT"
|
||||
tools:text="FORT" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="5"
|
||||
android:layout_row="1"
|
||||
android:layout_column="0"
|
||||
android:id="@+id/REF"
|
||||
tools:text="REF" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:typeface="monospace"
|
||||
android:ems="5"
|
||||
android:layout_row="1"
|
||||
android:layout_column="1"
|
||||
android:id="@+id/VOL"
|
||||
tools:text="VOL" />
|
||||
</GridLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -34,4 +34,11 @@
|
|||
</menu>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_stats"
|
||||
android:title="@string/show_stats"
|
||||
android:orderInCategory="10"
|
||||
app:showAsAction="ifRoom"
|
||||
android:icon="@drawable/ic_action_stats" />
|
||||
|
||||
</menu>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<string name="add_player">Añadir personaje</string>
|
||||
<string name="delete">Borrar</string>
|
||||
<string name="edit">Editar</string>
|
||||
<string name="help_welcome_text">Toca un jugador para seleccionarlo, mantén pulsado para opciones</string>
|
||||
<string name="help_list">Toca para abrir, mantén pulsado para opciones</string>
|
||||
<string name="impact">Impacto</string>
|
||||
<string name="impactEditHint">1d6 + 4 y eres invisible</string>
|
||||
<string name="keywords">Palabras clave</string>
|
||||
|
@ -104,7 +104,7 @@
|
|||
<item>Carisma</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="defence">
|
||||
<string-array name="defense">
|
||||
<item>Defensa</item>
|
||||
<item>CA</item>
|
||||
<item>Fortaleza</item>
|
||||
|
@ -112,10 +112,66 @@
|
|||
<item>Voluntad</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="abilities">
|
||||
<item>Habilidad</item>
|
||||
<item>Acrobacias</item>
|
||||
<item>Arcanos</item>
|
||||
<item>Atletismo</item>
|
||||
<item>BLUFF</item>
|
||||
<item>Diplomacia</item>
|
||||
<item>Dungeons</item>
|
||||
<item>ENDURANCE</item>
|
||||
<item>Sanar</item>
|
||||
<item>Historia</item>
|
||||
<item>INSIGHT</item>
|
||||
<item>Intimidación</item>
|
||||
<item>Naturaleza</item>
|
||||
<item>Percepción</item>
|
||||
<item>Religión</item>
|
||||
<item>STEALTH</item>
|
||||
<item>STREETWISE</item>
|
||||
<item>Hurto</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="classes">
|
||||
<item>Clase</item>
|
||||
<item>Ardiente</item>
|
||||
<item>Brujo</item>
|
||||
<item>Buscador</item>
|
||||
<item>Clérigo</item>
|
||||
<item>Explorador</item>
|
||||
<item>Guerrero</item>
|
||||
<item>Mago</item>
|
||||
<item>Mente de Batalla</item>
|
||||
<item>Monje</item>
|
||||
<item>Paladín</item>
|
||||
<item>Pícaro</item>
|
||||
<item>Psiónico</item>
|
||||
<item>Sacerdote Rúnico</item>
|
||||
<item>Señor de la Guerra</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<string-array name="races">
|
||||
<item>Race</item>
|
||||
<item>Dracónidos</item>
|
||||
<item>Eladrines</item>
|
||||
<item>Elfos</item>
|
||||
<item>Enanos</item>
|
||||
<item>Gitzerai</item>
|
||||
<item>Humanos</item>
|
||||
<item>Medianos</item>
|
||||
<item>Mente del Fragmento</item>
|
||||
<item>Minotauro</item>
|
||||
<item>Salvaje</item>
|
||||
<item>Semielfo</item>
|
||||
<item>Tiflin</item>
|
||||
</string-array>
|
||||
|
||||
<string name="required">Este campo es obligatorio</string>
|
||||
<string name="sure">¿Estás seguro?</string>
|
||||
<string name="used">Has usado</string>
|
||||
<string name="used">Usado</string>
|
||||
<string name="have_used">Has usado</string>
|
||||
<string name="restored">Valores restaurados</string>
|
||||
<string name="export">Exportar</string>
|
||||
<string name="healed">Has recuperado %d PG</string>
|
||||
|
@ -123,4 +179,6 @@
|
|||
<string name="lost_hp">Has perdido %d PG</string>
|
||||
<string name="level_up">Subir un nivel</string>
|
||||
<string name="use">Usar</string>
|
||||
<string name="no_powers">No tienes poderes, añade uno</string>
|
||||
<string name="show_stats">Mostrar ataque/defensa</string>
|
||||
</resources>
|
|
@ -48,7 +48,7 @@
|
|||
<string name="add_player">Add player</string>
|
||||
<string name="zero" translatable="false">0</string>
|
||||
<string name="no_players">No players, please add one</string>
|
||||
<string name="help_welcome_text">Press a player to open, hold for options</string>
|
||||
<string name="help_list">Press to open, hold for options</string>
|
||||
<string name="name">Name</string>
|
||||
<string name="keywords">Keywords</string>
|
||||
<string name="powerNameHint">Blasting charm</string>
|
||||
|
@ -61,7 +61,8 @@
|
|||
<string name="objective">Objective</string>
|
||||
<string name="objectiveHint">One creature</string>
|
||||
<string name="required">This field is required</string>
|
||||
<string name="used">You have used</string>
|
||||
<string name="used">Used</string>
|
||||
<string name="have_used">You have used</string>
|
||||
<string name="sure">Are you sure?</string>
|
||||
<string name="healed">You have restored %d HP</string>
|
||||
<string name="restored">Values restored</string>
|
||||
|
@ -149,22 +150,23 @@
|
|||
<item>Thievery</item>
|
||||
</string-array>
|
||||
|
||||
<!-- TODO: correctly translate and order the classes-->
|
||||
<string-array name="classes">
|
||||
<item>Class</item>
|
||||
<item>Ardiente</item>
|
||||
<item>Brujo</item>
|
||||
<item>Warlock</item>
|
||||
<item>Buscador</item>
|
||||
<item>Clérigo</item>
|
||||
<item>Explorador</item>
|
||||
<item>Guerrero</item>
|
||||
<item>Mago</item>
|
||||
<item>Cleric</item>
|
||||
<item>Explorer</item>
|
||||
<item>Warrior</item>
|
||||
<item>Wizard</item>
|
||||
<item>Mente de Batalla</item>
|
||||
<item>Monje</item>
|
||||
<item>Paladín</item>
|
||||
<item>Pícaro</item>
|
||||
<item>Psiónico</item>
|
||||
<item>Sacerdote Rúnico</item>
|
||||
<item>Señor de la Guerra</item>
|
||||
<item>Warlord</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="races">
|
||||
|
@ -187,5 +189,16 @@
|
|||
<string name="lost_hp">Lost %d HP</string>
|
||||
<string name="level_up">Level up</string>
|
||||
<string name="use">Use</string>
|
||||
<string name="no_powers">There are no powers, try creating one</string>
|
||||
<string name="show_stats">Show attack/defense</string>
|
||||
<string name="title_activity_display">Display</string>
|
||||
|
||||
<string name="title_section1">Section 1</string>
|
||||
<string name="title_section2">Section 2</string>
|
||||
<string name="title_section3">Section 3</string>
|
||||
|
||||
<string name="hello_world">Hello world!</string>
|
||||
|
||||
<string name="action_settings">Settings</string>
|
||||
|
||||
</resources>
|
||||
|
|