mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-08 16:59:55 +00:00
Cleanup
This commit is contained in:
parent
b4a1ba3080
commit
83011ead2c
@ -2,9 +2,7 @@ package com.looker.droidify.ui.compose.utils
|
|||||||
|
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.animateColor
|
import androidx.compose.animation.animateColor
|
||||||
import androidx.compose.animation.core.animateDp
|
import androidx.compose.animation.core.*
|
||||||
import androidx.compose.animation.core.animateFloat
|
|
||||||
import androidx.compose.animation.core.updateTransition
|
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.lazy.LazyRow
|
import androidx.compose.foundation.lazy.LazyRow
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
@ -54,7 +52,10 @@ private fun categoryChipTransition(selected: Boolean): CategoryChipTransition {
|
|||||||
SelectionState.Selected -> MaterialTheme.colorScheme.inversePrimary.copy(alpha = 0.8f)
|
SelectionState.Selected -> MaterialTheme.colorScheme.inversePrimary.copy(alpha = 0.8f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val checkScale = transition.animateFloat(label = "chip_check_scale") { state ->
|
val checkScale = transition.animateFloat(
|
||||||
|
label = "chip_check_scale",
|
||||||
|
transitionSpec = { spring(dampingRatio = Spring.DampingRatioHighBouncy, stiffness = Spring.StiffnessLow) }
|
||||||
|
) { state ->
|
||||||
when (state) {
|
when (state) {
|
||||||
SelectionState.Unselected -> 0.6f
|
SelectionState.Unselected -> 0.6f
|
||||||
SelectionState.Selected -> 1f
|
SelectionState.Selected -> 1f
|
||||||
|
@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.ExperimentalMaterialApi
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.Settings
|
import androidx.compose.material.icons.rounded.Settings
|
||||||
import androidx.compose.material.icons.rounded.Sync
|
import androidx.compose.material.icons.rounded.Sync
|
||||||
@ -65,15 +64,14 @@ class ExploreFragment : MainNavFragmentX() {
|
|||||||
// Avoid the compiler using the same class as observer
|
// Avoid the compiler using the same class as observer
|
||||||
Log.d(this::class.java.canonicalName, this.toString())
|
Log.d(this::class.java.canonicalName, this.toString())
|
||||||
}
|
}
|
||||||
viewModel.primaryProducts.observe(viewLifecycleOwner) {
|
viewModel.primaryProducts.observe(viewLifecycleOwner) { products ->
|
||||||
redrawPage(it, viewModel.categories.value ?: emptyList())
|
viewModel.categories.observe(viewLifecycleOwner) { categories ->
|
||||||
|
redrawPage(products, categories)
|
||||||
}
|
}
|
||||||
viewModel.categories.observe(viewLifecycleOwner) {
|
|
||||||
redrawPage(viewModel.primaryProducts.value, it)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterialApi::class, ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
private fun redrawPage(products: List<Product>?, categories: List<String> = emptyList()) {
|
private fun redrawPage(products: List<Product>?, categories: List<String> = emptyList()) {
|
||||||
binding.composeView.setContent {
|
binding.composeView.setContent {
|
||||||
AppTheme(
|
AppTheme(
|
||||||
@ -125,7 +123,8 @@ class ExploreFragment : MainNavFragmentX() {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
ProductsVerticalRecycler(products,
|
ProductsVerticalRecycler(
|
||||||
|
products,
|
||||||
repositories,
|
repositories,
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user