Skip to content

Instantly share code, notes, and snippets.

@ercnksgl
Created September 18, 2022 11:11
Show Gist options
  • Save ercnksgl/86fd24f96dc3855f2bb67cc2a764f45a to your computer and use it in GitHub Desktop.
Save ercnksgl/86fd24f96dc3855f2bb67cc2a764f45a to your computer and use it in GitHub Desktop.
The enum to customize the view.
import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import com.ercnksgl.enumtestapp.R
enum class MessageType(
@StringRes val titleResId: Int,
@DrawableRes val iconResId: Int,
@ColorRes val cardColorResId: Int,
@ColorRes val titleColorResId: Int
) {
SUCCESS(
titleResId = R.string.success_title,
iconResId = R.drawable.check,
cardColorResId = R.color.green_300,
titleColorResId = R.color.green_100
),
ERROR(
titleResId = R.string.error_title,
iconResId = R.drawable.close,
cardColorResId = R.color.red_300,
titleColorResId = R.color.red_100
),
INFO(
titleResId = R.string.info_title,
iconResId = R.drawable.info,
cardColorResId = R.color.yellow_300,
titleColorResId = R.color.yellow_100
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment