Fix SimpleRatingWidget state changed recompose and properly set theme
This commit is contained in:
1 parent
fa4d35487c
commit
83dc47c3b5
1 file changed
+8
-2
@@ -3,7 +3,11 @@ package com.hippo.ehviewer.widget
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.platform.AbstractComposeView
|
||||
import com.google.accompanist.themeadapter.material3.Mdc3Theme
|
||||
import com.hippo.ehviewer.ui.widget.SimpleRatingWidget
|
||||
|
||||
class SimpleRatingView @JvmOverloads constructor(
|
||||
@@ -11,10 +15,12 @@ class SimpleRatingView @JvmOverloads constructor(
|
||||
attrs: AttributeSet? = null,
|
||||
defStyle: Int = 0,
|
||||
) : AbstractComposeView(context, attrs, defStyle) {
|
||||
var rating: Float = 0.0f
|
||||
var rating by mutableStateOf(0f)
|
||||
|
||||
@Composable
|
||||
override fun Content() {
|
||||
SimpleRatingWidget(rating)
|
||||
Mdc3Theme {
|
||||
SimpleRatingWidget(rating)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user