mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-23 14:17:15 +00:00
fix equipping pets and mounts
This commit is contained in:
parent
318614ac02
commit
6dc5399b8c
2 changed files with 18 additions and 20 deletions
|
|
@ -120,14 +120,12 @@ public class MountDetailRecyclerAdapter extends RecyclerView.Adapter<MountDetail
|
|||
}
|
||||
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.setSelectionRunnable(index -> {
|
||||
if (index == 0) {
|
||||
EquipCommand event = new EquipCommand();
|
||||
event.type = "mount";
|
||||
event.key = animal.getKey();
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
});
|
||||
menu.show();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||
import android.content.res.Resources;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
|
@ -148,18 +149,17 @@ public class PetDetailRecyclerAdapter extends RecyclerView.Adapter<PetDetailRecy
|
|||
if (!this.isMountOwned()) {
|
||||
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.setSelectionRunnable(index -> {
|
||||
Log.e("EEEEEEE", index.toString());
|
||||
if (index == 0) {
|
||||
EquipCommand event = new EquipCommand();
|
||||
event.type = "pet";
|
||||
event.key = animal.getKey();
|
||||
EventBus.getDefault().post(event);
|
||||
} else if (index == 1) {
|
||||
FeedCommand event = new FeedCommand();
|
||||
event.usingPet = animal;
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
});
|
||||
menu.show();
|
||||
|
|
|
|||
Loading…
Reference in a new issue