view: Drop logic related to details

This has been moved to compose

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2025-06-30 12:44:26 +08:00
parent fe6c62851b
commit 2bb3bbec0c
26 changed files with 3 additions and 1743 deletions

View File

@@ -373,7 +373,7 @@ object NotificationUtil {
private fun getContentIntentForDetails(context: Context, packageName: String): PendingIntent {
return NavDeepLinkBuilder(context)
.setGraph(R.navigation.mobile_navigation)
.setDestination(R.id.appDetailsFragment)
.setDestination(R.id.splashFragment)
.setComponentName(MainActivity::class.java)
.setArguments(bundleOf("packageName" to packageName))
.createPendingIntent()

View File

@@ -1,101 +0,0 @@
/*
* Aurora Store
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
*
* Aurora Store is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Aurora Store 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.aurora.store.view.custom.layouts
import android.content.Context
import android.util.AttributeSet
import android.widget.RelativeLayout
import androidx.annotation.ColorInt
import androidx.appcompat.widget.AppCompatImageView
import androidx.core.view.isVisible
import com.aurora.store.R
import com.aurora.store.databinding.ViewDevInfoBinding
class DevInfoLayout : RelativeLayout {
private lateinit var binding: ViewDevInfoBinding
val icon: AppCompatImageView get() = binding.img
var title: String
get() = binding.txtTitle.text.toString()
set(value) = setTxtTitle(value)
var subTitle: String?
get() = binding.txtSubtitle.text.toString()
set(value) = setTxtSubtitle(value)
@get:ColorInt
var titleColor: Int
get() = binding.txtTitle.currentTextColor
set(value) = binding.txtTitle.setTextColor(value)
@get:ColorInt
var subTitleColor: Int
get() = binding.txtSubtitle.currentTextColor
set(value) = binding.txtSubtitle.setTextColor(value)
constructor(context: Context) : super(context) {
init(context, null)
}
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
init(context, attrs)
}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
) {
init(context, attrs)
}
private fun init(context: Context, attrs: AttributeSet?) {
val view = inflate(context, R.layout.view_dev_info, this)
binding = ViewDevInfoBinding.bind(view)
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.DevInfoLayout)
val icon = typedArray.getResourceId(
R.styleable.DevInfoLayout_imgIcon,
R.drawable.ic_map_marker
)
val textPrimary = typedArray.getString(R.styleable.DevInfoLayout_txtTitle)
val textSecondary = typedArray.getString(R.styleable.DevInfoLayout_txtSubtitle)
binding.img.setImageResource(icon)
binding.txtTitle.text = textPrimary
binding.txtSubtitle.text = textSecondary
typedArray.recycle()
}
private fun setTxtTitle(text: String?) {
binding.txtTitle.text = text
binding.txtTitle.isVisible = text != null
invalidate()
}
private fun setTxtSubtitle(text: String?) {
binding.txtSubtitle.text = text
binding.txtSubtitle.isVisible = text != null
invalidate()
}
}

View File

@@ -1,65 +0,0 @@
/*
* Aurora Store
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
*
* Aurora Store is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Aurora Store 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.aurora.store.view.epoxy.views.details
import android.content.Context
import android.util.AttributeSet
import coil3.load
import coil3.request.placeholder
import coil3.request.transformations
import coil3.transform.RoundedCornersTransformation
import com.airbnb.epoxy.CallbackProp
import com.airbnb.epoxy.ModelProp
import com.airbnb.epoxy.ModelView
import com.aurora.gplayapi.data.models.App
import com.aurora.store.R
import com.aurora.store.databinding.ViewAppDependentBinding
import com.aurora.store.view.epoxy.views.BaseModel
import com.aurora.store.view.epoxy.views.BaseView
@ModelView(
autoLayout = ModelView.Size.WRAP_WIDTH_WRAP_HEIGHT,
baseModelClass = BaseModel::class
)
class AppDependentView @JvmOverloads constructor(
context: Context?,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : BaseView<ViewAppDependentBinding>(context, attrs, defStyleAttr) {
@ModelProp
fun app(app: App) {
binding.txtName.text = app.displayName
binding.imgIcon.load(app.iconArtwork.url) {
placeholder(R.drawable.bg_placeholder)
transformations(RoundedCornersTransformation(32F))
}
}
@CallbackProp
fun click(onClickListener: OnClickListener?) {
binding.root.setOnClickListener(onClickListener)
}
@CallbackProp
fun longClick(onClickListener: OnLongClickListener?) {
binding.root.setOnLongClickListener(onClickListener)
}
}

View File

@@ -1,58 +0,0 @@
/*
* Aurora Store
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
*
* Aurora Store is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Aurora Store 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.aurora.store.view.epoxy.views.details
import android.content.Context
import android.util.AttributeSet
import coil3.load
import com.airbnb.epoxy.ModelProp
import com.airbnb.epoxy.ModelView
import com.aurora.gplayapi.data.models.details.Badge
import com.aurora.store.databinding.ViewBadgeBinding
import com.aurora.store.view.epoxy.views.BaseModel
import com.aurora.store.view.epoxy.views.BaseView
@ModelView(
autoLayout = ModelView.Size.WRAP_WIDTH_WRAP_HEIGHT,
baseModelClass = BaseModel::class
)
class BadgeView @JvmOverloads constructor(
context: Context?,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : BaseView<ViewBadgeBinding>(context, attrs, defStyleAttr) {
@ModelProp
fun badge(badge: Badge) {
if (badge.textMajor.isEmpty()) {
if (badge.textMinor.isEmpty()) {
binding.txt.text = badge.textDescription
} else {
binding.txt.text = badge.textMinor
}
} else {
binding.txt.text = badge.textMajor
}
badge.artwork?.let {
binding.img.load(it.url)
}
}
}

View File

@@ -1,61 +0,0 @@
/*
* Aurora Store
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
*
* Aurora Store is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Aurora Store 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.aurora.store.view.epoxy.views.details
import android.content.Context
import android.util.AttributeSet
import androidx.core.content.ContextCompat
import com.airbnb.epoxy.ModelProp
import com.airbnb.epoxy.ModelView
import com.airbnb.epoxy.OnViewRecycled
import com.aurora.store.R
import com.aurora.store.databinding.ViewInfoBinding
import com.aurora.store.view.epoxy.views.BaseModel
import com.aurora.store.view.epoxy.views.BaseView
@ModelView(
autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
baseModelClass = BaseModel::class
)
class InfoView @JvmOverloads constructor(
context: Context?,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : BaseView<ViewInfoBinding>(context, attrs, defStyleAttr) {
@ModelProp(options = [ModelProp.Option.IgnoreRequireHashCode])
fun badge(info: Map.Entry<String, String>) {
binding.txtTitle.text = when (info.key) {
"DOWNLOAD" -> ContextCompat.getString(context, R.string.app_info_downloads)
"UPDATED_ON" -> ContextCompat.getString(context, R.string.app_info_updated_on)
"REQUIRES" -> ContextCompat.getString(context, R.string.app_info_min_android)
"TARGET" -> ContextCompat.getString(context, R.string.app_info_target_android)
else -> info.key
}
binding.txtSubtitle.text = info.value
}
@OnViewRecycled
fun clear() {
binding.txtTitle.text = null
binding.txtSubtitle.text = null
}
}

View File

@@ -1,69 +0,0 @@
/*
* Aurora Store
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
*
* Aurora Store is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Aurora Store 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.aurora.store.view.epoxy.views.details
import android.content.Context
import android.util.AttributeSet
import androidx.core.text.HtmlCompat
import coil3.load
import coil3.request.placeholder
import com.airbnb.epoxy.ModelProp
import com.airbnb.epoxy.ModelView
import com.aurora.gplayapi.data.models.details.Badge
import com.aurora.store.R
import com.aurora.store.databinding.ViewMoreBadgeBinding
import com.aurora.store.view.epoxy.views.BaseModel
import com.aurora.store.view.epoxy.views.BaseView
@ModelView(
autoLayout = ModelView.Size.WRAP_WIDTH_WRAP_HEIGHT,
baseModelClass = BaseModel::class
)
class MoreBadgeView @JvmOverloads constructor(
context: Context?,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : BaseView<ViewMoreBadgeBinding>(context, attrs, defStyleAttr) {
@ModelProp
fun badge(badge: Badge) {
binding.line1.text = badge.textMajor
badge.textMinorHtml?.let {
if (it.isNotEmpty()) {
binding.line2.text = HtmlCompat.fromHtml(it, HtmlCompat.FROM_HTML_MODE_COMPACT)
} else {
binding.line2.text = badge.textMinor
}
}
badge.textDescription?.let {
if (it.isNotEmpty()) {
binding.line2.text = it
}
}
badge.artwork?.let {
binding.img.load(it.url) {
placeholder(R.drawable.ic_arrow_right)
}
}
}
}

View File

@@ -1,107 +0,0 @@
/*
* Aurora Store
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
*
* Aurora Store is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Aurora Store 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.aurora.store.view.ui.details
import android.os.Bundle
import android.view.View
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.aurora.gplayapi.data.models.App
import com.aurora.gplayapi.data.models.StreamCluster
import com.aurora.store.AppStreamStash
import com.aurora.store.data.model.ViewState
import com.aurora.store.data.model.ViewState.Loading.getDataAs
import com.aurora.store.databinding.FragmentGenericWithToolbarBinding
import com.aurora.store.view.custom.recycler.EndlessRecyclerOnScrollListener
import com.aurora.store.view.epoxy.controller.GenericCarouselController
import com.aurora.store.view.epoxy.controller.SearchCarouselController
import com.aurora.store.view.ui.commons.BaseFragment
import com.aurora.store.viewmodel.search.SearchResultViewModel
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
class DevAppsFragment : BaseFragment<FragmentGenericWithToolbarBinding>(),
GenericCarouselController.Callbacks {
private val args: DevAppsFragmentArgs by navArgs()
private val viewModel: SearchResultViewModel by viewModels()
private val controller = SearchCarouselController(this)
private var query: String = ""
get() = "pub:${args.developerName}"
private var scrollListener: EndlessRecyclerOnScrollListener =
object : EndlessRecyclerOnScrollListener(visibleThreshold = 4) {
override fun onLoadMore(currentPage: Int) {
viewModel.observe(query)
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
with(binding) {
toolbar.apply {
title = args.developerName
setNavigationOnClickListener { findNavController().navigateUp() }
}
recycler.setController(controller)
recycler.addOnScrollListener(scrollListener)
}
with(viewModel) {
search(query)
liveData.observe(viewLifecycleOwner) {
when (it) {
is ViewState.Loading -> {
controller.setData(null)
}
is ViewState.Success<*> -> {
val stash = it.getDataAs<AppStreamStash>()
controller.setData(stash[query])
}
else -> {}
}
}
}
}
override fun onHeaderClicked(streamCluster: StreamCluster) {
openStreamBrowseFragment(streamCluster)
}
override fun onClusterScrolled(streamCluster: StreamCluster) {
viewModel.observeCluster(query, streamCluster)
}
override fun onAppClick(app: App) {
openDetailsFragment(app.packageName, app)
}
override fun onAppLongClick(app: App) {
}
}

View File

@@ -117,11 +117,7 @@ abstract class BaseFlavouredSplashFragment : BaseFragment<FragmentSplashBinding>
navigateToDefaultTab()
} else {
requireArguments().remove("packageName")
findNavController().navigate(
SplashFragmentDirections.actionSplashFragmentToAppDetailsFragment(
packageName
)
)
openDetailsFragment(packageName)
}
}
@@ -142,11 +138,7 @@ abstract class BaseFlavouredSplashFragment : BaseFragment<FragmentSplashBinding>
navigateToDefaultTab()
} else {
requireArguments().remove("packageName")
findNavController().navigate(
SplashFragmentDirections.actionSplashFragmentToAppDetailsFragment(
packageName
)
)
openDetailsFragment(packageName)
}
}