NoAppView: Use string resources directly to show messages
Also localize "No apps available" string Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -61,7 +61,7 @@ open class GenericCarouselController(private val callbacks: Callbacks) :
|
||||
NoAppViewModel_()
|
||||
.id("no_app")
|
||||
.icon(R.drawable.ic_apps)
|
||||
.message("No apps available")
|
||||
.message(R.string.no_apps_available)
|
||||
)
|
||||
} else {
|
||||
if (streamBundle.streamClusters.size == 1) {
|
||||
@@ -98,4 +98,4 @@ open class GenericCarouselController(private val callbacks: Callbacks) :
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ package com.aurora.store.view.epoxy.views.app
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import com.airbnb.epoxy.CallbackProp
|
||||
@@ -41,15 +43,13 @@ class NoAppView @JvmOverloads constructor(
|
||||
) : BaseView<ViewNoAppBinding>(context, attrs, defStyleAttr) {
|
||||
|
||||
@ModelProp
|
||||
fun message(message: String) {
|
||||
binding.txt.text = message
|
||||
fun message(@StringRes message: Int) {
|
||||
binding.txt.text = context.getString(message)
|
||||
}
|
||||
|
||||
@ModelProp
|
||||
fun icon(icon: Int?) {
|
||||
icon?.let {
|
||||
binding.img.setImageDrawable(ContextCompat.getDrawable(context, icon))
|
||||
}
|
||||
fun icon(@DrawableRes icon: Int) {
|
||||
binding.img.setImageDrawable(ContextCompat.getDrawable(context, icon))
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
@@ -60,8 +60,8 @@ class NoAppView @JvmOverloads constructor(
|
||||
|
||||
@JvmOverloads
|
||||
@ModelProp
|
||||
fun actionMessage(message: String = String()) {
|
||||
binding.button.text = message
|
||||
fun actionMessage(@StringRes message: Int? = null) {
|
||||
message?.let { binding.button.text = context.getString(message) }
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
|
||||
@@ -96,7 +96,7 @@ class FavouriteFragment : BaseFragment<FragmentFavouriteBinding>() {
|
||||
NoAppViewModel_()
|
||||
.id("no_app")
|
||||
.icon(R.drawable.ic_favorite_unchecked)
|
||||
.message(getString(R.string.details_no_favourites))
|
||||
.message(R.string.details_no_favourites)
|
||||
)
|
||||
} else {
|
||||
favourites.forEach {
|
||||
|
||||
@@ -93,7 +93,7 @@ class DownloadFragment : BaseFragment<FragmentDownloadBinding>() {
|
||||
add(
|
||||
NoAppViewModel_()
|
||||
.id("no_downloads")
|
||||
.message(getString(R.string.download_none))
|
||||
.message(R.string.download_none)
|
||||
)
|
||||
} else {
|
||||
downloads.groupBy {
|
||||
|
||||
@@ -175,7 +175,7 @@ class SearchResultsFragment : BaseFragment<FragmentSearchResultBinding>(),
|
||||
add(
|
||||
NoAppViewModel_()
|
||||
.id("no_app")
|
||||
.message(getString(R.string.details_no_app_match))
|
||||
.message(R.string.details_no_app_match)
|
||||
.icon(R.drawable.ic_round_search)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -116,9 +116,9 @@ class UpdatesFragment : BaseFragment<FragmentUpdatesBinding>() {
|
||||
NoAppViewModel_()
|
||||
.id("no_update")
|
||||
.icon(R.drawable.ic_updates)
|
||||
.message(getString(R.string.details_no_updates))
|
||||
.message(R.string.details_no_updates)
|
||||
.showAction(true)
|
||||
.actionMessage(getString(R.string.check_updates))
|
||||
.actionMessage(R.string.check_updates)
|
||||
.actionCallback { _ -> viewModel.fetchUpdates() }
|
||||
)
|
||||
} else {
|
||||
|
||||
@@ -363,6 +363,7 @@
|
||||
<string name="app_link_android_market" translatable="false">market.android.com</string>
|
||||
<string name="android_market_desc">Android Market was an online store offering software applications designed for Android devices, retired in 2017.</string>
|
||||
<string name="failed_apk_export">Failed to export APKs</string>
|
||||
<string name="no_apps_available">No apps available</string>
|
||||
|
||||
<!-- InstallerFragment -->
|
||||
<string name="session_installer_subtitle">Session based installer for bundled/split APKs</string>
|
||||
|
||||
Reference in New Issue
Block a user