mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-11 14:58:48 +00:00
new icon for custom rewards
This commit is contained in:
parent
3883241fe2
commit
1021615d1c
7 changed files with 10 additions and 11 deletions
BIN
Habitica/res/drawable-hdpi/custom_reward.png
Normal file
BIN
Habitica/res/drawable-hdpi/custom_reward.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Habitica/res/drawable-mdpi/custom_reward.png
Normal file
BIN
Habitica/res/drawable-mdpi/custom_reward.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 802 B |
BIN
Habitica/res/drawable-xhdpi/custom_reward.png
Normal file
BIN
Habitica/res/drawable-xhdpi/custom_reward.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
Habitica/res/drawable-xxhdpi/custom_reward.png
Normal file
BIN
Habitica/res/drawable-xxhdpi/custom_reward.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -36,9 +36,4 @@ public class WelcomeFragment extends BaseFragment {
|
|||
|
||||
@Override
|
||||
public void injectFragment(AppComponent component) {}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue