Created
August 3, 2021 12:06
-
-
Save jayesh83/f5e708bf10f7a5f1f8cdb28dd1922edb to your computer and use it in GitHub Desktop.
Having this method in meta data model itself now. this will be used to fetch value based on current app language
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.nascent.pcmc.model | |
import android.os.Parcelable | |
import androidx.room.Entity | |
import com.nascent.pcmc.common.Constant | |
import com.nascent.pcmc.common.Constant.Companion.LANGUAGE_CODE_ENG | |
import com.nascent.pcmc.common.Constant.Companion.LANGUAGE_CODE_MARATHI | |
import com.nascent.pcmc.utils.LocaleHelper | |
import kotlinx.parcelize.Parcelize | |
@Parcelize | |
@Entity(tableName = Constant.TABLE_APP_META_DATA, primaryKeys = ["type", "id"]) | |
data class AppMetaDataModel( | |
val type: String, | |
val id: Int = 0, | |
val eng: String?, | |
val marathi: String?, | |
val parentId: Int = -1 | |
) : Parcelable { | |
fun getLabel(): String? { | |
return when (LocaleHelper.currentLanguage) { | |
LANGUAGE_CODE_ENG -> this.eng | |
LANGUAGE_CODE_MARATHI -> this.marathi | |
else -> null | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment