mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-22 13:48:55 +00:00
add hatching and feeding
This commit is contained in:
parent
7f2a44e6bb
commit
871077ed5a
21 changed files with 439 additions and 69 deletions
|
|
@ -12,8 +12,8 @@
|
|||
style="@style/CardContent">
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="81dp"
|
||||
android:layout_height="99dp"
|
||||
android:layout_width="@dimen/pet_image_width"
|
||||
android:layout_height="@dimen/pet_image_height"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:scaleType="fitEnd" />
|
||||
<TextView
|
||||
|
|
|
|||
28
Habitica/res/layout/fragment_items.xml
Normal file
28
Habitica/res/layout/fragment_items.xml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/coordinatorLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SectionTitle"
|
||||
android:id="@+id/titleTextView"
|
||||
android:background="@color/brand_100"
|
||||
android:textColor="@android:color/white"/>
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/md_grey_500"
|
||||
android:scrollbars="vertical" />
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
|
@ -6,6 +6,9 @@
|
|||
<variable name="title" type="String"/>
|
||||
<variable name="value" type="String"/>
|
||||
<variable name="imageNamed" type="String"/>
|
||||
<variable
|
||||
name="disabled"
|
||||
type="Boolean" />
|
||||
</data>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -17,7 +20,7 @@
|
|||
android:layout_height="@dimen/gear_image_size"
|
||||
bind:imageName='@{imageNamed == null ? "head_0" : imageNamed}'
|
||||
android:contentDescription="@{imageNamed}"
|
||||
android:alpha="@{imageNamed == null ? 0.4f : 1.0f}"
|
||||
android:alpha="@{imageNamed == null || disabled ? 0.3f : 1.0f}"
|
||||
android:scaleType="fitEnd"
|
||||
android:layout_marginRight="@dimen/row_padding"/>
|
||||
<LinearLayout
|
||||
|
|
@ -30,13 +33,15 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@{title}"
|
||||
tools:text="Title"
|
||||
style="@style/RowTitle"/>
|
||||
style="@style/RowTitle"
|
||||
android:alpha="@{disabled ? 0.3f : 1.0f}" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Value"
|
||||
android:text="@{value}"
|
||||
style="@style/RowText"/>
|
||||
style="@style/RowText"
|
||||
android:alpha="@{disabled ? 0.3f : 1.0f}" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
32
Habitica/res/layout/pet_detail_item.xml
Normal file
32
Habitica/res/layout/pet_detail_item.xml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/card_view"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/selection_highlight"
|
||||
style="@style/CardContent">
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="@dimen/pet_image_width"
|
||||
android:layout_height="@dimen/pet_image_height"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:scaleType="fitEnd" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:id="@+id/titleTextView"
|
||||
style="@style/RowTitle"/>
|
||||
|
||||
<ProgressBar
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/trainedProgressBar" />
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
5
Habitica/res/layout/pet_imageview.xml
Normal file
5
Habitica/res/layout/pet_imageview.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/pet_image_width" android:layout_height="@dimen/pet_image_height"
|
||||
android:layout_gravity="center">
|
||||
</ImageView>
|
||||
|
|
@ -68,4 +68,6 @@
|
|||
<dimen name="material_drawer_section_vertical_padding">4dp</dimen>
|
||||
<dimen name="pet_width">120dp</dimen>
|
||||
<dimen name="bottom_menu_padding">18dp</dimen>
|
||||
<dimen name="pet_image_width">81dp</dimen>
|
||||
<dimen name="pet_image_height">99dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -290,6 +290,15 @@ To start, which parts of your life do you want to improve?</string>
|
|||
<string name="sell" formatted="false">Sell (%s Gold)</string>
|
||||
<string name="hatch_with_potion">Hatch with potion</string>
|
||||
<string name="feed_to_pet">Feed to pet</string>
|
||||
<string name="hatch_egg">Hatch egg</string>
|
||||
<string name="hatch_egg">Hatch with egg</string>
|
||||
<string name="invite_party">Invite party</string>
|
||||
<string name="dialog_feeding" formatted="false">Feed %s with</string>
|
||||
<string name="use_animal">Use</string>
|
||||
<string name="feed">Feed</string>
|
||||
<string name="hatch_with" formatted="false">Hatch pet with %s</string>
|
||||
<string name="hatched_pet_title" formatted="false">You hatched a %s %s!</string>
|
||||
<string name="close">Close</string>
|
||||
<string name="share">Share</string>
|
||||
<string name="notification_pet_fed" formatted="false">You fed your %s!</string>
|
||||
<string name="notification_purchase" formatted="false">%s was purchased</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ package com.habitrpg.android.habitica.events.commands;
|
|||
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.ItemData;
|
||||
|
||||
public class EquipGearCommand {
|
||||
public class EquipCommand {
|
||||
|
||||
public ItemData gear;
|
||||
public Boolean asCostume;
|
||||
public String key;
|
||||
public String type;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.habitrpg.android.habitica.events.commands;
|
||||
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Food;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Pet;
|
||||
|
||||
public class FeedCommand {
|
||||
|
||||
public Pet usingPet;
|
||||
public Food usingFood;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.habitrpg.android.habitica.events.commands;
|
||||
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Egg;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.HatchingPotion;
|
||||
|
||||
public class HatchingCommand {
|
||||
|
||||
public Egg usingEgg;
|
||||
public HatchingPotion usingHatchingPotion;
|
||||
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ import android.preference.PreferenceManager;
|
|||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
|
|
@ -42,8 +43,9 @@ import com.habitrpg.android.habitica.events.TaskRemovedEvent;
|
|||
import com.habitrpg.android.habitica.events.ToggledInnStateEvent;
|
||||
import com.habitrpg.android.habitica.events.commands.BuyRewardCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.DeleteTaskCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.EquipGearCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.InvitePartyToQuestCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.EquipCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.FeedCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.HatchingCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.OpenGemPurchaseFragmentCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.OpenMenuItemCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.SellItemCommand;
|
||||
|
|
@ -55,6 +57,7 @@ import com.habitrpg.android.habitica.ui.TutorialView;
|
|||
import com.habitrpg.android.habitica.ui.UiUtils;
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.GemsPurchaseFragment;
|
||||
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
|
||||
import com.habitrpg.android.habitica.userpicture.UserPicture;
|
||||
import com.habitrpg.android.habitica.userpicture.UserPictureRunnable;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
|
||||
|
|
@ -62,7 +65,9 @@ import com.magicmicky.habitrpgwrapper.lib.models.SuppressedModals;
|
|||
import com.magicmicky.habitrpgwrapper.lib.models.TaskDirection;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.TaskDirectionData;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.TutorialStep;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Pet;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.responses.BuyResponse;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.responses.FeedResponse;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.ChecklistItem;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Days;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.ItemData;
|
||||
|
|
@ -84,6 +89,7 @@ import com.raizlabs.android.dbflow.sql.language.Delete;
|
|||
import com.raizlabs.android.dbflow.sql.language.From;
|
||||
import com.raizlabs.android.dbflow.sql.language.Select;
|
||||
import com.raizlabs.android.dbflow.sql.language.Where;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
|
@ -92,6 +98,7 @@ import org.json.JSONObject;
|
|||
import org.solovyev.android.checkout.ActivityCheckout;
|
||||
import org.solovyev.android.checkout.Checkout;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
|
@ -564,12 +571,8 @@ public class MainActivity extends BaseActivity implements HabitRPGUserCallback.O
|
|||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(EquipGearCommand event) {
|
||||
if (event.asCostume) {
|
||||
this.mAPIHelper.apiService.equipCostume(event.gear.key, new ItemsCallback(this, this.user));
|
||||
} else {
|
||||
this.mAPIHelper.apiService.equipBattleGear(event.gear.key, new ItemsCallback(this, this.user));
|
||||
}
|
||||
public void onEvent(EquipCommand event) {
|
||||
this.mAPIHelper.apiService.equipItem(event.type, event.key, new ItemsCallback(this, this.user));
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
@ -697,6 +700,59 @@ public class MainActivity extends BaseActivity implements HabitRPGUserCallback.O
|
|||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(final HatchingCommand event) {
|
||||
if (event.usingEgg == null || event.usingHatchingPotion == null) {
|
||||
return;
|
||||
}
|
||||
this.mAPIHelper.apiService.hatchPet(event.usingEgg.getKey(), event.usingHatchingPotion.getKey(), new ItemsCallback(new HabitRPGUserCallback.OnUserReceived() {
|
||||
@Override
|
||||
public void onUserReceived(HabitRPGUser user) {
|
||||
ImageView petImageView = (ImageView)getLayoutInflater().inflate(R.layout.pet_imageview, null);
|
||||
|
||||
DataBindingUtils.loadImage(petImageView, "Pet-" + event.usingEgg.getKey() + "-" + event.usingHatchingPotion.getKey());
|
||||
|
||||
AlertDialog dialog = new AlertDialog.Builder(MainActivity.this)
|
||||
.setTitle(getString(R.string.hatched_pet_title, event.usingHatchingPotion.getText(), event.usingEgg.getText()))
|
||||
.setView(petImageView)
|
||||
.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserFail() {
|
||||
|
||||
}
|
||||
}, this.user));
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(FeedCommand event) {
|
||||
if (event.usingFood == null || event.usingPet == null) {
|
||||
return;
|
||||
}
|
||||
final Pet pet = event.usingPet;
|
||||
this.mAPIHelper.apiService.feedPet(event.usingPet.getKey(), event.usingFood.getKey(), new Callback<FeedResponse>() {
|
||||
@Override
|
||||
public void success(FeedResponse feedResponse, Response response) {
|
||||
MainActivity.this.user.getItems().getPets().put(pet.getKey(), feedResponse.value);
|
||||
MainActivity.this.setUserData(false);
|
||||
showSnackbar(MainActivity.this, floatingMenuWrapper, getString(R.string.notification_pet_fed, pet.getKey()), SnackbarDisplayType.NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failure(RetrofitError error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// endregion
|
||||
|
||||
|
|
@ -704,7 +760,7 @@ public class MainActivity extends BaseActivity implements HabitRPGUserCallback.O
|
|||
public void onTaskDataReceived(TaskDirectionData data, Task task) {
|
||||
if (task.type.equals("reward")) {
|
||||
|
||||
showSnackbar(this, floatingMenuWrapper, task.getText() + " successfully purchased!", SnackbarDisplayType.NORMAL);
|
||||
showSnackbar(this, floatingMenuWrapper, getString(R.string.notification_purchase, task.getText()), SnackbarDisplayType.NORMAL);
|
||||
|
||||
} else {
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.events.commands.EquipGearCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.EquipCommand;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.ItemData;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
|
|
@ -108,9 +108,13 @@ class GearViewHolder extends RecyclerView.ViewHolder implements View.OnClickList
|
|||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
EquipGearCommand command = new EquipGearCommand();
|
||||
command.gear = this.gear;
|
||||
command.asCostume = isCostume;
|
||||
EquipCommand command = new EquipCommand();
|
||||
command.key = this.gear.key;
|
||||
if (isCostume) {
|
||||
command.type = "costume";
|
||||
} else {
|
||||
command.type = "gear";
|
||||
}
|
||||
EventBus.getDefault().post(command);
|
||||
if (this.gear.key.equals(equippedGear)) {
|
||||
equippedGear = type + "_base_0";
|
||||
|
|
|
|||
|
|
@ -10,8 +10,11 @@ import android.view.ViewGroup;
|
|||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.databinding.ItemItemBinding;
|
||||
import com.habitrpg.android.habitica.events.commands.FeedCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.HatchingCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.InvitePartyToQuestCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.SellItemCommand;
|
||||
import com.habitrpg.android.habitica.ui.fragments.inventory.items.ItemRecyclerFragment;
|
||||
import com.habitrpg.android.habitica.ui.menu.BottomSheetMenu;
|
||||
import com.habitrpg.android.habitica.ui.menu.BottomSheetMenuItem;
|
||||
import com.habitrpg.android.habitica.ui.menu.BottomSheetMenuSelectionRunnable;
|
||||
|
|
@ -19,10 +22,12 @@ import com.magicmicky.habitrpgwrapper.lib.models.inventory.Egg;
|
|||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Food;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.HatchingPotion;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Item;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Pet;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.QuestContent;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemRecyclerAdapter extends RecyclerView.Adapter<ItemRecyclerAdapter.ItemViewHolder> {
|
||||
|
|
@ -30,6 +35,11 @@ public class ItemRecyclerAdapter extends RecyclerView.Adapter<ItemRecyclerAdapte
|
|||
private List<Item> itemList;
|
||||
|
||||
public Boolean isHatching;
|
||||
public Boolean isFeeding;
|
||||
public Item hatchingItem;
|
||||
public Pet feedingPet;
|
||||
public ItemRecyclerFragment fragment;
|
||||
public HashMap<String, Integer> ownedPets;
|
||||
|
||||
public Context context;
|
||||
|
||||
|
|
@ -73,9 +83,20 @@ public class ItemRecyclerAdapter extends RecyclerView.Adapter<ItemRecyclerAdapte
|
|||
itemView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public Boolean isPetOwned() {
|
||||
String petKey;
|
||||
if (item instanceof Egg) {
|
||||
petKey = item.getKey() + "-" + hatchingItem.getKey();
|
||||
} else {
|
||||
petKey = hatchingItem.getKey() + "-" + item.getKey();
|
||||
}
|
||||
return ownedPets.containsKey(petKey);
|
||||
}
|
||||
|
||||
public void bind(Item item) {
|
||||
this.item = item;
|
||||
binding.setTitle(item.getText());
|
||||
binding.setDisabled(false);
|
||||
if (item instanceof QuestContent) {
|
||||
binding.setImageNamed("inventory_quest_scroll_"+item.getKey());
|
||||
} else {
|
||||
|
|
@ -88,21 +109,23 @@ public class ItemRecyclerAdapter extends RecyclerView.Adapter<ItemRecyclerAdapte
|
|||
type = "HatchingPotion";
|
||||
}
|
||||
binding.setImageNamed("Pet_"+type+"_"+item.getKey());
|
||||
|
||||
if (isHatching) {
|
||||
this.binding.setDisabled(this.isPetOwned());
|
||||
}
|
||||
}
|
||||
binding.setValue(item.getOwned().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!isHatching) {
|
||||
if (!isHatching && !isFeeding) {
|
||||
BottomSheetMenu menu = new BottomSheetMenu(context);
|
||||
if (!(item instanceof QuestContent)) {
|
||||
menu.addMenuItem(new BottomSheetMenuItem(resources.getString(R.string.sell, item.getValue()), true));
|
||||
}
|
||||
if (item instanceof Egg) {
|
||||
menu.addMenuItem(new BottomSheetMenuItem(resources.getString(R.string.hatch_with_potion)));
|
||||
} else if (item instanceof Food) {
|
||||
menu.addMenuItem(new BottomSheetMenuItem(resources.getString(R.string.feed_to_pet)));
|
||||
} else if (item instanceof HatchingPotion) {
|
||||
menu.addMenuItem(new BottomSheetMenuItem(resources.getString(R.string.hatch_egg)));
|
||||
} else if (item instanceof QuestContent) {
|
||||
|
|
@ -126,8 +149,17 @@ public class ItemRecyclerAdapter extends RecyclerView.Adapter<ItemRecyclerAdapte
|
|||
return;
|
||||
}
|
||||
if (item instanceof Egg) {
|
||||
HatchingCommand event = new HatchingCommand();
|
||||
event.usingEgg = (Egg)item;
|
||||
EventBus.getDefault().post(event);
|
||||
} else if (item instanceof Food) {
|
||||
FeedCommand event = new FeedCommand();
|
||||
event.usingFood = (Food)item;
|
||||
EventBus.getDefault().post(event);
|
||||
} else if (item instanceof HatchingPotion) {
|
||||
HatchingCommand event = new HatchingCommand();
|
||||
event.usingHatchingPotion = (HatchingPotion)item;
|
||||
EventBus.getDefault().post(event);
|
||||
} else if (item instanceof QuestContent) {
|
||||
InvitePartyToQuestCommand event = new InvitePartyToQuestCommand();
|
||||
event.questKey = item.getKey();
|
||||
|
|
@ -136,6 +168,28 @@ public class ItemRecyclerAdapter extends RecyclerView.Adapter<ItemRecyclerAdapte
|
|||
}
|
||||
});
|
||||
menu.show();
|
||||
} else if (isHatching){
|
||||
if (this.isPetOwned()) {
|
||||
return;
|
||||
}
|
||||
if (item instanceof Egg) {
|
||||
HatchingCommand event = new HatchingCommand();
|
||||
event.usingEgg = (Egg)item;
|
||||
event.usingHatchingPotion = (HatchingPotion)hatchingItem;
|
||||
EventBus.getDefault().post(event);
|
||||
} else if (item instanceof HatchingPotion) {
|
||||
HatchingCommand event = new HatchingCommand();
|
||||
event.usingHatchingPotion = (HatchingPotion) item;
|
||||
event.usingEgg = (Egg)hatchingItem;
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
fragment.dismiss();
|
||||
} else if (isFeeding) {
|
||||
FeedCommand event = new FeedCommand();
|
||||
event.usingPet = feedingPet;
|
||||
event.usingFood = (Food)item;
|
||||
EventBus.getDefault().post(event);
|
||||
fragment.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,10 +11,17 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.events.commands.EquipCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.FeedCommand;
|
||||
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
|
||||
import com.habitrpg.android.habitica.ui.menu.BottomSheetMenu;
|
||||
import com.habitrpg.android.habitica.ui.menu.BottomSheetMenuItem;
|
||||
import com.habitrpg.android.habitica.ui.menu.BottomSheetMenuSelectionRunnable;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Mount;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Pet;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -84,18 +91,22 @@ public class MountDetailRecyclerAdapter extends RecyclerView.Adapter<MountDetail
|
|||
itemView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public Boolean isOwned() {
|
||||
if (ownedMapping != null && animal != null) {
|
||||
if (ownedMapping.containsKey(animal.getKey()) && ownedMapping.get(animal.getKey())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void bind(Mount item) {
|
||||
animal = item;
|
||||
titleView.setText(item.getColor());
|
||||
ownedTextView.setVisibility(View.GONE);
|
||||
this.imageView.setAlpha(1.0f);
|
||||
if (ownedMapping != null) {
|
||||
if (ownedMapping.containsKey(item.getKey()) && ownedMapping.get(item.getKey())) {
|
||||
DataBindingUtils.loadImage(this.imageView, "Mount_Icon_" + itemType + "-" + item.getColor());
|
||||
} else {
|
||||
ownedTextView.setText(null);
|
||||
DataBindingUtils.loadImage(this.imageView, "PixelPaw");
|
||||
this.imageView.setAlpha(0.4f);
|
||||
}
|
||||
if (this.isOwned()) {
|
||||
DataBindingUtils.loadImage(this.imageView, "Mount_Icon_" + itemType + "-" + item.getColor());
|
||||
} else {
|
||||
DataBindingUtils.loadImage(this.imageView, "PixelPaw");
|
||||
this.imageView.setAlpha(0.4f);
|
||||
|
|
@ -104,7 +115,22 @@ public class MountDetailRecyclerAdapter extends RecyclerView.Adapter<MountDetail
|
|||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if (!this.isOwned()) {
|
||||
return;
|
||||
}
|
||||
BottomSheetMenu menu = new BottomSheetMenu(context);
|
||||
menu.addMenuItem(new BottomSheetMenuItem(resources.getString(R.string.use_animal)));
|
||||
menu.setSelectionRunnable(new BottomSheetMenuSelectionRunnable() {
|
||||
@Override
|
||||
public void selectedItemAt(Integer index) {
|
||||
if (index == 0) {
|
||||
EquipCommand event = new EquipCommand();
|
||||
event.type = "mount";
|
||||
event.key = animal.getKey();
|
||||
}
|
||||
}
|
||||
});
|
||||
menu.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,21 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.events.commands.EquipCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.FeedCommand;
|
||||
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Animal;
|
||||
import com.habitrpg.android.habitica.ui.menu.BottomSheetMenu;
|
||||
import com.habitrpg.android.habitica.ui.menu.BottomSheetMenuItem;
|
||||
import com.habitrpg.android.habitica.ui.menu.BottomSheetMenuSelectionRunnable;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Food;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Pet;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -43,7 +51,7 @@ public class PetDetailRecyclerAdapter extends RecyclerView.Adapter<PetDetailRecy
|
|||
public PetViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.animal_overview_item, parent, false);
|
||||
.inflate(R.layout.pet_detail_item, parent, false);
|
||||
|
||||
return new PetViewHolder(view);
|
||||
}
|
||||
|
|
@ -70,8 +78,8 @@ public class PetDetailRecyclerAdapter extends RecyclerView.Adapter<PetDetailRecy
|
|||
@Bind(R.id.titleTextView)
|
||||
TextView titleView;
|
||||
|
||||
@Bind(R.id.ownedTextView)
|
||||
TextView ownedTextView;
|
||||
@Bind(R.id.trainedProgressBar)
|
||||
ProgressBar trainedProgressbar;
|
||||
|
||||
Resources resources;
|
||||
|
||||
|
|
@ -84,22 +92,25 @@ public class PetDetailRecyclerAdapter extends RecyclerView.Adapter<PetDetailRecy
|
|||
itemView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public void bind(Pet item) {
|
||||
titleView.setText(item.getColor());
|
||||
ownedTextView.setVisibility(View.VISIBLE);
|
||||
this.imageView.setAlpha(1.0f);
|
||||
if (ownedMapping != null) {
|
||||
if (ownedMapping.containsKey(item.getKey()) && ownedMapping.get(item.getKey()) > 0) {
|
||||
this.ownedTextView.setText(ownedMapping.get(item.getKey()).toString());
|
||||
DataBindingUtils.loadImage(this.imageView, "Pet-" + itemType + "-" + item.getColor());
|
||||
} else {
|
||||
ownedTextView.setVisibility(View.GONE);
|
||||
ownedTextView.setText(null);
|
||||
DataBindingUtils.loadImage(this.imageView, "PixelPaw");
|
||||
this.imageView.setAlpha(0.4f);
|
||||
public Boolean isOwned() {
|
||||
if (ownedMapping != null && animal != null) {
|
||||
if (ownedMapping.containsKey(animal.getKey()) && ownedMapping.get(animal.getKey()) > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void bind(Pet item) {
|
||||
this.animal = item;
|
||||
this.titleView.setText(item.getColor());
|
||||
this.trainedProgressbar.setVisibility(View.VISIBLE);
|
||||
this.imageView.setAlpha(1.0f);
|
||||
if (this.isOwned()) {
|
||||
this.trainedProgressbar.setProgress(ownedMapping.get(item.getKey()));
|
||||
DataBindingUtils.loadImage(this.imageView, "Pet-" + itemType + "-" + item.getColor());
|
||||
} else {
|
||||
ownedTextView.setVisibility(View.GONE);
|
||||
this.trainedProgressbar.setVisibility(View.GONE);
|
||||
DataBindingUtils.loadImage(this.imageView, "PixelPaw");
|
||||
this.imageView.setAlpha(0.4f);
|
||||
}
|
||||
|
|
@ -107,7 +118,27 @@ public class PetDetailRecyclerAdapter extends RecyclerView.Adapter<PetDetailRecy
|
|||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if (!this.isOwned()) {
|
||||
return;
|
||||
}
|
||||
BottomSheetMenu menu = new BottomSheetMenu(context);
|
||||
menu.addMenuItem(new BottomSheetMenuItem(resources.getString(R.string.use_animal)));
|
||||
menu.addMenuItem(new BottomSheetMenuItem(resources.getString(R.string.feed)));
|
||||
menu.setSelectionRunnable(new BottomSheetMenuSelectionRunnable() {
|
||||
@Override
|
||||
public void selectedItemAt(Integer index) {
|
||||
if (index == 0) {
|
||||
EquipCommand event = new EquipCommand();
|
||||
event.type = "pet";
|
||||
event.key = animal.getKey();
|
||||
} else if (index == 1) {
|
||||
FeedCommand event = new FeedCommand();
|
||||
event.usingPet = animal;
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
}
|
||||
});
|
||||
menu.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments;
|
||||
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
import com.amplitude.api.Amplitude;
|
||||
|
|
@ -16,7 +17,7 @@ import org.json.JSONObject;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
public class BaseFragment extends Fragment {
|
||||
public class BaseFragment extends DialogFragment {
|
||||
|
||||
public String tutorialStepIdentifier;
|
||||
public String tutorialText;
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.events.commands.FeedCommand;
|
||||
import com.habitrpg.android.habitica.ui.adapter.inventory.PetDetailRecyclerAdapter;
|
||||
import com.habitrpg.android.habitica.ui.adapter.inventory.StableRecyclerAdapter;
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.inventory.items.ItemRecyclerFragment;
|
||||
import com.habitrpg.android.habitica.ui.helpers.MarginDecoration;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Animal;
|
||||
|
|
@ -22,6 +24,8 @@ import com.raizlabs.android.dbflow.sql.builder.Condition;
|
|||
import com.raizlabs.android.dbflow.sql.language.From;
|
||||
import com.raizlabs.android.dbflow.sql.language.Select;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -87,8 +91,6 @@ public class PetDetailRecyclerFragment extends BaseMainFragment {
|
|||
outState.putString(ANIMAL_TYPE_KEY, this.animalType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void setGridSpanCount(int width) {
|
||||
float itemWidth;
|
||||
itemWidth = getContext().getResources().getDimension(R.dimen.pet_width);
|
||||
|
|
@ -112,6 +114,17 @@ public class PetDetailRecyclerFragment extends BaseMainFragment {
|
|||
}
|
||||
};
|
||||
itemsRunnable.run();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void showFeedingDialog(FeedCommand event) {
|
||||
if (event.usingPet == null || event.usingFood == null) {
|
||||
ItemRecyclerFragment fragment = new ItemRecyclerFragment();
|
||||
fragment.feedingPet = event.usingPet;
|
||||
fragment.isFeeding = true;
|
||||
fragment.isHatching = false;
|
||||
fragment.itemType = "food";
|
||||
fragment.show(getFragmentManager(), "feedDialog");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,15 @@ package com.habitrpg.android.habitica.ui.fragments.inventory.items;
|
|||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.ui.DividerItemDecoration;
|
||||
|
|
@ -17,18 +20,35 @@ import com.magicmicky.habitrpgwrapper.lib.models.inventory.Egg;
|
|||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Food;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.HatchingPotion;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Item;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Pet;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.QuestContent;
|
||||
import com.raizlabs.android.dbflow.sql.builder.Condition;
|
||||
import com.raizlabs.android.dbflow.sql.language.From;
|
||||
import com.raizlabs.android.dbflow.sql.language.Select;
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.Bind;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class ItemRecyclerFragment extends BaseFragment {
|
||||
@Bind(R.id.recyclerView)
|
||||
public RecyclerView recyclerView;
|
||||
|
||||
@Bind(R.id.titleTextView)
|
||||
public TextView titleView;
|
||||
public ItemRecyclerAdapter adapter;
|
||||
public String itemType;
|
||||
|
||||
public Boolean isHatching;
|
||||
public Boolean isFeeding;
|
||||
public Item hatchingItem;
|
||||
public Pet feedingPet;
|
||||
public HashMap<String, Integer> ownedPets;
|
||||
|
||||
private static final String ITEM_TYPE_KEY = "CLASS_TYPE_KEY";
|
||||
LinearLayoutManager layoutManager = null;
|
||||
|
||||
|
|
@ -37,9 +57,9 @@ public class ItemRecyclerFragment extends BaseFragment {
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
if (view == null) {
|
||||
view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
|
||||
view = inflater.inflate(R.layout.fragment_items, container, false);
|
||||
|
||||
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
android.support.v4.app.FragmentActivity context = getActivity();
|
||||
|
||||
|
|
@ -56,6 +76,15 @@ public class ItemRecyclerFragment extends BaseFragment {
|
|||
adapter = new ItemRecyclerAdapter();
|
||||
adapter.context = this.getActivity();
|
||||
adapter.isHatching = this.isHatching;
|
||||
adapter.isFeeding = this.isFeeding;
|
||||
adapter.fragment = this;
|
||||
adapter.ownedPets = this.ownedPets;
|
||||
if (this.hatchingItem != null) {
|
||||
adapter.hatchingItem = this.hatchingItem;
|
||||
}
|
||||
if (this.feedingPet != null) {
|
||||
adapter.feedingPet = this.feedingPet;
|
||||
}
|
||||
recyclerView.setAdapter(adapter);
|
||||
this.loadItems();
|
||||
|
||||
|
|
@ -67,9 +96,33 @@ public class ItemRecyclerFragment extends BaseFragment {
|
|||
this.itemType = savedInstanceState.getString(ITEM_TYPE_KEY, "");
|
||||
}
|
||||
|
||||
if (this.isHatching) {
|
||||
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
this.titleView.setText(getString(R.string.hatch_with, this.hatchingItem.getText()));
|
||||
this.titleView.setVisibility(View.VISIBLE);
|
||||
} else if (this.isFeeding) {
|
||||
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
this.titleView.setText(getString(R.string.dialog_feeding, this.feedingPet.getKey()));
|
||||
this.titleView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
this.titleView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
if (this.isHatching) {
|
||||
ViewGroup.LayoutParams params = getDialog().getWindow().getAttributes();
|
||||
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
getDialog().getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
|
||||
}
|
||||
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments.inventory.items;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
|
|
@ -10,10 +11,13 @@ import android.view.ViewGroup;
|
|||
|
||||
import com.habitrpg.android.habitica.ContentCache;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.events.commands.FeedCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.HatchingCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.InvitePartyToQuestCommand;
|
||||
import com.habitrpg.android.habitica.events.commands.OpenMenuItemCommand;
|
||||
import com.habitrpg.android.habitica.ui.MainDrawerBuilder;
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.inventory.PetDetailRecyclerFragment;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.Group;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.UserParty;
|
||||
|
||||
|
|
@ -47,12 +51,6 @@ public class ItemsFragment extends BaseMainFragment {
|
|||
public void setViewPagerAdapter() {
|
||||
android.support.v4.app.FragmentManager fragmentManager = getChildFragmentManager();
|
||||
|
||||
UserParty party = user.getParty();
|
||||
|
||||
if (party == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
viewPager.setAdapter(new FragmentPagerAdapter(fragmentManager) {
|
||||
|
||||
@Override
|
||||
|
|
@ -79,6 +77,7 @@ public class ItemsFragment extends BaseMainFragment {
|
|||
}
|
||||
}
|
||||
fragment.isHatching = false;
|
||||
fragment.isFeeding = false;
|
||||
|
||||
return fragment;
|
||||
}
|
||||
|
|
@ -123,4 +122,22 @@ public class ItemsFragment extends BaseMainFragment {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void showHatchingDialog(HatchingCommand event) {
|
||||
if (event.usingEgg == null || event.usingHatchingPotion == null) {
|
||||
ItemRecyclerFragment fragment = new ItemRecyclerFragment();
|
||||
if (event.usingEgg != null) {
|
||||
fragment.itemType = "hatchingPotions";
|
||||
fragment.hatchingItem= event.usingEgg;
|
||||
} else {
|
||||
fragment.itemType = "eggs";
|
||||
fragment.hatchingItem = event.usingHatchingPotion;
|
||||
}
|
||||
fragment.isHatching = true;
|
||||
fragment.isFeeding = false;
|
||||
fragment.ownedPets = this.user.getItems().getPets();
|
||||
fragment.show(getFragmentManager(), "hatchingDialog");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.magicmicky.habitrpgwrapper.lib.models.UserAuth;
|
|||
import com.magicmicky.habitrpgwrapper.lib.models.UserAuthResponse;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.UserAuthSocial;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.responses.BuyResponse;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.responses.FeedResponse;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.responses.UnlockResponse;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.ItemData;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
|
||||
|
|
@ -51,11 +52,8 @@ public interface ApiService {
|
|||
@GET("/user/inventory/buy")
|
||||
void getInventoryBuyableGear(Callback<List<ItemData>> buyableGearCallback);
|
||||
|
||||
@POST("/user/inventory/equip/equipped/{key}")
|
||||
void equipBattleGear(@Path("key") String itemKey, Callback<Items> gearCallback);
|
||||
|
||||
@POST("/user/inventory/equip/costume/{key}")
|
||||
void equipCostume(@Path("key") String itemKey, Callback<Items> gearCallback);
|
||||
@POST("/user/inventory/equip/{type}/{key}")
|
||||
void equipItem(@Path("type") String type, @Path("key") String itemKey, Callback<Items> gearCallback);
|
||||
|
||||
@POST("/user/inventory/buy/{key}")
|
||||
void buyItem(@Path("key") String itemKey, Callback<BuyResponse> voidCallback);
|
||||
|
|
@ -63,6 +61,13 @@ public interface ApiService {
|
|||
@POST("/user/inventory/sell/{type}/{key}")
|
||||
void sellItem(@Path("type") String itemType, @Path("key") String itemKey, Callback<HabitRPGUser> voidCallback);
|
||||
|
||||
@POST("/user/inventory/feed/{pet}/{food}")
|
||||
void feedPet(@Path("pet") String petKey, @Path("food") String foodKey, Callback<FeedResponse> feedingCallback);
|
||||
|
||||
@POST("/user/inventory/hatch/{egg}/{hatchingPotion}")
|
||||
void hatchPet(@Path("egg") String eggKey, @Path("hatchingPotion") String hatchingPotionKey, Callback<Items> itemsCallback);
|
||||
|
||||
|
||||
@POST("/user/unlock")
|
||||
void unlockPath(@Query("path") String path, Callback<UnlockResponse> unlockResponseCallback);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package com.magicmicky.habitrpgwrapper.lib.models.responses;
|
||||
|
||||
public class FeedResponse {
|
||||
|
||||
public Integer value;
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue