remove picasso

This commit is contained in:
d954mas 2016-11-19 14:29:45 +03:00
parent 9841a7fddc
commit 6f07bb79a5
37 changed files with 69 additions and 115 deletions

View file

@ -74,10 +74,7 @@ dependencies {
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:preference-v14:24.2.1'
compile 'com.android.support:multidex:1.0.1'
// Image Loading/Caching
compile 'com.squareup.picasso:picasso:2.5.2'
//QR Code
compile 'com.github.kenglxn.QRGen:android:2.2.0'

View file

@ -294,7 +294,7 @@
android:text="@string/attributes"
android:textStyle="bold" />
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/attributes_collapse_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View file

@ -14,7 +14,7 @@
android:gravity="center"
android:layout_marginTop="8dp"
style="@style/CardTitle"/>
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="180dp"

View file

@ -10,7 +10,7 @@
android:orientation="vertical"
android:background="@drawable/selection_highlight"
style="@style/CardContent">
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/imageView"
android:layout_width="@dimen/pet_image_width"
android:layout_height="@dimen/pet_image_height"

View file

@ -16,7 +16,7 @@
android:paddingBottom="8dp"
android:clickable="true"
android:background="@drawable/selection_highlight">
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="@dimen/avatar_width"
android:layout_height="@dimen/avatar_height"
bind:imageName='@{imageNamed == null ? "head_0" : imageNamed}'

View file

@ -22,7 +22,7 @@
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="@android:color/black" />
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/imageView"
android:layout_width="@dimen/avatar_width"
android:layout_height="@dimen/avatar_height"

View file

@ -22,7 +22,7 @@
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="@android:color/black" />
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/imageView"
android:layout_width="60dp"
android:layout_height="60dp"

View file

@ -3,7 +3,7 @@
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"

View file

@ -258,7 +258,7 @@
style="@style/CardTitle"
/>
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"

View file

@ -14,7 +14,7 @@
android:gravity="center_horizontal"
android:layout_margin="24dp" />
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"

View file

@ -6,7 +6,7 @@
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View file

@ -5,7 +5,7 @@
style="@style/RowWrapper"
android:id="@+id/gear_container">
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="@dimen/gear_image_size"
android:layout_height="@dimen/gear_image_size"
android:id="@+id/gear_image"

View file

@ -13,7 +13,7 @@
android:layout_height="wrap_content"
style="@style/RowWrapper"
android:clickable="true">
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="@dimen/gear_image_size"
android:layout_height="@dimen/gear_image_size"
bind:imageName='@{imageNamed == null ? "head_0" : imageNamed}'

View file

@ -15,7 +15,7 @@
android:layout_height="wrap_content"
style="@style/RowWrapper"
android:clickable="true">
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="@dimen/gear_image_size"
android:layout_height="@dimen/gear_image_size"
bind:imageName='@{imageNamed == null ? "head_0" : imageNamed}'

View file

@ -10,7 +10,7 @@
android:orientation="vertical"
android:background="@drawable/selection_highlight"
style="@style/CardContent">
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/imageView"
android:layout_width="@dimen/pet_image_width"
android:layout_height="@dimen/pet_image_height"

View file

@ -2,7 +2,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/pet_image_width" android:layout_height="@dimen/pet_image_height"
android:layout_gravity="center">
<ImageView android:id="@+id/pet_imageview"
<com.facebook.drawee.view.SimpleDraweeView android:id="@+id/pet_imageview"
android:layout_width="@dimen/pet_image_width" android:layout_height="@dimen/pet_image_height"
android:layout_gravity="center" />
</FrameLayout>

View file

@ -20,7 +20,7 @@
android:layout_height="300dp"
android:id="@+id/qrCodeWrapper">
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/QRImageView"

View file

@ -5,7 +5,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:clickable="false">
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/rewardImageView"
android:layout_width="60dp"
android:padding="5dp"

View file

@ -1,13 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bind="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/RowWrapper"
android:clickable="true"
android:background="@android:color/white">
<ImageView
android:background="@android:color/white">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/imageView"
android:layout_width="@dimen/gear_image_size"
android:layout_height="@dimen/gear_image_size"

View file

@ -5,7 +5,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/section_leftright_padding">
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/imageView"
android:layout_width="@dimen/shop_width"
android:layout_height="@dimen/shop_height"

View file

@ -10,7 +10,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/skill_image"
android:layout_width="40dp"
android:layout_height="40dp"

View file

@ -37,7 +37,7 @@
android:layout_marginBottom="@dimen/bar_padding"
android:orientation="horizontal"
android:id="@+id/value_bar_layout">
<ImageView
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/ic_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View file

@ -1,15 +1,13 @@
package com.habitrpg.android.habitica.ui;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
import android.content.Context;
import android.content.DialogInterface;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.text.Spannable;
import android.text.Spanned;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
@ -18,7 +16,7 @@ import android.widget.TextView;
public class ItemDetailDialog extends AlertDialog {
private final ImageView itemImageView;
private final SimpleDraweeView itemImageView;
private final TextView contentTextView;
private final TextView priceTextView;
private final ImageView currencyImageView;
@ -31,7 +29,7 @@ public class ItemDetailDialog extends AlertDialog {
contentViewLayout.setOrientation(LinearLayout.VERTICAL);
// Gear Image
itemImageView = new ImageView(context);
itemImageView = new SimpleDraweeView(context);
LinearLayout.LayoutParams gearImageLayoutParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.ui.activities;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.APIHelper;
import com.habitrpg.android.habitica.HabiticaApplication;
import com.habitrpg.android.habitica.HostConfig;
@ -134,7 +135,6 @@ import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import java.io.File;
@ -1097,7 +1097,7 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
.compose(apiHelper.configureApiCallObserver())
.subscribe(new ItemsCallback(user1 -> {
FrameLayout petWrapper = (FrameLayout) getLayoutInflater().inflate(R.layout.pet_imageview, null);
ImageView petImageView = (ImageView) petWrapper.findViewById(R.id.pet_imageview);
SimpleDraweeView petImageView = (SimpleDraweeView) petWrapper.findViewById(R.id.pet_imageview);
DataBindingUtils.loadImage(petImageView, "Pet-" + event.usingEgg.getKey() + "-" + event.usingHatchingPotion.getKey());
String potionName = event.usingHatchingPotion.getText();
@ -1142,7 +1142,7 @@ public class MainActivity extends BaseActivity implements Action1<Throwable>, Ha
showSnackbar(MainActivity.this, floatingMenuWrapper, getString(R.string.notification_pet_fed, pet.getColorText(), pet.getAnimalText()), SnackbarDisplayType.NORMAL);
if (feedResponse.value == -1) {
FrameLayout mountWrapper = (FrameLayout) getLayoutInflater().inflate(R.layout.pet_imageview, null);
ImageView mountImageView = (ImageView) mountWrapper.findViewById(R.id.pet_imageview);
SimpleDraweeView mountImageView = (SimpleDraweeView) mountWrapper.findViewById(R.id.pet_imageview);
DataBindingUtils.loadImage(mountImageView, "Mount_Icon_" + event.usingPet.getKey());
String colorName = event.usingPet.getColorText();

View file

@ -1,10 +1,10 @@
package com.habitrpg.android.habitica.ui.activities;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.components.AppComponent;
import com.habitrpg.android.habitica.ui.helpers.MarkdownParser;
import com.magicmicky.habitrpgwrapper.lib.api.MaintenanceApiService;
import com.squareup.picasso.Picasso;
import net.pherth.android.emoji_library.EmojiTextView;
@ -14,7 +14,6 @@ import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import javax.inject.Inject;
@ -31,7 +30,7 @@ public class MaintenanceActivity extends BaseActivity {
@BindView(R.id.titleTextView)
TextView titleTextView;
@BindView(R.id.imageView)
ImageView imageView;
SimpleDraweeView imageView;
@BindView(R.id.descriptionTextView)
EmojiTextView descriptionTextView;
@BindView(R.id.playStoreButton)
@ -50,7 +49,8 @@ public class MaintenanceActivity extends BaseActivity {
Bundle data = getIntent().getExtras();
this.titleTextView.setText(data.getString("title"));
Picasso.with(this).load(data.getString("imageUrl")).into(this.imageView);
imageView.setImageURI(Uri.parse(data.getString("imageUrl")));
this.descriptionTextView.setText(MarkdownParser.parseMarkdown(data.getString("description")));
this.descriptionTextView.setMovementMethod(LinkMovementMethod.getInstance());

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.ui.adapter;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.events.commands.OpenMenuItemCommand;
import com.habitrpg.android.habitica.events.commands.UnlockPathCommand;
@ -19,7 +20,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
@ -147,7 +147,7 @@ public class CustomizationRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
RelativeLayout linearLayout;
@BindView(R.id.imageView)
ImageView imageView;
SimpleDraweeView imageView;
@BindView(R.id.purchaseOverlay)
View purchaseOverlay;
@ -189,7 +189,7 @@ public class CustomizationRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
LinearLayout dialogContent = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.dialog_purchase_customization, null);
ImageView imageView = (ImageView) dialogContent.findViewById(R.id.imageView);
SimpleDraweeView imageView = (SimpleDraweeView) dialogContent.findViewById(R.id.imageView);
DataBindingUtils.loadImage(imageView, customization.getImageName(userSize, hairColor));
TextView priceLabel = (TextView) dialogContent.findViewById(R.id.priceLabel);

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.ui.adapter;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.events.commands.UseSkillCommand;
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
@ -14,7 +15,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
@ -60,7 +60,7 @@ public class SkillsRecyclerViewAdapter extends RecyclerView.Adapter<SkillsRecycl
class SkillViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
@BindView(R.id.skill_image)
ImageView skillImageView;
SimpleDraweeView skillImageView;
@BindView(R.id.skill_text)
TextView skillNameTextView;

View file

@ -1,19 +1,19 @@
package com.habitrpg.android.habitica.ui.adapter.inventory;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.events.commands.EquipCommand;
import com.magicmicky.habitrpgwrapper.lib.models.tasks.ItemData;
import com.squareup.picasso.Picasso;
import org.greenrobot.eventbus.EventBus;
import android.content.Context;
import android.net.Uri;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
@ -64,7 +64,7 @@ public class EquipmentRecyclerViewAdapter extends RecyclerView.Adapter<Equipment
TextView gearNotesTextView;
@BindView(R.id.gear_image)
ImageView imageView;
SimpleDraweeView imageView;
@BindView(R.id.equippedIndicator)
View equippedIndicator;
@ -96,10 +96,7 @@ public class EquipmentRecyclerViewAdapter extends RecyclerView.Adapter<Equipment
}
String imageUrl = "https://habitica-assets.s3.amazonaws.com/mobileApp/images/shop_" + gear.key + ".png";
Picasso.with(imageView.getContext())
.load(imageUrl)
.into(imageView);
imageView.setImageURI(Uri.parse(imageUrl));
}
@Override

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.ui.adapter.inventory;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.events.commands.EquipCommand;
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
@ -16,7 +17,6 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.HashMap;
@ -68,7 +68,7 @@ public class MountDetailRecyclerAdapter extends RecyclerView.Adapter<MountDetail
CardView cardView;
@BindView(R.id.imageView)
ImageView imageView;
SimpleDraweeView imageView;
@BindView(R.id.titleTextView)
TextView titleView;

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.ui.adapter.inventory;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.events.commands.EquipCommand;
import com.habitrpg.android.habitica.events.commands.FeedCommand;
@ -17,7 +18,6 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
@ -76,7 +76,7 @@ public class PetDetailRecyclerAdapter extends RecyclerView.Adapter<PetDetailRecy
CardView cardView;
@BindView(R.id.imageView)
ImageView imageView;
SimpleDraweeView imageView;
@BindView(R.id.titleTextView)
TextView titleView;

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.ui.adapter.inventory;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.events.commands.BuyGemItemCommand;
import com.habitrpg.android.habitica.ui.ItemDetailDialog;
@ -12,7 +13,6 @@ import com.magicmicky.habitrpgwrapper.lib.models.ShopItem;
import org.greenrobot.eventbus.EventBus;
import android.content.Context;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
@ -21,7 +21,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.ArrayList;
@ -107,7 +106,7 @@ public class ShopRecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
static class ItemViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
@BindView(R.id.imageView)
ImageView imageView;
SimpleDraweeView imageView;
@BindView(R.id.titleView)
TextView titleView;
@BindView(R.id.descriptionView)
@ -216,7 +215,7 @@ public class ShopRecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
public static class ShopHeaderViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.imageView)
public ImageView imageView;
public SimpleDraweeView imageView;
@BindView(R.id.descriptionView)
public TextView descriptionView;

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.ui.adapter.inventory;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.ui.activities.MainActivity;
import com.habitrpg.android.habitica.ui.fragments.inventory.stable.MountDetailRecyclerFragment;
@ -8,15 +9,12 @@ import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
import com.habitrpg.android.habitica.ui.viewHolders.SectionViewHolder;
import com.magicmicky.habitrpgwrapper.lib.models.inventory.Animal;
import android.content.Context;
import android.content.res.Resources;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
@ -82,7 +80,7 @@ public class StableRecyclerAdapter extends RecyclerView.Adapter<RecyclerView.Vie
CardView cardView;
@BindView(R.id.imageView)
ImageView imageView;
SimpleDraweeView imageView;
@BindView(R.id.titleTextView)
TextView titleView;

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.ui.adapter.setup;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.events.commands.UpdateUserCommand;
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils;
@ -15,7 +16,6 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
@ -142,7 +142,7 @@ public class CustomizationSetupAdapter extends RecyclerView.Adapter<RecyclerView
RelativeLayout linearLayout;
@BindView(R.id.imageView)
ImageView imageView;
SimpleDraweeView imageView;
@BindView(R.id.purchaseOverlay)
View purchaseOverlay;

View file

@ -1,15 +1,15 @@
package com.habitrpg.android.habitica.ui.adapter.social;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.R;
import com.magicmicky.habitrpgwrapper.lib.models.QuestProgress;
import com.magicmicky.habitrpgwrapper.lib.models.inventory.QuestContent;
import com.squareup.picasso.Picasso;
import android.net.Uri;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.ArrayList;
@ -57,7 +57,7 @@ public class QuestCollectRecyclerViewAdapter extends RecyclerView.Adapter<QuestC
class QuestCollectViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.image)
ImageView image;
SimpleDraweeView image;
@BindView(R.id.name)
TextView name;
@ -74,9 +74,7 @@ public class QuestCollectRecyclerViewAdapter extends RecyclerView.Adapter<QuestC
}
public void bind(String key) {
Picasso.with(view.getContext())
.load("https://habitica-assets.s3.amazonaws.com/mobileApp/images/" + "quest_" + quest.getKey() + "_" + key + ".png")
.into(image);
image.setImageURI(Uri.parse("https://habitica-assets.s3.amazonaws.com/mobileApp/images/" + "quest_" + quest.getKey() + "_" + key + ".png"));
if (quest.getCollect().get(key) != null) {
name.setText(quest.getCollect().get(key).text);
count.setText(progress.collect.get(key) + " / " + quest.getCollect().get(key).count);

View file

@ -1,8 +1,8 @@
package com.habitrpg.android.habitica.ui.helpers;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.databinding.ValueBarBinding;
import com.squareup.picasso.Picasso;
import net.pherth.android.emoji_library.EmojiTextView;
@ -10,6 +10,7 @@ import android.databinding.BindingAdapter;
import android.databinding.DataBindingUtil;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.res.ResourcesCompat;
@ -19,28 +20,22 @@ import android.view.animation.Animation;
import android.view.animation.Transformation;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
public class DataBindingUtils {
@BindingAdapter("bind:imageName")
public static void loadImage(ImageView view, String imageName) {
public static void loadImage(SimpleDraweeView view, String imageName) {
if (view.getVisibility() == View.VISIBLE) {
Picasso.with(view.getContext())
.load("https://habitica-assets.s3.amazonaws.com/mobileApp/images/" + imageName + ".png")
.into(view);
view.setImageURI(Uri.parse("https://habitica-assets.s3.amazonaws.com/mobileApp/images/" + imageName + ".png"));
}
}
@BindingAdapter("bind:questImageName")
public static void loadQuestImage(ImageView view, String imageName) {
public static void loadQuestImage(SimpleDraweeView view, String imageName) {
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);
view.setImageURI(Uri.parse("https://habitica-assets.s3.amazonaws.com/mobileApp/images/" + imageName + ".png"));
}
}

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.ui.viewHolders.tasks;
import com.facebook.drawee.view.SimpleDraweeView;
import com.habitrpg.android.habitica.R;
import com.habitrpg.android.habitica.events.TaskTappedEvent;
import com.habitrpg.android.habitica.events.commands.BuyRewardCommand;
@ -9,15 +10,8 @@ import com.magicmicky.habitrpgwrapper.lib.models.tasks.Task;
import org.greenrobot.eventbus.EventBus;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.text.DecimalFormat;
@ -28,7 +22,7 @@ public class RewardViewHolder extends BaseTaskViewHolder {
private final DecimalFormat priceFormat;
@BindView(R.id.rewardImageView)
ImageView rewardImageView;
SimpleDraweeView rewardImageView;
@BindView(R.id.btnReward)
Button rewardButton;

View file

@ -1,29 +1,8 @@
package com.habitrpg.android.habitica.userpicture;
import com.magicmicky.habitrpgwrapper.lib.models.HabitRPGUser;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.util.Log;
import android.widget.ImageView;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
public class UserPicture {
final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
/* final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
private static final int WIDTH = 140;
private static final int HEIGHT = 147;
private static final int COMPACT_WIDTH = 114;
@ -156,7 +135,7 @@ public class UserPicture {
private void clearRunning() {
for (SpriteTarget target : this.targets) {
Picasso.with(this.context).cancelRequest(target);
// Picasso.with(this.context).cancelRequest(target);
}
this.targets.clear();
this.numOfTasks.set(0);
@ -223,7 +202,7 @@ public class UserPicture {
Integer layerNumber = 0;
this.numOfTasks.set(layerNames.size());
this.layers.clear();
Picasso picasso = Picasso.with(this.context);
// Picasso picasso = Picasso.with(this.context);
for (String layer : layerNames) {
this.layers.add(null);
SpriteTarget target = new SpriteTarget(layerNumber, layer);
@ -302,7 +281,7 @@ public class UserPicture {
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
}
}*/
}