Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fresco/Picasso comparison on images with a dimension > 2048px
package com.example.matteomazzarolo.imagetest;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.squareup.picasso.Picasso;
public class MainActivity extends AppCompatActivity {
final static String IMG_URL = "https://drive.google.com/uc?export=view&id=1ZaMs3E-_TubRoiAg1BjQdD7ylpgVf_iH";
Button mButtonFresco;
Button mButtonPicasso;
SimpleDraweeView mImageViewFresco;
ImageView mImageViewPicasso;
TextView mTextViewInfo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportActionBar().hide();
mButtonFresco = findViewById(R.id.btn_fresco);
mButtonPicasso = findViewById(R.id.btn_picasso);
mImageViewFresco = findViewById(R.id.iv_fresco);
mImageViewPicasso = findViewById(R.id.iv_picasso);
mTextViewInfo = findViewById(R.id.tv_info);
mButtonFresco.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mImageViewFresco.setVisibility(View.VISIBLE);
mImageViewPicasso.setVisibility(View.GONE);
mButtonFresco.setEnabled(false);
mButtonPicasso.setEnabled(true);
mTextViewInfo.setText("Currently using: FRESCO");
}
});
mButtonPicasso.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mImageViewFresco.setVisibility(View.GONE);
mImageViewPicasso.setVisibility(View.VISIBLE);
mButtonFresco.setEnabled(true);
mButtonPicasso.setEnabled(false);
mTextViewInfo.setText("Currently using: PICASSO");
}
});
// Initialize the Fresco image
Uri uri = Uri.parse(IMG_URL);
mImageViewFresco.setImageURI(uri);
// Initialize the Picasso image
Picasso.get()
.load(IMG_URL)
.into(mImageViewPicasso);
}
}
@mmazzarolo

This comment has been minimized.

Copy link
Owner Author

mmazzarolo commented Dec 13, 2018

Fresco:
screenshot 2018-12-13 at 21 39 40

Picasso:
screenshot 2018-12-13 at 21 39 36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.