Fix issues with displaying skins. Fixes #1299

This commit is contained in:
Phillip Thelen 2020-04-16 13:02:16 +02:00
parent fb39ef7b0b
commit 7432944313
7 changed files with 28 additions and 15 deletions

View file

@ -162,7 +162,7 @@ android {
multiDexEnabled true
resConfigs "en", "bg", "de", "en-rGB", "es", "fr", "hr-rHR", "in", "it", "iw", "ja", "ko", "lt", "nl", "pl", "pt-rBR", "pt-rPT", "ru", "tr", "zh", "zh-rTW"
versionCode 2402
versionCode 2404
versionName "2.5"
}

View file

@ -30,6 +30,7 @@ class CustomizationRecyclerViewAdapter : androidx.recyclerview.widget.RecyclerVi
var userSize: String? = null
var hairColor: String? = null
var gemBalance: Int = 0
var unsortedCustomizations: List<Customization> = ArrayList()
var customizationList: MutableList<Any> = ArrayList()
set(value) {
field = value
@ -50,6 +51,7 @@ class CustomizationRecyclerViewAdapter : androidx.recyclerview.widget.RecyclerVi
fun updateOwnership(ownedCustomizations: List<String>) {
this.ownedCustomiztations = ownedCustomizations
setCustomizations(unsortedCustomizations)
notifyDataSetChanged()
}
@ -90,9 +92,16 @@ class CustomizationRecyclerViewAdapter : androidx.recyclerview.widget.RecyclerVi
}
fun setCustomizations(newCustomizationList: List<Customization>) {
unsortedCustomizations = newCustomizationList
this.customizationList = ArrayList()
var lastSet = CustomizationSet()
val today = Date()
for (customization in newCustomizationList.reversed()) {
if (customization.availableFrom != null || customization.availableUntil != null) {
if ((customization.availableFrom?.compareTo(today) ?: 0 > 0 || customization.availableUntil?.compareTo(today) ?: 0 < 0) && !customization.isUsable(ownedCustomiztations.contains(customization.identifier))) {
continue
}
}
if (customization.customizationSet != null && customization.customizationSet != lastSet.identifier) {
val set = CustomizationSet()
set.identifier = customization.customizationSet

View file

@ -118,7 +118,7 @@ class AvatarCustomizationFragment : BaseMainFragment() {
private fun loadCustomizations() {
val type = this.type ?: return
compositeSubscription.add(customizationRepository.getCustomizations(type, category, true).subscribe(Consumer<RealmResults<Customization>> { adapter.setCustomizations(it) }, RxErrorHandler.handleEmptyError()))
compositeSubscription.add(customizationRepository.getCustomizations(type, category, false).subscribe(Consumer<RealmResults<Customization>> { adapter.setCustomizations(it) }, RxErrorHandler.handleEmptyError()))
if (type == "hair" && (category == "beard" || category == "mustache")) {
val otherCategory = if (category == "mustache") "beard" else "mustache"
compositeSubscription.add(customizationRepository.getCustomizations(type, otherCategory, true).subscribe(Consumer<RealmResults<Customization>> { adapter.additionalSetItems = it }, RxErrorHandler.handleEmptyError()))

View file

@ -90,6 +90,13 @@ class InboxMessageListFragment : BaseMainFragment(), androidx.swiperefreshlayout
communityGuidelinesView.visibility = View.GONE
}
override fun onResume() {
if (replyToUserUUID?.isNotBlank() != true && chatRoomUser?.isNotBlank() != true) {
fragmentManager?.popBackStack()
}
super.onResume()
}
override fun onAttach(context: Context) {
view?.invalidate()
view?.forceLayout()

View file

@ -2,6 +2,7 @@ package com.habitrpg.android.habitica.ui.fragments.support
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
@ -97,16 +98,13 @@ class BugFixFragment: BaseMainFragment() {
bodyOfEmail += " \nDetails:\n"
activity?.let {
val email = Intent(Intent.ACTION_SEND)
email.putExtra(Intent.EXTRA_EMAIL, arrayOf<String>(appConfigManager.supportEmail()))
email.putExtra(Intent.EXTRA_SUBJECT, subject)
email.putExtra(Intent.EXTRA_TEXT, bodyOfEmail)
val emailIntent = Intent(Intent.ACTION_SENDTO)
val mailto = "mailto:" + appConfigManager.supportEmail() +
"&subject=" + Uri.encode(subject) +
"&body=" + Uri.encode(bodyOfEmail)
emailIntent.data = Uri.parse(mailto);
//need this to prompts email client only
//need this to prompts email client only
email.type = "message/rfc822"
startActivity(Intent.createChooser(email, "Choose an Email client :"))
startActivity(Intent.createChooser(emailIntent, "Choose an Email client :"))
}
}
}

View file

@ -117,11 +117,10 @@ class SupportMainFragment : BaseMainFragment() {
activity?.let {
val emailIntent = Intent(Intent.ACTION_SENDTO)
val mailto = "mailto:bob@example.org" +
"?cc=" + "alice@example.com" +
val mailto = "mailto:" + appConfigManager.supportEmail() +
"&subject=" + Uri.encode(subject) +
"&body=" + Uri.encode(bodyOfEmail)
emailIntent.setData(Uri.parse(mailto));
emailIntent.data = Uri.parse(mailto);
startActivity(Intent.createChooser(emailIntent, "Choose an Email client :"))
}

View file

@ -75,7 +75,7 @@ class InboxViewModel(recipientID: String?, recipientUsername: String?) : BaseVie
if (recipientID?.isNotBlank() == true) {
setMemberID(recipientID)
loadMemberFromLocal()
} else {
} else if (recipientUsername?.isNotBlank() == true) {
socialRepository.getMemberWithUsername(recipientUsername).subscribe(Consumer {
setMemberID(it.id ?: "")
member.value = it