mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-08-01 03:30:34 +00:00
don't show hourglass or gem count for other players. fixes #911.
This commit is contained in:
parent
b94be8c215
commit
c66378643c
2 changed files with 15 additions and 5 deletions
|
|
@ -15,6 +15,7 @@ import com.habitrpg.android.habitica.events.commands.OpenGemPurchaseFragmentComm
|
|||
import com.habitrpg.android.habitica.events.commands.OpenMenuItemCommand;
|
||||
import com.habitrpg.android.habitica.models.Avatar;
|
||||
import com.habitrpg.android.habitica.models.user.Stats;
|
||||
import com.habitrpg.android.habitica.models.user.User;
|
||||
import com.habitrpg.android.habitica.ui.menu.MainDrawerBuilder;
|
||||
import com.habitrpg.android.habitica.ui.views.CurrencyViews;
|
||||
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper;
|
||||
|
|
@ -116,9 +117,11 @@ public class AvatarWithBarsViewModel {
|
|||
setXpBarData(stats.getExp().floatValue(), stats.getToNextLevel());
|
||||
setMpBarData(stats.getMp().floatValue(), stats.getMaxMP());
|
||||
|
||||
currencyView.setHourglasses(user.getHourglassCount());
|
||||
currencyView.setGold(stats.getGp());
|
||||
currencyView.setGems(user.getGemCount());
|
||||
if (user instanceof User) {
|
||||
currencyView.setHourglasses(user.getHourglassCount());
|
||||
currencyView.setGems(user.getGemCount());
|
||||
}
|
||||
}
|
||||
|
||||
private void setHpBarData(float value, int valueMax) {
|
||||
|
|
|
|||
|
|
@ -29,12 +29,15 @@ class CurrencyView : android.support.v7.widget.AppCompatTextView {
|
|||
attrs,
|
||||
R.styleable.CurrencyViews,
|
||||
0, 0)
|
||||
lightBackground = attributes?.getBoolean(R.styleable.CurrencyView_hasLightBackground, true) ?: true
|
||||
lightBackground = attributes?.getBoolean(R.styleable.CurrencyView_hasLightBackground,
|
||||
true) ?: true
|
||||
visibility = GONE;
|
||||
}
|
||||
|
||||
constructor(context: Context, currency: String, lightbackground: Boolean) : super(context) {
|
||||
this.lightBackground = lightbackground
|
||||
this.currency = currency
|
||||
visibility = GONE;
|
||||
}
|
||||
|
||||
private fun configureCurrency() {
|
||||
|
|
@ -69,8 +72,10 @@ class CurrencyView : android.support.v7.widget.AppCompatTextView {
|
|||
field = value
|
||||
if (value != null) {
|
||||
drawable = BitmapDrawable(resources, value)
|
||||
this.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
|
||||
val padding = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 6f, context.resources.displayMetrics).toInt()
|
||||
this.setCompoundDrawablesWithIntrinsicBounds(drawable,
|
||||
null, null, null)
|
||||
val padding = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
||||
6f, context.resources.displayMetrics).toInt()
|
||||
compoundDrawablePadding = padding
|
||||
this.gravity = Gravity.CENTER_VERTICAL
|
||||
}
|
||||
|
|
@ -109,6 +114,8 @@ class CurrencyView : android.support.v7.widget.AppCompatTextView {
|
|||
private fun updateVisibility() {
|
||||
if ("hourglasses" == this.currency) {
|
||||
visibility = if ("0" == text) View.GONE else View.VISIBLE
|
||||
} else {
|
||||
visibility = View.VISIBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue