package com.example.development.mainActivity.components

import android.content.Context
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.RatingBar
import android.widget.TextView

class RatingBox(context: Context, param: Int):
        LinearLayout(context){
            init {
                orientation = HORIZONTAL
                val ratingBar = RatingBar(context).apply{
                    numStars = 5
                    rating = param.toFloat()
                    isEnabled = false
                }

                val ratingTextView = TextView(context).apply{
                    text = String.format("%.1f", param)
                    layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
                }
                addView(ratingBar)
                addView(ratingTextView)
            }
        }