ktlint: Reformat all views
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -79,4 +79,4 @@ class ActionHeaderLayout : RelativeLayout {
|
|||||||
binding.imgAction.visibility = View.VISIBLE
|
binding.imgAction.visibility = View.VISIBLE
|
||||||
binding.imgAction.setOnClickListener(onclickListener)
|
binding.imgAction.setOnClickListener(onclickListener)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,11 +64,11 @@ class StateButton : RelativeLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateProgress(isVisible: Boolean) {
|
fun updateProgress(isVisible: Boolean) {
|
||||||
if (isVisible)
|
if (isVisible) {
|
||||||
binding.progress.visibility = View.VISIBLE
|
binding.progress.visibility = View.VISIBLE
|
||||||
else
|
} else {
|
||||||
|
|
||||||
binding.progress.visibility = View.INVISIBLE
|
binding.progress.visibility = View.INVISIBLE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addOnClickListener(onClickListener: OnClickListener) {
|
fun addOnClickListener(onClickListener: OnClickListener) {
|
||||||
|
|||||||
@@ -42,11 +42,9 @@ class AuroraListPreference : ListPreference {
|
|||||||
defStyleRes: Int
|
defStyleRes: Int
|
||||||
) : super(context, attrs, defStyleAttr, defStyleRes)
|
) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||||
|
|
||||||
override fun getPersistedString(defaultReturnValue: String?): String {
|
override fun getPersistedString(defaultReturnValue: String?): String =
|
||||||
return getPersistedInt(defaultReturnValue?.toInt() ?: -1).toString()
|
getPersistedInt(defaultReturnValue?.toInt() ?: -1).toString()
|
||||||
}
|
|
||||||
|
|
||||||
override fun persistString(value: String?): Boolean {
|
override fun persistString(value: String?): Boolean =
|
||||||
return if (value != null) persistInt(Integer.valueOf(value)) else false
|
if (value != null) persistInt(Integer.valueOf(value)) else false
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import android.view.WindowManager
|
|||||||
import androidx.preference.EditTextPreferenceDialogFragmentCompat
|
import androidx.preference.EditTextPreferenceDialogFragmentCompat
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
|
||||||
|
|
||||||
class M3EditTextPreference : EditTextPreferenceDialogFragmentCompat() {
|
class M3EditTextPreference : EditTextPreferenceDialogFragmentCompat() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -40,7 +39,6 @@ class M3EditTextPreference : EditTextPreferenceDialogFragmentCompat() {
|
|||||||
return builder.create()
|
return builder.create()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
||||||
|
|||||||
@@ -54,16 +54,20 @@ abstract class EndlessRecyclerOnScrollListener : RecyclerView.OnScrollListener {
|
|||||||
|
|
||||||
private fun findFirstVisibleItemPosition(recyclerView: RecyclerView): Int {
|
private fun findFirstVisibleItemPosition(recyclerView: RecyclerView): Int {
|
||||||
val child = findOneVisibleChild(0, layoutManager.childCount, true, false)
|
val child = findOneVisibleChild(0, layoutManager.childCount, true, false)
|
||||||
return if (child == null) RecyclerView.NO_POSITION else recyclerView.getChildAdapterPosition(
|
return if (child == null) {
|
||||||
child
|
RecyclerView.NO_POSITION
|
||||||
)
|
} else {
|
||||||
|
recyclerView.getChildAdapterPosition(child)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findLastVisibleItemPosition(recyclerView: RecyclerView): Int {
|
private fun findLastVisibleItemPosition(recyclerView: RecyclerView): Int {
|
||||||
val child = findOneVisibleChild(recyclerView.childCount - 1, -1, false, true)
|
val child = findOneVisibleChild(recyclerView.childCount - 1, -1, false, true)
|
||||||
return if (child == null) RecyclerView.NO_POSITION else recyclerView.getChildAdapterPosition(
|
return if (child == null) {
|
||||||
child
|
RecyclerView.NO_POSITION
|
||||||
)
|
} else {
|
||||||
|
recyclerView.getChildAdapterPosition(child)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findOneVisibleChild(
|
private fun findOneVisibleChild(
|
||||||
@@ -72,12 +76,15 @@ abstract class EndlessRecyclerOnScrollListener : RecyclerView.OnScrollListener {
|
|||||||
completelyVisible: Boolean,
|
completelyVisible: Boolean,
|
||||||
acceptPartiallyVisible: Boolean
|
acceptPartiallyVisible: Boolean
|
||||||
): View? {
|
): View? {
|
||||||
if (layoutManager.canScrollVertically() != isOrientationHelperVertical || orientationHelper == null) {
|
if (layoutManager.canScrollVertically() != isOrientationHelperVertical ||
|
||||||
|
orientationHelper == null
|
||||||
|
) {
|
||||||
isOrientationHelperVertical = layoutManager.canScrollVertically()
|
isOrientationHelperVertical = layoutManager.canScrollVertically()
|
||||||
orientationHelper = if (isOrientationHelperVertical)
|
orientationHelper = if (isOrientationHelperVertical) {
|
||||||
OrientationHelper.createVerticalHelper(layoutManager)
|
OrientationHelper.createVerticalHelper(layoutManager)
|
||||||
else
|
} else {
|
||||||
OrientationHelper.createHorizontalHelper(layoutManager)
|
OrientationHelper.createHorizontalHelper(layoutManager)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val mOrientationHelper = this.orientationHelper ?: return null
|
val mOrientationHelper = this.orientationHelper ?: return null
|
||||||
@@ -118,12 +125,9 @@ abstract class EndlessRecyclerOnScrollListener : RecyclerView.OnScrollListener {
|
|||||||
?: throw RuntimeException("A LayoutManager is required")
|
?: throw RuntimeException("A LayoutManager is required")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (visibleThreshold == RecyclerView.NO_POSITION) {
|
if (visibleThreshold == RecyclerView.NO_POSITION) {
|
||||||
visibleThreshold =
|
visibleThreshold = findLastVisibleItemPosition(recyclerView) -
|
||||||
findLastVisibleItemPosition(recyclerView) - findFirstVisibleItemPosition(
|
findFirstVisibleItemPosition(recyclerView)
|
||||||
recyclerView
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
visibleItemCount = recyclerView.childCount
|
visibleItemCount = recyclerView.childCount
|
||||||
@@ -137,7 +141,9 @@ abstract class EndlessRecyclerOnScrollListener : RecyclerView.OnScrollListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoading && totalItemCount - visibleItemCount <= firstVisibleItem + visibleThreshold) {
|
if (!isLoading &&
|
||||||
|
totalItemCount - visibleItemCount <= firstVisibleItem + visibleThreshold
|
||||||
|
) {
|
||||||
currentPage++
|
currentPage++
|
||||||
onLoadMore(currentPage)
|
onLoadMore(currentPage)
|
||||||
isLoading = true
|
isLoading = true
|
||||||
@@ -164,4 +170,4 @@ abstract class EndlessRecyclerOnScrollListener : RecyclerView.OnScrollListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract fun onLoadMore(currentPage: Int)
|
abstract fun onLoadMore(currentPage: Int)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ import com.aurora.gplayapi.data.models.StreamCluster
|
|||||||
class CategoryCarouselController(callbacks: Callbacks) : GenericCarouselController(callbacks) {
|
class CategoryCarouselController(callbacks: Callbacks) : GenericCarouselController(callbacks) {
|
||||||
|
|
||||||
override fun applyFilter(streamBundle: StreamCluster): Boolean {
|
override fun applyFilter(streamBundle: StreamCluster): Boolean {
|
||||||
return streamBundle.clusterAppList.isNotEmpty() //Filter empty clusters
|
return streamBundle.clusterAppList.isNotEmpty() // Filter empty clusters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ open class GenericCarouselController(private val callbacks: Callbacks) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
open fun applyFilter(streamBundle: StreamCluster): Boolean {
|
open fun applyFilter(streamBundle: StreamCluster): Boolean {
|
||||||
return streamBundle.clusterTitle.isNotBlank() //Filter noisy cluster
|
return streamBundle.clusterTitle.isNotBlank() && // Filter noisy cluster
|
||||||
&& streamBundle.clusterAppList.isNotEmpty() //Filter empty clusters
|
streamBundle.clusterAppList.isNotEmpty() && // Filter empty clusters
|
||||||
&& streamBundle.clusterAppList.count() > 1 //Filter clusters with single apps (mostly promotions)
|
streamBundle.clusterAppList.count() > 1 // Filter clusters with single apps (promotions)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun buildModels(streamBundle: StreamBundle?) {
|
override fun buildModels(streamBundle: StreamBundle?) {
|
||||||
@@ -79,7 +79,6 @@ open class GenericCarouselController(private val callbacks: Callbacks) :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
streamBundle
|
streamBundle
|
||||||
.streamClusters
|
.streamClusters
|
||||||
@@ -88,13 +87,13 @@ open class GenericCarouselController(private val callbacks: Callbacks) :
|
|||||||
.forEach { streamCluster ->
|
.forEach { streamCluster ->
|
||||||
add(CarouselModelGroup(streamCluster, callbacks))
|
add(CarouselModelGroup(streamCluster, callbacks))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (streamBundle.hasNext())
|
if (streamBundle.hasNext()) {
|
||||||
add(
|
add(
|
||||||
CarouselShimmerGroup()
|
CarouselShimmerGroup()
|
||||||
.id("progress")
|
.id("progress")
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,8 @@ import com.airbnb.epoxy.ModelView
|
|||||||
@ModelView(saveViewState = true, autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT)
|
@ModelView(saveViewState = true, autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT)
|
||||||
class CarouselHorizontal(context: Context?) : Carousel(context) {
|
class CarouselHorizontal(context: Context?) : Carousel(context) {
|
||||||
|
|
||||||
override fun createLayoutManager(): LayoutManager {
|
override fun createLayoutManager(): LayoutManager =
|
||||||
return LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
|
LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
|
||||||
}
|
|
||||||
|
|
||||||
override fun getSnapHelperFactory(): Nothing? = null
|
override fun getSnapHelperFactory(): Nothing? = null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ class CarouselModelGroup(
|
|||||||
callbacks: GenericCarouselController.Callbacks
|
callbacks: GenericCarouselController.Callbacks
|
||||||
) :
|
) :
|
||||||
EpoxyModelGroup(
|
EpoxyModelGroup(
|
||||||
R.layout.model_carousel_group, buildModels(
|
R.layout.model_carousel_group,
|
||||||
|
buildModels(
|
||||||
streamCluster,
|
streamCluster,
|
||||||
callbacks
|
callbacks
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ import java.util.UUID
|
|||||||
|
|
||||||
class CarouselShimmerGroup :
|
class CarouselShimmerGroup :
|
||||||
EpoxyModelGroup(
|
EpoxyModelGroup(
|
||||||
R.layout.model_carousel_group, buildModels()
|
R.layout.model_carousel_group,
|
||||||
|
buildModels()
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
private fun buildModels(): List<EpoxyModel<*>> {
|
private fun buildModels(): List<EpoxyModel<*>> {
|
||||||
@@ -50,7 +51,7 @@ class CarouselShimmerGroup :
|
|||||||
|
|
||||||
models.add(
|
models.add(
|
||||||
CarouselHorizontalModel_()
|
CarouselHorizontalModel_()
|
||||||
.id("cluster_${idPrefix}")
|
.id("cluster_$idPrefix")
|
||||||
.models(clusterViewModels)
|
.models(clusterViewModels)
|
||||||
)
|
)
|
||||||
return models
|
return models
|
||||||
|
|||||||
@@ -29,4 +29,4 @@ class AppProgressView @JvmOverloads constructor(
|
|||||||
context: Context?,
|
context: Context?,
|
||||||
attrs: AttributeSet? = null,
|
attrs: AttributeSet? = null,
|
||||||
defStyleAttr: Int = 0
|
defStyleAttr: Int = 0
|
||||||
) : BaseView<ViewAppProgressBinding>(context, attrs, defStyleAttr)
|
) : BaseView<ViewAppProgressBinding>(context, attrs, defStyleAttr)
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ abstract class BaseView<ViewBindingType : ViewBinding> : RelativeLayout {
|
|||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
private fun inflateViewBinding(inflater: LayoutInflater): ViewBindingType {
|
private fun inflateViewBinding(inflater: LayoutInflater): ViewBindingType {
|
||||||
val type =
|
val type = (javaClass.genericSuperclass as ParameterizedType)
|
||||||
(javaClass.genericSuperclass as ParameterizedType).actualTypeArguments[0] as Class<ViewBindingType>
|
.actualTypeArguments[0] as Class<ViewBindingType>
|
||||||
val method = type.getMethod(
|
val method = type.getMethod(
|
||||||
"inflate",
|
"inflate",
|
||||||
LayoutInflater::class.java,
|
LayoutInflater::class.java,
|
||||||
@@ -48,4 +48,4 @@ abstract class BaseView<ViewBindingType : ViewBinding> : RelativeLayout {
|
|||||||
)
|
)
|
||||||
return method.invoke(null, inflater, this, false) as ViewBindingType
|
return method.invoke(null, inflater, this, false) as ViewBindingType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,8 +45,9 @@ class HeaderView @JvmOverloads constructor(
|
|||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
@ModelProp
|
@ModelProp
|
||||||
fun browseUrl(browseUrl: String? = String()) {
|
fun browseUrl(browseUrl: String? = String()) {
|
||||||
if (browseUrl.isNullOrEmpty())
|
if (browseUrl.isNullOrEmpty()) {
|
||||||
binding.imgAction.visibility = INVISIBLE
|
binding.imgAction.visibility = INVISIBLE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@CallbackProp
|
@CallbackProp
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import com.airbnb.epoxy.ModelView
|
|||||||
import com.airbnb.epoxy.OnViewRecycled
|
import com.airbnb.epoxy.OnViewRecycled
|
||||||
import com.aurora.store.databinding.ViewHeaderUpdateBinding
|
import com.aurora.store.databinding.ViewHeaderUpdateBinding
|
||||||
|
|
||||||
|
|
||||||
@ModelView(
|
@ModelView(
|
||||||
autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
|
autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
|
||||||
baseModelClass = BaseModel::class
|
baseModelClass = BaseModel::class
|
||||||
|
|||||||
@@ -60,17 +60,20 @@ class AppListView @JvmOverloads constructor(
|
|||||||
extras.add(if (app.size > 0) CommonUtil.addSiPrefix(app.size) else app.downloadString)
|
extras.add(if (app.size > 0) CommonUtil.addSiPrefix(app.size) else app.downloadString)
|
||||||
extras.add("${app.labeledRating}★")
|
extras.add("${app.labeledRating}★")
|
||||||
extras.add(
|
extras.add(
|
||||||
if (app.isFree)
|
if (app.isFree) {
|
||||||
ContextCompat.getString(context, R.string.details_free)
|
ContextCompat.getString(context, R.string.details_free)
|
||||||
else
|
} else {
|
||||||
ContextCompat.getString(context, R.string.details_paid)
|
ContextCompat.getString(context, R.string.details_paid)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (app.containsAds)
|
if (app.containsAds) {
|
||||||
extras.add(ContextCompat.getString(context, R.string.details_contains_ads))
|
extras.add(ContextCompat.getString(context, R.string.details_contains_ads))
|
||||||
|
}
|
||||||
|
|
||||||
if (app.dependencies.dependentPackages.isNotEmpty())
|
if (app.dependencies.dependentPackages.isNotEmpty()) {
|
||||||
extras.add(ContextCompat.getString(context, R.string.details_gsf_dependent))
|
extras.add(ContextCompat.getString(context, R.string.details_gsf_dependent))
|
||||||
|
}
|
||||||
|
|
||||||
binding.txtLine3.text = extras.joinToString(separator = " • ")
|
binding.txtLine3.text = extras.joinToString(separator = " • ")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,14 +76,15 @@ class AppUpdateView @JvmOverloads constructor(
|
|||||||
|
|
||||||
binding.txtLine2.text = developerName
|
binding.txtLine2.text = developerName
|
||||||
binding.txtLine3.text = ("${CommonUtil.addSiPrefix(size)} • $updatedOn")
|
binding.txtLine3.text = ("${CommonUtil.addSiPrefix(size)} • $updatedOn")
|
||||||
binding.txtLine4.text = ("$versionName (${versionCode})")
|
binding.txtLine4.text = ("$versionName ($versionCode)")
|
||||||
binding.txtChangelog.text = if (changelog.isNotEmpty())
|
binding.txtChangelog.text = if (changelog.isNotEmpty()) {
|
||||||
HtmlCompat.fromHtml(
|
HtmlCompat.fromHtml(
|
||||||
changelog,
|
changelog,
|
||||||
HtmlCompat.FROM_HTML_OPTION_USE_CSS_COLORS
|
HtmlCompat.FROM_HTML_OPTION_USE_CSS_COLORS
|
||||||
)
|
)
|
||||||
else
|
} else {
|
||||||
context.getString(R.string.details_changelog_unavailable)
|
context.getString(R.string.details_changelog_unavailable)
|
||||||
|
}
|
||||||
|
|
||||||
binding.headerIndicator.setOnClickListener {
|
binding.headerIndicator.setOnClickListener {
|
||||||
if (binding.cardChangelog.isVisible) {
|
if (binding.cardChangelog.isVisible) {
|
||||||
@@ -162,11 +163,13 @@ class AppUpdateView @JvmOverloads constructor(
|
|||||||
val isDownloadVisible = binding.progressDownload.isShown
|
val isDownloadVisible = binding.progressDownload.isShown
|
||||||
|
|
||||||
// Avoids flickering when the download is in progress
|
// Avoids flickering when the download is in progress
|
||||||
if (isDownloadVisible && scaleFactor != 1f)
|
if (isDownloadVisible && scaleFactor != 1f) {
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (!isDownloadVisible && scaleFactor == 1f)
|
if (!isDownloadVisible && scaleFactor == 1f) {
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (scaleFactor == 1f) {
|
if (scaleFactor == 1f) {
|
||||||
binding.progressDownload.invisible()
|
binding.progressDownload.invisible()
|
||||||
@@ -190,10 +193,11 @@ class AppUpdateView @JvmOverloads constructor(
|
|||||||
iconDrawable?.let {
|
iconDrawable?.let {
|
||||||
binding.imgIcon.load(it) {
|
binding.imgIcon.load(it) {
|
||||||
transformations(
|
transformations(
|
||||||
if (scaleFactor == 1f)
|
if (scaleFactor == 1f) {
|
||||||
cornersTransformation
|
cornersTransformation
|
||||||
else
|
} else {
|
||||||
CircleCropTransformation()
|
CircleCropTransformation()
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,10 +53,11 @@ class AppView @JvmOverloads constructor(
|
|||||||
transformations(RoundedCornersTransformation(32F))
|
transformations(RoundedCornersTransformation(32F))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app.size > 0)
|
if (app.size > 0) {
|
||||||
binding.txtSize.text = CommonUtil.addSiPrefix(app.size)
|
binding.txtSize.text = CommonUtil.addSiPrefix(app.size)
|
||||||
else
|
} else {
|
||||||
binding.txtSize.text = app.downloadString
|
binding.txtSize.text = app.downloadString
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@CallbackProp
|
@CallbackProp
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class AppsContainerFragment : BaseFragment<FragmentAppsGamesBinding>() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
binding.pager.isUserInputEnabled =
|
binding.pager.isUserInputEnabled =
|
||||||
false //Disable viewpager scroll to avoid scroll conflicts
|
false // Disable viewpager scroll to avoid scroll conflicts
|
||||||
|
|
||||||
val tabTitles: MutableList<String> = mutableListOf<String>().apply {
|
val tabTitles: MutableList<String> = mutableListOf<String>().apply {
|
||||||
if (isForYouEnabled) {
|
if (isForYouEnabled) {
|
||||||
@@ -141,12 +141,8 @@ class AppsContainerFragment : BaseFragment<FragmentAppsGamesBinding>() {
|
|||||||
add(CategoryFragment.newInstance(0))
|
add(CategoryFragment.newInstance(0))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createFragment(position: Int): Fragment {
|
override fun createFragment(position: Int): Fragment = tabFragments[position]
|
||||||
return tabFragments[position]
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
override fun getItemCount(): Int = tabFragments.size
|
||||||
return tabFragments.size
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ abstract class BaseFragment<ViewBindingType : ViewBinding> : Fragment() {
|
|||||||
|
|
||||||
lateinit var permissionProvider: PermissionProvider
|
lateinit var permissionProvider: PermissionProvider
|
||||||
|
|
||||||
protected open var _binding: ViewBindingType? = null
|
protected open var viewBindingType: ViewBindingType? = null
|
||||||
protected val binding get() = _binding!!
|
protected val binding get() = viewBindingType!!
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@@ -52,18 +52,19 @@ abstract class BaseFragment<ViewBindingType : ViewBinding> : Fragment() {
|
|||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
val type =
|
val type = (javaClass.genericSuperclass as ParameterizedType)
|
||||||
(javaClass.genericSuperclass as ParameterizedType).actualTypeArguments[0] as Class<ViewBindingType>
|
.actualTypeArguments[0] as Class<ViewBindingType>
|
||||||
val method = type.getMethod(
|
val method = type.getMethod(
|
||||||
"inflate",
|
"inflate",
|
||||||
LayoutInflater::class.java,
|
LayoutInflater::class.java,
|
||||||
ViewGroup::class.java,
|
ViewGroup::class.java,
|
||||||
Boolean::class.java
|
Boolean::class.java
|
||||||
)
|
)
|
||||||
_binding = method.invoke(null, inflater, container, false) as ViewBindingType
|
viewBindingType = method.invoke(null, inflater, container, false) as ViewBindingType
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
@@ -75,7 +76,7 @@ abstract class BaseFragment<ViewBindingType : ViewBinding> : Fragment() {
|
|||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
cleanupRecyclerViews(findAllRecyclerViews(requireView()))
|
cleanupRecyclerViews(findAllRecyclerViews(requireView()))
|
||||||
_binding = null
|
viewBindingType = null
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ import com.aurora.store.viewmodel.subcategory.CategoryStreamViewModel
|
|||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class CategoryBrowseFragment : BaseFragment<FragmentGenericWithToolbarBinding>(),
|
class CategoryBrowseFragment :
|
||||||
|
BaseFragment<FragmentGenericWithToolbarBinding>(),
|
||||||
GenericCarouselController.Callbacks {
|
GenericCarouselController.Callbacks {
|
||||||
private val args: CategoryBrowseFragmentArgs by navArgs()
|
private val args: CategoryBrowseFragmentArgs by navArgs()
|
||||||
private val viewModel: CategoryStreamViewModel by activityViewModels()
|
private val viewModel: CategoryStreamViewModel by activityViewModels()
|
||||||
@@ -95,6 +96,5 @@ class CategoryBrowseFragment : BaseFragment<FragmentGenericWithToolbarBinding>()
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onAppLongClick(app: App) {
|
override fun onAppLongClick(app: App) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,11 +39,9 @@ class CategoryFragment : BaseFragment<FragmentGenericRecyclerBinding>() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(pageType: Int): CategoryFragment {
|
fun newInstance(pageType: Int): CategoryFragment = CategoryFragment().apply {
|
||||||
return CategoryFragment().apply {
|
arguments = Bundle().apply {
|
||||||
arguments = Bundle().apply {
|
putInt(Constants.PAGE_TYPE, pageType)
|
||||||
putInt(Constants.PAGE_TYPE, pageType)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ class ExpandedStreamBrowseFragment : BaseFragment<FragmentGenericWithToolbarBind
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTitle(streamCluster: StreamCluster) {
|
private fun updateTitle(streamCluster: StreamCluster) {
|
||||||
if (streamCluster.clusterTitle.isNotEmpty())
|
if (streamCluster.clusterTitle.isNotEmpty()) {
|
||||||
binding.toolbar.title = streamCluster.clusterTitle
|
binding.toolbar.title = streamCluster.clusterTitle
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun attachRecycler() {
|
private fun attachRecycler() {
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ import com.aurora.store.viewmodel.homestream.StreamViewModel
|
|||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class ForYouFragment : BaseFragment<FragmentForYouBinding>(),
|
class ForYouFragment :
|
||||||
|
BaseFragment<FragmentForYouBinding>(),
|
||||||
GenericCarouselController.Callbacks {
|
GenericCarouselController.Callbacks {
|
||||||
private val viewModel: StreamViewModel by activityViewModels()
|
private val viewModel: StreamViewModel by activityViewModels()
|
||||||
|
|
||||||
@@ -47,11 +48,9 @@ class ForYouFragment : BaseFragment<FragmentForYouBinding>(),
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(pageType: Int): ForYouFragment {
|
fun newInstance(pageType: Int): ForYouFragment = ForYouFragment().apply {
|
||||||
return ForYouFragment().apply {
|
arguments = Bundle().apply {
|
||||||
arguments = Bundle().apply {
|
putInt(Constants.PAGE_TYPE, pageType)
|
||||||
putInt(Constants.PAGE_TYPE, pageType)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,6 +109,5 @@ class ForYouFragment : BaseFragment<FragmentForYouBinding>(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onAppLongClick(app: App) {
|
override fun onAppLongClick(app: App) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,17 +9,16 @@ import com.jakewharton.processphoenix.ProcessPhoenix
|
|||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class ForceRestartDialog: DialogFragment() {
|
class ForceRestartDialog : DialogFragment() {
|
||||||
|
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog =
|
||||||
return MaterialAlertDialogBuilder(requireContext())
|
MaterialAlertDialogBuilder(requireContext())
|
||||||
.setTitle(R.string.force_restart_title)
|
.setTitle(R.string.force_restart_title)
|
||||||
.setMessage(R.string.force_restart_summary)
|
.setMessage(R.string.force_restart_summary)
|
||||||
.setPositiveButton(getString(R.string.action_restart)) { _, _ ->
|
.setPositiveButton(getString(R.string.action_restart)) { _, _ ->
|
||||||
ProcessPhoenix.triggerRebirth(requireContext())
|
ProcessPhoenix.triggerRebirth(requireContext())
|
||||||
}
|
}
|
||||||
.create()
|
.create()
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class MoreDialogFragment : DialogFragment() {
|
|||||||
|
|
||||||
private abstract class Option(
|
private abstract class Option(
|
||||||
@StringRes open val title: Int,
|
@StringRes open val title: Int,
|
||||||
@DrawableRes open val icon: Int,
|
@DrawableRes open val icon: Int
|
||||||
)
|
)
|
||||||
|
|
||||||
private data class ViewOption(
|
private data class ViewOption(
|
||||||
@@ -95,76 +95,59 @@ class MoreDialogFragment : DialogFragment() {
|
|||||||
val screen: Screen
|
val screen: Screen
|
||||||
) : Option(title, icon)
|
) : Option(title, icon)
|
||||||
|
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog =
|
||||||
return MaterialAlertDialogBuilder(requireContext())
|
MaterialAlertDialogBuilder(requireContext())
|
||||||
.setView(customDialogView(requireContext()))
|
.setView(customDialogView(requireContext()))
|
||||||
.create()
|
.create()
|
||||||
}
|
|
||||||
|
|
||||||
private fun customDialogView(context: Context): ComposeView {
|
private fun customDialogView(context: Context): ComposeView = ComposeView(context).apply {
|
||||||
return ComposeView(context).apply {
|
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
|
||||||
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
|
setContent {
|
||||||
setContent {
|
AuroraTheme {
|
||||||
AuroraTheme {
|
primaryColor =
|
||||||
primaryColor =
|
Color(requireContext().getStyledAttributeColor(MR.colorSurface))
|
||||||
Color(requireContext().getStyledAttributeColor(MR.colorSurface))
|
onPrimaryColor =
|
||||||
onPrimaryColor =
|
Color(requireContext().getStyledAttributeColor(MR.colorOnSurface))
|
||||||
Color(requireContext().getStyledAttributeColor(MR.colorOnSurface))
|
secondaryColor =
|
||||||
secondaryColor =
|
Color(requireContext().getStyledAttributeColor(MR.colorSecondaryContainer))
|
||||||
Color(requireContext().getStyledAttributeColor(MR.colorSecondaryContainer))
|
onSecondaryColor =
|
||||||
onSecondaryColor =
|
Color(
|
||||||
Color(requireContext().getStyledAttributeColor(MR.colorOnSecondaryContainer))
|
requireContext().getStyledAttributeColor(MR.colorOnSecondaryContainer)
|
||||||
|
)
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.background(color = primaryColor)
|
||||||
|
.verticalScroll(rememberScrollState())
|
||||||
|
.padding(10.dp),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(
|
||||||
|
4.dp,
|
||||||
|
Alignment.CenterVertically
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
AppBar(onBackgroundColor = onPrimaryColor)
|
||||||
|
AccountHeader(
|
||||||
|
backgroundColor = secondaryColor,
|
||||||
|
onBackgroundColor = onSecondaryColor
|
||||||
|
)
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.clip(
|
||||||
.background(color = primaryColor)
|
RoundedCornerShape(
|
||||||
.verticalScroll(rememberScrollState())
|
topStart = 2.dp,
|
||||||
.padding(10.dp),
|
topEnd = 2.dp,
|
||||||
verticalArrangement = Arrangement.spacedBy(
|
bottomStart = 25.dp,
|
||||||
4.dp,
|
bottomEnd = 25.dp
|
||||||
Alignment.CenterVertically
|
)
|
||||||
)
|
)
|
||||||
|
.background(color = secondaryColor)
|
||||||
) {
|
) {
|
||||||
AppBar(onBackgroundColor = onPrimaryColor)
|
getOptions().fastForEach { option ->
|
||||||
AccountHeader(
|
|
||||||
backgroundColor = secondaryColor,
|
|
||||||
onBackgroundColor = onSecondaryColor
|
|
||||||
)
|
|
||||||
Column(
|
|
||||||
modifier = Modifier
|
|
||||||
.clip(
|
|
||||||
RoundedCornerShape(
|
|
||||||
topStart = 2.dp,
|
|
||||||
topEnd = 2.dp,
|
|
||||||
bottomStart = 25.dp,
|
|
||||||
bottomEnd = 25.dp
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.background(color = secondaryColor)
|
|
||||||
) {
|
|
||||||
getOptions().fastForEach { option ->
|
|
||||||
OptionItem(
|
|
||||||
option = option,
|
|
||||||
tintColor = onPrimaryColor,
|
|
||||||
textColor = onSecondaryColor,
|
|
||||||
onClick = {
|
|
||||||
when (option) {
|
|
||||||
is ViewOption -> {
|
|
||||||
findNavController().navigate(option.destinationID)
|
|
||||||
}
|
|
||||||
|
|
||||||
is ComposeOption -> context.navigate(option.screen)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getExtraOptions().fastForEach { option ->
|
|
||||||
OptionItem(
|
OptionItem(
|
||||||
option = option,
|
option = option,
|
||||||
tintColor = onPrimaryColor,
|
tintColor = onPrimaryColor,
|
||||||
textColor = onPrimaryColor,
|
textColor = onSecondaryColor,
|
||||||
onClick = {
|
onClick = {
|
||||||
when (option) {
|
when (option) {
|
||||||
is ViewOption -> {
|
is ViewOption -> {
|
||||||
@@ -176,8 +159,24 @@ class MoreDialogFragment : DialogFragment() {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Footer(onPrimaryColor)
|
|
||||||
}
|
}
|
||||||
|
getExtraOptions().fastForEach { option ->
|
||||||
|
OptionItem(
|
||||||
|
option = option,
|
||||||
|
tintColor = onPrimaryColor,
|
||||||
|
textColor = onPrimaryColor,
|
||||||
|
onClick = {
|
||||||
|
when (option) {
|
||||||
|
is ViewOption -> {
|
||||||
|
findNavController().navigate(option.destinationID)
|
||||||
|
}
|
||||||
|
|
||||||
|
is ComposeOption -> context.navigate(option.screen)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Footer(onPrimaryColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -322,7 +321,11 @@ class MoreDialogFragment : DialogFragment() {
|
|||||||
shape = RoundedCornerShape(12.dp),
|
shape = RoundedCornerShape(12.dp),
|
||||||
border = BorderStroke(
|
border = BorderStroke(
|
||||||
1.dp,
|
1.dp,
|
||||||
Color(requireContext().getStyledAttributeColor(androidx.appcompat.R.attr.colorControlHighlight))
|
Color(
|
||||||
|
requireContext().getStyledAttributeColor(
|
||||||
|
androidx.appcompat.R.attr.colorControlHighlight
|
||||||
|
)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
@@ -331,7 +334,7 @@ class MoreDialogFragment : DialogFragment() {
|
|||||||
color = onBackgroundColor,
|
color = onBackgroundColor,
|
||||||
fontWeight = FontWeight.Normal,
|
fontWeight = FontWeight.Normal,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -372,9 +375,7 @@ class MoreDialogFragment : DialogFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ThreeStateIconButton(
|
fun ThreeStateIconButton(tint: Color = Color.White) {
|
||||||
tint: Color = Color.White
|
|
||||||
) {
|
|
||||||
var currentState by remember {
|
var currentState by remember {
|
||||||
mutableStateOf(
|
mutableStateOf(
|
||||||
Preferences.getInteger(
|
Preferences.getInteger(
|
||||||
@@ -418,46 +419,42 @@ class MoreDialogFragment : DialogFragment() {
|
|||||||
enum class State(val value: Int) {
|
enum class State(val value: Int) {
|
||||||
Auto(0),
|
Auto(0),
|
||||||
Light(1),
|
Light(1),
|
||||||
Dark(2),
|
Dark(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getOptions(): List<Option> {
|
private fun getOptions(): List<Option> = listOf(
|
||||||
return listOf(
|
ComposeOption(
|
||||||
ComposeOption(
|
title = R.string.title_apps_games,
|
||||||
title = R.string.title_apps_games,
|
icon = R.drawable.ic_apps,
|
||||||
icon = R.drawable.ic_apps,
|
screen = Screen.Installed
|
||||||
screen = Screen.Installed
|
),
|
||||||
),
|
ComposeOption(
|
||||||
ComposeOption(
|
title = R.string.title_blacklist_manager,
|
||||||
title = R.string.title_blacklist_manager,
|
icon = R.drawable.ic_blacklist,
|
||||||
icon = R.drawable.ic_blacklist,
|
screen = Screen.Blacklist
|
||||||
screen = Screen.Blacklist
|
),
|
||||||
),
|
ComposeOption(
|
||||||
ComposeOption(
|
title = R.string.title_favourites_manager,
|
||||||
title = R.string.title_favourites_manager,
|
icon = R.drawable.ic_favorite_unchecked,
|
||||||
icon = R.drawable.ic_favorite_unchecked,
|
screen = Screen.Favourite
|
||||||
screen = Screen.Favourite
|
),
|
||||||
),
|
ComposeOption(
|
||||||
ComposeOption(
|
title = R.string.title_spoof_manager,
|
||||||
title = R.string.title_spoof_manager,
|
icon = R.drawable.ic_spoof,
|
||||||
icon = R.drawable.ic_spoof,
|
screen = Screen.Spoof
|
||||||
screen = Screen.Spoof
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
)
|
||||||
|
|
||||||
private fun getExtraOptions(): List<Option> {
|
private fun getExtraOptions(): List<Option> = listOf(
|
||||||
return listOf(
|
ViewOption(
|
||||||
ViewOption(
|
title = R.string.title_settings,
|
||||||
title = R.string.title_settings,
|
icon = R.drawable.ic_menu_settings,
|
||||||
icon = R.drawable.ic_menu_settings,
|
destinationID = R.id.settingsFragment
|
||||||
destinationID = R.id.settingsFragment
|
),
|
||||||
),
|
ComposeOption(
|
||||||
ComposeOption(
|
title = R.string.title_about,
|
||||||
title = R.string.title_about,
|
icon = R.drawable.ic_menu_about,
|
||||||
icon = R.drawable.ic_menu_about,
|
screen = Screen.About
|
||||||
screen = Screen.About
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,13 +35,12 @@ import dagger.hilt.android.AndroidEntryPoint
|
|||||||
class TopChartContainerFragment : BaseFragment<FragmentTopChartBinding>() {
|
class TopChartContainerFragment : BaseFragment<FragmentTopChartBinding>() {
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(chartType: Int): TopChartContainerFragment {
|
fun newInstance(chartType: Int): TopChartContainerFragment =
|
||||||
return TopChartContainerFragment().apply {
|
TopChartContainerFragment().apply {
|
||||||
arguments = Bundle().apply {
|
arguments = Bundle().apply {
|
||||||
putInt(Constants.TOP_CHART_TYPE, chartType)
|
putInt(Constants.TOP_CHART_TYPE, chartType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
@@ -96,12 +95,8 @@ class TopChartContainerFragment : BaseFragment<FragmentTopChartBinding>() {
|
|||||||
TopChartFragment.newInstance(chartType, 3)
|
TopChartFragment.newInstance(chartType, 3)
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun createFragment(position: Int): Fragment {
|
override fun createFragment(position: Int): Fragment = tabFragments[position]
|
||||||
return tabFragments[position]
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
override fun getItemCount(): Int = tabFragments.size
|
||||||
return tabFragments.size
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,14 +46,13 @@ class TopChartFragment : BaseFragment<FragmentTopContainerBinding>() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(chartType: Int, chartCategory: Int): TopChartFragment {
|
fun newInstance(chartType: Int, chartCategory: Int): TopChartFragment =
|
||||||
return TopChartFragment().apply {
|
TopChartFragment().apply {
|
||||||
arguments = Bundle().apply {
|
arguments = Bundle().apply {
|
||||||
putInt(Constants.TOP_CHART_TYPE, chartType)
|
putInt(Constants.TOP_CHART_TYPE, chartType)
|
||||||
putInt(Constants.TOP_CHART_CATEGORY, chartCategory)
|
putInt(Constants.TOP_CHART_CATEGORY, chartCategory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ import com.aurora.store.viewmodel.details.DevProfileViewModel
|
|||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class DevProfileFragment : BaseFragment<FragmentDevProfileBinding>(),
|
class DevProfileFragment :
|
||||||
|
BaseFragment<FragmentDevProfileBinding>(),
|
||||||
GenericCarouselController.Callbacks {
|
GenericCarouselController.Callbacks {
|
||||||
|
|
||||||
private val args: DevProfileFragmentArgs by navArgs()
|
private val args: DevProfileFragmentArgs by navArgs()
|
||||||
@@ -46,10 +47,14 @@ class DevProfileFragment : BaseFragment<FragmentDevProfileBinding>(),
|
|||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
|
||||||
// Toolbar
|
// Toolbar
|
||||||
binding.toolbar.apply {
|
binding.toolbar.apply {
|
||||||
title = if (args.title.isNullOrBlank()) getString(R.string.details_dev_profile) else args.title
|
title =
|
||||||
|
if (args.title.isNullOrBlank()) {
|
||||||
|
getString(R.string.details_dev_profile)
|
||||||
|
} else {
|
||||||
|
args.title
|
||||||
|
}
|
||||||
setNavigationOnClickListener { findNavController().navigateUp() }
|
setNavigationOnClickListener { findNavController().navigateUp() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,15 +66,12 @@ class DevProfileFragment : BaseFragment<FragmentDevProfileBinding>(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
is ViewState.Loading -> {
|
is ViewState.Loading -> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is ViewState.Error -> {
|
is ViewState.Error -> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is ViewState.Status -> {
|
is ViewState.Status -> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is ViewState.Success<*> -> {
|
is ViewState.Success<*> -> {
|
||||||
@@ -101,6 +103,5 @@ class DevProfileFragment : BaseFragment<FragmentDevProfileBinding>(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onAppLongClick(app: App) {
|
override fun onAppLongClick(app: App) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,12 +140,8 @@ class GamesContainerFragment : BaseFragment<FragmentAppsGamesBinding>() {
|
|||||||
add(CategoryFragment.newInstance(1))
|
add(CategoryFragment.newInstance(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createFragment(position: Int): Fragment {
|
override fun createFragment(position: Int): Fragment = tabFragments[position]
|
||||||
return tabFragments[position]
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
override fun getItemCount(): Int = tabFragments.size
|
||||||
return tabFragments.size
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ abstract class BasePreferenceFragment : PreferenceFragmentCompat() {
|
|||||||
M3EditTextPreference.PREFERENCE_DIALOG_FRAGMENT_TAG
|
M3EditTextPreference.PREFERENCE_DIALOG_FRAGMENT_TAG
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
is ListPreference -> {
|
is ListPreference -> {
|
||||||
val dialogFragment = M3ListPreference.newInstance(preference.getKey())
|
val dialogFragment = M3ListPreference.newInstance(preference.getKey())
|
||||||
dialogFragment.setTargetFragment(this, 0)
|
dialogFragment.setTargetFragment(this, 0)
|
||||||
@@ -36,6 +37,7 @@ abstract class BasePreferenceFragment : PreferenceFragmentCompat() {
|
|||||||
M3ListPreference.PREFERENCE_DIALOG_FRAGMENT_TAG
|
M3ListPreference.PREFERENCE_DIALOG_FRAGMENT_TAG
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> super.onDisplayPreferenceDialog(preference)
|
else -> super.onDisplayPreferenceDialog(preference)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,11 @@ class UIPreference : BasePreferenceFragment() {
|
|||||||
if (isTAndAbove) {
|
if (isTAndAbove) {
|
||||||
summary = Locale.getDefault().displayName
|
summary = Locale.getDefault().displayName
|
||||||
setOnPreferenceClickListener {
|
setOnPreferenceClickListener {
|
||||||
startActivity(Intent(Settings.ACTION_APP_LOCALE_SETTINGS).apply {
|
startActivity(
|
||||||
data = ("package:" + requireContext().packageName).toUri()
|
Intent(Settings.ACTION_APP_LOCALE_SETTINGS).apply {
|
||||||
})
|
data = ("package:" + requireContext().packageName).toUri()
|
||||||
|
}
|
||||||
|
)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import com.google.android.material.textfield.TextInputLayout
|
|||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class ProxyURLDialog: DialogFragment() {
|
class ProxyURLDialog : DialogFragment() {
|
||||||
|
|
||||||
private val viewModel: ProxyURLViewModel by viewModels()
|
private val viewModel: ProxyURLViewModel by viewModels()
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ class ProxyURLDialog: DialogFragment() {
|
|||||||
.setView(view)
|
.setView(view)
|
||||||
.setPositiveButton(getString(R.string.set), null)
|
.setPositiveButton(getString(R.string.set), null)
|
||||||
.setNeutralButton(getString(R.string.disable), null)
|
.setNeutralButton(getString(R.string.disable), null)
|
||||||
.setNegativeButton(getString(android.R.string.cancel)) { _, _ -> dialog?.dismiss()}
|
.setNegativeButton(getString(android.R.string.cancel)) { _, _ -> dialog?.dismiss() }
|
||||||
.create()
|
.create()
|
||||||
|
|
||||||
alertDialog.setOnShowListener {
|
alertDialog.setOnShowListener {
|
||||||
|
|||||||
@@ -54,7 +54,10 @@ class UpdatesPreference : BasePreferenceFragment() {
|
|||||||
|
|
||||||
val updatesEnabled = Preferences.getInteger(requireContext(), PREFERENCE_UPDATES_AUTO) != 0
|
val updatesEnabled = Preferences.getInteger(requireContext(), PREFERENCE_UPDATES_AUTO) != 0
|
||||||
|
|
||||||
findPreference<ListPreference>(PREFERENCE_UPDATES_AUTO)?.setOnPreferenceChangeListener { _, newValue ->
|
findPreference<ListPreference>(PREFERENCE_UPDATES_AUTO)?.setOnPreferenceChangeListener {
|
||||||
|
_,
|
||||||
|
newValue
|
||||||
|
->
|
||||||
when (UpdateMode.entries[newValue.toString().toInt()]) {
|
when (UpdateMode.entries[newValue.toString().toInt()]) {
|
||||||
UpdateMode.DISABLED -> {
|
UpdateMode.DISABLED -> {
|
||||||
handleAutoUpdateDependentPrefs(false)
|
handleAutoUpdateDependentPrefs(false)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class UpdatesRestrictionsDialog : DialogFragment() {
|
|||||||
.setTitle(R.string.pref_updates_restrictions_title)
|
.setTitle(R.string.pref_updates_restrictions_title)
|
||||||
.setMessage(R.string.pref_updates_restrictions_desc)
|
.setMessage(R.string.pref_updates_restrictions_desc)
|
||||||
.setView(view)
|
.setView(view)
|
||||||
.setPositiveButton(getString(android.R.string.ok)) { _, _ -> dialog?.dismiss()}
|
.setPositiveButton(getString(android.R.string.ok)) { _, _ -> dialog?.dismiss() }
|
||||||
.create()
|
.create()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,16 +65,17 @@ class AppMenuSheet : BaseDialogSheet<SheetAppMenuBinding>() {
|
|||||||
val isBlacklisted: Boolean = viewModel.blacklistProvider.isBlacklisted(args.app.packageName)
|
val isBlacklisted: Boolean = viewModel.blacklistProvider.isBlacklisted(args.app.packageName)
|
||||||
|
|
||||||
with(binding.navigationView) {
|
with(binding.navigationView) {
|
||||||
//Switch strings for Add/Remove Blacklist
|
// Switch strings for Add/Remove Blacklist
|
||||||
val blackListMenu: MenuItem = menu.findItem(R.id.action_blacklist)
|
val blackListMenu: MenuItem = menu.findItem(R.id.action_blacklist)
|
||||||
blackListMenu.setTitle(
|
blackListMenu.setTitle(
|
||||||
if (isBlacklisted)
|
if (isBlacklisted) {
|
||||||
R.string.action_whitelist
|
R.string.action_whitelist
|
||||||
else
|
} else {
|
||||||
R.string.action_blacklist_add
|
R.string.action_blacklist_add
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
//Show/Hide actions based on installed status
|
// Show/Hide actions based on installed status
|
||||||
val installed = PackageUtil.isInstalled(requireContext(), args.app.packageName)
|
val installed = PackageUtil.isInstalled(requireContext(), args.app.packageName)
|
||||||
menu.findItem(R.id.action_uninstall).isVisible = installed
|
menu.findItem(R.id.action_uninstall).isVisible = installed
|
||||||
menu.findItem(R.id.action_local).isVisible = installed
|
menu.findItem(R.id.action_local).isVisible = installed
|
||||||
@@ -82,7 +83,6 @@ class AppMenuSheet : BaseDialogSheet<SheetAppMenuBinding>() {
|
|||||||
setNavigationItemSelectedListener { item ->
|
setNavigationItemSelectedListener { item ->
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.action_blacklist -> {
|
R.id.action_blacklist -> {
|
||||||
|
|
||||||
if (isBlacklisted) {
|
if (isBlacklisted) {
|
||||||
viewModel.blacklistProvider.whitelist(args.app.packageName)
|
viewModel.blacklistProvider.whitelist(args.app.packageName)
|
||||||
requireContext().toast(R.string.toast_apk_whitelisted)
|
requireContext().toast(R.string.toast_apk_whitelisted)
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ abstract class BaseDialogSheet<ViewBindingType : ViewBinding> : BottomSheetDialo
|
|||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
val type =
|
val type = (javaClass.genericSuperclass as ParameterizedType)
|
||||||
(javaClass.genericSuperclass as ParameterizedType).actualTypeArguments[0] as Class<ViewBindingType>
|
.actualTypeArguments[0] as Class<ViewBindingType>
|
||||||
|
|
||||||
val method = type.getMethod(
|
val method = type.getMethod(
|
||||||
"inflate",
|
"inflate",
|
||||||
|
|||||||
@@ -38,10 +38,7 @@ class NetworkDialogSheet : BaseDialogSheet<SheetNetworkBinding>() {
|
|||||||
const val TAG = "NetworkDialogSheet"
|
const val TAG = "NetworkDialogSheet"
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(): NetworkDialogSheet {
|
fun newInstance(): NetworkDialogSheet = NetworkDialogSheet().apply {
|
||||||
return NetworkDialogSheet().apply {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ abstract class BaseFlavouredSplashFragment : BaseFragment<FragmentSplashBinding>
|
|||||||
|
|
||||||
val canLoginWithMicroG: Boolean
|
val canLoginWithMicroG: Boolean
|
||||||
get() = PackageUtil.hasSupportedMicroGVariant(requireContext()) &&
|
get() = PackageUtil.hasSupportedMicroGVariant(requireContext()) &&
|
||||||
Preferences.getBoolean(requireContext(), PREFERENCE_MICROG_AUTH, true)
|
Preferences.getBoolean(requireContext(), PREFERENCE_MICROG_AUTH, true)
|
||||||
|
|
||||||
val startForAccount =
|
val startForAccount =
|
||||||
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
||||||
@@ -61,7 +61,7 @@ abstract class BaseFlavouredSplashFragment : BaseFragment<FragmentSplashBinding>
|
|||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View {
|
): View {
|
||||||
_binding = FragmentSplashBinding.inflate(inflater, container, false)
|
viewBindingType = FragmentSplashBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +180,9 @@ abstract class BaseFlavouredSplashFragment : BaseFragment<FragmentSplashBinding>
|
|||||||
}
|
}
|
||||||
|
|
||||||
1 -> SplashFragmentDirections.actionSplashFragmentToGamesContainerFragment()
|
1 -> SplashFragmentDirections.actionSplashFragmentToGamesContainerFragment()
|
||||||
|
|
||||||
2 -> SplashFragmentDirections.actionSplashFragmentToUpdatesFragment()
|
2 -> SplashFragmentDirections.actionSplashFragmentToUpdatesFragment()
|
||||||
|
|
||||||
else -> SplashFragmentDirections.actionSplashFragmentToNavigationApps()
|
else -> SplashFragmentDirections.actionSplashFragmentToNavigationApps()
|
||||||
}
|
}
|
||||||
requireActivity().viewModelStore.clear() // Clear ViewModelStore to avoid bugs with logout
|
requireActivity().viewModelStore.clear() // Clear ViewModelStore to avoid bugs with logout
|
||||||
|
|||||||
@@ -89,12 +89,15 @@ class UpdatesFragment : BaseFragment<FragmentUpdatesBinding>() {
|
|||||||
viewModel.updates
|
viewModel.updates
|
||||||
.combine(viewModel.downloadsList) { uList, dList ->
|
.combine(viewModel.downloadsList) { uList, dList ->
|
||||||
uList?.associateWith { a ->
|
uList?.associateWith { a ->
|
||||||
dList.find { it.packageName == a.packageName && it.versionCode == a.versionCode }
|
dList.find {
|
||||||
|
it.packageName == a.packageName && it.versionCode == a.versionCode
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.collectLatest { map ->
|
}.collectLatest { map ->
|
||||||
updateController(map)
|
updateController(map)
|
||||||
viewModel.updateAllEnqueued =
|
viewModel.updateAllEnqueued = map?.values?.all {
|
||||||
map?.values?.all { it?.isRunning == true } ?: false
|
it?.isRunning == true
|
||||||
|
} ?: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,10 +146,11 @@ class UpdatesFragment : BaseFragment<FragmentUpdatesBinding>() {
|
|||||||
.id("header_all")
|
.id("header_all")
|
||||||
.title(
|
.title(
|
||||||
"${appList.size} " +
|
"${appList.size} " +
|
||||||
if (appList.size == 1)
|
if (appList.size == 1) {
|
||||||
getString(R.string.update_available)
|
getString(R.string.update_available)
|
||||||
else
|
} else {
|
||||||
getString(R.string.updates_available)
|
getString(R.string.updates_available)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
.action(
|
.action(
|
||||||
if (viewModel.updateAllEnqueued) {
|
if (viewModel.updateAllEnqueued) {
|
||||||
|
|||||||
Reference in New Issue
Block a user