diff --git a/app/src/main/kotlin/com/github/premnirmal/ticker/portfolio/PortfolioVH.kt b/app/src/main/kotlin/com/github/premnirmal/ticker/portfolio/PortfolioVH.kt index 60b5525c..eeb242b5 100644 --- a/app/src/main/kotlin/com/github/premnirmal/ticker/portfolio/PortfolioVH.kt +++ b/app/src/main/kotlin/com/github/premnirmal/ticker/portfolio/PortfolioVH.kt @@ -23,10 +23,18 @@ abstract class PortfolioVH(itemView: View) : RecyclerView.ViewHolder(itemView), protected val positiveColor: Int = ContextCompat.getColor(itemView.context, R.color.positive_green) protected val negativeColor: Int = ContextCompat.getColor(itemView.context, R.color.negative_red) protected val neutralColor: Int by lazy { - val typedValue = TypedValue() - val theme: Theme = itemView.context.theme - theme.resolveAttribute(com.google.android.material.R.attr.colorOnSurfaceVariant, typedValue, true) - ContextCompat.getColor(itemView.context, typedValue.data) + try { + val typedValue = TypedValue() + val theme: Theme = itemView.context.theme + theme.resolveAttribute( + com.google.android.material.R.attr.colorOnSurfaceVariant, + typedValue, + true + ) + ContextCompat.getColor(itemView.context, typedValue.data) + } catch (e: Exception) { + ContextCompat.getColor(itemView.context, R.color.text_2) + } } @Throws(Exception::class) protected abstract fun updateView(quote: Quote, color: Int) diff --git a/app/src/main/res/values-night/color_palette.xml b/app/src/main/res/values-night/color_palette.xml index 7fa1dad7..45082860 100644 --- a/app/src/main/res/values-night/color_palette.xml +++ b/app/src/main/res/values-night/color_palette.xml @@ -11,4 +11,5 @@ #ff6666 #ccff66 #009900 + #fff3f3f3 \ No newline at end of file diff --git a/app/src/main/res/values/color_palette.xml b/app/src/main/res/values/color_palette.xml index 5cb1e4e9..79de0cf3 100644 --- a/app/src/main/res/values/color_palette.xml +++ b/app/src/main/res/values/color_palette.xml @@ -23,5 +23,6 @@ #e55b5b #009900 #006b00 + #6e6e6e \ No newline at end of file