mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-26 16:22:39 +00:00
Design fixes
This commit is contained in:
parent
c8adf7bd78
commit
f3afda0720
13 changed files with 62 additions and 58 deletions
|
|
@ -67,7 +67,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="6dp"
|
android:paddingTop="4dp"
|
||||||
android:paddingBottom="6dp"
|
android:paddingBottom="6dp"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
android:id="@+id/gold_icon"
|
android:id="@+id/gold_icon"
|
||||||
android:layout_width="22dp"
|
android:layout_width="22dp"
|
||||||
android:layout_height="22dp"
|
android:layout_height="22dp"
|
||||||
android:paddingBottom="4dp"/>
|
android:paddingBottom="8dp"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@id/priceLabel"
|
android:id="@id/priceLabel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,7 @@
|
||||||
android:layout_height="32dp"
|
android:layout_height="32dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:background="@drawable/layout_rounded_bg_shopitem_price">
|
android:background="@drawable/layout_rounded_bg_shopitem_price">
|
||||||
<ImageView
|
<com.habitrpg.android.habitica.ui.views.CurrencyView
|
||||||
android:id="@+id/currency_icon_view"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"/>
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/priceLabel"
|
android:id="@+id/priceLabel"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@
|
||||||
android:layout_height="@dimen/shop_scene_height" />
|
android:layout_height="@dimen/shop_scene_height" />
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="54dp"
|
android:layout_height="28dp"
|
||||||
android:layout_marginTop="138dp"
|
android:layout_marginTop="97dp"
|
||||||
android:background="@drawable/gradient_white"/>
|
android:background="@drawable/gradient_white"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:layout_marginLeft="45dp"
|
android:layout_marginLeft="45dp"
|
||||||
android:layout_marginTop="126dp"
|
android:layout_marginTop="83dp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/descriptionView"
|
android:id="@+id/descriptionView"
|
||||||
|
|
@ -37,7 +37,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="16dp"
|
android:layout_marginRight="16dp"
|
||||||
android:layout_marginTop="156dp"
|
android:layout_marginTop="124dp"
|
||||||
tools:text="Welcome to the Market! Stock up on new gear or buy rare eggs and potions. Check in periodically for new stock."
|
tools:text="Welcome to the Market! Stock up on new gear or buy rare eggs and potions. Check in periodically for new stock." />
|
||||||
/>
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
@ -75,7 +75,7 @@
|
||||||
<dimen name="bottom_menu_padding">18dp</dimen>
|
<dimen name="bottom_menu_padding">18dp</dimen>
|
||||||
<dimen name="pet_image_width">81dp</dimen>
|
<dimen name="pet_image_width">81dp</dimen>
|
||||||
<dimen name="pet_image_height">99dp</dimen>
|
<dimen name="pet_image_height">99dp</dimen>
|
||||||
<dimen name="shop_height">192dp</dimen>
|
<dimen name="shop_height">124dp</dimen>
|
||||||
<dimen name="bar_icon_padding">10dp</dimen>
|
<dimen name="bar_icon_padding">10dp</dimen>
|
||||||
<dimen name="task_text_padding">16dp</dimen>
|
<dimen name="task_text_padding">16dp</dimen>
|
||||||
<dimen name="task_text_compactpadding">4dp</dimen>
|
<dimen name="task_text_compactpadding">4dp</dimen>
|
||||||
|
|
@ -112,7 +112,7 @@
|
||||||
<dimen name="shopitem_width">84dp</dimen>
|
<dimen name="shopitem_width">84dp</dimen>
|
||||||
<dimen name="shopitem_status_size">24dp</dimen>
|
<dimen name="shopitem_status_size">24dp</dimen>
|
||||||
<dimen name="shopitem_image_size">68dp</dimen>
|
<dimen name="shopitem_image_size">68dp</dimen>
|
||||||
<dimen name="shop_scene_height">186dp</dimen>
|
<dimen name="shop_scene_height">124dp</dimen>
|
||||||
<dimen name="currency_icon_size">24dp</dimen>
|
<dimen name="currency_icon_size">24dp</dimen>
|
||||||
<dimen name="shopitem_dialog_content_inset">24dp</dimen>
|
<dimen name="shopitem_dialog_content_inset">24dp</dimen>
|
||||||
<dimen name="reward_width">84dp</dimen>
|
<dimen name="reward_width">84dp</dimen>
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class AvatarWithBarsViewModel {
|
||||||
|
|
||||||
ButterKnife.bind(this, v);
|
ButterKnife.bind(this, v);
|
||||||
|
|
||||||
hpBar.setIcon(HabiticaIconsHelper.imageOfHeartDarkBg());
|
hpBar.setIcon(HabiticaIconsHelper.imageOfHeartLightBg());
|
||||||
xpBar.setIcon(HabiticaIconsHelper.imageOfExperience());
|
xpBar.setIcon(HabiticaIconsHelper.imageOfExperience());
|
||||||
mpBar.setIcon(HabiticaIconsHelper.imageOfMagic());
|
mpBar.setIcon(HabiticaIconsHelper.imageOfMagic());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -214,7 +215,7 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
|
||||||
@Nullable
|
@Nullable
|
||||||
private AccountHeader accountHeader;
|
private AccountHeader accountHeader;
|
||||||
@Nullable
|
@Nullable
|
||||||
private BaseMainFragment activeFragment;
|
private WeakReference<BaseMainFragment> activeFragment;
|
||||||
private AvatarWithBarsViewModel avatarInHeader;
|
private AvatarWithBarsViewModel avatarInHeader;
|
||||||
private AlertDialog faintDialog;
|
private AlertDialog faintDialog;
|
||||||
private AvatarView sideAvatarView;
|
private AvatarView sideAvatarView;
|
||||||
|
|
@ -271,7 +272,7 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
|
||||||
userRepository.getUser(hostConfig.getUser())
|
userRepository.getUser(hostConfig.getUser())
|
||||||
.subscribe(newUser -> {
|
.subscribe(newUser -> {
|
||||||
MainActivity.this.user = newUser;
|
MainActivity.this.user = newUser;
|
||||||
MainActivity.this.setUserData(true);
|
MainActivity.this.setUserData();
|
||||||
}, RxErrorHandler.handleEmptyError());
|
}, RxErrorHandler.handleEmptyError());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -309,7 +310,7 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
|
||||||
//a state can arise in which the active fragment no longer has a
|
//a state can arise in which the active fragment no longer has a
|
||||||
//reference to the tabLayout (and all its adapters are null).
|
//reference to the tabLayout (and all its adapters are null).
|
||||||
//Recreate the fragment as a result.
|
//Recreate the fragment as a result.
|
||||||
if (activeFragment != null && activeFragment.tabLayout == null) {
|
if (activeFragment != null && activeFragment.get() != null && activeFragment.get().tabLayout == null) {
|
||||||
activeFragment = null;
|
activeFragment = null;
|
||||||
if (drawer != null) {
|
if (drawer != null) {
|
||||||
drawer.setSelectionAtPosition(this.sharedPreferences.getInt("lastActivePosition", 1));
|
drawer.setSelectionAtPosition(this.sharedPreferences.getInt("lastActivePosition", 1));
|
||||||
|
|
@ -336,13 +337,13 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
|
||||||
|
|
||||||
@SuppressLint("ObsoleteSdkInt")
|
@SuppressLint("ObsoleteSdkInt")
|
||||||
public void displayFragment(BaseMainFragment fragment) {
|
public void displayFragment(BaseMainFragment fragment) {
|
||||||
if (this.activeFragment != null && fragment.getClass() == this.activeFragment.getClass()) {
|
if (this.activeFragment != null && activeFragment.get() != null && fragment.getClass() == this.activeFragment.get().getClass()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && this.isDestroyed()) {
|
if (SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && this.isDestroyed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.activeFragment = fragment;
|
this.activeFragment = new WeakReference<>(fragment);
|
||||||
fragment.setArguments(getIntent().getExtras());
|
fragment.setArguments(getIntent().getExtras());
|
||||||
fragment.setUser(user);
|
fragment.setUser(user);
|
||||||
fragment.setActivity(this);
|
fragment.setActivity(this);
|
||||||
|
|
@ -362,7 +363,7 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUserData(boolean fromLocalDb) {
|
protected void setUserData() {
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
|
|
||||||
Preferences preferences = user.getPreferences();
|
Preferences preferences = user.getPreferences();
|
||||||
|
|
@ -374,8 +375,8 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
updateHeader();
|
updateHeader();
|
||||||
updateSidebar();
|
updateSidebar();
|
||||||
if (activeFragment != null) {
|
if (activeFragment != null && activeFragment.get() != null) {
|
||||||
activeFragment.updateUserData(user);
|
activeFragment.get().updateUserData(user);
|
||||||
} else {
|
} else {
|
||||||
if (drawer != null) {
|
if (drawer != null) {
|
||||||
drawer.setSelectionAtPosition(1);
|
drawer.setSelectionAtPosition(1);
|
||||||
|
|
@ -421,7 +422,7 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
|
||||||
avatarInHeader.updateData(user);
|
avatarInHeader.updateData(user);
|
||||||
}
|
}
|
||||||
if (activeFragment != null) {
|
if (activeFragment != null) {
|
||||||
setTranslatedFragmentTitle(activeFragment);
|
setTranslatedFragmentTitle(activeFragment.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawer != null) {
|
if (drawer != null) {
|
||||||
|
|
@ -489,10 +490,10 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActiveFragment(@Nullable BaseMainFragment fragment) {
|
public void setActiveFragment(@Nullable BaseMainFragment fragment) {
|
||||||
this.activeFragment = fragment;
|
this.activeFragment = new WeakReference<BaseMainFragment>(fragment);
|
||||||
setTranslatedFragmentTitle(fragment);
|
setTranslatedFragmentTitle(fragment);
|
||||||
if (this.drawer != null && this.activeFragment != null) {
|
if (this.drawer != null && this.activeFragment != null && activeFragment.get() != null) {
|
||||||
this.drawer.setSelectionAtPosition(this.activeFragment.fragmentSidebarPosition, false);
|
this.drawer.setSelectionAtPosition(this.activeFragment.get().fragmentSidebarPosition, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -515,8 +516,8 @@ public class MainActivity extends BaseActivity implements TutorialView.OnTutoria
|
||||||
drawer.closeDrawer();
|
drawer.closeDrawer();
|
||||||
} else {
|
} else {
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
if (this.activeFragment != null) {
|
if (this.activeFragment != null && activeFragment.get() != null) {
|
||||||
this.activeFragment.updateUserData(user);
|
this.activeFragment.get().updateUserData(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import com.facebook.imagepipeline.image.CloseableImage;
|
||||||
import com.facebook.imagepipeline.request.ImageRequest;
|
import com.facebook.imagepipeline.request.ImageRequest;
|
||||||
import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
||||||
import com.habitrpg.android.habitica.R;
|
import com.habitrpg.android.habitica.R;
|
||||||
|
import com.habitrpg.android.habitica.helpers.RxErrorHandler;
|
||||||
import com.habitrpg.android.habitica.models.inventory.Item;
|
import com.habitrpg.android.habitica.models.inventory.Item;
|
||||||
import com.habitrpg.android.habitica.models.shops.Shop;
|
import com.habitrpg.android.habitica.models.shops.Shop;
|
||||||
import com.habitrpg.android.habitica.models.shops.ShopCategory;
|
import com.habitrpg.android.habitica.models.shops.ShopCategory;
|
||||||
|
|
@ -35,17 +36,20 @@ import com.habitrpg.android.habitica.ui.viewHolders.SectionViewHolder;
|
||||||
import com.habitrpg.android.habitica.ui.viewHolders.ShopItemViewHolder;
|
import com.habitrpg.android.habitica.ui.viewHolders.ShopItemViewHolder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import rx.Observable;
|
||||||
|
import rx.android.schedulers.AndroidSchedulers;
|
||||||
|
|
||||||
public class ShopRecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class ShopRecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
private List<Object> items;
|
private List<Object> items;
|
||||||
private String shopIdentifier;
|
private String shopIdentifier;
|
||||||
private Map<String, Item> ownedItems;
|
private Map<String, Item> ownedItems = new HashMap<>();
|
||||||
|
|
||||||
public void setShop(Shop shop) {
|
public void setShop(Shop shop) {
|
||||||
shopIdentifier = shop.identifier;
|
shopIdentifier = shop.identifier;
|
||||||
|
|
@ -182,7 +186,9 @@ public class ShopRecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
int width = Math.round(height * aspectRatio);
|
int width = Math.round(height * aspectRatio);
|
||||||
BitmapDrawable drawable = new BitmapDrawable(context.getResources(), Bitmap.createScaledBitmap(bitmap, width, height, false));
|
BitmapDrawable drawable = new BitmapDrawable(context.getResources(), Bitmap.createScaledBitmap(bitmap, width, height, false));
|
||||||
drawable.setTileModeX(Shader.TileMode.REPEAT);
|
drawable.setTileModeX(Shader.TileMode.REPEAT);
|
||||||
backgroundView.setBackground(drawable);
|
Observable.just(drawable)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(bitmapDrawable -> backgroundView.setBackground(bitmapDrawable), RxErrorHandler.handleEmptyError());
|
||||||
dataSource.close();
|
dataSource.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -157,11 +157,15 @@ public abstract class BaseMainFragment extends BaseFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideToolbar() {
|
public void hideToolbar() {
|
||||||
activity.avatar_with_bars.setVisibility(View.GONE);
|
if (activity != null) {
|
||||||
|
activity.avatar_with_bars.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showToolbar() {
|
public void showToolbar() {
|
||||||
activity.avatar_with_bars.setVisibility(View.VISIBLE);
|
if (activity != null) {
|
||||||
|
activity.avatar_with_bars.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableToolbarScrolling() {
|
public void disableToolbarScrolling() {
|
||||||
|
|
|
||||||
|
|
@ -142,10 +142,8 @@ public class ShopFragment extends BaseFragment {
|
||||||
this.adapter.setShop(shop);
|
this.adapter.setShop(shop);
|
||||||
}, RxErrorHandler.handleEmptyError());
|
}, RxErrorHandler.handleEmptyError());
|
||||||
|
|
||||||
this.inventoryRepository.getOwnedItems(user)
|
compositeSubscription.add(this.inventoryRepository.getOwnedItems(user)
|
||||||
.subscribe(ownedItems -> {
|
.subscribe(ownedItems -> adapter.setOwnedItems(ownedItems), RxErrorHandler.handleEmptyError()));
|
||||||
adapter.setOwnedItems(ownedItems);
|
|
||||||
}, RxErrorHandler.handleEmptyError());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import com.habitrpg.android.habitica.HabiticaBaseApplication;
|
||||||
import com.habitrpg.android.habitica.R;
|
import com.habitrpg.android.habitica.R;
|
||||||
import com.habitrpg.android.habitica.models.shops.ShopItem;
|
import com.habitrpg.android.habitica.models.shops.ShopItem;
|
||||||
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
|
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
|
||||||
|
import com.habitrpg.android.habitica.ui.views.CurrencyView;
|
||||||
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper;
|
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper;
|
||||||
import com.habitrpg.android.habitica.ui.views.shops.PurchaseDialog;
|
import com.habitrpg.android.habitica.ui.views.shops.PurchaseDialog;
|
||||||
|
|
||||||
|
|
@ -26,10 +27,8 @@ public class ShopItemViewHolder extends RecyclerView.ViewHolder implements View.
|
||||||
SimpleDraweeView imageView;
|
SimpleDraweeView imageView;
|
||||||
@BindView(R.id.buyButton)
|
@BindView(R.id.buyButton)
|
||||||
View buyButton;
|
View buyButton;
|
||||||
@BindView(R.id.currency_icon_view)
|
|
||||||
ImageView currencyIconView;
|
|
||||||
@BindView(R.id.priceLabel)
|
@BindView(R.id.priceLabel)
|
||||||
TextView priceLabel;
|
CurrencyView priceLabel;
|
||||||
|
|
||||||
@BindView(R.id.item_detail_indicator)
|
@BindView(R.id.item_detail_indicator)
|
||||||
TextView itemDetailIndicator;
|
TextView itemDetailIndicator;
|
||||||
|
|
@ -66,16 +65,8 @@ public class ShopItemViewHolder extends RecyclerView.ViewHolder implements View.
|
||||||
|
|
||||||
if (item.getUnlockCondition() == null || !item.getLocked()) {
|
if (item.getUnlockCondition() == null || !item.getLocked()) {
|
||||||
priceLabel.setText(String.valueOf(item.getValue()));
|
priceLabel.setText(String.valueOf(item.getValue()));
|
||||||
if (item.getCurrency().equals("gold")) {
|
priceLabel.setCurrency(item.getCurrency());
|
||||||
currencyIconView.setImageBitmap(HabiticaIconsHelper.imageOfGold());
|
if (item.getCurrency() == null) {
|
||||||
priceLabel.setTextColor(ContextCompat.getColor(context, R.color.gold));
|
|
||||||
} else if (item.getCurrency().equals("gems")) {
|
|
||||||
currencyIconView.setImageBitmap(HabiticaIconsHelper.imageOfGem());
|
|
||||||
priceLabel.setTextColor(ContextCompat.getColor(context, R.color.green_10));
|
|
||||||
} else if (item.getCurrency().equals("hourglasses")) {
|
|
||||||
currencyIconView.setImageBitmap(HabiticaIconsHelper.imageOfHourglass());
|
|
||||||
priceLabel.setTextColor(ContextCompat.getColor(context, R.color.brand_300));
|
|
||||||
} else {
|
|
||||||
buyButton.setVisibility(View.GONE);
|
buyButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -89,13 +80,10 @@ public class ShopItemViewHolder extends RecyclerView.ViewHolder implements View.
|
||||||
itemDetailIndicator.setVisibility(View.VISIBLE);
|
itemDetailIndicator.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priceLabel.setLocked(item.getLocked());
|
||||||
if (item.getLocked()) {
|
if (item.getLocked()) {
|
||||||
priceLabel.setTextColor(ContextCompat.getColor(context, R.color.gray_300));
|
|
||||||
currencyIconView.setAlpha(0.5f);
|
|
||||||
itemDetailIndicator.setBackground(lockedDrawable);
|
itemDetailIndicator.setBackground(lockedDrawable);
|
||||||
itemDetailIndicator.setVisibility(View.VISIBLE);
|
itemDetailIndicator.setVisibility(View.VISIBLE);
|
||||||
} else {
|
|
||||||
currencyIconView.setAlpha(1.0f);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import android.graphics.drawable.Drawable;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
|
@ -32,7 +33,7 @@ public class CurrencyView extends android.support.v7.widget.AppCompatTextView {
|
||||||
private void setIcon(Bitmap iconBitmap) {
|
private void setIcon(Bitmap iconBitmap) {
|
||||||
drawable = new BitmapDrawable(getResources(), iconBitmap);
|
drawable = new BitmapDrawable(getResources(), iconBitmap);
|
||||||
this.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
|
this.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
|
||||||
int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, getContext().getResources().getDisplayMetrics());
|
int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 6, getContext().getResources().getDisplayMetrics());
|
||||||
setCompoundDrawablePadding(padding);
|
setCompoundDrawablePadding(padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -51,7 +52,11 @@ public class CurrencyView extends android.support.v7.widget.AppCompatTextView {
|
||||||
}
|
}
|
||||||
} else if ("gems".equals(currency)) {
|
} else if ("gems".equals(currency)) {
|
||||||
setIcon(HabiticaIconsHelper.imageOfGem());
|
setIcon(HabiticaIconsHelper.imageOfGem());
|
||||||
setTextColor(ContextCompat.getColor(getContext(), R.color.green_50));
|
if (lightbackground) {
|
||||||
|
setTextColor(ContextCompat.getColor(getContext(), R.color.green_100));
|
||||||
|
} else {
|
||||||
|
setTextColor(ContextCompat.getColor(getContext(), R.color.green_50));
|
||||||
|
}
|
||||||
} else if ("hourglasses".equals(currency)) {
|
} else if ("hourglasses".equals(currency)) {
|
||||||
setIcon(HabiticaIconsHelper.imageOfHourglass());
|
setIcon(HabiticaIconsHelper.imageOfHourglass());
|
||||||
if (lightbackground) {
|
if (lightbackground) {
|
||||||
|
|
@ -75,6 +80,9 @@ public class CurrencyView extends android.support.v7.widget.AppCompatTextView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLocked(boolean isLocked) {
|
public void setLocked(boolean isLocked) {
|
||||||
|
if (drawable == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isLocked) {
|
if (isLocked) {
|
||||||
this.setTextColor(ContextCompat.getColor(getContext(), R.color.gray_300));
|
this.setTextColor(ContextCompat.getColor(getContext(), R.color.gray_300));
|
||||||
drawable.setAlpha(127);
|
drawable.setAlpha(127);
|
||||||
|
|
@ -86,6 +94,9 @@ public class CurrencyView extends android.support.v7.widget.AppCompatTextView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCantAfford(boolean cantAfford) {
|
public void setCantAfford(boolean cantAfford) {
|
||||||
|
if (drawable == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (cantAfford) {
|
if (cantAfford) {
|
||||||
this.setTextColor(ContextCompat.getColor(getContext(), R.color.red_50));
|
this.setTextColor(ContextCompat.getColor(getContext(), R.color.red_50));
|
||||||
drawable.setAlpha(127);
|
drawable.setAlpha(127);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import com.habitrpg.android.habitica.models.inventory.Quest;
|
import com.habitrpg.android.habitica.models.inventory.Quest;
|
||||||
import com.habitrpg.android.habitica.models.members.Member;
|
import com.habitrpg.android.habitica.models.members.Member;
|
||||||
|
import com.habitrpg.android.habitica.models.members.MemberPreferences;
|
||||||
import com.habitrpg.android.habitica.models.social.UserParty;
|
import com.habitrpg.android.habitica.models.social.UserParty;
|
||||||
import com.habitrpg.android.habitica.models.user.ContributorInfo;
|
import com.habitrpg.android.habitica.models.user.ContributorInfo;
|
||||||
import com.habitrpg.android.habitica.models.user.Flags;
|
import com.habitrpg.android.habitica.models.user.Flags;
|
||||||
|
|
@ -42,7 +43,7 @@ public class MemberSerialization implements JsonDeserializer<Member> {
|
||||||
member.setInbox(context.deserialize(obj.get("inbox"), Inbox.class));
|
member.setInbox(context.deserialize(obj.get("inbox"), Inbox.class));
|
||||||
}
|
}
|
||||||
if (obj.has("preferences")) {
|
if (obj.has("preferences")) {
|
||||||
member.setPreferences(context.deserialize(obj.get("preferences"), Preferences.class));
|
member.setPreferences(context.deserialize(obj.get("preferences"), MemberPreferences.class));
|
||||||
}
|
}
|
||||||
if (obj.has("profile")) {
|
if (obj.has("profile")) {
|
||||||
member.setProfile(context.deserialize(obj.get("profile"), Profile.class));
|
member.setProfile(context.deserialize(obj.get("profile"), Profile.class));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue