Merge pull request #316 from dlew/dlew/quest-display

Fixed/improved quest display
This commit is contained in:
Phillip Thelen 2015-12-17 15:44:04 +01:00
commit 9c3d3b962a
4 changed files with 24 additions and 37 deletions

View file

@ -7,6 +7,7 @@
<import type="com.magicmicky.habitrpgwrapper.lib.models.Group" />
<import type="com.magicmicky.habitrpgwrapper.lib.models.QuestContent" />
<import type="android.view.View" />
<import type="android.text.Html"/>
<variable
name="party"
@ -53,7 +54,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Quest"
android:text="@string/quest"
android:layout_margin="5dp"
android:visibility="@{quest != null ? View.VISIBLE : View.GONE}" />
@ -63,54 +64,35 @@
android:layout_margin="5dp"
android:visibility="@{quest != null ? View.VISIBLE : View.GONE}">
<GridLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alignmentMode="alignBounds"
android:columnCount="2"
android:columnOrderPreserved="false"
android:padding="5dp"
android:rowCount="3">
android:orientation="vertical"
android:padding="8dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_columnSpan="2"
android:layout_marginBottom="8dp"
android:text="@{quest.text}" />
android:text="@{quest.text}"
android:textStyle="bold"
/>
<ImageView
android:layout_column="0"
android:layout_columnWeight="1"
android:layout_row="1"
bind:imageName='@{"quest_"+ quest.key}'
android:src="@drawable/ic_action_chat"
android:layout_width="128dp"
android:layout_height="128dp" />
<LinearLayout
android:layout_column="1"
android:layout_columnWeight="4"
android:layout_row="1"
android:orientation="vertical">
</LinearLayout>
<LinearLayout android:layout_column="0"
android:layout_columnSpan="2"
android:layout_row="2"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
android:layout_marginBottom="8dp"
bind:imageName='@{"quest_"+ quest.key}'
/>
<TextView android:layout_margin="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{quest.notes}" />
</LinearLayout>
</GridLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{quest.notes != null ? Html.fromHtml(quest.notes) : null}"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>

View file

@ -30,6 +30,9 @@
<dimen name="row_size">58dp</dimen>
<dimen name="btn_height_reward">50dp</dimen>
<dimen name="quest_image_width">128dp</dimen>
<dimen name="quest_image_height">128dp</dimen>
<!-- Widget -->
<dimen name="widget_bar_horizontal_margin">20dp</dimen>

View file

@ -145,4 +145,5 @@
<string name="taskform.delete.message">Do you really want to delete?</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="quest">Quest</string>
</resources>

View file

@ -27,6 +27,7 @@ public class DataBindingUtils {
if (view.getVisibility() == View.VISIBLE) {
Picasso.with(view.getContext())
.load("https://habitica-assets.s3.amazonaws.com/mobileApp/images/" + imageName + ".png")
.resizeDimen(R.dimen.quest_image_width, R.dimen.quest_image_height)
.into(view);
}
}