Dynamically size quest image based on presence

If it's there, it's 128dp x 128dp. If it's not, the ImageView is basically
hidden.
This commit is contained in:
Dan Lew 2015-12-17 06:50:55 -06:00
parent 888e0b7cfa
commit 9f5c219605
3 changed files with 6 additions and 3 deletions

View file

@ -86,9 +86,8 @@
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" />
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_column="1"

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

@ -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);
}
}