|
|
|
|
@ -4,9 +4,9 @@ import android.content.Context |
|
|
|
|
import android.util.AttributeSet |
|
|
|
|
import android.view.LayoutInflater |
|
|
|
|
import android.widget.FrameLayout |
|
|
|
|
import android.widget.TextView |
|
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout |
|
|
|
|
import androidx.core.view.isVisible |
|
|
|
|
import kotlinx.android.synthetic.main.layout_legend_default.view.* |
|
|
|
|
import net.pokeranalytics.android.R |
|
|
|
|
import net.pokeranalytics.android.calculus.Stat |
|
|
|
|
import net.pokeranalytics.android.ui.extensions.setTextFormat |
|
|
|
|
@ -35,7 +35,7 @@ open class LegendView : FrameLayout { |
|
|
|
|
// rightFormat: TextFormat? = null |
|
|
|
|
// ) : Values("", leftFormat, rightFormat) |
|
|
|
|
|
|
|
|
|
private lateinit var legendLayout: ConstraintLayout |
|
|
|
|
protected lateinit var legendLayout: ConstraintLayout |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Constructors |
|
|
|
|
@ -56,14 +56,29 @@ open class LegendView : FrameLayout { |
|
|
|
|
return R.layout.layout_legend_default |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
*/ |
|
|
|
|
private fun init() { |
|
|
|
|
protected open fun init() { |
|
|
|
|
val layoutInflater = LayoutInflater.from(context) |
|
|
|
|
legendLayout = layoutInflater.inflate(this.getResourceLayout(), this, false) as ConstraintLayout |
|
|
|
|
val layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT) |
|
|
|
|
addView(legendLayout, layoutParams) |
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|