mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-20 04:39:04 +00:00
better display for rewards
This commit is contained in:
parent
950aa1264c
commit
ff5c1ece48
6 changed files with 25 additions and 44 deletions
|
|
@ -24,6 +24,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:paddingLeft="16dp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<View
|
||||
|
|
|
|||
|
|
@ -17,22 +17,13 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:clickable="false"
|
||||
>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/white"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_centerVertical="true"
|
||||
android:weightSum="1">
|
||||
|
||||
<ImageView
|
||||
|
|
@ -40,38 +31,33 @@
|
|||
android:layout_width="60dp"
|
||||
android:padding="5dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:visibility='@{reward.specialTag == "item" ? View.VISIBLE : View.VISIBLE}'
|
||||
android:layout_gravity="center_vertical"
|
||||
android:visibility='@{reward.specialTag == "item" ? View.VISIBLE : View.GONE}'
|
||||
bind:imageName='@{"shop_"+reward.id}'/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/textReward"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
android:layout_weight="1"
|
||||
android:paddingBottom="@dimen/task_top_bottom_padding"
|
||||
android:paddingTop="@dimen/task_top_bottom_padding"
|
||||
android:paddingLeft='16dp'
|
||||
android:paddingRight="@dimen/reward_spacing">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/checkedTextView"
|
||||
style="@style/CardTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{reward.text}" />
|
||||
android:text="@{reward.text}"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/notesTextView"
|
||||
style="@style/CardText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="41dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{reward.notes}"
|
||||
android:visibility="@{reward.notes != null ? View.VISIBLE : View.GONE}"/>
|
||||
|
||||
|
|
@ -79,9 +65,8 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/btnReward"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="25dp"
|
||||
android:padding="3dp"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="30dp"
|
||||
android:textColor="@color/white"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textSize="15sp"
|
||||
|
|
@ -89,14 +74,11 @@
|
|||
android:text='@{String.format("%.0f", reward.value)}'
|
||||
android:background="@drawable/rounded_purple_square"
|
||||
android:layout_weight="2"
|
||||
android:layout_marginRight="10dp" />
|
||||
android:layout_marginRight="10dp"
|
||||
android:paddingLeft="6dp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:id="@+id/bottomBorderView"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="com.habitrpg.android.habitica.TaskFormActivity">
|
||||
<item android:id="@+id/action_discard_changes" android:title="@string/discard_changes"
|
||||
android:orderInCategory="100" app:showAsAction="never" />
|
||||
android:orderInCategory="100" app:showAsAction="always" />
|
||||
</menu>
|
||||
|
|
|
|||
|
|
@ -45,4 +45,5 @@
|
|||
|
||||
<dimen name="login_field_width">350dp</dimen>
|
||||
<dimen name="task_top_bottom_padding">20dp</dimen>
|
||||
<dimen name="reward_spacing">8dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -139,7 +139,7 @@
|
|||
<string name="checklist.item.hint">Add item…</string>
|
||||
<string name="title_activity_task_form">Add Task</string>
|
||||
|
||||
<string name="discard_changes">Discard Changes</string>
|
||||
<string name="discard_changes">Cancel</string>
|
||||
<string name="notes">Notes</string>
|
||||
<string name="text">Text</string>
|
||||
<string name="difficulty">Difficulty</string>
|
||||
|
|
|
|||
|
|
@ -497,22 +497,21 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
public class RewardViewHolder extends ViewHolder<Task> {
|
||||
RewardItemCardBinding binding;
|
||||
|
||||
@InjectView(R.id.btnReward)
|
||||
Button btnReward;
|
||||
|
||||
public RewardViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
binding = DataBindingUtil.bind(itemView);
|
||||
|
||||
binding.btnReward.setClickable(true);
|
||||
binding.btnReward.setOnClickListener(this);
|
||||
binding.imageView3.setOnClickListener(this);
|
||||
binding.gearElementsLayout.setOnClickListener(this);
|
||||
binding.imageView3.setVisibility(View.GONE);
|
||||
|
||||
btnReward.setClickable(true);
|
||||
btnReward.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v == binding.btnReward) {
|
||||
if (v == btnReward) {
|
||||
LinearLayout contentViewForDialog = createContentViewForDialog();
|
||||
|
||||
MaterialDialog dialog = createGearDialog(contentViewForDialog);
|
||||
|
|
@ -602,7 +601,6 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
// endregion
|
||||
|
||||
public void loadContent(HabitRPGUser user) {
|
||||
Log.d("setting content", this.taskType);
|
||||
this.observableContent = new ObservableArrayList<>();
|
||||
if (this.taskType.equals(Task.TYPE_HABIT)) {
|
||||
this.observableContent.addAll(user.getHabits());
|
||||
|
|
@ -627,7 +625,6 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
public void loadContent(boolean forced) {
|
||||
|
||||
if (this.observableContent == null || forced) {
|
||||
Log.d("Loading content", this.taskType);
|
||||
this.observableContent = new ObservableArrayList<>();
|
||||
new Select().from(Task.class)
|
||||
.where(Condition.column("type").eq(this.taskType))
|
||||
|
|
|
|||
Loading…
Reference in a new issue