Update: Unify Explore, Installed, Latest & PrefRepo layouts

This commit is contained in:
machiav3lli 2022-04-12 18:21:51 +02:00
parent bffcbea4ce
commit de3376d6ce
8 changed files with 17 additions and 121 deletions

View File

@ -20,7 +20,7 @@ import com.looker.droidify.R
import com.looker.droidify.content.Preferences import com.looker.droidify.content.Preferences
import com.looker.droidify.database.entity.Product import com.looker.droidify.database.entity.Product
import com.looker.droidify.database.entity.Repository import com.looker.droidify.database.entity.Repository
import com.looker.droidify.databinding.FragmentExploreXBinding import com.looker.droidify.databinding.FragmentComposeBinding
import com.looker.droidify.entity.Section import com.looker.droidify.entity.Section
import com.looker.droidify.ui.compose.ProductsVerticalRecycler import com.looker.droidify.ui.compose.ProductsVerticalRecycler
import com.looker.droidify.ui.compose.theme.AppTheme import com.looker.droidify.ui.compose.theme.AppTheme
@ -30,7 +30,7 @@ import com.looker.droidify.widget.FocusSearchView
class ExploreFragment : MainNavFragmentX() { class ExploreFragment : MainNavFragmentX() {
private lateinit var binding: FragmentExploreXBinding private lateinit var binding: FragmentComposeBinding
override val primarySource = Source.AVAILABLE override val primarySource = Source.AVAILABLE
override val secondarySource = Source.AVAILABLE override val secondarySource = Source.AVAILABLE
@ -43,7 +43,7 @@ class ExploreFragment : MainNavFragmentX() {
savedInstanceState: Bundle?, savedInstanceState: Bundle?,
): View { ): View {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
binding = FragmentExploreXBinding.inflate(inflater, container, false) binding = FragmentComposeBinding.inflate(inflater, container, false)
binding.lifecycleOwner = this binding.lifecycleOwner = this
return binding.root return binding.root
} }
@ -82,7 +82,7 @@ class ExploreFragment : MainNavFragmentX() {
@OptIn(ExperimentalMaterialApi::class, ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterialApi::class, ExperimentalMaterial3Api::class)
private fun redrawPage(products: List<Product>?, categories: List<String> = emptyList()) { private fun redrawPage(products: List<Product>?, categories: List<String> = emptyList()) {
binding.primaryComposeRecycler.setContent { binding.composeView.setContent {
AppTheme( AppTheme(
darkTheme = when (Preferences[Preferences.Key.Theme]) { darkTheme = when (Preferences[Preferences.Key.Theme]) {
is Preferences.Theme.System -> isSystemInDarkTheme() is Preferences.Theme.System -> isSystemInDarkTheme()

View File

@ -27,7 +27,7 @@ import com.looker.droidify.R
import com.looker.droidify.content.Preferences import com.looker.droidify.content.Preferences
import com.looker.droidify.database.entity.Product import com.looker.droidify.database.entity.Product
import com.looker.droidify.database.entity.Repository import com.looker.droidify.database.entity.Repository
import com.looker.droidify.databinding.FragmentInstalledXBinding import com.looker.droidify.databinding.FragmentComposeBinding
import com.looker.droidify.ui.compose.ProductsHorizontalRecycler import com.looker.droidify.ui.compose.ProductsHorizontalRecycler
import com.looker.droidify.ui.compose.ProductsVerticalRecycler import com.looker.droidify.ui.compose.ProductsVerticalRecycler
import com.looker.droidify.ui.compose.theme.AppTheme import com.looker.droidify.ui.compose.theme.AppTheme
@ -36,7 +36,7 @@ import com.looker.droidify.widget.FocusSearchView
class InstalledFragment : MainNavFragmentX() { class InstalledFragment : MainNavFragmentX() {
private lateinit var binding: FragmentInstalledXBinding private lateinit var binding: FragmentComposeBinding
override val primarySource = Source.INSTALLED override val primarySource = Source.INSTALLED
override val secondarySource = Source.UPDATES override val secondarySource = Source.UPDATES
@ -49,7 +49,7 @@ class InstalledFragment : MainNavFragmentX() {
savedInstanceState: Bundle?, savedInstanceState: Bundle?,
): View { ): View {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
binding = FragmentInstalledXBinding.inflate(inflater, container, false) binding = FragmentComposeBinding.inflate(inflater, container, false)
binding.lifecycleOwner = this binding.lifecycleOwner = this
return binding.root return binding.root
} }
@ -88,7 +88,7 @@ class InstalledFragment : MainNavFragmentX() {
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterialApi::class) @OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterialApi::class)
private fun redrawPage(primaryList: List<Product>?, secondaryList: List<Product>?) { private fun redrawPage(primaryList: List<Product>?, secondaryList: List<Product>?) {
binding.primaryComposeRecycler.setContent { binding.composeView.setContent {
AppTheme( AppTheme(
darkTheme = when (Preferences[Preferences.Key.Theme]) { darkTheme = when (Preferences[Preferences.Key.Theme]) {
is Preferences.Theme.System -> isSystemInDarkTheme() is Preferences.Theme.System -> isSystemInDarkTheme()

View File

@ -21,7 +21,7 @@ import com.looker.droidify.R
import com.looker.droidify.content.Preferences import com.looker.droidify.content.Preferences
import com.looker.droidify.database.entity.Product import com.looker.droidify.database.entity.Product
import com.looker.droidify.database.entity.Repository import com.looker.droidify.database.entity.Repository
import com.looker.droidify.databinding.FragmentLatestXBinding import com.looker.droidify.databinding.FragmentComposeBinding
import com.looker.droidify.ui.compose.ProductsHorizontalRecycler import com.looker.droidify.ui.compose.ProductsHorizontalRecycler
import com.looker.droidify.ui.compose.ProductsVerticalRecycler import com.looker.droidify.ui.compose.ProductsVerticalRecycler
import com.looker.droidify.ui.compose.theme.AppTheme import com.looker.droidify.ui.compose.theme.AppTheme
@ -30,7 +30,7 @@ import com.looker.droidify.widget.FocusSearchView
class LatestFragment : MainNavFragmentX() { class LatestFragment : MainNavFragmentX() {
private lateinit var binding: FragmentLatestXBinding private lateinit var binding: FragmentComposeBinding
// TODO replace the source with one that get a certain amount of updated apps // TODO replace the source with one that get a certain amount of updated apps
override val primarySource = Source.UPDATED override val primarySource = Source.UPDATED
@ -44,7 +44,7 @@ class LatestFragment : MainNavFragmentX() {
savedInstanceState: Bundle?, savedInstanceState: Bundle?,
): View { ): View {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
binding = FragmentLatestXBinding.inflate(inflater, container, false) binding = FragmentComposeBinding.inflate(inflater, container, false)
binding.lifecycleOwner = this binding.lifecycleOwner = this
return binding.root return binding.root
} }
@ -83,7 +83,7 @@ class LatestFragment : MainNavFragmentX() {
@OptIn(ExperimentalMaterialApi::class, ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterialApi::class, ExperimentalMaterial3Api::class)
private fun redrawPage(primaryList: List<Product>?, secondaryList: List<Product>?) { private fun redrawPage(primaryList: List<Product>?, secondaryList: List<Product>?) {
binding.primaryComposeRecycler.setContent { binding.composeView.setContent {
AppTheme( AppTheme(
darkTheme = when (Preferences[Preferences.Key.Theme]) { darkTheme = when (Preferences[Preferences.Key.Theme]) {
is Preferences.Theme.System -> isSystemInDarkTheme() is Preferences.Theme.System -> isSystemInDarkTheme()

View File

@ -16,7 +16,7 @@ import androidx.fragment.app.viewModels
import com.looker.droidify.R import com.looker.droidify.R
import com.looker.droidify.content.Preferences import com.looker.droidify.content.Preferences
import com.looker.droidify.database.entity.Repository import com.looker.droidify.database.entity.Repository
import com.looker.droidify.databinding.FragmentRepositoriesXBinding import com.looker.droidify.databinding.FragmentComposeBinding
import com.looker.droidify.service.Connection import com.looker.droidify.service.Connection
import com.looker.droidify.service.SyncService import com.looker.droidify.service.SyncService
import com.looker.droidify.ui.activities.PrefsActivityX import com.looker.droidify.ui.activities.PrefsActivityX
@ -29,7 +29,7 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
class PrefsRepositoriesFragment : BaseNavFragment() { class PrefsRepositoriesFragment : BaseNavFragment() {
private lateinit var binding: FragmentRepositoriesXBinding private lateinit var binding: FragmentComposeBinding
val viewModel: RepositoriesViewModelX by viewModels { val viewModel: RepositoriesViewModelX by viewModels {
RepositoriesViewModelX.Factory(prefsActivityX.db) RepositoriesViewModelX.Factory(prefsActivityX.db)
} }
@ -45,7 +45,7 @@ class PrefsRepositoriesFragment : BaseNavFragment() {
savedInstanceState: Bundle?, savedInstanceState: Bundle?,
): View { ): View {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
binding = FragmentRepositoriesXBinding.inflate(inflater, container, false) binding = FragmentComposeBinding.inflate(inflater, container, false)
binding.lifecycleOwner = this binding.lifecycleOwner = this
return binding.root return binding.root
@ -65,7 +65,7 @@ class PrefsRepositoriesFragment : BaseNavFragment() {
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
fun redrawPage(repos: List<Repository>) { fun redrawPage(repos: List<Repository>) {
binding.reposRecycler.setContent { binding.composeView.setContent {
AppTheme( AppTheme(
darkTheme = when (Preferences[Preferences.Key.Theme]) { darkTheme = when (Preferences[Preferences.Key.Theme]) {
is Preferences.Theme.System -> isSystemInDarkTheme() is Preferences.Theme.System -> isSystemInDarkTheme()

View File

@ -27,7 +27,7 @@
android:orientation="vertical"> android:orientation="vertical">
<androidx.compose.ui.platform.ComposeView <androidx.compose.ui.platform.ComposeView
android:id="@+id/reposRecycler" android:id="@+id/composeView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
</com.google.android.material.circularreveal.CircularRevealFrameLayout> </com.google.android.material.circularreveal.CircularRevealFrameLayout>

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ OAndBackupX: open-source apps backup and restore app.
~ Copyright (C) 2020 Antonios Hazim
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
~ published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
</data>
<com.google.android.material.circularreveal.CircularRevealFrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.compose.ui.platform.ComposeView
android:id="@+id/primaryComposeRecycler"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.google.android.material.circularreveal.CircularRevealFrameLayout>
</layout>

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ OAndBackupX: open-source apps backup and restore app.
~ Copyright (C) 2020 Antonios Hazim
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
~ published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
</data>
<com.google.android.material.circularreveal.CircularRevealFrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.compose.ui.platform.ComposeView
android:id="@+id/primaryComposeRecycler"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.google.android.material.circularreveal.CircularRevealFrameLayout>
</layout>

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ OAndBackupX: open-source apps backup and restore app.
~ Copyright (C) 2020 Antonios Hazim
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
~ published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
</data>
<com.google.android.material.circularreveal.CircularRevealFrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.compose.ui.platform.ComposeView
android:id="@+id/primaryComposeRecycler"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.google.android.material.circularreveal.CircularRevealFrameLayout>
</layout>