desgin tweaks

This commit is contained in:
Phillip Thelen 2020-04-10 13:16:17 +02:00
parent 824f61fa4d
commit b56c16654b
22 changed files with 149 additions and 96 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 2396
versionCode 2398
versionName "2.5"
}

View file

@ -11,26 +11,27 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
android:paddingStart="30dp"
android:paddingEnd="30dp"
android:paddingTop="@dimen/spacing_large"
android:paddingBottom="@dimen/spacing_large">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/black"
style="@style/Headline6"
android:id="@+id/questionTextView"
android:layout_gravity="center_horizontal"
android:padding="@dimen/card_padding"/>
android:layout_gravity="center_horizontal"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/answerTextView"
android:layout_gravity="center_horizontal"
android:paddingLeft="@dimen/card_padding"
android:paddingStart="@dimen/card_padding"
android:paddingEnd="@dimen/card_padding"
android:paddingRight="@dimen/card_padding"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginTop="12dp"
android:textColor="@color/gray_200"
style="@style/Subheader3"
/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -100,21 +100,38 @@
android:layout_height="wrap_content"
android:text="@string/common_questions"
style="@style/SectionHeaderCaps"
android:layout_marginTop="@dimen/spacing_large"/>
android:layout_marginTop="@dimen/spacing_large"
android:layout_marginBottom="@dimen/spacing_medium"/>
<LinearLayout
android:id="@+id/faq_linear_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="32dp"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:paddingBottom="32dp"
android:orientation="vertical"
android:background="@color/gray_700"
android:layout_marginTop="@dimen/spacing_large"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/still_questions"
android:textColor="@color/black"
style="@style/Subheader3"
android:layout_marginBottom="@dimen/spacing_small"/>
<TextView
android:id="@+id/more_help_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_large"
android:paddingTop="@dimen/spacing_large"
android:paddingStart="@dimen/spacing_large"
android:paddingEnd="@dimen/spacing_large"
android:paddingBottom="@dimen/spacing_large"
android:background="@color/gray_700"/>
android:textSize="14sp"
android:textColor="@color/gray_50"
android:gravity="center"/>
</LinearLayout>
</LinearLayout>
</ScrollView>

View file

@ -86,8 +86,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="3 Participants"
android:textColor="@color/gray_300"
android:visibility="gone"/>
android:textColor="@color/gray_300" />
</LinearLayout>
<ImageView
android:layout_width="wrap_content"

View file

@ -3,34 +3,25 @@
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/support_bug_title"
android:textSize="13sp"
android:textColor="@color/gray_200"
android:paddingTop="13dp"
android:paddingBottom="13dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:layout_margin="@dimen/spacing_medium"
android:gravity="center"
android:background="@color/gray_700"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/common_fixes"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginTop="@dimen/spacing_large"
android:layout_marginBottom="12dp"
style="@style/SectionHeaderCaps"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:padding="19dp"
android:orientation="vertical"
android:background="@drawable/layout_rounded_bg_gray_700"
android:layout_margin="@dimen/spacing_medium">
android:layout_marginLeft="@dimen/spacing_medium"
android:layout_marginRight="@dimen/spacing_medium"
android:layout_marginBottom="@dimen/spacing_medium">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -47,10 +38,12 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:padding="19dp"
android:orientation="vertical"
android:background="@drawable/layout_rounded_bg_gray_700"
android:layout_margin="@dimen/spacing_medium">
android:layout_marginLeft="@dimen/spacing_medium"
android:layout_marginRight="@dimen/spacing_medium"
android:layout_marginBottom="@dimen/spacing_medium">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -67,10 +60,12 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:padding="19dp"
android:orientation="vertical"
android:background="@drawable/layout_rounded_bg_gray_700"
android:layout_margin="@dimen/spacing_medium">
android:layout_marginLeft="@dimen/spacing_medium"
android:layout_marginRight="@dimen/spacing_medium"
android:layout_marginBottom="@dimen/spacing_medium">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View file

@ -29,6 +29,7 @@
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large"
style="@style/Subheader2"
android:letterSpacing="0.015"
android:textColor="@color/black"
/>
<TextView
@ -36,9 +37,10 @@
android:layout_height="wrap_content"
android:text="@string/using_habitica_description"
style="@style/Body2"
android:lineSpacingExtra="3sp"
android:textColor="@color/gray_50"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:gravity="center"
android:layout_marginTop="6dp"
android:layout_marginBottom="16dp"
@ -55,8 +57,7 @@
android:background="@drawable/support_info_lower_bg"
android:textColor="@color/white"
android:textAllCaps="false"
android:textStyle="bold"
android:textSize="12sp"
style="@style/Subheader1"
/>
</LinearLayout>
<LinearLayout
@ -84,9 +85,10 @@
android:layout_height="wrap_content"
android:text="@string/bugs_fixes_description"
style="@style/Body2"
android:lineSpacingExtra="3sp"
android:textColor="@color/gray_50"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:gravity="center"
android:layout_marginTop="6dp"
android:layout_marginBottom="16dp"
@ -103,8 +105,7 @@
android:background="@drawable/support_info_lower_bg"
android:textColor="@color/white"
android:textAllCaps="false"
android:textStyle="bold"
android:textSize="12sp"
style="@style/Subheader1"
/>
</LinearLayout>
<LinearLayout
@ -132,9 +133,10 @@
android:layout_height="wrap_content"
android:text="@string/suggestions_feedback_description"
style="@style/Body2"
android:lineSpacingExtra="3sp"
android:textColor="@color/gray_50"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:gravity="center"
android:layout_marginTop="6dp"
android:layout_marginBottom="16dp"
@ -151,8 +153,7 @@
android:background="@drawable/support_info_lower_bg"
android:textColor="@color/white"
android:textStyle="bold"
android:textAllCaps="false"
android:textSize="12sp"
style="@style/Subheader1"
/>
</LinearLayout>
</LinearLayout>

View file

@ -10,7 +10,7 @@
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/icon_view"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_margin="8dp" />
<LinearLayout

View file

@ -11,7 +11,7 @@
<string name="sidebar_guilds">Guilds</string>
<string name="sidebar_challenges">Challenges</string>
<string name="sidebar_section_inventory">Inventory</string>
<string name="sidebar_avatar">Avatar</string>
<string name="sidebar_avatar">Avatar Customization</string>
<string name="sidebar_equipment">Equipment</string>
<string name="sidebar_stable">Pets &amp; Mounts</string>
<string name="sidebar_news">News</string>

View file

@ -530,6 +530,7 @@
<string name="leave_party">Leave Party</string>
<string name="party_description">Party Description</string>
<string name="number_participants">%1$d Participants</string>
<string name="number_responded">%1$d/%2$d Responded</string>
<string name="welcome_back">Welcome Back</string>
<string name="yesterdaililes_prompt">Check off any Dailies you did yesterday:</string>
<string name="start_day">Start My Day</string>
@ -956,7 +957,7 @@
<string name="not_participating">You are not participating</string>
<string name="quest_completed">Quest completed!</string>
<string name="using_habitica">Using Habitica</string>
<string name="using_habitica_description">Confused? Well go over the basics to get you up to speed.</string>
<string name="using_habitica_description">Well explain the basics and answer common questions to get you up to speed</string>
<string name="suggestions_feedback_description">Have input on how features could work better or an idea for something new? Tell us!</string>
<string name="contact_us">Contact Us</string>
<string name="get_help">Get Help</string>
@ -971,24 +972,24 @@
<string name="how_best_habitica">Not sure how to best use Habitica?</string>
<string name="stats_currency"><![CDATA[Stats & Currency]]></string>
<string name="health_points">Health Points</string>
<string name="health_description">This represents your avatars life. Missing a Daily or doing a negative Habit **reduces your HP**.\n\n**Regain HP** by completing tasks, using a Health Potion, or a healing ability.\n\nIf your **HP reaches 0** your avatar will pass out (lose a level, all Gold, and one piece of equipment). Lost equipment can be re-purchased.</string>
<string name="health_description">This represents your avatars life. Missing a Daily or doing a negative Habit **reduces your HP**.\n\n**Regain HP** by leveling up, using a Health Potion, or a class skill with healing ability.\n\nIf your **HP reaches 0** you will lose a level, all Gold, and one piece of equipment. Lost equipment can be re-purchased.</string>
<string name="experience_points">Experience Points</string>
<string name="experience_description">Experience points represent your progress and allows you to level up. Youll mainly **gain EXP** from completing tasks or quests.\n\nHigher difficulty or red colored tasks will give you **more EXP**. The **Intelligence** stat also raises your EXP gain.</string>
<string name="experience_description">Experience points represent your progress and allow you to level up. Youll mainly **gain EXP** from completing tasks or quests, but there are also some class skills that give EXP.\n\nTasks of higher difficulty, or red-colored tasks will give you **more EXP**. The **Intelligence stat** also raises your rate of EXP gain.</string>
<string name="mana_points">Mana Points</string>
<string name="gold_description">Gold is the **main form of currency** within Habitica and allows you to buy certain gear, quests, items, or even custom rewards you make for yourself.\n\n**Earn Gold** through completing tasks or quests. **Perception** raises the amount of Gold you earn. Rogues can also use an ability to get more Gold.\n\nIf you subscribe to Habitica, you can even use Gold to purchase Gems.</string>
<string name="mana_description">Mana points are unlocked with the class system at level 10 and allow you to **use Skills**.\n\nSome **MP is restored** naturally every day, but you can regain more by completing tasks or using a Mage ability.</string>
<string name="gold_description">Gold is the **main form of currency** within Habitica and allows you to buy certain gear, quests, items, or even custom rewards you make for yourself.\n\n**Earn Gold** through completing tasks or quests, or through some Class skills. Higher **Perception stats** raise the amount of Gold you earn.\n\nIf you subscribe to Habitica, you can even use Gold to purchase a number of Gems determined by the length of time youve been subscribed.</string>
<string name="mana_description">Mana points are unlocked with the class system at level 10 and allow you to **use Skills** once you begin learning them at level 11.\n\nSome **MP is restored** at day reset every day, but you can regain more by completing tasks or using a Mage class skill.</string>
<string name="stat_allocation">Stat Allocation</string>
<string name="stat_description">All Habitica characters have four stats that affect the gameplay aspects of Habitica.\n\n**Strength (STR)** affects critical hits and raises damage done to a Quest Boss. Mainly for Warriors and Rogues.\n\n**Constitution (CON)** raises your HP and makes you take less damage. Mainly for Healers and Warriors.\n\n**Intelligence (INT)** raises the amount of EXP you earn and gives you more Mana. Mainly for Mages and Healers.\n\n**Perception (PER)** increases the gold you earn and the rate of finding items. Mainly for Rogues and Mages.\nnAfter level 10, you earn 1 Stat Point every level you gain that you can put into any stat youd like. You can also equip gear that has different combinations of stat boosts.</string>
<string name="stat_description">All Habitica characters have four stats that affect the gameplay aspects of Habitica.\n\n**Strength (STR)** affects critical hits and raises damage done to a Quest Boss. Warriors and Rogues gain STR from their class equipment.\n\n**Constitution (CON)** raises your HP and makes you take less damage. Healers and Warriors gain CON from their class equipment.\n\n**Intelligence (INT)** raises the amount of EXP you earn and gives you more Mana. Mages and Healers gain INT from their class equipment.\n\n**Perception (PER)** increases the gold you earn and the rate of finding dropped items.Rogues and Mages gain PER from their class equipment.\n\nAfter level 10, you earn 1 Stat Point every level you gain that you can put into any stat youd like. You can also equip gear that has different combinations of stat boosts.</string>
<string name="standard"> Standard </string>
<string name="premium_currency">Premium Currency</string>
<string name="currency">Currency</string>
<string name="gems_description">Gems are a currency purchased with real money that allow you to buy extra content within Habitica and are one of the main source of financial support for the Habitica team alongside subscriptions.\n\nAll content purchased through Gems is purely cosmetic or can be obtained for free with time.\n\nYou can also receive Gems through gifts, Challenge prizes, contributing work to Habitica, or subscribing.</string>
<string name="gems_description">Gems are a currency purchased with real money that allow you to buy extra content within Habitica and are one of the main sources of financial support for the Habitica team alongside subscriptions.\n\nAll content purchased through Gems is purely cosmetic or can be obtained for free with time.\n\nYou can also receive Gems through gifts from other players, Challenge prizes, contributing to Habitica, or subscribing.</string>
<string name="common_questions">Common Questions</string>
<string name="game_mechanics">Game Mechanics</string>
<string name="subscriber_currency">Subscriber Currency</string>
<string name="mystic_hourglasses">Mystic Hourglasses</string>
<string name="hourglasses_description">Mystic Hourglasses are an extremely rare form of currency you can only receive for subscribing to Habitica. They are used in the Time Travelers shop to buy past gear sets, pets, mounts, animated backgrounds, or even special quests.\n\nYou can receive up to four Mystic Hourglasses a year. The time they are rewarded is based on your subscription renewal schedule. They are sent out on the first day of a new month after your last subscription payment that qualified you for an hourglass. See the [Subscription] page for more details.</string>
<string name="hourglasses_description">Mystic Hourglasses are an extremely rare form of currency you can only receive for subscribing to Habitica for three consecutive months or more. They are used in the Time Travelers shop to buy past gear sets, pets, mounts, animated backgrounds, or even special quests.\n\nYou can receive up to four Mystic Hourglasses a year. The time they are rewarded is based on your subscription renewal schedule. They are sent out on the first day of a new month after your last subscription payment that qualified you for an hourglass. See the [Subscription] page for more details.</string>
<string name="clear_cache">Clear your Cache</string>
<string name="clear_cache_description"><![CDATA[To clear your cache, open your phones Settings app. Go to Storage > Apps > Habitica, then tap Clear Cache.]]></string>
<string name="manual_sync_restart">Manual Sync or Restart</string>
@ -1006,4 +1007,5 @@
<string name="buy_all">Buy All</string>
<string name="read_more">Read More</string>
<string name="purchase_amount_error">You are unable to buy that amount.</string>
<string name="still_questions">Still have a question?</string>
</resources>

View file

@ -51,7 +51,8 @@
<style name="Subheader3">
<item name="android:fontFamily">@string/font_family_regular</item>
<item name="android:textSize">16sp</item>
<item name="android:letterSpacing">0.04</item>
<item name="android:letterSpacing">0.015</item>
<item name="android:lineSpacingExtra">6sp</item>
<item name="android:textColor">?textColorSecondary</item>
</style>
@ -70,7 +71,7 @@
</style>
<style name="Body2">
<item name="android:fontFamily">sans-serif</item>
<item name="android:fontFamily">@string/font_family_regular</item>
<item name="android:textSize">14sp</item>
<item name="android:letterSpacing">0.02</item>
<item name="android:lineSpacingExtra">6sp</item>

View file

@ -294,10 +294,12 @@
</style>
<style name="SectionHeaderCaps">
<item name="android:fontFamily">@string/font_family_medium</item>
<item name="android:textSize">10sp</item>
<item name="android:textColor">@color/gray_200</item>
<item name="android:textAllCaps">true</item>
<item name="android:layout_marginStart">@dimen/spacing_large</item>
<item name="android:letterSpacing">0.08</item>
</style>
<style name="BottomMenu">

View file

@ -290,6 +290,4 @@ class InventoryRepositoryImpl(localRepository: InventoryLocalRepository, apiClie
} else apiClient.togglePinnedItem(item.pinType ?: "", item.path ?: "")
.flatMap { retrieveInAppRewards() }
}
}

View file

@ -1,12 +0,0 @@
package com.habitrpg.android.habitica.models.inventory;
import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;
public class QuestMember extends RealmObject {
@PrimaryKey
public String key;
public Boolean isParticipating;
}

View file

@ -0,0 +1,10 @@
package com.habitrpg.android.habitica.models.inventory
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
open class QuestMember : RealmObject() {
@PrimaryKey
var key: String? = null
var isParticipating: Boolean? = null
}

View file

@ -89,9 +89,7 @@ class ShopFragment : BaseFragment() {
adapter?.selectedGearCategory = user?.stats?.habitClass ?: ""
if (shop == null) {
loadShopInventory()
} else {
if (shop != null) {
adapter?.setShop(shop)
}
adapter?.shopSpriteSuffix = configManager.shopSpriteSuffix()
@ -118,6 +116,11 @@ class ShopFragment : BaseFragment() {
view.post { setGridSpanCount(view.width) }
}
override fun onResume() {
super.onResume()
loadShopInventory()
}
private fun loadShopInventory() {
val shopUrl = when (this.shopIdentifier) {
Shop.MARKET -> "market"

View file

@ -7,6 +7,7 @@ import android.view.ViewGroup
import android.widget.Button
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.core.os.bundleOf
import androidx.lifecycle.Observer
import com.facebook.drawee.view.SimpleDraweeView
@ -210,6 +211,7 @@ class PartyDetailFragment : BaseFragment() {
}
questImageWrapper?.alpha = 1.0f
questProgressView?.alpha = 1.0f
context?.let { questParticipationView?.setTextColor(ContextCompat.getColor(it, R.color.gray_300)) }
if (viewModel?.isQuestActive == true) {
questProgressView?.visibility = View.VISIBLE
questProgressView?.setData(questContent, viewModel?.getGroupData()?.value?.quest?.progress)
@ -219,11 +221,15 @@ class PartyDetailFragment : BaseFragment() {
questParticipationView?.text = context?.getString(R.string.number_participants, questParticipants.size)
} else {
questParticipationView?.text = context?.getString(R.string.not_participating)
context?.let { questParticipationView?.setTextColor(ContextCompat.getColor(it, R.color.red_10)) }
questImageWrapper?.alpha = 0.5f
questProgressView?.alpha = 0.5f
}
} else {
questProgressView?.visibility = View.GONE
val members = viewModel?.getGroupData()?.value?.quest?.members
val responded = members?.filter { it.isParticipating != null }
questParticipationView?.text = context?.getString(R.string.number_responded, responded?.size, members?.size)
}
}

View file

@ -2,7 +2,9 @@ package com.habitrpg.android.habitica.ui.helpers
import android.graphics.Bitmap
import android.graphics.PorterDuff
import android.graphics.drawable.Animatable
import android.view.View
import android.view.ViewGroup
import android.view.animation.Animation
import android.view.animation.Transformation
import android.widget.LinearLayout
@ -14,10 +16,12 @@ import com.facebook.common.executors.CallerThreadExecutor
import com.facebook.common.references.CloseableReference
import com.facebook.datasource.DataSource
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.controller.BaseControllerListener
import com.facebook.drawee.interfaces.DraweeController
import com.facebook.drawee.view.SimpleDraweeView
import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber
import com.facebook.imagepipeline.image.CloseableImage
import com.facebook.imagepipeline.image.ImageInfo
import com.facebook.imagepipeline.request.ImageRequestBuilder
import com.habitrpg.android.habitica.R
import com.habitrpg.android.habitica.helpers.AppConfigManager
@ -42,11 +46,19 @@ object DataBindingUtils {
return
}
view.tag = fullname
val controller: DraweeController = Fresco.newDraweeControllerBuilder()
val builder = Fresco.newDraweeControllerBuilder()
.setUri("https://habitica-assets.s3.amazonaws.com/mobileApp/images/$fullname")
.setControllerListener(object : BaseControllerListener<ImageInfo>() {
override fun onFinalImageSet(id: String?, imageInfo: ImageInfo?, animatable: Animatable?) {
if (imageInfo != null && view.layoutParams.height == ViewGroup.LayoutParams.WRAP_CONTENT) {
view.aspectRatio = imageInfo.width.toFloat() / imageInfo.height
}
super.onFinalImageSet(id, imageInfo, animatable)
}
})
.setAutoPlayAnimations(true)
.setOldController(view.controller)
.build()
val controller: DraweeController = builder.build()
view.controller = controller
}
}

View file

@ -314,7 +314,7 @@ open class NotificationsViewModel : BaseViewModel() {
private fun acceptGroupInvitation(groupId: String?) {
groupId?.let {
disposable.add(socialRepository.joinGroup(it)
.flatMap { userRepository.retrieveUser(false) }
.flatMap { userRepository.retrieveUser(false, forced = true) }
.subscribe(Consumer {
refreshNotifications()
}, RxErrorHandler.handleEmptyError()))
@ -324,7 +324,7 @@ open class NotificationsViewModel : BaseViewModel() {
fun rejectGroupInvite(groupId: String?) {
groupId?.let {
disposable.add(socialRepository.rejectGroupInvite(it)
.flatMap { userRepository.retrieveUser(false) }
.flatMap { userRepository.retrieveUser(false, forced = true) }
.subscribe(Consumer {
refreshNotifications()
}, RxErrorHandler.handleEmptyError()))
@ -334,7 +334,7 @@ open class NotificationsViewModel : BaseViewModel() {
private fun acceptQuestInvitation() {
party?.id?.let {
disposable.add(socialRepository.acceptQuest(null, it)
.flatMap { userRepository.retrieveUser(false) }
.flatMap { userRepository.retrieveUser(false, forced = true) }
.subscribe(Consumer {
refreshNotifications()
}, RxErrorHandler.handleEmptyError()))
@ -344,7 +344,7 @@ open class NotificationsViewModel : BaseViewModel() {
private fun rejectQuestInvitation() {
party?.id?.let {
disposable.add(socialRepository.rejectQuest(null, it)
.flatMap { userRepository.retrieveUser(false) }
.flatMap { userRepository.retrieveUser(false, forced = true) }
.subscribe(Consumer {
refreshNotifications()
}, RxErrorHandler.handleEmptyError()))

View file

@ -3,13 +3,16 @@ package com.habitrpg.android.habitica.ui.viewmodels
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.habitrpg.android.habitica.components.UserComponent
import com.habitrpg.android.habitica.events.ShowSnackbarEvent
import com.habitrpg.android.habitica.extensions.filterOptionalDoOnEmpty
import com.habitrpg.android.habitica.helpers.RxErrorHandler
import com.habitrpg.android.habitica.models.members.Member
import com.habitrpg.android.habitica.ui.views.HabiticaSnackbar
import io.reactivex.BackpressureStrategy
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.realm.RealmResults
import org.greenrobot.eventbus.EventBus
class PartyViewModel: GroupViewModel() {
@ -46,7 +49,12 @@ class PartyViewModel: GroupViewModel() {
groupIDSubject.value?.value?.let {
disposable.add(socialRepository.acceptQuest(null, it)
.flatMap { userRepository.retrieveUser() }
.subscribe(Consumer { }, RxErrorHandler.handleEmptyError()))
.subscribe(Consumer {
val event = ShowSnackbarEvent()
event.type = HabiticaSnackbar.SnackbarDisplayType.SUCCESS
event.text = "Quest invitation accepted"
EventBus.getDefault().post(event)
}, RxErrorHandler.handleEmptyError()))
}
}
@ -54,7 +62,12 @@ class PartyViewModel: GroupViewModel() {
groupIDSubject.value?.value?.let {
disposable.add(socialRepository.rejectQuest(null, it)
.flatMap { userRepository.retrieveUser() }
.subscribe(Consumer { }, RxErrorHandler.handleEmptyError()))
.subscribe(Consumer {
val event = ShowSnackbarEvent()
event.type = HabiticaSnackbar.SnackbarDisplayType.FAILURE
event.text = "Quest invitation rejected"
EventBus.getDefault().post(event)
}, RxErrorHandler.handleEmptyError()))
}
}

View file

@ -42,8 +42,6 @@ class WrapContentDraweeView : SimpleDraweeView {
}
internal fun updateViewSize(imageInfo: ImageInfo?) {
if (imageInfo != null) {
aspectRatio = imageInfo.width.toFloat() / imageInfo.height
}
}
}

View file

@ -264,7 +264,7 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
} else {
observable = inventoryRepository.purchaseItem(shopItem.purchaseType, shopItem.key, purchaseQuantity)
}
observable
val subscription = observable
.doOnNext {
val event = ShowSnackbarEvent()
if (snackbarText[0].isNotEmpty()) {
@ -274,10 +274,10 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
}
event.type = HabiticaSnackbar.SnackbarDisplayType.NORMAL
event.rightIcon = priceLabel.compoundDrawables[0]
when {
"gold" == item.currency -> event.rightTextColor = ContextCompat.getColor(context, R.color.yellow_5)
"gems" == item.currency -> event.rightTextColor = ContextCompat.getColor(context, R.color.green_10)
"hourglasses" == item.currency -> event.rightTextColor = ContextCompat.getColor(context, R.color.brand_300)
when (item.currency) {
"gold" -> event.rightTextColor = ContextCompat.getColor(context, R.color.yellow_5)
"gems" -> event.rightTextColor = ContextCompat.getColor(context, R.color.green_10)
"hourglasses" -> event.rightTextColor = ContextCompat.getColor(context, R.color.brand_300)
}
event.rightText = "-" + priceLabel.text
EventBus.getDefault().post(event)
@ -298,7 +298,13 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
}
} else {
when {
"gems" == shopItem.purchaseType -> InsufficientSubscriberGemsDialog(context)
"gems" == shopItem.purchaseType -> {
if (shopItem.canAfford(user, purchaseQuantity)) {
InsufficientSubscriberGemsDialog(context)
} else {
InsufficientGoldDialog(context)
}
}
"gold" == shopItem.currency -> InsufficientGoldDialog(context)
"gems" == shopItem.currency -> InsufficientGemsDialog(context, shopItem.value)
"hourglasses" == shopItem.currency -> InsufficientHourglassesDialog(context)

View file

@ -54,6 +54,7 @@ class StepperValueFormView @JvmOverloads constructor(
private var valueString = ""
set(value) {
if (value.isEmpty()) return
field = value
if (editText.text.toString() != field) {