mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
start adding shop info to items list
This commit is contained in:
parent
e7d32c3c6c
commit
fa9a4ab266
6 changed files with 94 additions and 10 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/coordinatorLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
|
@ -12,23 +13,56 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SectionTitle"
|
||||
style="@style/FragmentDialogTitle"
|
||||
android:id="@+id/titleTextView"
|
||||
android:background="@color/brand_100"
|
||||
android:textColor="@android:color/white"/>
|
||||
android:textColor="@android:color/white" />
|
||||
<com.habitrpg.android.habitica.ui.helpers.RecyclerViewEmptySupport
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/md_grey_500"
|
||||
android:scrollbars="vertical" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/empty_view"
|
||||
style="@style/EmptyView"/>
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/footerTextView"
|
||||
tools:text="Need more items. Check the Market"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"/>
|
||||
<Button
|
||||
android:id="@+id/openMarketButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:text="@string/open_market"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/empty_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/empty_text_view"
|
||||
style="@style/EmptyView"
|
||||
android:gravity="center" />
|
||||
<Button
|
||||
android:id="@+id/openEmptyMarketButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/open_market"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
|
|
|||
|
|
@ -424,5 +424,8 @@ To start, which parts of your life do you want to improve?</string>
|
|||
<string name="gem.purchase.listitem4">The ability to change your class before level 100</string>
|
||||
<string name="support_habitica">Support Habitica</string>
|
||||
<string name="skill_transformation_use">use</string>
|
||||
<string name="hatching_market_info">Not getting the right drops? Check out the Market!</string>
|
||||
<string name="feeding_market_info">Need different food? Buy more from the market!</string>
|
||||
<string name="open_market">Open Market</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -191,4 +191,13 @@
|
|||
<item name="android:layout_gravity">center_horizontal</item>
|
||||
<item name="android:paddingTop">12dp</item>
|
||||
</style>
|
||||
|
||||
<style name="FragmentDialogTitle">
|
||||
<item name="android:textSize">@dimen/card_medium_text</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:paddingLeft">@dimen/section_leftright_padding</item>
|
||||
<item name="android:paddingRight">@dimen/section_leftright_padding</item>
|
||||
<item name="android:paddingTop">@dimen/section_top_padding</item>
|
||||
<item name="android:paddingBottom">@dimen/section_top_padding</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
@ -34,6 +34,8 @@ public class ItemRecyclerAdapter extends RecyclerView.Adapter<ItemRecyclerAdapte
|
|||
|
||||
public Boolean isHatching;
|
||||
public Boolean isFeeding;
|
||||
public Boolean showShopAd;
|
||||
public String shopIdentifier;
|
||||
public Item hatchingItem;
|
||||
public Pet feedingPet;
|
||||
public ItemRecyclerFragment fragment;
|
||||
|
|
|
|||
|
|
@ -3,10 +3,12 @@ package com.habitrpg.android.habitica.ui.fragments.inventory.items;
|
|||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.components.AppComponent;
|
||||
import com.habitrpg.android.habitica.events.ContentReloadedEvent;
|
||||
import com.habitrpg.android.habitica.events.commands.OpenMenuItemCommand;
|
||||
import com.habitrpg.android.habitica.ui.adapter.inventory.ItemRecyclerAdapter;
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseFragment;
|
||||
import com.habitrpg.android.habitica.ui.helpers.RecyclerViewEmptySupport;
|
||||
import com.habitrpg.android.habitica.ui.menu.DividerItemDecoration;
|
||||
import com.habitrpg.android.habitica.ui.menu.MainDrawerBuilder;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Egg;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Food;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.inventory.HatchingPotion;
|
||||
|
|
@ -17,6 +19,7 @@ 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.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
|
@ -26,6 +29,7 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
@ -33,15 +37,22 @@ import java.util.List;
|
|||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class ItemRecyclerFragment extends BaseFragment {
|
||||
private static final String ITEM_TYPE_KEY = "CLASS_TYPE_KEY";
|
||||
@BindView(R.id.recyclerView)
|
||||
public RecyclerViewEmptySupport recyclerView;
|
||||
@BindView(R.id.empty_view)
|
||||
public TextView emptyView;
|
||||
public View emptyView;
|
||||
@BindView(R.id.empty_text_view)
|
||||
public TextView emptyTextView;
|
||||
@BindView(R.id.titleTextView)
|
||||
public TextView titleView;
|
||||
@BindView(R.id.footerTextView)
|
||||
public TextView footerView;
|
||||
@BindView(R.id.openMarketButton)
|
||||
public Button openMarketButton;
|
||||
public ItemRecyclerAdapter adapter;
|
||||
public String itemType;
|
||||
public String itemTypeText;
|
||||
|
|
@ -62,7 +73,7 @@ public class ItemRecyclerFragment extends BaseFragment {
|
|||
unbinder = ButterKnife.bind(this, view);
|
||||
|
||||
recyclerView.setEmptyView(emptyView);
|
||||
emptyView.setText(getString(R.string.empty_items, itemTypeText));
|
||||
emptyTextView.setText(getString(R.string.empty_items, itemTypeText));
|
||||
|
||||
android.support.v4.app.FragmentActivity context = getActivity();
|
||||
|
||||
|
|
@ -100,12 +111,20 @@ public class ItemRecyclerFragment extends BaseFragment {
|
|||
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
this.titleView.setText(getString(R.string.hatch_with, this.hatchingItem.getText()));
|
||||
this.titleView.setVisibility(View.VISIBLE);
|
||||
this.footerView.setText(getString(R.string.hatching_market_info));
|
||||
this.footerView.setVisibility(View.VISIBLE);
|
||||
this.openMarketButton.setVisibility(View.VISIBLE);
|
||||
} else if (this.isFeeding != null && this.isFeeding) {
|
||||
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
this.titleView.setText(getString(R.string.dialog_feeding, this.feedingPet.getColorText(), this.feedingPet.getAnimalText()));
|
||||
this.titleView.setVisibility(View.VISIBLE);
|
||||
this.footerView.setText(getString(R.string.feeding_market_info));
|
||||
this.footerView.setVisibility(View.VISIBLE);
|
||||
this.openMarketButton.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
this.titleView.setVisibility(View.GONE);
|
||||
this.footerView.setVisibility(View.GONE);
|
||||
this.openMarketButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
return view;
|
||||
|
|
@ -169,4 +188,21 @@ public class ItemRecyclerFragment extends BaseFragment {
|
|||
adapter.setItemList(items);
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.openMarketButton)
|
||||
public void onOpenMarketClicked() {
|
||||
dismiss();
|
||||
openMarket();
|
||||
}
|
||||
|
||||
@OnClick(R.id.openEmptyMarketButton)
|
||||
public void onEmptyOpenMarketButtonClicked() {
|
||||
openMarket();
|
||||
}
|
||||
|
||||
private void openMarket() {
|
||||
OpenMenuItemCommand command = new OpenMenuItemCommand();
|
||||
command.identifier = MainDrawerBuilder.SIDEBAR_SHOPS;
|
||||
EventBus.getDefault().post(command);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.2.0'
|
||||
classpath 'com.android.tools.build:gradle:2.2.1'
|
||||
classpath 'com.android.databinding:dataBinder:1.0-rc4'
|
||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||
classpath 'com.google.gms:google-services:3.0.0'
|
||||
|
|
|
|||
Loading…
Reference in a new issue