Converts enums to Kotlin.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'androidx.navigation.safeargs'
|
||||
id 'kotlin-android'
|
||||
}
|
||||
|
||||
Properties properties = new Properties()
|
||||
@@ -65,6 +66,8 @@ dependencies {
|
||||
// Included libs
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.20"
|
||||
|
||||
// Google
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
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")
|
||||
public enum ArmorType {
|
||||
enum class ArmorType(
|
||||
@JvmField val stringValue: String,
|
||||
@JvmField val displayName: String,
|
||||
@JvmField val baseArmorClass: Int
|
||||
) {
|
||||
NONE("none", "None", 10),
|
||||
NATURAL_ARMOR("natural armor", "Natural Armor", 10),
|
||||
MAGE_ARMOR("mage armor", "Mage Armor", 10),
|
||||
@@ -17,25 +20,17 @@ public enum ArmorType {
|
||||
CHAIN_MAIL("chain mail", "Chain Mail", 16),
|
||||
SPLINT_MAIL("splint", "Splint Mail", 17),
|
||||
PLATE_MAIL("plate", "Plate Mail", 18),
|
||||
OTHER("other", "Other", 10),
|
||||
;
|
||||
OTHER("other", "Other", 10);
|
||||
|
||||
public final String displayName;
|
||||
public final String stringValue;
|
||||
public final int baseArmorClass;
|
||||
|
||||
ArmorType(String stringValue, String displayName, int baseArmorClass) {
|
||||
this.displayName = displayName;
|
||||
this.stringValue = stringValue;
|
||||
this.baseArmorClass = baseArmorClass;
|
||||
}
|
||||
|
||||
public static ArmorType valueOfString(String string) {
|
||||
for (ArmorType armorType : values()) {
|
||||
if (armorType.stringValue.equals(string)) {
|
||||
return armorType;
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun valueOfString(string: String): ArmorType {
|
||||
for (armorType in values()) {
|
||||
if (armorType.stringValue == 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")
|
||||
public enum ChallengeRating {
|
||||
enum class ChallengeRating(
|
||||
@JvmField val stringValue: String,
|
||||
@JvmField val displayName: String,
|
||||
@JvmField val proficiencyBonus: Int
|
||||
) {
|
||||
CUSTOM("custom", "Custom", 0),
|
||||
ZERO("zero", "0 (10 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_EIGHT("28", "28 (120,000 XP)", 8),
|
||||
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;
|
||||
public final String stringValue;
|
||||
public final int proficiencyBonus;
|
||||
|
||||
ChallengeRating(String stringValue, String displayName, int proficiencyBonus) {
|
||||
this.displayName = displayName;
|
||||
this.stringValue = stringValue;
|
||||
this.proficiencyBonus = proficiencyBonus;
|
||||
}
|
||||
|
||||
public static ChallengeRating valueOfString(String string) {
|
||||
for (ChallengeRating challengeRating : values()) {
|
||||
if (challengeRating.stringValue.equals(string)) {
|
||||
return challengeRating;
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun valueOfString(string: String): ChallengeRating {
|
||||
for (challengeRating in values()) {
|
||||
if (challengeRating.stringValue == 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,
|
||||
DAMAGE_IMMUNITY,
|
||||
DAMAGE_RESISTANCE,
|
||||
DAMAGE_VULNERABILITY,
|
||||
SENSE
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.majinnaibu.monstercards.data.enums;
|
||||
package com.majinnaibu.monstercards.data.enums
|
||||
|
||||
public enum TraitType {
|
||||
enum class TraitType {
|
||||
ABILITY,
|
||||
ACTION,
|
||||
LAIR_ACTION,
|
||||
LEGENDARY_ACTION,
|
||||
REGIONAL_ACTION,
|
||||
REACTIONS
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ buildscript {
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.0.4'
|
||||
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
|
||||
// in the individual module build.gradle files
|
||||
|
||||
Reference in New Issue
Block a user