better display for skills

This commit is contained in:
Phillip Thelen 2015-11-26 21:26:53 +01:00
parent 2d2e8ad9ab
commit b00d545d1c
3 changed files with 19 additions and 3 deletions

View file

@ -12,7 +12,7 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
@ -32,7 +32,9 @@
android:layout_height="wrap_content"
android:id="@+id/price_button"
android:background="@color/brand_100"
android:textColor="@android:color/white" />
android:textColor="@android:color/white"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp" />
</LinearLayout>
</android.support.v7.widget.CardView>

View file

@ -52,6 +52,8 @@ public class SkillsRecyclerViewAdapter extends RecyclerView.Adapter<SkillsRecycl
private List<Skill> skillList;
public Double mana;
public void setSkillList(List<Skill> skillList) {
this.skillList = skillList;
this.notifyDataSetChanged();
@ -102,6 +104,18 @@ public class SkillsRecyclerViewAdapter extends RecyclerView.Adapter<SkillsRecycl
skillNameTextView.setText(skill.text);
skillNotesTextView.setText(skill.notes);
priceButton.setText(String.format(resources.getString(R.string.mana_price_button), skill.mana));
if (skill.mana > mana) {
priceButton.setEnabled(false);
priceButton.setBackgroundResource(R.color.task_gray);
skillNameTextView.setTextColor(resources.getColor(R.color.task_gray));
skillNotesTextView.setTextColor(resources.getColor(R.color.task_gray));
} else {
skillNameTextView.setTextColor(resources.getColor(android.R.color.black));
skillNotesTextView.setTextColor(resources.getColor(android.R.color.black));
priceButton.setEnabled(true);
}
}
}
}

View file

@ -53,7 +53,7 @@ public class SkillsFragment extends BaseFragment {
view = inflater.inflate(R.layout.fragment_skills, container, false);
adapter = new SkillsRecyclerViewAdapter();
adapter.mana = this.user.getStats().getMp();
loadSkills();
return view;