Skip to content

Commit

Permalink
✨ feature : enum util 구현
Browse files Browse the repository at this point in the history
> Related to : #26
  • Loading branch information
eunjjungg committed Jan 21, 2023
1 parent 34689f5 commit f5f0b25
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions app/src/main/java/com/shootit/greme/util/EnumUtil.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.shootit.greme.util

import com.shootit.greme.model.GENDER
import com.shootit.greme.viewmodel.SignUpViewModel

object EnumUtil {
fun Int.getGenderByInt(): GENDER {
return when (this) {
0 -> GENDER.Male
1 -> GENDER.Female
else -> GENDER.Whatever
}
}

fun Int.getInterestByInt(): SignUpViewModel.INTEREST {
return when (this) {
0 -> SignUpViewModel.INTEREST.ENERGY
1 -> SignUpViewModel.INTEREST.UP_CYCLING
2 -> SignUpViewModel.INTEREST.ECO_PRODUCT
3 -> SignUpViewModel.INTEREST.VEGAN
else -> SignUpViewModel.INTEREST.COSMETIC
}
}
}

0 comments on commit f5f0b25

Please sign in to comment.