new icon for custom rewards

This commit is contained in:
Phillip Thelen 2017-04-17 16:49:43 +02:00
parent 3883241fe2
commit 1021615d1c
7 changed files with 10 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -16,7 +16,7 @@
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:padding="5dp" />
android:padding="8dp" />
<LinearLayout
android:id="@+id/textReward"
@ -27,9 +27,9 @@
android:orientation="vertical"
android:paddingBottom="@dimen/task_top_bottom_padding"
android:paddingEnd="@dimen/reward_spacing"
android:paddingLeft="@dimen/task_text_padding"
android:paddingLeft="12dp"
android:paddingRight="@dimen/reward_spacing"
android:paddingStart="@dimen/task_text_padding"
android:paddingStart="12dp"
android:paddingTop="@dimen/task_top_bottom_padding">
<net.pherth.android.emoji_library.EmojiTextView

View file

@ -36,9 +36,4 @@ public class WelcomeFragment extends BaseFragment {
@Override
public void injectFragment(AppComponent component) {}
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
}

View file

@ -10,6 +10,8 @@ import com.habitrpg.android.habitica.models.tasks.Task;
import org.greenrobot.eventbus.EventBus;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.Button;
@ -27,10 +29,13 @@ public class RewardViewHolder extends BaseTaskViewHolder {
@BindView(R.id.btnReward)
Button rewardButton;
private Drawable customRewardIcon;
public RewardViewHolder(View itemView) {
super(itemView);
priceFormat = new DecimalFormat("0.##");
customRewardIcon = ContextCompat.getDrawable(itemView.getContext(), R.drawable.custom_reward);
}
@Override
@ -40,10 +45,9 @@ public class RewardViewHolder extends BaseTaskViewHolder {
this.rewardButton.setText(this.priceFormat.format(this.task.value));
if (this.isItem()) {
this.rewardImageView.setVisibility(View.VISIBLE);
DataBindingUtils.loadImage(this.rewardImageView, "shop_" + this.task.getId());
} else {
this.rewardImageView.setVisibility(View.GONE);
this.rewardImageView.setImageDrawable(customRewardIcon);
}
}
@ -57,7 +61,7 @@ public class RewardViewHolder extends BaseTaskViewHolder {
}
@OnClick(R.id.btnReward)
public void buyReward() {
void buyReward() {
BuyRewardCommand event = new BuyRewardCommand();
event.Reward = task;
EventBus.getDefault().post(event);