mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Update: Abstract redrawPage in Installed & Latest
This commit is contained in:
parent
0e379d95ff
commit
8b266f4433
@ -6,7 +6,9 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.SearchView
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material.Scaffold
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Scaffold
|
||||
import com.google.android.material.composethemeadapter.MdcTheme
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.content.Preferences
|
||||
@ -45,28 +47,7 @@ class InstalledFragment : MainNavFragmentX() {
|
||||
}
|
||||
viewModel.installed.observe(viewLifecycleOwner) {}
|
||||
viewModel.primaryProducts.observe(viewLifecycleOwner) {
|
||||
binding.primaryComposeRecycler.setContent {
|
||||
AppTheme(
|
||||
darkTheme = when (Preferences[Preferences.Key.Theme]) {
|
||||
is Preferences.Theme.System -> isSystemInDarkTheme()
|
||||
is Preferences.Theme.AmoledSystem -> isSystemInDarkTheme()
|
||||
else -> isDarkTheme
|
||||
}
|
||||
) {
|
||||
Scaffold { _ ->
|
||||
ProductsVerticalRecycler(it.sortedBy(Product::label), repositories,
|
||||
onUserClick = { item ->
|
||||
AppSheetX(item.packageName)
|
||||
.showNow(parentFragmentManager, "Product ${item.packageName}")
|
||||
},
|
||||
onFavouriteClick = {},
|
||||
onInstallClick = {
|
||||
mainActivityX.syncConnection.binder?.installApps(listOf(it))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
redrawPage(it)
|
||||
}
|
||||
viewModel.secondaryProducts.observe(viewLifecycleOwner) {
|
||||
binding.updatedBar.visibility = if (it.isNotEmpty()) View.VISIBLE else View.GONE
|
||||
@ -129,4 +110,30 @@ class InstalledFragment : MainNavFragmentX() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class, ExperimentalMaterial3Api::class)
|
||||
private fun redrawPage(products: List<Product>?) {
|
||||
binding.primaryComposeRecycler.setContent {
|
||||
AppTheme(
|
||||
darkTheme = when (Preferences[Preferences.Key.Theme]) {
|
||||
is Preferences.Theme.System -> isSystemInDarkTheme()
|
||||
is Preferences.Theme.AmoledSystem -> isSystemInDarkTheme()
|
||||
else -> isDarkTheme
|
||||
}
|
||||
) {
|
||||
Scaffold { _ ->
|
||||
ProductsVerticalRecycler(products?.sortedBy(Product::label), repositories,
|
||||
onUserClick = { item ->
|
||||
AppSheetX(item.packageName)
|
||||
.showNow(parentFragmentManager, "Product ${item.packageName}")
|
||||
},
|
||||
onFavouriteClick = {},
|
||||
onInstallClick = {
|
||||
mainActivityX.syncConnection.binder?.installApps(listOf(it))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,10 +6,13 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.SearchView
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material.Scaffold
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Scaffold
|
||||
import com.google.android.material.composethemeadapter.MdcTheme
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.content.Preferences
|
||||
import com.looker.droidify.database.entity.Product
|
||||
import com.looker.droidify.database.entity.Repository
|
||||
import com.looker.droidify.databinding.FragmentLatestXBinding
|
||||
import com.looker.droidify.ui.compose.ProductsHorizontalRecycler
|
||||
@ -45,28 +48,7 @@ class LatestFragment : MainNavFragmentX() {
|
||||
}
|
||||
viewModel.installed.observe(viewLifecycleOwner) {}
|
||||
viewModel.primaryProducts.observe(viewLifecycleOwner) {
|
||||
binding.primaryComposeRecycler.setContent {
|
||||
AppTheme(
|
||||
darkTheme = when (Preferences[Preferences.Key.Theme]) {
|
||||
is Preferences.Theme.System -> isSystemInDarkTheme()
|
||||
is Preferences.Theme.AmoledSystem -> isSystemInDarkTheme()
|
||||
else -> isDarkTheme
|
||||
}
|
||||
) {
|
||||
Scaffold { _ ->
|
||||
ProductsVerticalRecycler(it, repositories,
|
||||
onUserClick = { item ->
|
||||
AppSheetX(item.packageName)
|
||||
.showNow(parentFragmentManager, "Product ${item.packageName}")
|
||||
},
|
||||
onFavouriteClick = {},
|
||||
onInstallClick = {
|
||||
mainActivityX.syncConnection.binder?.installApps(listOf(it))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
redrawPage(it)
|
||||
}
|
||||
viewModel.secondaryProducts.observe(viewLifecycleOwner) {
|
||||
binding.secondaryComposeRecycler.setContent {
|
||||
@ -106,4 +88,30 @@ class LatestFragment : MainNavFragmentX() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class, ExperimentalMaterial3Api::class)
|
||||
private fun redrawPage(products: List<Product>?) {
|
||||
binding.primaryComposeRecycler.setContent {
|
||||
AppTheme(
|
||||
darkTheme = when (Preferences[Preferences.Key.Theme]) {
|
||||
is Preferences.Theme.System -> isSystemInDarkTheme()
|
||||
is Preferences.Theme.AmoledSystem -> isSystemInDarkTheme()
|
||||
else -> isDarkTheme
|
||||
}
|
||||
) {
|
||||
Scaffold { _ ->
|
||||
ProductsVerticalRecycler(products, repositories,
|
||||
onUserClick = { item ->
|
||||
AppSheetX(item.packageName)
|
||||
.showNow(parentFragmentManager, "Product ${item.packageName}")
|
||||
},
|
||||
onFavouriteClick = {},
|
||||
onInstallClick = {
|
||||
mainActivityX.syncConnection.binder?.installApps(listOf(it))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user