diff --git a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt index b84fbca35a8e09f920b327e32a6642c2c5599cbe..bd021f3395810b90012387c176c7abf82cd24297 100644 --- a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt +++ b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt @@ -30,6 +30,7 @@ import android.widget.RelativeLayout import androidx.core.content.ContextCompat import androidx.core.graphics.BlendModeColorFilterCompat import androidx.core.graphics.BlendModeCompat +import androidx.core.view.isVisible import androidx.fragment.app.activityViewModels import androidx.fragment.app.viewModels import androidx.lifecycle.lifecycleScope @@ -325,7 +326,9 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { appInfoFetchViewModel.getAuthorName(it).observe(viewLifecycleOwner) { appAuthor.text = it } - categoryTitle.text = it.category + + updateCategoryTitle(it) + if (it.origin == Origin.CLEANAPK) { sourceTag.visibility = View.VISIBLE sourceTag.text = it.source @@ -338,6 +341,20 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { } } + private fun updateCategoryTitle(app: FusedApp) { + binding.titleInclude.apply { + var catText = app.category.ifBlank { args.category } + when { + catText.isBlank() -> categoryTitle.isVisible = false + catText == "game_open_games" -> catText = getString(R.string.games) // F-droid games + catText == "web_games" -> catText = getString(R.string.games) // PWA games + } + + catText = catText.replace("_", " ") + categoryTitle.text = catText + } + } + private fun setupScreenshotRVAdapter() { screenshotsRVAdapter = ApplicationScreenshotsRVAdapter(origin) binding.recyclerView.apply { diff --git a/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListFragment.kt b/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListFragment.kt index 534d0b49ae4afdb8deeffdd34046399502675452..44919d4c22a9d3a0c4757245ac9c450c3fdcdc45 100644 --- a/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListFragment.kt +++ b/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListFragment.kt @@ -216,7 +216,7 @@ class ApplicationListFragment : ) { return } - listAdapter?.setData(fusedAppResult.data!!) + listAdapter?.setData(fusedAppResult.data!!, args.translation) listAdapter?.let { adapter -> observeDownloadList(adapter) } diff --git a/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListRVAdapter.kt b/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListRVAdapter.kt index 0cc118431a0953ee3fedafc3a44cc63bfd57ff9c..724f1f3a44a70c5b38e62589a971c33a72f5e936 100644 --- a/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListRVAdapter.kt +++ b/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListRVAdapter.kt @@ -67,6 +67,8 @@ class ApplicationListRVAdapter( private val TAG = ApplicationListRVAdapter::class.java.simpleName + private var optionalCategory = "" + private val shimmer = Shimmer.ColorHighlightBuilder() .setDuration(500) .setBaseAlpha(0.7f) @@ -200,26 +202,30 @@ class ApplicationListRVAdapter( searchApp: FusedApp, view: View ) { + val catText = searchApp.category.ifBlank { optionalCategory } val action = when (currentDestinationId) { R.id.applicationListFragment -> { ApplicationListFragmentDirections.actionApplicationListFragmentToApplicationFragment( searchApp._id, searchApp.package_name, - searchApp.origin + searchApp.origin, + catText, ) } R.id.searchFragment -> { SearchFragmentDirections.actionSearchFragmentToApplicationFragment( searchApp._id, searchApp.package_name, - searchApp.origin + searchApp.origin, + catText, ) } R.id.updatesFragment -> { UpdatesFragmentDirections.actionUpdatesFragmentToApplicationFragment( searchApp._id, searchApp.package_name, - searchApp.origin + searchApp.origin, + catText, ) } else -> null @@ -515,7 +521,10 @@ class ApplicationListRVAdapter( progressBarInstall.visibility = View.GONE } - fun setData(newList: List) { + fun setData(newList: List, optionalCategory: String? = null) { + optionalCategory?.let { + this.optionalCategory = it + } currentList.forEach { newList.find { item -> item._id == it._id }?.let { foundItem -> foundItem.privacyScore = it.privacyScore diff --git a/app/src/main/java/foundation/e/apps/home/model/HomeChildRVAdapter.kt b/app/src/main/java/foundation/e/apps/home/model/HomeChildRVAdapter.kt index 3309c595ba9f1a987a42ed2aed41997343df2967..7e5c580b40947e98f05849a4c132e72190522b89 100644 --- a/app/src/main/java/foundation/e/apps/home/model/HomeChildRVAdapter.kt +++ b/app/src/main/java/foundation/e/apps/home/model/HomeChildRVAdapter.kt @@ -96,7 +96,8 @@ class HomeChildRVAdapter( val action = HomeFragmentDirections.actionHomeFragmentToApplicationFragment( homeApp._id, homeApp.package_name, - homeApp.origin + homeApp.origin, + homeApp.category ) holder.itemView.findNavController().navigate(action) } diff --git a/app/src/main/res/navigation/navigation_resource.xml b/app/src/main/res/navigation/navigation_resource.xml index a258c3c773d7d826be5a383b4667954f9b3f4dd9..1c7d6c2909746eeb125cb49186d5ac943fc2ad3b 100644 --- a/app/src/main/res/navigation/navigation_resource.xml +++ b/app/src/main/res/navigation/navigation_resource.xml @@ -106,6 +106,9 @@ android:name="origin" android:defaultValue="GPLAY" app:argType="foundation.e.apps.utils.enums.Origin" /> +