Have Picasso load images into memory at the size they will be displayed.

This commit is contained in:
Eder Bastos 2015-05-08 19:54:56 -04:00
parent a7d5084e1f
commit a4395ecd75
5 changed files with 5 additions and 3 deletions

View File

@ -56,5 +56,5 @@ dependencies {
compile 'de.hdodenhof:circleimageview:1.2.2'
// For loading huge screenshots from the disk.
compile "com.squareup.picasso:picasso:2.4.0"
compile 'com.squareup.picasso:picasso:2.5.2'
}

View File

@ -64,6 +64,8 @@ public class GameAdapter extends RecyclerView.Adapter<GameViewHolder>
// Fill in the view contents.
Picasso.with(holder.imageScreenshot.getContext())
.load(game.getScreenPath())
.fit()
.centerCrop()
.error(R.drawable.no_banner)
.into(holder.imageScreenshot);

View File

@ -84,6 +84,8 @@ public class GameDetailsDialog extends DialogFragment
// Fill in the view contents.
Picasso.with(imageGameScreen.getContext())
.load(getArguments().getString(ARGUMENT_GAME_SCREENSHOT_PATH))
.fit()
.centerCrop()
.noFade()
.noPlaceholder()
.into(imageGameScreen);

View File

@ -15,7 +15,6 @@
android:id="@+id/image_game_screen"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:transitionName="image_game_screen"
android:layout_weight="1"
tools:src="@drawable/placeholder_screenshot"/>

View File

@ -31,7 +31,6 @@
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:scaleType="centerCrop"
android:transitionName="image_game_screen"
tools:src="@drawable/placeholder_screenshot"/>