Fix grammar mistake on empty Special items page (#1326)

* Fix grammar mistake on empty Special items page

When you have no special items the following message is displayed
You don't have any Special
This commit changes that to the following
You don't have any Special items.

Or the equivilant in the user's language

* Allow support of RTL languages for special items

Previously the "you do not have any special items" message on the
items screen would not be compatible with right to left languages.
This change will allow proper display of the message after translation.

* refactoring for better expressivity
This commit is contained in:
Kristian Welsh 2020-06-10 15:48:36 +01:00 committed by GitHub
parent 2bbb198e3d
commit 36d7884ee0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 18 deletions

View file

@ -455,6 +455,7 @@
<string name="inbox">Messages</string>
<string name="notifications">Notifications</string>
<string name="special">Special</string>
<string name="special_items">Special items</string>
<string name="gem_for_gold_description">Because you subscribe to Habitica, you can purchase a number of Gems each month using Gold.</string>
<string name="gem_shop">Gem</string>
<string name="mystery_item">Mystery Item</string>

View file

@ -53,30 +53,22 @@ class ItemsFragment : BaseMainFragment() {
viewPager?.adapter = object : FragmentPagerAdapter(fragmentManager) {
override fun getItem(position: Int): androidx.fragment.app.Fragment {
val fragment = ItemRecyclerFragment()
when (position) {
0 -> {
fragment.itemType = "eggs"
}
1 -> {
fragment.itemType = "hatchingPotions"
}
2 -> {
fragment.itemType = "food"
}
3 -> {
fragment.itemType = "quests"
}
4 -> {
fragment.itemType = "special"
}
fragment.itemType = when (position) {
0 -> "eggs"
1 -> "hatchingPotions"
2 -> "food"
3 -> "quests"
4 -> "special"
else -> ""
}
fragment.isHatching = false
fragment.isFeeding = false
fragment.itemTypeText = this.getPageTitle(position).toString()
fragment.user = this@ItemsFragment.user
fragment.itemTypeText =
if (position == 4) getString(R.string.special_items)
else this.getPageTitle(position).toString()
return fragment
}