Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Fix for #1389 Clothes blocking BUY option #1432

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public void onResultLoaded(int value) {
}
});

} else if (storeItemTypeindex == 1) { //clothes
} else if (storeItemTypeindex == TYPE_CLOTHES) { //clothes
dataSource.getPurchasedClothes(index, new IDataSource.LoadIntegerCallback() {
@Override
public void onResultLoaded(int value) {
Expand All @@ -260,7 +260,7 @@ public void onResultLoaded(int value) {
}
}
});
} else if (storeItemTypeindex == 2) { //accessories
} else if (storeItemTypeindex == TYPE_ACCESSORIES) { //accessories
dataSource.getPurchasedAccessories(index, new IDataSource.LoadIntegerCallback() {
@Override
public void onResultLoaded(int value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_store);
ButterKnife.bind(this);

init();

GridView gridView = findViewById(R.id.grid_view);
//adapter = new powerup.systers.com.ui.store_screen.StoreLevel2Activity.GridAdapter(this, allDataSet.get(0).subList(0, MAX_ELEMENTS_PER_SCREEN));
adapter = new GridAdapter(this, allDataSet.get(0).subList(0, MAX_ELEMENTS_PER_SCREEN));
Expand Down Expand Up @@ -157,8 +157,8 @@ public void updateAvatarAccessory(int accessory) {

class GridAdapter extends BaseAdapter {

private List<StoreItem> storeItems;
private Context context;
List<StoreItem> storeItems;
Context context;

GridAdapter(Context context, List<StoreItem> list) {
this.context = context;
Expand Down Expand Up @@ -186,22 +186,22 @@ public long getItemId(int position) {
}

class ViewHolder {
private ImageView itemImage;
private TextView itemPoints;
ImageView itemImage;
TextView itemPoints;

ViewHolder(View view) {
itemImage = view.findViewById(R.id.item_image);
itemPoints = view.findViewById(R.id.item_points);
}
}

@SuppressLint("ResourceType")
// @SuppressLint("ResourceType")
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public View getView(final int position, View convertView, ViewGroup parent) {

View storeItem = convertView;
GridAdapter.ViewHolder holder;
ViewHolder holder;
if (storeItem == null) {
// inflating the store_selection_view layout
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Expand All @@ -211,10 +211,10 @@ public View getView(final int position, View convertView, ViewGroup parent) {
int itemHeight = (int) ((screenHeight / 51.428f) * 18);
storeItem.setLayoutParams(new AbsListView.LayoutParams(itemWidth, itemHeight));

holder = new GridAdapter.ViewHolder(storeItem);
holder = new ViewHolder(storeItem);
storeItem.setTag(holder);
} else {
holder = (GridAdapter.ViewHolder) storeItem.getTag();
holder = (ViewHolder) storeItem.getTag();
}
storeItem.setOnClickListener(new View.OnClickListener() {
@Override
Expand Down Expand Up @@ -358,8 +358,8 @@ public void onClick(DialogInterface dialog, int id) {
dataSource.setCurrentAccessoriesValue(index);
presenter.calculateAccessoryValue(index);
break;
default:
throw new IllegalArgumentException("Invalid store type index");
// default:
// throw new IllegalArgumentException("Invalid store type index");
}
adapter.refresh(adapter.storeItems); // will update change the background if any is not available
showSuccessPurchaseDialog();
Expand Down Expand Up @@ -393,21 +393,21 @@ public void onClick(DialogInterface dialog, int id) {
public int getPurchasedStatus(int index) {
final int[] returnValue = new int[1];
switch(storeItemTypeindex) {
case 0: dataSource.getPurchasedHair(index, new IDataSource.LoadIntegerCallback() {
case TYPE_HAIR: dataSource.getPurchasedHair(index, new IDataSource.LoadIntegerCallback() {
@Override
public void onResultLoaded(int value) {
returnValue[0] = value;
}
}); // hair
return returnValue[0];
case 1: dataSource.getPurchasedClothes(index, new IDataSource.LoadIntegerCallback() {
case TYPE_CLOTHES: dataSource.getPurchasedClothes(index, new IDataSource.LoadIntegerCallback() {
@Override
public void onResultLoaded(int value) {
returnValue[0] = value;
}
}); // clothes
return returnValue[0];
case 2: dataSource.getPurchasedAccessories(index, new IDataSource.LoadIntegerCallback() {
case TYPE_ACCESSORIES: dataSource.getPurchasedAccessories(index, new IDataSource.LoadIntegerCallback() {
@Override
public void onResultLoaded(int value) {
returnValue[0] = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,18 +345,18 @@ public class PowerUpUtils {

public static int[] SAVE_BLOOD_ANSWER_COUNT = {0,2,2,2,3,3,2,6};

public static int[] HS_CLOTHES_IMAGES = {
R.drawable.hs_dress_avatar1,
R.drawable.hs_dress_avatar2,
R.drawable.hs_dress_avatar3,
R.drawable.hs_dress_avatar4,
R.drawable.hs_dress_avatar5,
R.drawable.hs_dress_avatar6,
R.drawable.hs_dress_avatar7,
R.drawable.hs_dress_avatar8
public static final int[] HS_CLOTHES_IMAGES = {
R.drawable.dress1_level2,
R.drawable.dress2_level2,
R.drawable.dress3_level2,
R.drawable.dress4_level2,
R.drawable.dress5_level2,
R.drawable.dress6_level2,
R.drawable.dress7_level2,
R.drawable.dress8_level2
};

public static String[] HS_CLOTHES_POINTS_TEXTS = {"5", "5", "5", "5", "10", "10", "10", "10" };
public static final String[] HS_CLOTHES_POINTS_TEXTS = {"5", "5", "5", "5", "10", "10", "10", "10" };

public static final String questionCSV = "Question.csv";
public static final String answerCSV = "Answer.csv";
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion PowerUp/app/src/main/res/layout/activity_store.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
android:layout_weight="3"
android:numColumns="3"
android:horizontalSpacing="10dp"
android:verticalSpacing="10dp">
android:verticalSpacing="20dp">

</GridView>

Expand Down