Converts enums to Kotlin.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application'
|
id 'com.android.application'
|
||||||
id 'androidx.navigation.safeargs'
|
id 'androidx.navigation.safeargs'
|
||||||
|
id 'kotlin-android'
|
||||||
}
|
}
|
||||||
|
|
||||||
Properties properties = new Properties()
|
Properties properties = new Properties()
|
||||||
@@ -65,6 +66,8 @@ dependencies {
|
|||||||
// Included libs
|
// Included libs
|
||||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
|
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.20"
|
||||||
|
|
||||||
// Google
|
// Google
|
||||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||||
implementation 'com.google.android.material:material:1.4.0'
|
implementation 'com.google.android.material:material:1.4.0'
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.majinnaibu.monstercards.data.enums;
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public enum AbilityScore {
|
|
||||||
STRENGTH("strength", "Strength", "STR"),
|
|
||||||
DEXTERITY("dexterity", "Dexterity", "DEX"),
|
|
||||||
CONSTITUTION("constitution", "Constitution", "CON"),
|
|
||||||
INTELLIGENCE("intelligence", "Intelligence", "INT"),
|
|
||||||
WISDOM("wisdom", "Wisdom", "WIS"),
|
|
||||||
CHARISMA("charisma", "Charisma", "CHA"),
|
|
||||||
;
|
|
||||||
|
|
||||||
public final String displayName;
|
|
||||||
public final String shortDisplayName;
|
|
||||||
public final String stringValue;
|
|
||||||
|
|
||||||
AbilityScore(String stringValue, String displayName, String shortDisplayName) {
|
|
||||||
this.displayName = displayName;
|
|
||||||
this.stringValue = stringValue;
|
|
||||||
this.shortDisplayName = shortDisplayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AbilityScore valueOfString(String string) {
|
|
||||||
for (AbilityScore abilityScore : values()) {
|
|
||||||
if (abilityScore.stringValue.equals(string)) {
|
|
||||||
return abilityScore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return AbilityScore.STRENGTH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.majinnaibu.monstercards.data.enums
|
||||||
|
|
||||||
|
enum class AbilityScore(
|
||||||
|
@JvmField val stringValue: String,
|
||||||
|
@JvmField val displayName: String,
|
||||||
|
@JvmField val shortDisplayName: String
|
||||||
|
) {
|
||||||
|
STRENGTH("strength", "Strength", "STR"),
|
||||||
|
DEXTERITY("dexterity", "Dexterity", "DEX"),
|
||||||
|
CONSTITUTION("constitution", "Constitution", "CON"),
|
||||||
|
INTELLIGENCE("intelligence", "Intelligence", "INT"),
|
||||||
|
WISDOM("wisdom", "Wisdom", "WIS"),
|
||||||
|
CHARISMA("charisma", "Charisma", "CHA");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun valueOfString(string: String): AbilityScore {
|
||||||
|
for (abilityScore in values()) {
|
||||||
|
if (abilityScore.stringValue == string) {
|
||||||
|
return abilityScore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return STRENGTH
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package com.majinnaibu.monstercards.data.enums;
|
|
||||||
|
|
||||||
public enum AdvantageType {
|
|
||||||
NONE("none", "None", ""),
|
|
||||||
ADVANTAGE("advantage", "Advantage", "A"),
|
|
||||||
DISADVANTAGE("disadvantage", "Disadvantage", "D"),
|
|
||||||
;
|
|
||||||
|
|
||||||
public final String displayName;
|
|
||||||
public final String stringValue;
|
|
||||||
public final String label;
|
|
||||||
|
|
||||||
AdvantageType(String stringValue, String displayName, String label) {
|
|
||||||
this.displayName = displayName;
|
|
||||||
this.stringValue = stringValue;
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AdvantageType valueOfString(String string) {
|
|
||||||
for (AdvantageType advantageType : values()) {
|
|
||||||
if (advantageType.stringValue.equals(string)) {
|
|
||||||
return advantageType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return AdvantageType.NONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.majinnaibu.monstercards.data.enums
|
||||||
|
|
||||||
|
enum class AdvantageType(
|
||||||
|
val stringValue: String,
|
||||||
|
val displayName: String,
|
||||||
|
@JvmField val label: String
|
||||||
|
) {
|
||||||
|
NONE("none", "None", ""),
|
||||||
|
ADVANTAGE("advantage", "Advantage", "A"),
|
||||||
|
DISADVANTAGE("disadvantage", "Disadvantage", "D");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun valueOfString(string: String): AdvantageType {
|
||||||
|
for (advantageType in values()) {
|
||||||
|
if (advantageType.stringValue == string) {
|
||||||
|
return advantageType
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.majinnaibu.monstercards.data.enums;
|
package com.majinnaibu.monstercards.data.enums
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
enum class ArmorType(
|
||||||
public enum ArmorType {
|
@JvmField val stringValue: String,
|
||||||
|
@JvmField val displayName: String,
|
||||||
|
@JvmField val baseArmorClass: Int
|
||||||
|
) {
|
||||||
NONE("none", "None", 10),
|
NONE("none", "None", 10),
|
||||||
NATURAL_ARMOR("natural armor", "Natural Armor", 10),
|
NATURAL_ARMOR("natural armor", "Natural Armor", 10),
|
||||||
MAGE_ARMOR("mage armor", "Mage Armor", 10),
|
MAGE_ARMOR("mage armor", "Mage Armor", 10),
|
||||||
@@ -17,25 +20,17 @@ public enum ArmorType {
|
|||||||
CHAIN_MAIL("chain mail", "Chain Mail", 16),
|
CHAIN_MAIL("chain mail", "Chain Mail", 16),
|
||||||
SPLINT_MAIL("splint", "Splint Mail", 17),
|
SPLINT_MAIL("splint", "Splint Mail", 17),
|
||||||
PLATE_MAIL("plate", "Plate Mail", 18),
|
PLATE_MAIL("plate", "Plate Mail", 18),
|
||||||
OTHER("other", "Other", 10),
|
OTHER("other", "Other", 10);
|
||||||
;
|
|
||||||
|
|
||||||
public final String displayName;
|
companion object {
|
||||||
public final String stringValue;
|
@JvmStatic
|
||||||
public final int baseArmorClass;
|
fun valueOfString(string: String): ArmorType {
|
||||||
|
for (armorType in values()) {
|
||||||
ArmorType(String stringValue, String displayName, int baseArmorClass) {
|
if (armorType.stringValue == string) {
|
||||||
this.displayName = displayName;
|
return armorType
|
||||||
this.stringValue = stringValue;
|
}
|
||||||
this.baseArmorClass = baseArmorClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArmorType valueOfString(String string) {
|
|
||||||
for (ArmorType armorType : values()) {
|
|
||||||
if (armorType.stringValue.equals(string)) {
|
|
||||||
return armorType;
|
|
||||||
}
|
}
|
||||||
|
return NONE
|
||||||
}
|
}
|
||||||
return ArmorType.NONE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.majinnaibu.monstercards.data.enums;
|
package com.majinnaibu.monstercards.data.enums
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
enum class ChallengeRating(
|
||||||
public enum ChallengeRating {
|
@JvmField val stringValue: String,
|
||||||
|
@JvmField val displayName: String,
|
||||||
|
@JvmField val proficiencyBonus: Int
|
||||||
|
) {
|
||||||
CUSTOM("custom", "Custom", 0),
|
CUSTOM("custom", "Custom", 0),
|
||||||
ZERO("zero", "0 (10 XP)", 2),
|
ZERO("zero", "0 (10 XP)", 2),
|
||||||
ONE_EIGHTH("1/8", "1/8 (25 XP)", 2),
|
ONE_EIGHTH("1/8", "1/8 (25 XP)", 2),
|
||||||
@@ -36,25 +39,17 @@ public enum ChallengeRating {
|
|||||||
TWENTY_SEVEN("27", "27 (105,000 XP)", 8),
|
TWENTY_SEVEN("27", "27 (105,000 XP)", 8),
|
||||||
TWENTY_EIGHT("28", "28 (120,000 XP)", 8),
|
TWENTY_EIGHT("28", "28 (120,000 XP)", 8),
|
||||||
TWENTY_NINE("29", "29 (135,000 XP)", 9),
|
TWENTY_NINE("29", "29 (135,000 XP)", 9),
|
||||||
THIRTY("30", "30 (155,000 XP)", 9),
|
THIRTY("30", "30 (155,000 XP)", 9);
|
||||||
;
|
|
||||||
|
|
||||||
public final String displayName;
|
companion object {
|
||||||
public final String stringValue;
|
@JvmStatic
|
||||||
public final int proficiencyBonus;
|
fun valueOfString(string: String): ChallengeRating {
|
||||||
|
for (challengeRating in values()) {
|
||||||
ChallengeRating(String stringValue, String displayName, int proficiencyBonus) {
|
if (challengeRating.stringValue == string) {
|
||||||
this.displayName = displayName;
|
return challengeRating
|
||||||
this.stringValue = stringValue;
|
}
|
||||||
this.proficiencyBonus = proficiencyBonus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ChallengeRating valueOfString(String string) {
|
|
||||||
for (ChallengeRating challengeRating : values()) {
|
|
||||||
if (challengeRating.stringValue.equals(string)) {
|
|
||||||
return challengeRating;
|
|
||||||
}
|
}
|
||||||
|
return ONE
|
||||||
}
|
}
|
||||||
return ChallengeRating.ONE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package com.majinnaibu.monstercards.data.enums;
|
|
||||||
|
|
||||||
public enum ProficiencyType {
|
|
||||||
NONE("none", "None", ""),
|
|
||||||
PROFICIENT("proficient", "Proficient", "P"),
|
|
||||||
EXPERTISE("expertise", "Expertise", "Ex"),
|
|
||||||
;
|
|
||||||
|
|
||||||
public final String displayName;
|
|
||||||
public final String stringValue;
|
|
||||||
public final String label;
|
|
||||||
|
|
||||||
ProficiencyType(String stringValue, String displayName, String label) {
|
|
||||||
this.displayName = displayName;
|
|
||||||
this.stringValue = stringValue;
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ProficiencyType valueOfString(String string) {
|
|
||||||
for (ProficiencyType proficiencyType : values()) {
|
|
||||||
if (proficiencyType.stringValue.equals(string)) {
|
|
||||||
return proficiencyType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ProficiencyType.NONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.majinnaibu.monstercards.data.enums
|
||||||
|
|
||||||
|
enum class ProficiencyType(
|
||||||
|
@JvmField val stringValue: String,
|
||||||
|
@JvmField val displayName: String,
|
||||||
|
@JvmField val label: String
|
||||||
|
) {
|
||||||
|
NONE("none", "None", ""),
|
||||||
|
PROFICIENT("proficient", "Proficient", "P"),
|
||||||
|
EXPERTISE("expertise", "Expertise", "Ex");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun valueOfString(string: String): ProficiencyType {
|
||||||
|
for (proficiencyType in values()) {
|
||||||
|
if (proficiencyType.stringValue == string) {
|
||||||
|
return proficiencyType
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.majinnaibu.monstercards.data.enums;
|
package com.majinnaibu.monstercards.data.enums
|
||||||
|
|
||||||
public enum StringType {
|
enum class StringType {
|
||||||
CONDITION_IMMUNITY,
|
CONDITION_IMMUNITY,
|
||||||
DAMAGE_IMMUNITY,
|
DAMAGE_IMMUNITY,
|
||||||
DAMAGE_RESISTANCE,
|
DAMAGE_RESISTANCE,
|
||||||
DAMAGE_VULNERABILITY,
|
DAMAGE_VULNERABILITY,
|
||||||
SENSE
|
SENSE
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.majinnaibu.monstercards.data.enums;
|
package com.majinnaibu.monstercards.data.enums
|
||||||
|
|
||||||
public enum TraitType {
|
enum class TraitType {
|
||||||
ABILITY,
|
ABILITY,
|
||||||
ACTION,
|
ACTION,
|
||||||
LAIR_ACTION,
|
LAIR_ACTION,
|
||||||
LEGENDARY_ACTION,
|
LEGENDARY_ACTION,
|
||||||
REGIONAL_ACTION,
|
REGIONAL_ACTION,
|
||||||
REACTIONS
|
REACTIONS
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ buildscript {
|
|||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.0.4'
|
classpath 'com.android.tools.build:gradle:7.0.4'
|
||||||
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
|
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|||||||
Reference in New Issue
Block a user