|
|
|
|
@ -58,10 +58,8 @@ open class LegendView : FrameLayout { |
|
|
|
|
|
|
|
|
|
protected lateinit var stat1Name: TextView |
|
|
|
|
protected lateinit var stat2Name: TextView |
|
|
|
|
protected lateinit var counter: TextView |
|
|
|
|
protected lateinit var stat1Value: TextView |
|
|
|
|
protected lateinit var stat2Value: TextView |
|
|
|
|
protected lateinit var title: TextView |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Init |
|
|
|
|
@ -74,10 +72,8 @@ open class LegendView : FrameLayout { |
|
|
|
|
|
|
|
|
|
this.stat1Name = legendLayout.findViewById(R.id.stat1Name) |
|
|
|
|
this.stat2Name = legendLayout.findViewById(R.id.stat2Name) |
|
|
|
|
this.counter = legendLayout.findViewById(R.id.counter) |
|
|
|
|
this.stat1Value = legendLayout.findViewById(R.id.stat1Value) |
|
|
|
|
this.stat2Value = legendLayout.findViewById(R.id.stat2Value) |
|
|
|
|
this.title = legendLayout.findViewById(R.id.title) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -90,7 +86,9 @@ open class LegendView : FrameLayout { |
|
|
|
|
Graph.Style.BAR -> { |
|
|
|
|
this.stat1Name.text = stat.localizedTitle(context) |
|
|
|
|
this.stat2Name.text = context.getString(R.string.sessions) |
|
|
|
|
this.counter.isVisible = false |
|
|
|
|
|
|
|
|
|
val count = legendLayout.findViewById<TextView>(R.id.counter) |
|
|
|
|
count.isVisible = false |
|
|
|
|
} |
|
|
|
|
Graph.Style.LINE -> { |
|
|
|
|
if (stat.graphSignificantIndividualValue) { |
|
|
|
|
@ -103,8 +101,9 @@ open class LegendView : FrameLayout { |
|
|
|
|
|
|
|
|
|
counter?.let { |
|
|
|
|
val counterText = "$it ${context.getString(R.string.points)}" |
|
|
|
|
this.counter.text = counterText |
|
|
|
|
this.counter.isVisible = stat.graphShouldShowNumberOfSessions |
|
|
|
|
val count = legendLayout.findViewById<TextView>(R.id.counter) |
|
|
|
|
count.text = counterText |
|
|
|
|
count.isVisible = stat.graphShouldShowNumberOfSessions |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else -> { |
|
|
|
|
@ -120,7 +119,8 @@ open class LegendView : FrameLayout { |
|
|
|
|
|
|
|
|
|
if (content is DefaultLegendValues) { |
|
|
|
|
|
|
|
|
|
this.title.text = content.title.capitalize() |
|
|
|
|
val title = legendLayout.findViewById<TextView>(R.id.title) |
|
|
|
|
title.text = content.title.capitalize() |
|
|
|
|
|
|
|
|
|
this.stat1Value.setTextFormat(content.leftFormat, context) |
|
|
|
|
|
|
|
|
|
|