mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-17 19:42:04 +00:00
display skill icons
This commit is contained in:
parent
35fe0f78d2
commit
a444dfd3a9
2 changed files with 20 additions and 4 deletions
|
|
@ -2,21 +2,30 @@
|
|||
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp">
|
||||
style="@style/CardView.Default">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="8dp">
|
||||
style="@style/CardContent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:id="@+id/skill_image"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:id="@+id/skill_text" />
|
||||
|
|
|
|||
|
|
@ -7,11 +7,14 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.events.commands.UseSkillCommand;
|
||||
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
|
||||
import com.magicmicky.habitrpgwrapper.lib.models.Skill;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
|
|
@ -58,6 +61,9 @@ public class SkillsRecyclerViewAdapter extends RecyclerView.Adapter<SkillsRecycl
|
|||
|
||||
class SkillViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
|
||||
@Bind(R.id.skill_image)
|
||||
ImageView skillImageView;
|
||||
|
||||
@Bind(R.id.skill_text)
|
||||
TextView skillNameTextView;
|
||||
|
||||
|
|
@ -86,6 +92,7 @@ public class SkillsRecyclerViewAdapter extends RecyclerView.Adapter<SkillsRecycl
|
|||
skillNameTextView.setText(skill.text);
|
||||
skillNotesTextView.setText(skill.notes);
|
||||
priceButton.setText(String.format(context.getResources().getString(R.string.mana_price_button), skill.mana));
|
||||
DataBindingUtils.loadImage(skillImageView, "shop_"+skill.key);
|
||||
|
||||
if (skill.mana > mana) {
|
||||
priceButton.setEnabled(false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue