Code reformat

This commit is contained in:
2020-09-02 00:05:03 -07:00
parent 8e0252f49e
commit 05b1f8ad01
12 changed files with 228 additions and 96 deletions

View File

@@ -2,19 +2,20 @@ package com.majinnaibu.monstercards;
import android.os.Bundle; import android.os.Bundle;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.NavController; import androidx.navigation.NavController;
import androidx.navigation.Navigation; import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration; import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI; import androidx.navigation.ui.NavigationUI;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.microsoft.appcenter.AppCenter; import com.microsoft.appcenter.AppCenter;
import com.microsoft.appcenter.analytics.Analytics; import com.microsoft.appcenter.analytics.Analytics;
import com.microsoft.appcenter.crashes.Crashes; import com.microsoft.appcenter.crashes.Crashes;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
@SuppressWarnings("ConstantConditions")
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View File

@@ -26,7 +26,7 @@ public final class CommonMarkHelper {
if (parent1 == parent2 && parent1 instanceof Paragraph) { if (parent1 == parent2 && parent1 instanceof Paragraph) {
document = new Document(); document = new Document();
Node child = parent1.getFirstChild(); Node child = parent1.getFirstChild();
while(child != null) { while (child != null) {
Node nextChild = child.getNext(); Node nextChild = child.getNext();
document.appendChild(child); document.appendChild(child);
child = nextChild;//child.getNext(); child = nextChild;//child.getNext();

View File

@@ -46,7 +46,7 @@ public final class StringHelper {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
int index = 0; int index = 0;
int lastIndex = length - 1; int lastIndex = length - 1;
for(String element : strings) { for (String element : strings) {
if (index > 0 && index < lastIndex) { if (index > 0 && index < lastIndex) {
sb.append(delimiter); sb.append(delimiter);
} else if (index > 0 && index >= lastIndex) { } else if (index > 0 && index >= lastIndex) {

View File

@@ -8,17 +8,21 @@ public class Ability {
} }
private String mName; private String mName;
public String getName() { public String getName() {
return mName; return mName;
} }
public void setName(String name) { public void setName(String name) {
mName = name; mName = name;
} }
private String mDescription; private String mDescription;
public String getDescription() { public String getDescription() {
return mDescription; return mDescription;
} }
public void setDescription(String description) { public void setDescription(String description) {
mDescription = description; mDescription = description;
} }

View File

@@ -8,17 +8,21 @@ public class Action {
} }
private String mName; private String mName;
public String getName() { public String getName() {
return mName; return mName;
} }
public void setName(String name) { public void setName(String name) {
mName = name; mName = name;
} }
private String mDescription; private String mDescription;
public String getDescription() { public String getDescription() {
return mDescription; return mDescription;
} }
public void setDescription(String description) { public void setDescription(String description) {
mDescription = description; mDescription = description;
} }

View File

@@ -9,25 +9,31 @@ public class DamageType {
} }
private String mName; private String mName;
public String getName() { public String getName() {
return mName; return mName;
} }
public void setName(String value) { public void setName(String value) {
mName = value; mName = value;
} }
private String mNote; private String mNote;
public String getNote() { public String getNote() {
return mNote; return mNote;
} }
public void setNote(String value) { public void setNote(String value) {
mNote = value; mNote = value;
} }
private String mType; private String mType;
public String getType() { public String getType() {
return mType; return mType;
} }
public void setType(String value) { public void setType(String value) {
mType = value; mType = value;
} }

View File

@@ -10,17 +10,21 @@ public class Language implements Comparator<Language>, Comparable<Language> {
} }
private String mName; private String mName;
public String getName() { public String getName() {
return mName; return mName;
} }
public void setName(String value) { public void setName(String value) {
mName = value; mName = value;
} }
private boolean mSpeaks; private boolean mSpeaks;
public boolean getSpeaks() { public boolean getSpeaks() {
return mSpeaks; return mSpeaks;
} }
public void setSpeaks(boolean value) { public void setSpeaks(boolean value) {
mSpeaks = value; mSpeaks = value;
} }

View File

@@ -23,41 +23,51 @@ public class Monster {
} }
private String mName; private String mName;
public String getName() { public String getName() {
return mName; return mName;
} }
public void setName(String value) { public void setName(String value) {
mName = value; mName = value;
} }
private String mSize; private String mSize;
public String getSize() { public String getSize() {
return mSize; return mSize;
} }
public void setSize(String value) { public void setSize(String value) {
mSize = value; mSize = value;
} }
private String mType; private String mType;
public String getType() { public String getType() {
return mType; return mType;
} }
public void setType(String value) { public void setType(String value) {
mType = value; mType = value;
} }
private String mTag; private String mTag;
public String getTag() { public String getTag() {
return mTag; return mTag;
} }
public void setTag(String value) { public void setTag(String value) {
mTag = value; mTag = value;
} }
private String mAlignment; private String mAlignment;
public String getAlignment() { public String getAlignment() {
return mAlignment; return mAlignment;
} }
public void setAlignment(String value) { public void setAlignment(String value) {
mAlignment = value; mAlignment = value;
} }
@@ -121,7 +131,7 @@ public class Monster {
} }
public static int getAbilityModifierForScore(int score) { public static int getAbilityModifierForScore(int score) {
return (int)Math.floor((score-10)/2.0); return (int) Math.floor((score - 10) / 2.0);
} }
public int getAbilityModifier(String abilityScoreName) { public int getAbilityModifier(String abilityScoreName) {
@@ -130,99 +140,125 @@ public class Monster {
} }
private int mStrengthScore; private int mStrengthScore;
public int getStrengthScore() { public int getStrengthScore() {
return mStrengthScore; return mStrengthScore;
} }
public void setStrengthScore(int value) { public void setStrengthScore(int value) {
mStrengthScore = value; mStrengthScore = value;
} }
public int getStrengthModifier() { public int getStrengthModifier() {
return getAbilityModifierForScore(getStrengthScore()); return getAbilityModifierForScore(getStrengthScore());
} }
private int mDexterityScore; private int mDexterityScore;
public int getDexterityScore() { public int getDexterityScore() {
return mDexterityScore; return mDexterityScore;
} }
public void setDexterityScore(int value) { public void setDexterityScore(int value) {
mDexterityScore = value; mDexterityScore = value;
} }
public int getDexterityModifier() { public int getDexterityModifier() {
return getAbilityModifierForScore(getDexterityScore()); return getAbilityModifierForScore(getDexterityScore());
} }
private int mConstitutionScore; private int mConstitutionScore;
public int getConstitutionScore() { public int getConstitutionScore() {
return mConstitutionScore; return mConstitutionScore;
} }
public void setConstitutionScore(int value) { public void setConstitutionScore(int value) {
mConstitutionScore = value; mConstitutionScore = value;
} }
public int getConstitutionModifier() { public int getConstitutionModifier() {
return getAbilityModifierForScore(getConstitutionScore()); return getAbilityModifierForScore(getConstitutionScore());
} }
private int mIntelligenceScore; private int mIntelligenceScore;
public int getIntelligenceScore() { public int getIntelligenceScore() {
return mIntelligenceScore; return mIntelligenceScore;
} }
public void setIntelligenceScore(int value) { public void setIntelligenceScore(int value) {
mIntelligenceScore = value; mIntelligenceScore = value;
} }
public int getIntelligenceModifier() { public int getIntelligenceModifier() {
return getAbilityModifierForScore(getIntelligenceScore()); return getAbilityModifierForScore(getIntelligenceScore());
} }
private int mWisdomScore; private int mWisdomScore;
public int getWisdomScore() { public int getWisdomScore() {
return mWisdomScore; return mWisdomScore;
} }
public void setWisdomScore(int value) { public void setWisdomScore(int value) {
mWisdomScore = value; mWisdomScore = value;
} }
public int getWisdomModifier() { public int getWisdomModifier() {
return getAbilityModifierForScore(getWisdomScore()); return getAbilityModifierForScore(getWisdomScore());
} }
private int mCharismaScore; private int mCharismaScore;
public int getCharismaScore() { public int getCharismaScore() {
return mCharismaScore; return mCharismaScore;
} }
public void setCharismaScore(int value) { public void setCharismaScore(int value) {
mCharismaScore = value; mCharismaScore = value;
} }
public int getCharismaModifier() { public int getCharismaModifier() {
return getAbilityModifierForScore(getCharismaScore()); return getAbilityModifierForScore(getCharismaScore());
} }
private String mArmorName; private String mArmorName;
public String getArmorName() { public String getArmorName() {
return mArmorName; return mArmorName;
} }
public void setArmorName(String value) { public void setArmorName(String value) {
mArmorName = value; mArmorName = value;
} }
private int mShieldBonus; private int mShieldBonus;
public int getShieldBonus() { public int getShieldBonus() {
return mShieldBonus; return mShieldBonus;
} }
public void setShieldBonus(int value) { public void setShieldBonus(int value) {
mShieldBonus = value; mShieldBonus = value;
} }
private int mNaturalArmorBonus; private int mNaturalArmorBonus;
public int getNaturalArmorBonus() { public int getNaturalArmorBonus() {
return mNaturalArmorBonus; return mNaturalArmorBonus;
} }
public void setNaturalArmorBonus(int value) { public void setNaturalArmorBonus(int value) {
mNaturalArmorBonus = value; mNaturalArmorBonus = value;
} }
private String mOtherArmorDescription; private String mOtherArmorDescription;
public String getOtherArmorDescription() { public String getOtherArmorDescription() {
return mOtherArmorDescription; return mOtherArmorDescription;
} }
public void setOtherArmorDescription(String value) { public void setOtherArmorDescription(String value) {
mOtherArmorDescription = value; mOtherArmorDescription = value;
} }
@@ -233,7 +269,7 @@ public class Monster {
if (StringHelper.isNullOrEmpty(armorName) || "none".equals(armorName)) { if (StringHelper.isNullOrEmpty(armorName) || "none".equals(armorName)) {
// 10 + dexMod + 2 for shieldBonus "15" or "17 (shield)" // 10 + dexMod + 2 for shieldBonus "15" or "17 (shield)"
return String.format(Locale.US, "%d%s", BASE_ARMOR_CLASS + getDexterityModifier() + getShieldBonus(), hasShield ? " (shield)" : ""); return String.format(Locale.US, "%d%s", BASE_ARMOR_CLASS + getDexterityModifier() + getShieldBonus(), hasShield ? " (shield)" : "");
} else if("natural armor".equals(armorName)) { } else if ("natural armor".equals(armorName)) {
// 10 + dexMod + naturalArmorBonus + 2 for shieldBonus "16 (natural armor)" or "18 (natural armor, shield)" // 10 + dexMod + naturalArmorBonus + 2 for shieldBonus "16 (natural armor)" or "18 (natural armor, shield)"
return String.format(Locale.US, "%d (natural armor%s)", BASE_ARMOR_CLASS + getDexterityModifier() + getNaturalArmorBonus() + getShieldBonus(), hasShield ? ", shield" : ""); return String.format(Locale.US, "%d (natural armor%s)", BASE_ARMOR_CLASS + getDexterityModifier() + getNaturalArmorBonus() + getShieldBonus(), hasShield ? ", shield" : "");
} else if ("mage armor".equals(armorName)) { } else if ("mage armor".equals(armorName)) {
@@ -259,7 +295,7 @@ public class Monster {
return String.format(Locale.US, "%d (scale mail%s)", SCALE_MAIL_ARMOR_CLASS + Math.min(2, getDexterityModifier()) + getShieldBonus(), hasShield ? ", shield" : ""); return String.format(Locale.US, "%d (scale mail%s)", SCALE_MAIL_ARMOR_CLASS + Math.min(2, getDexterityModifier()) + getShieldBonus(), hasShield ? ", shield" : "");
} else if ("breastplate".equals(armorName)) { } else if ("breastplate".equals(armorName)) {
// 14 + Min(2, dexMod) + 2 for shield "16 (breastplate)" // 14 + Min(2, dexMod) + 2 for shield "16 (breastplate)"
return String.format(Locale.US, "%d (breastplate%s)", BREASTPLATE_ARMOR_CLASS +Math.min(2, getDexterityModifier()) + getShieldBonus(), hasShield ? ", shield" : ""); return String.format(Locale.US, "%d (breastplate%s)", BREASTPLATE_ARMOR_CLASS + Math.min(2, getDexterityModifier()) + getShieldBonus(), hasShield ? ", shield" : "");
} else if ("half plate".equals(armorName)) { } else if ("half plate".equals(armorName)) {
// 15 + Min(2, dexMod) + 2 for shield "17 (half plate)" // 15 + Min(2, dexMod) + 2 for shield "17 (half plate)"
return String.format(Locale.US, "%d (half plate%s)", HALF_PLATE_ARMOR_CLASS + Math.min(2, getDexterityModifier()) + getShieldBonus(), hasShield ? ", shield" : ""); return String.format(Locale.US, "%d (half plate%s)", HALF_PLATE_ARMOR_CLASS + Math.min(2, getDexterityModifier()) + getShieldBonus(), hasShield ? ", shield" : "");
@@ -271,10 +307,10 @@ public class Monster {
return String.format(Locale.US, "%d (chain mail%s)", CHAIN_MAIL_ARMOR_CLASS + getShieldBonus(), hasShield ? ", shield" : ""); return String.format(Locale.US, "%d (chain mail%s)", CHAIN_MAIL_ARMOR_CLASS + getShieldBonus(), hasShield ? ", shield" : "");
} else if ("splint".equals(armorName)) { } else if ("splint".equals(armorName)) {
// 17 + 2 for shield "17 (splint)" // 17 + 2 for shield "17 (splint)"
return String.format(Locale.US, "%d (splint%s)", SPLINT_ARMOR_CLASS + getShieldBonus(), hasShield ? ", shield": ""); return String.format(Locale.US, "%d (splint%s)", SPLINT_ARMOR_CLASS + getShieldBonus(), hasShield ? ", shield" : "");
} else if ("plate".equals(armorName)) { } else if ("plate".equals(armorName)) {
// 18 + 2 for shield "18 (plate)" // 18 + 2 for shield "18 (plate)"
return String.format(Locale.US, "%d (plate%s)", PLATE_ARMOR_CLASS + getShieldBonus(), hasShield ? ", shield": ""); return String.format(Locale.US, "%d (plate%s)", PLATE_ARMOR_CLASS + getShieldBonus(), hasShield ? ", shield" : "");
} else if ("other".equals(armorName)) { } else if ("other".equals(armorName)) {
// pure string value shield check does nothing just copies the string from otherArmorDesc // pure string value shield check does nothing just copies the string from otherArmorDesc
return getOtherArmorDescription(); return getOtherArmorDescription();
@@ -299,25 +335,31 @@ public class Monster {
private static final int PLATE_ARMOR_CLASS = BASE_ARMOR_CLASS + 8; private static final int PLATE_ARMOR_CLASS = BASE_ARMOR_CLASS + 8;
private int mHitDice; private int mHitDice;
public int getHitDice() { public int getHitDice() {
return mHitDice; return mHitDice;
} }
public void setHitDice(int value) { public void setHitDice(int value) {
mHitDice = value; mHitDice = value;
} }
private boolean mCustomHP; private boolean mCustomHP;
public boolean getCustomHP() { public boolean getCustomHP() {
return mCustomHP; return mCustomHP;
} }
public void setCustomHP(boolean value) { public void setCustomHP(boolean value) {
mCustomHP = value; mCustomHP = value;
} }
private String mHPText; private String mHPText;
public String getHPText() { public String getHPText() {
return mHPText; return mHPText;
} }
public void setHPText(String value) { public void setHPText(String value) {
mHPText = value; mHPText = value;
} }
@@ -353,65 +395,81 @@ public class Monster {
} }
private String mSpeed; private String mSpeed;
public String getSpeed() { public String getSpeed() {
return mSpeed; return mSpeed;
} }
public void setSpeed(String value) { public void setSpeed(String value) {
mSpeed = value; mSpeed = value;
} }
private String mBurrowSpeed; private String mBurrowSpeed;
public String getBurrowSpeed() { public String getBurrowSpeed() {
return mBurrowSpeed; return mBurrowSpeed;
} }
public void setBurrowSpeed(String value) { public void setBurrowSpeed(String value) {
mBurrowSpeed = value; mBurrowSpeed = value;
} }
private String mClimbSpeed; private String mClimbSpeed;
public String getClimbSpeed() { public String getClimbSpeed() {
return mClimbSpeed; return mClimbSpeed;
} }
public void setClimbSpeed(String value) { public void setClimbSpeed(String value) {
mClimbSpeed = value; mClimbSpeed = value;
} }
private String mFlySpeed; private String mFlySpeed;
public String getFlySpeed() { public String getFlySpeed() {
return mFlySpeed; return mFlySpeed;
} }
public void setFlySpeed(String value) { public void setFlySpeed(String value) {
mFlySpeed = value; mFlySpeed = value;
} }
private boolean mHover; private boolean mHover;
public boolean getHover() { public boolean getHover() {
return mHover; return mHover;
} }
public void setHover(boolean value) { public void setHover(boolean value) {
mHover = value; mHover = value;
} }
private String mSwimSpeed; private String mSwimSpeed;
public String getSwimSpeed() { public String getSwimSpeed() {
return mSwimSpeed; return mSwimSpeed;
} }
public void setSwimSpeed(String value) { public void setSwimSpeed(String value) {
mSwimSpeed = value; mSwimSpeed = value;
} }
private boolean mCustomSpeed; private boolean mCustomSpeed;
public boolean getCustomSpeed() { public boolean getCustomSpeed() {
return mCustomSpeed; return mCustomSpeed;
} }
public void setCustomSpeed(boolean value) { public void setCustomSpeed(boolean value) {
mCustomSpeed = value; mCustomSpeed = value;
} }
private String mSpeedDescription; private String mSpeedDescription;
public String getSpeedDescription() { public String getSpeedDescription() {
return mSpeedDescription; return mSpeedDescription;
} }
public void setSpeedDescription(String value) { public void setSpeedDescription(String value) {
mSpeedDescription = value; mSpeedDescription = value;
} }
@@ -471,15 +529,19 @@ public class Monster {
} }
private HashSet<SavingThrow> mSavingThrows; private HashSet<SavingThrow> mSavingThrows;
public Set<SavingThrow> getSavingThrows() { public Set<SavingThrow> getSavingThrows() {
return mSavingThrows; return mSavingThrows;
} }
public void addSavingThrow(SavingThrow savingThrow) { public void addSavingThrow(SavingThrow savingThrow) {
mSavingThrows.add(savingThrow); mSavingThrows.add(savingThrow);
} }
public void removeSavingThrow(SavingThrow savingThrow) { public void removeSavingThrow(SavingThrow savingThrow) {
mSavingThrows.remove(savingThrow); mSavingThrows.remove(savingThrow);
} }
public void clearSavingThrows() { public void clearSavingThrows() {
mSavingThrows.clear(); mSavingThrows.clear();
} }
@@ -496,7 +558,7 @@ public class Monster {
} }
String name = st.getName(); String name = st.getName();
sb.append(String.format(Locale.US, "%s%s %+d", name.substring(0,1).toUpperCase(Locale.US), name.substring(1), getAbilityModifier(name) + getProficiencyBonus())); sb.append(String.format(Locale.US, "%s%s %+d", name.substring(0, 1).toUpperCase(Locale.US), name.substring(1), getAbilityModifier(name) + getProficiencyBonus()));
isFirst = false; isFirst = false;
} }
return sb.toString(); return sb.toString();
@@ -570,40 +632,50 @@ public class Monster {
} }
private String mChallengeRating; private String mChallengeRating;
public String getChallengeRating() { public String getChallengeRating() {
return mChallengeRating; return mChallengeRating;
} }
public void setChallengeRating(String challengeRating) { public void setChallengeRating(String challengeRating) {
mChallengeRating = challengeRating; mChallengeRating = challengeRating;
// TODO: update proficiency bonus based on CR // TODO: update proficiency bonus based on CR
} }
private String mCustomChallengeRating; private String mCustomChallengeRating;
public String getCustomChallengeRating() { public String getCustomChallengeRating() {
return mCustomChallengeRating; return mCustomChallengeRating;
} }
public void setCustomChallengeRating(String challengeRating) { public void setCustomChallengeRating(String challengeRating) {
mCustomChallengeRating = challengeRating; mCustomChallengeRating = challengeRating;
} }
private int mCustomProficiencyBonus; private int mCustomProficiencyBonus;
public int getCustomProficiencyBonus() { public int getCustomProficiencyBonus() {
return mCustomProficiencyBonus; return mCustomProficiencyBonus;
} }
public void setCustomProficiencyBonus(int proficiencyBonus) { public void setCustomProficiencyBonus(int proficiencyBonus) {
mCustomProficiencyBonus = proficiencyBonus; mCustomProficiencyBonus = proficiencyBonus;
} }
private HashSet<Skill> mSkills; private HashSet<Skill> mSkills;
public Set<Skill> getSkills() { public Set<Skill> getSkills() {
return mSkills; return mSkills;
} }
public void addSkill(Skill skill) { public void addSkill(Skill skill) {
mSkills.add(skill); mSkills.add(skill);
} }
public void removeSkill(Skill skill) { public void removeSkill(Skill skill) {
mSkills.remove(skill); mSkills.remove(skill);
} }
public void clearSkill(Skill skill) { public void clearSkill(Skill skill) {
mSkills.clear(); mSkills.clear();
} }
@@ -626,16 +698,20 @@ public class Monster {
} }
private HashSet<DamageType> mDamageTypes; private HashSet<DamageType> mDamageTypes;
public Set<DamageType> getDamageTypes() { public Set<DamageType> getDamageTypes() {
return mDamageTypes; return mDamageTypes;
} }
public void addDamageType(DamageType damageType) { public void addDamageType(DamageType damageType) {
// TODO: make this remove the damage type with the same name if it exists first // TODO: make this remove the damage type with the same name if it exists first
mDamageTypes.add(damageType); mDamageTypes.add(damageType);
} }
public void removeDamageType(DamageType damageType) { public void removeDamageType(DamageType damageType) {
mDamageTypes.remove(damageType); mDamageTypes.remove(damageType);
} }
public void clearDamageTypes() { public void clearDamageTypes() {
mDamageTypes.clear(); mDamageTypes.clear();
} }
@@ -650,6 +726,7 @@ public class Monster {
Collections.sort(vulnerabilities); Collections.sort(vulnerabilities);
return StringHelper.oxfordJoin(", ", ", and ", " and ", vulnerabilities); return StringHelper.oxfordJoin(", ", ", and ", " and ", vulnerabilities);
} }
public String getDamageResistancesDescription() { public String getDamageResistancesDescription() {
ArrayList<String> vulnerabilities = new ArrayList<>(); ArrayList<String> vulnerabilities = new ArrayList<>();
for (DamageType damageType : mDamageTypes) { for (DamageType damageType : mDamageTypes) {
@@ -660,6 +737,7 @@ public class Monster {
Collections.sort(vulnerabilities); Collections.sort(vulnerabilities);
return StringHelper.oxfordJoin(", ", ", and ", " and ", vulnerabilities); return StringHelper.oxfordJoin(", ", ", and ", " and ", vulnerabilities);
} }
public String getDamageImmunitiesDescription() { public String getDamageImmunitiesDescription() {
ArrayList<String> vulnerabilities = new ArrayList<>(); ArrayList<String> vulnerabilities = new ArrayList<>();
for (DamageType damageType : mDamageTypes) { for (DamageType damageType : mDamageTypes) {
@@ -672,17 +750,21 @@ public class Monster {
} }
private HashSet<String> mConditionImmunities; private HashSet<String> mConditionImmunities;
public Set<String> getConditionImmunities() { public Set<String> getConditionImmunities() {
return mConditionImmunities; return mConditionImmunities;
} }
public void addConditionImmunity(String condition) { public void addConditionImmunity(String condition) {
// TODO: filter out duplicates // TODO: filter out duplicates
mConditionImmunities.add(condition); mConditionImmunities.add(condition);
} }
public void removeConditionImmunity(String condition) { public void removeConditionImmunity(String condition) {
// TODO: make sure this works even though we're using strings // TODO: make sure this works even though we're using strings
mConditionImmunities.remove(condition); mConditionImmunities.remove(condition);
} }
public void clearConditionImmunities() { public void clearConditionImmunities() {
mConditionImmunities.clear(); mConditionImmunities.clear();
} }
@@ -694,41 +776,51 @@ public class Monster {
} }
private String mBlindsight; private String mBlindsight;
public String getBlindsight() { public String getBlindsight() {
return mBlindsight; return mBlindsight;
} }
public void setBlindsight(String value) { public void setBlindsight(String value) {
mBlindsight = value; mBlindsight = value;
} }
private boolean mIsBlind; private boolean mIsBlind;
public boolean getIsBlind() { public boolean getIsBlind() {
return mIsBlind; return mIsBlind;
} }
public void setIsBlind(boolean value) { public void setIsBlind(boolean value) {
mIsBlind = value; mIsBlind = value;
} }
private String mDarkvision; private String mDarkvision;
public String getDarkvision() { public String getDarkvision() {
return mDarkvision; return mDarkvision;
} }
public void setDarkvision(String value) { public void setDarkvision(String value) {
mDarkvision = value; mDarkvision = value;
} }
private String mTremorsense; private String mTremorsense;
public String getTremorsense() { public String getTremorsense() {
return mTremorsense; return mTremorsense;
} }
public void setTremorsense(String value) { public void setTremorsense(String value) {
mTremorsense = value; mTremorsense = value;
} }
private String mTruesight; private String mTruesight;
public String getTruesight() { public String getTruesight() {
return mTruesight; return mTruesight;
} }
public void setTruesight(String value) { public void setTruesight(String value) {
mTruesight = value; mTruesight = value;
} }
@@ -758,31 +850,39 @@ public class Monster {
} }
private HashSet<Language> mLanguages; private HashSet<Language> mLanguages;
public Set<Language> getLanguages() { public Set<Language> getLanguages() {
return mLanguages; return mLanguages;
} }
public void addLanguage(Language value) { public void addLanguage(Language value) {
mLanguages.add(value); mLanguages.add(value);
} }
public void removeLanguage(Language value) { public void removeLanguage(Language value) {
mLanguages.remove(value); mLanguages.remove(value);
} }
public void clearLanguages() { public void clearLanguages() {
mLanguages.clear(); mLanguages.clear();
} }
private int mTelepathy; private int mTelepathy;
public int getTelepathy() { public int getTelepathy() {
return mTelepathy; return mTelepathy;
} }
public void setTelepathy(int value) { public void setTelepathy(int value) {
mTelepathy = value; mTelepathy = value;
} }
private String mUnderstandsBut; private String mUnderstandsBut;
public String getUnderstandsBut() { public String getUnderstandsBut() {
return mUnderstandsBut; return mUnderstandsBut;
} }
public void setUnderstandsBut(String value) { public void setUnderstandsBut(String value) {
mUnderstandsBut = value; mUnderstandsBut = value;
} }
@@ -921,15 +1021,19 @@ public class Monster {
} }
private ArrayList<Ability> mAbilities; private ArrayList<Ability> mAbilities;
public List<Ability> getAbilities() { public List<Ability> getAbilities() {
return mAbilities; return mAbilities;
} }
public void addAbility(Ability ability) { public void addAbility(Ability ability) {
mAbilities.add(ability); mAbilities.add(ability);
} }
public void removeAbility(Ability ability) { public void removeAbility(Ability ability) {
mAbilities.remove(ability); mAbilities.remove(ability);
} }
public void clearAbilities() { public void clearAbilities() {
mAbilities.clear(); mAbilities.clear();
} }
@@ -960,7 +1064,7 @@ public class Monster {
public int getSavingThrow(String name) { public int getSavingThrow(String name) {
Set<SavingThrow> sts = getSavingThrows(); Set<SavingThrow> sts = getSavingThrows();
for(SavingThrow st : sts) { for (SavingThrow st : sts) {
if (name.equals(st.getName())) { if (name.equals(st.getName())) {
return getAbilityModifier(name) + getProficiencyBonus(); return getAbilityModifier(name) + getProficiencyBonus();
} }
@@ -989,15 +1093,19 @@ public class Monster {
} }
private ArrayList<Action> mActions; private ArrayList<Action> mActions;
public List<Action> getActions() { public List<Action> getActions() {
return mActions; return mActions;
} }
public void addAction(Action ability) { public void addAction(Action ability) {
mActions.add(ability); mActions.add(ability);
} }
public void removeAction(Action ability) { public void removeAction(Action ability) {
mActions.remove(ability); mActions.remove(ability);
} }
public void clearActions() { public void clearActions() {
mActions.clear(); mActions.clear();
} }

View File

@@ -10,17 +10,21 @@ public class SavingThrow implements Comparator<SavingThrow>, Comparable<SavingTh
} }
private String mName; private String mName;
public String getName() { public String getName() {
return mName; return mName;
} }
public void setName(String value) { public void setName(String value) {
mName = value; mName = value;
} }
private int mOrder; private int mOrder;
public int getOrder() { public int getOrder() {
return mOrder; return mOrder;
} }
public void setOrder(int value) { public void setOrder(int value) {
mOrder = value; mOrder = value;
} }

View File

@@ -24,6 +24,7 @@ public class Skill implements Comparator<Skill>, Comparable<Skill> {
public String getName() { public String getName() {
return mName; return mName;
} }
public void setName(String name) { public void setName(String name) {
mName = name; mName = name;
} }
@@ -31,6 +32,7 @@ public class Skill implements Comparator<Skill>, Comparable<Skill> {
public String getAbilityScoreName() { public String getAbilityScoreName() {
return mAbilityScoreName; return mAbilityScoreName;
} }
public void setAbilityScoreName(String abilityScoreName) { public void setAbilityScoreName(String abilityScoreName) {
mAbilityScoreName = abilityScoreName; mAbilityScoreName = abilityScoreName;
} }
@@ -52,7 +54,7 @@ public class Skill implements Comparator<Skill>, Comparable<Skill> {
public String getText(Monster monster) { public String getText(Monster monster) {
int bonus = getSkillBonus(monster); int bonus = getSkillBonus(monster);
return String.format(Locale.US, "%s%s %d", mName.substring(0,1), mName.substring(1), bonus); return String.format(Locale.US, "%s%s %d", mName.substring(0, 1), mName.substring(1), bonus);
} }
@Override @Override

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -119,12 +118,12 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/label_dex"
app:layout_constraintTop_toBottomOf="@+id/divider2"
android:text="@string/strength_abbreviation" android:text="@string/strength_abbreviation"
android:textAlignment="center" android:textAlignment="center"
android:textStyle="bold" /> android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/label_dex"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider2" />
<TextView <TextView
android:id="@+id/strength" android:id="@+id/strength"
@@ -134,10 +133,10 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:layout_constraintStart_toStartOf="@+id/label_str"
app:layout_constraintEnd_toEndOf="@+id/label_str"
app:layout_constraintTop_toBottomOf="@+id/label_str"
android:textAlignment="center" android:textAlignment="center"
app:layout_constraintEnd_toEndOf="@+id/label_str"
app:layout_constraintStart_toStartOf="@+id/label_str"
app:layout_constraintTop_toBottomOf="@+id/label_str"
tools:text="2 (-4)" /> tools:text="2 (-4)" />
<!-- Dexterity --> <!-- Dexterity -->
@@ -149,12 +148,12 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:layout_constraintStart_toEndOf="@+id/label_str"
app:layout_constraintEnd_toStartOf="@+id/label_con"
app:layout_constraintTop_toBottomOf="@+id/divider2"
android:text="@string/dexterity_abbreviation" android:text="@string/dexterity_abbreviation"
android:textAlignment="center" android:textAlignment="center"
android:textStyle="bold" /> android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/label_con"
app:layout_constraintStart_toEndOf="@+id/label_str"
app:layout_constraintTop_toBottomOf="@+id/divider2" />
<TextView <TextView
android:id="@+id/dexterity" android:id="@+id/dexterity"
@@ -164,10 +163,10 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:layout_constraintStart_toStartOf="@+id/label_dex"
app:layout_constraintEnd_toEndOf="@+id/label_dex"
app:layout_constraintTop_toBottomOf="@+id/label_dex"
android:textAlignment="center" android:textAlignment="center"
app:layout_constraintEnd_toEndOf="@+id/label_dex"
app:layout_constraintStart_toStartOf="@+id/label_dex"
app:layout_constraintTop_toBottomOf="@+id/label_dex"
tools:text="20 (+5)" /> tools:text="20 (+5)" />
<!-- Constitution --> <!-- Constitution -->
@@ -179,24 +178,24 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:layout_constraintStart_toEndOf="@+id/label_dex"
app:layout_constraintEnd_toStartOf="@+id/label_int"
app:layout_constraintTop_toBottomOf="@+id/divider2"
android:text="@string/constitution_abbreviation" android:text="@string/constitution_abbreviation"
android:textAlignment="center" android:textAlignment="center"
android:textStyle="bold" /> android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/label_int"
app:layout_constraintStart_toEndOf="@+id/label_dex"
app:layout_constraintTop_toBottomOf="@+id/divider2" />
<TextView <TextView
android:id="@+id/constitution" android:id="@+id/constitution"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAlignment="center"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:layout_constraintStart_toStartOf="@+id/label_con" android:textAlignment="center"
app:layout_constraintEnd_toEndOf="@+id/label_con" app:layout_constraintEnd_toEndOf="@+id/label_con"
app:layout_constraintStart_toStartOf="@+id/label_con"
app:layout_constraintTop_toBottomOf="@+id/label_con" app:layout_constraintTop_toBottomOf="@+id/label_con"
tools:text="8 (-1)" /> tools:text="8 (-1)" />
@@ -209,12 +208,12 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:layout_constraintStart_toEndOf="@+id/label_con"
app:layout_constraintEnd_toStartOf="@+id/label_wis"
app:layout_constraintTop_toBottomOf="@+id/divider2"
android:text="@string/intelligence_abbreviation" android:text="@string/intelligence_abbreviation"
android:textAlignment="center" android:textAlignment="center"
android:textStyle="bold" /> android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/label_wis"
app:layout_constraintStart_toEndOf="@+id/label_con"
app:layout_constraintTop_toBottomOf="@+id/divider2" />
<TextView <TextView
android:id="@+id/intelligence" android:id="@+id/intelligence"
@@ -224,10 +223,10 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:layout_constraintStart_toStartOf="@+id/label_int"
app:layout_constraintEnd_toEndOf="@+id/label_int"
app:layout_constraintTop_toBottomOf="@+id/label_int"
android:textAlignment="center" android:textAlignment="center"
app:layout_constraintEnd_toEndOf="@+id/label_int"
app:layout_constraintStart_toStartOf="@+id/label_int"
app:layout_constraintTop_toBottomOf="@+id/label_int"
tools:text="10 (+0)" /> tools:text="10 (+0)" />
<!-- Wisdom --> <!-- Wisdom -->
@@ -239,12 +238,12 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:layout_constraintStart_toEndOf="@+id/label_int"
app:layout_constraintEnd_toStartOf="@+id/label_cha"
app:layout_constraintTop_toBottomOf="@+id/divider2"
android:text="@string/wisdom_abbreviation" android:text="@string/wisdom_abbreviation"
android:textAlignment="center" android:textAlignment="center"
android:textStyle="bold" /> android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/label_cha"
app:layout_constraintStart_toEndOf="@+id/label_int"
app:layout_constraintTop_toBottomOf="@+id/divider2" />
<TextView <TextView
android:id="@+id/wisdom" android:id="@+id/wisdom"
@@ -254,10 +253,10 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:layout_constraintStart_toStartOf="@+id/label_wis"
app:layout_constraintEnd_toEndOf="@+id/label_wis"
app:layout_constraintTop_toBottomOf="@+id/label_wis"
android:textAlignment="center" android:textAlignment="center"
app:layout_constraintEnd_toEndOf="@+id/label_wis"
app:layout_constraintStart_toStartOf="@+id/label_wis"
app:layout_constraintTop_toBottomOf="@+id/label_wis"
tools:text="14 (+2)" /> tools:text="14 (+2)" />
<!-- Charisma --> <!-- Charisma -->
@@ -269,12 +268,12 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:layout_constraintStart_toEndOf="@+id/label_wis"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider2"
android:text="@string/charisma_abbreviation" android:text="@string/charisma_abbreviation"
android:textAlignment="center" android:textAlignment="center"
android:textStyle="bold" /> android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/label_wis"
app:layout_constraintTop_toBottomOf="@+id/divider2" />
<TextView <TextView
android:id="@+id/charisma" android:id="@+id/charisma"
@@ -284,10 +283,10 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:layout_constraintStart_toStartOf="@+id/label_cha"
app:layout_constraintEnd_toEndOf="@+id/label_cha"
app:layout_constraintTop_toBottomOf="@+id/label_cha"
android:textAlignment="center" android:textAlignment="center"
app:layout_constraintEnd_toEndOf="@+id/label_cha"
app:layout_constraintStart_toStartOf="@+id/label_cha"
app:layout_constraintTop_toBottomOf="@+id/label_cha"
tools:text="15 (+2)" /> tools:text="15 (+2)" />
<ImageView <ImageView
@@ -425,13 +424,13 @@
<!-- Abilities --> <!-- Abilities -->
<LinearLayout <LinearLayout
android:id="@+id/abilities" android:id="@+id/abilities"
android:orientation="vertical"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="0dp" android:layout_marginTop="0dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="0dp" android:layout_marginBottom="0dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/challenge" app:layout_constraintTop_toBottomOf="@+id/challenge"
@@ -445,10 +444,10 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:text="@string/actions_label"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/abilities" app:layout_constraintTop_toBottomOf="@+id/abilities" />
android:text="@string/actions_label" />
<ImageView <ImageView
android:id="@+id/divider4" android:id="@+id/divider4"
@@ -468,13 +467,13 @@
<!-- Actions --> <!-- Actions -->
<LinearLayout <LinearLayout
android:id="@+id/actions" android:id="@+id/actions"
android:orientation="vertical"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="0dp" android:layout_marginTop="0dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="0dp" android:layout_marginBottom="0dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider4" app:layout_constraintTop_toBottomOf="@+id/divider4"

View File

@@ -23,10 +23,10 @@
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:importantForAutofill="no"
android:ems="10" android:ems="10"
android:inputType="textPersonName"
android:hint="@string/label_search_query" android:hint="@string/label_search_query"
android:importantForAutofill="no"
android:inputType="textPersonName"
app:layout_constraintEnd_toStartOf="@+id/button_search" app:layout_constraintEnd_toStartOf="@+id/button_search"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />