Fix contributor gear display

This commit is contained in:
Phillip Thelen 2016-04-12 18:03:52 +02:00
parent 732679708e
commit cd75b36637
6 changed files with 28 additions and 35 deletions

View file

@ -10,21 +10,7 @@
<variable
name="equipmentNames"
type="Map&lt;String, String>" />
<variable
name="userSize"
type="String" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/SectionTitle"
android:text="@{categorytitle}"
android:textAppearance="?android:attr/textAppearanceMedium" />
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -54,7 +40,7 @@
android:id="@+id/outfit_Armor"
bind:title="@{@string/outfit_armor}"
bind:value='@{equipmentNames.get(outfit.getArmor)}'
bind:imageNamed='@{"shop_"+userSize + "_" + outfit.getArmor}'/>
bind:imageNamed='@{"shop_"+outfit.getArmor}'/>
<include layout="@layout/item_image_row"
android:id="@+id/outfit_back"
bind:title="@{@string/outfit_back}"
@ -77,5 +63,4 @@
bind:imageNamed='@{"shop_"+outfit.getShield}'/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</layout>

View file

@ -19,9 +19,6 @@
<variable
name="equipmentNames"
type="Map&lt;String, String>" />
<variable
name="userSize"
type="String" />
</data>
@ -38,18 +35,22 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/SectionTitle"
android:text="@string/battle_gear"
android:textAppearance="?android:attr/textAppearanceMedium" />
<include layout="@layout/equipment_overview_list"
android:id="@+id/battle_gear_group"
bind:categorytitle="@{@string/battle_gear}"
bind:outfit="@{currentBattleGear}"
bind:equipmentNames="@{equipmentNames}"
bind:userSize="@{userSize}" />
<include layout="@layout/equipment_overview_list"
android:id="@+id/costume_group"
bind:categorytitle="@{@string/costume}"
bind:outfit="@{currentCostume}"
bind:equipmentNames="@{equipmentNames}"
bind:userSize="@{userSize}" />
bind:equipmentNames="@{equipmentNames}" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/SectionTitle"
android:text="@string/costume"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -67,6 +68,10 @@
android:checked="@{usingCostume}"/>
</LinearLayout>
<include layout="@layout/equipment_overview_list"
android:id="@+id/costume_group"
bind:outfit="@{currentCostume}"
bind:equipmentNames="@{equipmentNames}" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</layout>

View file

@ -28,7 +28,6 @@ private List<ItemData> gearList;
public String equippedGear;
public Boolean isCostume;
public String userSize;
public String type;
public void setGearList(List<ItemData> gearList) {
@ -99,9 +98,6 @@ class GearViewHolder extends RecyclerView.ViewHolder implements View.OnClickList
}
String imageUrl = "https://habitica-assets.s3.amazonaws.com/mobileApp/images/shop_" + gear.key + ".png";
if (gear.type.equals("armor")) {
imageUrl = "https://habitica-assets.s3.amazonaws.com/mobileApp/images/shop_" + userSize + "_" + gear.key + ".png";
}
Picasso.with(imageView.getContext())
.load(imageUrl)

View file

@ -43,7 +43,6 @@ public class EquipmentDetailFragment extends BaseMainFragment {
this.adapter = new EquipmentRecyclerViewAdapter();
this.adapter.equippedGear = this.equippedGear;
this.adapter.isCostume = this.isCostume;
this.adapter.userSize = this.user.getPreferences().getSize();
this.adapter.type = this.type;
this.recyclerView.setLayoutManager(new LinearLayoutManager(activity));
this.recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));

View file

@ -70,7 +70,6 @@ public class EquipmentOverviewFragment extends BaseMainFragment implements Trans
viewBinding.setCurrentBattleGear(this.user.getItems().getGear().getEquipped());
viewBinding.setCurrentCostume(this.user.getItems().getGear().getCostume());
viewBinding.setUsingCostume(this.user.getPreferences().getCostume());
viewBinding.setUserSize(this.user.getPreferences().getSize());
ButterKnife.bind(this, v);

View file

@ -196,7 +196,7 @@ public class UserPicture {
this.layers.add(null);
SpriteTarget target = new SpriteTarget(layerNumber, layer);
this.targets.add(target);
picasso.load("https://habitica-assets.s3.amazonaws.com/mobileApp/images/" + layer + ".png").into(target);
picasso.load("https://habitica-assets.s3.amazonaws.com/mobileApp/images/" + this.getFileName(layer)).into(target);
layerNumber = layerNumber + 1;
}
}
@ -289,6 +289,15 @@ public class UserPicture {
}
}
private String getFileName(String imageName) {
if (imageName.equals("head_special_1")) {
return "ContributorOnly-Equip-CrystalHelmet.gif";
} else if (imageName.equals("armor_special_1")) {
return "ContributorOnly-Equip-CrystalArmor.gif";
}
return imageName+".png";
}
}