From 0c3ab6dc3937bd3b5ad2f434f70cf8fb0cb30954 Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Sat, 17 Apr 2021 14:33:49 -0700 Subject: [PATCH] Creates initial app database class and adds minimal DTO support for monsters. --- .../1.json | 405 +----------------- .../majinnaibu/monstercards/AppDatabase.java | 21 +- .../converters/UUIDConverter.java | 18 + .../monstercards/data/MonsterDAO.java | 13 +- .../monstercards/models/Monster.java | 69 ++- .../ui/monster/MonsterFragment.java | 2 +- .../ui/monster/MonsterViewModel.java | 2 +- 7 files changed, 88 insertions(+), 442 deletions(-) create mode 100644 Android/app/src/main/java/com/majinnaibu/monstercards/converters/UUIDConverter.java diff --git a/Android/app/schemas/com.majinnaibu.monstercards.AppDatabase/1.json b/Android/app/schemas/com.majinnaibu.monstercards.AppDatabase/1.json index 83ab2bc..f92e587 100644 --- a/Android/app/schemas/com.majinnaibu.monstercards.AppDatabase/1.json +++ b/Android/app/schemas/com.majinnaibu.monstercards.AppDatabase/1.json @@ -2,11 +2,11 @@ "formatVersion": 1, "database": { "version": 1, - "identityHash": "db1293d2f490940b55ca1f4f56b21b1a", + "identityHash": "a9371223372fb64522cc40f5529ada09", "entities": [ { "tableName": "Monster", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL DEFAULT '', `size` TEXT NOT NULL DEFAULT '', `type` TEXT NOT NULL DEFAULT '', `subtype` TEXT NOT NULL DEFAULT '', `alignment` TEXT NOT NULL DEFAULT '', `strength_score` INTEGER NOT NULL DEFAULT 10, `strength_saving_throw_advantage` TEXT DEFAULT 'none', `strength_saving_throw_proficiency` TEXT DEFAULT 'none', `dexterity_score` INTEGER NOT NULL DEFAULT 10, `dexterity_saving_throw_advantage` TEXT DEFAULT 'none', `dexterity_saving_throw_proficiency` TEXT DEFAULT 'none', `constitution_score` INTEGER NOT NULL DEFAULT 10, `constitution_saving_throw_advantage` TEXT DEFAULT 'none', `constitution_saving_throw_proficiency` TEXT DEFAULT 'none', `intelligence_score` INTEGER NOT NULL DEFAULT 10, `intelligence_saving_throw_advantage` TEXT DEFAULT 'none', `intelligence_saving_throw_proficiency` TEXT DEFAULT 'none', `wisdom_score` INTEGER NOT NULL DEFAULT 10, `wisdom_saving_throw_advantage` TEXT DEFAULT 'none', `wisdom_saving_throw_proficiency` TEXT DEFAULT 'none', `charisma_score` INTEGER NOT NULL DEFAULT 10, `charisma_saving_throw_advantage` TEXT DEFAULT 'none', `charisma_saving_throw_proficiency` TEXT DEFAULT 'none', `armor_type` TEXT DEFAULT 'none', `shield_bonus` INTEGER NOT NULL DEFAULT 0, `natural_armor_bonus` INTEGER NOT NULL DEFAULT 0, `other_armor_description` TEXT DEFAULT '', `hit_dice` INTEGER NOT NULL DEFAULT 1, `has_custom_hit_points` INTEGER NOT NULL, `custom_hit_points_description` TEXT DEFAULT '', `walk_speed` INTEGER NOT NULL DEFAULT 0, `burrow_speed` INTEGER NOT NULL DEFAULT 0, `climb_speed` INTEGER NOT NULL DEFAULT 0, `fly_speed` INTEGER NOT NULL DEFAULT 0, `can_hover` INTEGER NOT NULL DEFAULT false, `swim_speed` INTEGER NOT NULL DEFAULT 0, `has_custom_speed` INTEGER NOT NULL DEFAULT false, `custom_speed_description` TEXT, `challenge_rating` TEXT DEFAULT '1', `custom_challenge_rating_description` TEXT DEFAULT '', `custom_proficiency_bonus` INTEGER NOT NULL DEFAULT 0, `blindsight_range` INTEGER NOT NULL DEFAULT 0, `is_blind_beyond_blindsight_range` INTEGER NOT NULL DEFAULT false, `darkvision_range` INTEGER NOT NULL DEFAULT 0, `tremorsense_range` INTEGER NOT NULL DEFAULT 0, `truesight_range` INTEGER NOT NULL DEFAULT 0, `telepathy_range` INTEGER NOT NULL DEFAULT 0, `understands_but_description` TEXT DEFAULT '', `skills` TEXT, `damage_immunities` TEXT, `damage_resistances` TEXT, `damage_vulnerabilities` TEXT, `condition_immunities` TEXT, `languages` TEXT, `abilities` TEXT, `actions` TEXT, `reactions` TEXT, `lair_actions` TEXT, `legendary_actions` TEXT, `regional_actions` TEXT, PRIMARY KEY(`id`))", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL DEFAULT '', PRIMARY KEY(`id`))", "fields": [ { "fieldPath": "id", @@ -20,405 +20,6 @@ "affinity": "TEXT", "notNull": true, "defaultValue": "''" - }, - { - "fieldPath": "size", - "columnName": "size", - "affinity": "TEXT", - "notNull": true, - "defaultValue": "''" - }, - { - "fieldPath": "type", - "columnName": "type", - "affinity": "TEXT", - "notNull": true, - "defaultValue": "''" - }, - { - "fieldPath": "subtype", - "columnName": "subtype", - "affinity": "TEXT", - "notNull": true, - "defaultValue": "''" - }, - { - "fieldPath": "alignment", - "columnName": "alignment", - "affinity": "TEXT", - "notNull": true, - "defaultValue": "''" - }, - { - "fieldPath": "strengthScore", - "columnName": "strength_score", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "10" - }, - { - "fieldPath": "strengthSavingThrowAdvantage", - "columnName": "strength_saving_throw_advantage", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'none'" - }, - { - "fieldPath": "strengthSavingThrowProficiency", - "columnName": "strength_saving_throw_proficiency", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'none'" - }, - { - "fieldPath": "dexterityScore", - "columnName": "dexterity_score", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "10" - }, - { - "fieldPath": "dexteritySavingThrowAdvantage", - "columnName": "dexterity_saving_throw_advantage", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'none'" - }, - { - "fieldPath": "dexteritySavingThrowProficiency", - "columnName": "dexterity_saving_throw_proficiency", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'none'" - }, - { - "fieldPath": "constitutionScore", - "columnName": "constitution_score", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "10" - }, - { - "fieldPath": "constitutionSavingThrowAdvantage", - "columnName": "constitution_saving_throw_advantage", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'none'" - }, - { - "fieldPath": "constitutionSavingThrowProficiency", - "columnName": "constitution_saving_throw_proficiency", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'none'" - }, - { - "fieldPath": "intelligenceScore", - "columnName": "intelligence_score", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "10" - }, - { - "fieldPath": "intelligenceSavingThrowAdvantage", - "columnName": "intelligence_saving_throw_advantage", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'none'" - }, - { - "fieldPath": "intelligenceSavingThrowProficiency", - "columnName": "intelligence_saving_throw_proficiency", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'none'" - }, - { - "fieldPath": "wisdomScore", - "columnName": "wisdom_score", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "10" - }, - { - "fieldPath": "wisdomSavingThrowAdvantage", - "columnName": "wisdom_saving_throw_advantage", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'none'" - }, - { - "fieldPath": "wisdomSavingThrowProficiency", - "columnName": "wisdom_saving_throw_proficiency", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'none'" - }, - { - "fieldPath": "charismaScore", - "columnName": "charisma_score", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "10" - }, - { - "fieldPath": "charismaSavingThrowAdvantage", - "columnName": "charisma_saving_throw_advantage", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'none'" - }, - { - "fieldPath": "charismaSavingThrowProficiency", - "columnName": "charisma_saving_throw_proficiency", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'none'" - }, - { - "fieldPath": "armorType", - "columnName": "armor_type", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'none'" - }, - { - "fieldPath": "shieldBonus", - "columnName": "shield_bonus", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "0" - }, - { - "fieldPath": "naturalArmorBonus", - "columnName": "natural_armor_bonus", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "0" - }, - { - "fieldPath": "otherArmorDescription", - "columnName": "other_armor_description", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "''" - }, - { - "fieldPath": "hitDice", - "columnName": "hit_dice", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "1" - }, - { - "fieldPath": "hasCustomHP", - "columnName": "has_custom_hit_points", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "customHPDescription", - "columnName": "custom_hit_points_description", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "''" - }, - { - "fieldPath": "walkSpeed", - "columnName": "walk_speed", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "0" - }, - { - "fieldPath": "burrowSpeed", - "columnName": "burrow_speed", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "0" - }, - { - "fieldPath": "climbSpeed", - "columnName": "climb_speed", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "0" - }, - { - "fieldPath": "flySpeed", - "columnName": "fly_speed", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "0" - }, - { - "fieldPath": "canHover", - "columnName": "can_hover", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "false" - }, - { - "fieldPath": "swimSpeed", - "columnName": "swim_speed", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "0" - }, - { - "fieldPath": "hasCustomSpeed", - "columnName": "has_custom_speed", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "false" - }, - { - "fieldPath": "customSpeedDescription", - "columnName": "custom_speed_description", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "challengeRating", - "columnName": "challenge_rating", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "'1'" - }, - { - "fieldPath": "customChallengeRatingDescription", - "columnName": "custom_challenge_rating_description", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "''" - }, - { - "fieldPath": "customProficiencyBonus", - "columnName": "custom_proficiency_bonus", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "0" - }, - { - "fieldPath": "blindsightRange", - "columnName": "blindsight_range", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "0" - }, - { - "fieldPath": "isBlindBeyondBlindsightRange", - "columnName": "is_blind_beyond_blindsight_range", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "false" - }, - { - "fieldPath": "darkvisionRange", - "columnName": "darkvision_range", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "0" - }, - { - "fieldPath": "tremorsenseRange", - "columnName": "tremorsense_range", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "0" - }, - { - "fieldPath": "truesightRange", - "columnName": "truesight_range", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "0" - }, - { - "fieldPath": "telepathyRange", - "columnName": "telepathy_range", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "0" - }, - { - "fieldPath": "understandsButDescription", - "columnName": "understands_but_description", - "affinity": "TEXT", - "notNull": false, - "defaultValue": "''" - }, - { - "fieldPath": "skills", - "columnName": "skills", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "damageImmunities", - "columnName": "damage_immunities", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "damageResistances", - "columnName": "damage_resistances", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "damageVulnerabilities", - "columnName": "damage_vulnerabilities", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "conditionImmunities", - "columnName": "condition_immunities", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "languages", - "columnName": "languages", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "abilities", - "columnName": "abilities", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "actions", - "columnName": "actions", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "reactions", - "columnName": "reactions", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "lairActions", - "columnName": "lair_actions", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "legendaryActions", - "columnName": "legendary_actions", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "regionalActions", - "columnName": "regional_actions", - "affinity": "TEXT", - "notNull": false } ], "primaryKey": { @@ -434,7 +35,7 @@ "views": [], "setupQueries": [ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", - "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'db1293d2f490940b55ca1f4f56b21b1a')" + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'a9371223372fb64522cc40f5529ada09')" ] } } \ No newline at end of file diff --git a/Android/app/src/main/java/com/majinnaibu/monstercards/AppDatabase.java b/Android/app/src/main/java/com/majinnaibu/monstercards/AppDatabase.java index 7b27aa6..fc44923 100644 --- a/Android/app/src/main/java/com/majinnaibu/monstercards/AppDatabase.java +++ b/Android/app/src/main/java/com/majinnaibu/monstercards/AppDatabase.java @@ -4,27 +4,12 @@ import androidx.room.Database; import androidx.room.RoomDatabase; import androidx.room.TypeConverters; +import com.majinnaibu.monstercards.converters.UUIDConverter; import com.majinnaibu.monstercards.data.MonsterDAO; -import com.majinnaibu.monstercards.data.converters.ArmorTypeConverter; -import com.majinnaibu.monstercards.data.converters.ChallengeRatingConverter; -import com.majinnaibu.monstercards.data.converters.ListOfTraitsConverter; -import com.majinnaibu.monstercards.data.converters.SetOfLanguageConverter; -import com.majinnaibu.monstercards.data.converters.SetOfSkillConverter; -import com.majinnaibu.monstercards.data.converters.SetOfStringConverter; -import com.majinnaibu.monstercards.data.converters.UUIDConverter; import com.majinnaibu.monstercards.models.Monster; -import com.majinnaibu.monstercards.models.MonsterFTS; -@Database(entities = {Monster.class, MonsterFTS.class}, version = 3) -@TypeConverters({ - ArmorTypeConverter.class, - ChallengeRatingConverter.class, - ListOfTraitsConverter.class, - SetOfLanguageConverter.class, - SetOfSkillConverter.class, - SetOfStringConverter.class, - UUIDConverter.class, -}) +@Database(entities = {Monster.class}, version=1) +@TypeConverters({UUIDConverter.class}) public abstract class AppDatabase extends RoomDatabase { public abstract MonsterDAO monsterDAO(); } diff --git a/Android/app/src/main/java/com/majinnaibu/monstercards/converters/UUIDConverter.java b/Android/app/src/main/java/com/majinnaibu/monstercards/converters/UUIDConverter.java new file mode 100644 index 0000000..b1effc8 --- /dev/null +++ b/Android/app/src/main/java/com/majinnaibu/monstercards/converters/UUIDConverter.java @@ -0,0 +1,18 @@ +package com.majinnaibu.monstercards.converters; + +import androidx.room.TypeConverter; + +import java.util.UUID; + +public class UUIDConverter { + + @TypeConverter + public static String fromUUID(UUID uuid) { + return uuid.toString(); + } + + @TypeConverter + public static UUID uuidFromString(String string) { + return UUID.fromString(string); + } +} diff --git a/Android/app/src/main/java/com/majinnaibu/monstercards/data/MonsterDAO.java b/Android/app/src/main/java/com/majinnaibu/monstercards/data/MonsterDAO.java index 9671790..5295e92 100644 --- a/Android/app/src/main/java/com/majinnaibu/monstercards/data/MonsterDAO.java +++ b/Android/app/src/main/java/com/majinnaibu/monstercards/data/MonsterDAO.java @@ -4,7 +4,6 @@ package com.majinnaibu.monstercards.data; import androidx.room.Dao; import androidx.room.Delete; import androidx.room.Insert; -import androidx.room.OnConflictStrategy; import androidx.room.Query; import com.majinnaibu.monstercards.models.Monster; @@ -16,24 +15,18 @@ import io.reactivex.rxjava3.core.Flowable; @Dao public interface MonsterDAO { - @Query("SELECT * FROM monsters") + @Query("SELECT * FROM monster") Flowable> getAll(); - @Query("SELECT * FROM monsters WHERE id IN (:monsterIds)") + @Query("SELECT * FROM monster WHERE id IN (:monsterIds)") Flowable> loadAllByIds(String[] monsterIds); - @Query("SELECT * FROM monsters WHERE name LIKE :name LIMIT 1") + @Query("SELECT * FROM monster WHERE name LIKE :name LIMIT 1") Flowable findByName(String name); - @Query("SELECT monsters.* FROM monsters JOIN monsters_fts ON monsters.oid = monsters_fts.docid WHERE monsters_fts MATCH :searchText") - Flowable> search(String searchText); - @Insert Completable insertAll(Monster... monsters); - @Insert(onConflict = OnConflictStrategy.REPLACE) - Completable save(Monster... monsters); - @Delete Completable delete(Monster monster); } diff --git a/Android/app/src/main/java/com/majinnaibu/monstercards/models/Monster.java b/Android/app/src/main/java/com/majinnaibu/monstercards/models/Monster.java index 690e881..e755fed 100644 --- a/Android/app/src/main/java/com/majinnaibu/monstercards/models/Monster.java +++ b/Android/app/src/main/java/com/majinnaibu/monstercards/models/Monster.java @@ -1,5 +1,11 @@ package com.majinnaibu.monstercards.models; +import androidx.annotation.NonNull; +import androidx.room.ColumnInfo; +import androidx.room.Entity; +import androidx.room.Ignore; +import androidx.room.PrimaryKey; + import com.majinnaibu.monstercards.helpers.StringHelper; import java.util.ArrayList; @@ -9,10 +15,21 @@ import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; +import java.util.UUID; +@Entity public class Monster { + @PrimaryKey + @NonNull + public UUID id; + + @NonNull + @ColumnInfo(defaultValue = "") + public String name; + public Monster() { + name = ""; mAbilities = new ArrayList<>(); mActions = new ArrayList<>(); mConditionImmunities = new HashSet<>(); @@ -22,16 +39,7 @@ public class Monster { mSkills = new HashSet<>(); } - private String mName; - - public String getName() { - return mName; - } - - public void setName(String value) { - mName = value; - } - + @Ignore() private String mSize; public String getSize() { @@ -42,6 +50,7 @@ public class Monster { mSize = value; } + @Ignore() private String mType; public String getType() { @@ -52,6 +61,7 @@ public class Monster { mType = value; } + @Ignore() private String mTag; public String getTag() { @@ -62,6 +72,7 @@ public class Monster { mTag = value; } + @Ignore() private String mAlignment; public String getAlignment() { @@ -139,6 +150,7 @@ public class Monster { return getAbilityModifierForScore(score); } + @Ignore() private int mStrengthScore; public int getStrengthScore() { @@ -153,6 +165,7 @@ public class Monster { return getAbilityModifierForScore(getStrengthScore()); } + @Ignore() private int mDexterityScore; public int getDexterityScore() { @@ -167,6 +180,7 @@ public class Monster { return getAbilityModifierForScore(getDexterityScore()); } + @Ignore() private int mConstitutionScore; public int getConstitutionScore() { @@ -181,6 +195,7 @@ public class Monster { return getAbilityModifierForScore(getConstitutionScore()); } + @Ignore() private int mIntelligenceScore; public int getIntelligenceScore() { @@ -195,6 +210,7 @@ public class Monster { return getAbilityModifierForScore(getIntelligenceScore()); } + @Ignore() private int mWisdomScore; public int getWisdomScore() { @@ -209,6 +225,7 @@ public class Monster { return getAbilityModifierForScore(getWisdomScore()); } + @Ignore() private int mCharismaScore; public int getCharismaScore() { @@ -223,6 +240,7 @@ public class Monster { return getAbilityModifierForScore(getCharismaScore()); } + @Ignore() private String mArmorName; public String getArmorName() { @@ -233,6 +251,7 @@ public class Monster { mArmorName = value; } + @Ignore() private int mShieldBonus; public int getShieldBonus() { @@ -243,6 +262,7 @@ public class Monster { mShieldBonus = value; } + @Ignore() private int mNaturalArmorBonus; public int getNaturalArmorBonus() { @@ -253,6 +273,7 @@ public class Monster { mNaturalArmorBonus = value; } + @Ignore() private String mOtherArmorDescription; public String getOtherArmorDescription() { @@ -334,6 +355,7 @@ public class Monster { private static final int SPLINT_ARMOR_CLASS = BASE_ARMOR_CLASS + 7; private static final int PLATE_ARMOR_CLASS = BASE_ARMOR_CLASS + 8; + @Ignore() private int mHitDice; public int getHitDice() { @@ -344,6 +366,7 @@ public class Monster { mHitDice = value; } + @Ignore() private boolean mCustomHP; public boolean getCustomHP() { @@ -354,6 +377,7 @@ public class Monster { mCustomHP = value; } + @Ignore() private String mHPText; public String getHPText() { @@ -397,6 +421,7 @@ public class Monster { } } + @Ignore() private String mSpeed; public String getSpeed() { @@ -407,6 +432,7 @@ public class Monster { mSpeed = value; } + @Ignore() private String mBurrowSpeed; public String getBurrowSpeed() { @@ -417,6 +443,7 @@ public class Monster { mBurrowSpeed = value; } + @Ignore() private String mClimbSpeed; public String getClimbSpeed() { @@ -427,6 +454,7 @@ public class Monster { mClimbSpeed = value; } + @Ignore() private String mFlySpeed; public String getFlySpeed() { @@ -437,6 +465,7 @@ public class Monster { mFlySpeed = value; } + @Ignore() private boolean mHover; public boolean getHover() { @@ -447,6 +476,7 @@ public class Monster { mHover = value; } + @Ignore() private String mSwimSpeed; public String getSwimSpeed() { @@ -457,6 +487,7 @@ public class Monster { mSwimSpeed = value; } + @Ignore() private boolean mCustomSpeed; public boolean getCustomSpeed() { @@ -467,6 +498,7 @@ public class Monster { mCustomSpeed = value; } + @Ignore() private String mSpeedDescription; public String getSpeedDescription() { @@ -531,6 +563,7 @@ public class Monster { return String.format(Locale.US, "%d (%+d)", getCharismaScore(), getCharismaModifier()); } + @Ignore() private HashSet mSavingThrows; public Set getSavingThrows() { @@ -634,6 +667,7 @@ public class Monster { } } + @Ignore() private String mChallengeRating; public String getChallengeRating() { @@ -645,6 +679,7 @@ public class Monster { // TODO: update proficiency bonus based on CR } + @Ignore() private String mCustomChallengeRating; public String getCustomChallengeRating() { @@ -655,6 +690,7 @@ public class Monster { mCustomChallengeRating = challengeRating; } + @Ignore() private int mCustomProficiencyBonus; public int getCustomProficiencyBonus() { @@ -665,6 +701,7 @@ public class Monster { mCustomProficiencyBonus = proficiencyBonus; } + @Ignore() private HashSet mSkills; public Set getSkills() { @@ -700,6 +737,7 @@ public class Monster { return sb.toString(); } + @Ignore() private HashSet mDamageTypes; public Set getDamageTypes() { @@ -752,6 +790,7 @@ public class Monster { return StringHelper.oxfordJoin(", ", ", and ", " and ", vulnerabilities); } + @Ignore() private HashSet mConditionImmunities; public Set getConditionImmunities() { @@ -778,6 +817,7 @@ public class Monster { return StringHelper.oxfordJoin(", ", ", and ", " and ", immunities); } + @Ignore() private String mBlindsight; public String getBlindsight() { @@ -788,6 +828,7 @@ public class Monster { mBlindsight = value; } + @Ignore() private boolean mIsBlind; public boolean getIsBlind() { @@ -798,6 +839,7 @@ public class Monster { mIsBlind = value; } + @Ignore() private String mDarkvision; public String getDarkvision() { @@ -808,6 +850,7 @@ public class Monster { mDarkvision = value; } + @Ignore() private String mTremorsense; public String getTremorsense() { @@ -818,6 +861,7 @@ public class Monster { mTremorsense = value; } + @Ignore() private String mTruesight; public String getTruesight() { @@ -852,6 +896,7 @@ public class Monster { return StringHelper.join(", ", parts); } + @Ignore() private HashSet mLanguages; public Set getLanguages() { @@ -870,6 +915,7 @@ public class Monster { mLanguages.clear(); } + @Ignore() private int mTelepathy; public int getTelepathy() { @@ -880,6 +926,7 @@ public class Monster { mTelepathy = value; } + @Ignore() private String mUnderstandsBut; public String getUnderstandsBut() { @@ -1023,6 +1070,7 @@ public class Monster { } } + @Ignore() private ArrayList mAbilities; public List getAbilities() { @@ -1095,6 +1143,7 @@ public class Monster { return actions; } + @Ignore() private ArrayList mActions; public List getActions() { diff --git a/Android/app/src/main/java/com/majinnaibu/monstercards/ui/monster/MonsterFragment.java b/Android/app/src/main/java/com/majinnaibu/monstercards/ui/monster/MonsterFragment.java index 9a2174b..e587b77 100644 --- a/Android/app/src/main/java/com/majinnaibu/monstercards/ui/monster/MonsterFragment.java +++ b/Android/app/src/main/java/com/majinnaibu/monstercards/ui/monster/MonsterFragment.java @@ -43,7 +43,7 @@ public class MonsterFragment extends Fragment { // TODO: remove this block make the monster ID a parameter to the view and get the monster from saved data (sqlite) Monster monster = new Monster(); // Name - monster.setName("Pixie"); + monster.name ="Pixie"; // Meta monster.setSize("tiny"); monster.setType("fey"); diff --git a/Android/app/src/main/java/com/majinnaibu/monstercards/ui/monster/MonsterViewModel.java b/Android/app/src/main/java/com/majinnaibu/monstercards/ui/monster/MonsterViewModel.java index 4449896..24b507a 100644 --- a/Android/app/src/main/java/com/majinnaibu/monstercards/ui/monster/MonsterViewModel.java +++ b/Android/app/src/main/java/com/majinnaibu/monstercards/ui/monster/MonsterViewModel.java @@ -167,7 +167,7 @@ public class MonsterViewModel extends ViewModel { mIntelligence.setValue(monster.getIntelligenceDescription()); mLanguages.setValue(mMonster.getLanguagesDescription()); mMeta.setValue(mMonster.getMeta()); - mName.setValue(mMonster.getName()); + mName.setValue(mMonster.name); mSavingThrows.setValue(monster.getSavingThrowsDescription()); mSenses.setValue(monster.getSensesDescription()); mSkills.setValue(monster.getSkillsDescription());