diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficBarChartViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficBarChartViewHolder.kt index e0bcad563e19..4bb62711b41b 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficBarChartViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficBarChartViewHolder.kt @@ -80,7 +80,7 @@ class TrafficBarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( val dataSet = if (hasData(item.entries)) { buildDataSet(chart.context, mappedEntries) } else { - buildEmptyDataSet(chart.context, cutEntries.size) + BarDataSet(emptyList(), "Empty") } item.onBarChartDrawn?.invoke(dataSet.entryCount) @@ -156,25 +156,6 @@ class TrafficBarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( } } - private fun buildEmptyDataSet(context: Context, count: Int): BarDataSet { - val emptyValues = (0 until count).map { index -> BarEntry(index.toFloat(), 1f, "empty") } - val dataSet = BarDataSet(emptyValues, "Empty") - dataSet.setGradientColor( - ContextCompat.getColor( - context, - R.color.primary_5 - ), ContextCompat.getColor( - context, - android.R.color.transparent - ) - ) - dataSet.formLineWidth = 0f - dataSet.setDrawValues(false) - dataSet.isHighlightEnabled = false - dataSet.highLightAlpha = 255 - return dataSet - } - private fun buildDataSet(context: Context, cut: List): BarDataSet { val dataSet = BarDataSet(cut, "Data") chart.renderer.paintRender.shader = null diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BarChartViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BarChartViewHolder.kt index e459f53c6883..c6f9ff774ffb 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BarChartViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BarChartViewHolder.kt @@ -90,7 +90,7 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( val dataSet = if (hasData) { buildDataSet(context, mappedEntries) } else { - buildEmptyDataSet(context, cutEntries.size) + BarDataSet(emptyList(), "Empty") } item.onBarChartDrawn?.invoke(dataSet.entryCount) val dataSets = mutableListOf() @@ -208,25 +208,6 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( } } - private fun buildEmptyDataSet(context: Context, count: Int): BarDataSet { - val emptyValues = (0 until count).map { index -> BarEntry(index.toFloat(), 1f, "empty") } - val dataSet = BarDataSet(emptyValues, "Empty") - dataSet.setGradientColor( - ContextCompat.getColor( - context, - R.color.primary_5 - ), ContextCompat.getColor( - context, - AndroidR.color.transparent - ) - ) - dataSet.formLineWidth = 0f - dataSet.setDrawValues(false) - dataSet.isHighlightEnabled = false - dataSet.highLightAlpha = 255 - return dataSet - } - private fun buildDataSet(context: Context, cut: List): BarDataSet { val dataSet = BarDataSet(cut, "Data") chart.renderer.paintRender.shader = null