Slide 1

Slide 1 text

Rinsing the Brush: Picasso 3.0 John Rodriguez Jake Wharton

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

3 years later

Slide 8

Slide 8 text

3.x Goals

Slide 9

Slide 9 text

• Android P 3.x Goals

Slide 10

Slide 10 text

• Android P • Improvements 3.x Goals

Slide 11

Slide 11 text

• Android P • Improvements • OkHttp 2.x => 3.x 3.x Goals

Slide 12

Slide 12 text

• Android P • Improvements • OkHttp 2.x => 3.x
 • Okio integration 3.x Goals

Slide 13

Slide 13 text

• Android P • Improvements • OkHttp 2.x => 3.x
 • Okio integration 3.x Goals

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Bitmap decodeStreamPreP(Request r, BufferedSource bs) { BitmapFactory.Options options = createBitmapOptions(request); if (requiresInSampleSize(options)) { InputStream stream = new SourceBufferingInputStream(bs); BitmapFactory.decodeStream(stream, null, options); calculateInSampleSize(r.targetWidth, r.targetHeight, options, r); } return BitmapFactory.decodeStream(bs.inputStream(), null, options); }

Slide 17

Slide 17 text

Bitmap decodeStreamPreP(Request r, BufferedSource bs) { BitmapFactory.Options options = createBitmapOptions(request); if (requiresInSampleSize(options)) { InputStream stream = new SourceBufferingInputStream(bs); BitmapFactory.decodeStream(stream, null, options); calculateInSampleSize(r.targetWidth, r.targetHeight, options, r); } return BitmapFactory.decodeStream(bs.inputStream(), null, options); }

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

Bitmap decodeStreamP(Request r, BufferedSource bs) { ImageDecoder.Source imageSource = ImageDecoder.createSource(ByteBuffer.wrap(bs.readByteArray())); return ImageDecoder.decodeBitmap( imageSource, (imageDecoder, imageInfo, src) -> { if (r.hasSize()) { imageDecoder.setTargetSize(r.targetWidth, r.targetHeight); } } }); }

Slide 20

Slide 20 text

Bitmap decodeStreamP(Request r, BufferedSource bs) { ImageDecoder.Source imageSource = ImageDecoder.createSource(ByteBuffer.wrap(bs.readByteArray())); return ImageDecoder.decodeBitmap( imageSource, (imageDecoder, imageInfo, src) -> { if (r.hasSize()) { imageDecoder.setTargetSize(r.targetWidth, r.targetHeight); } } }); }

Slide 21

Slide 21 text

Bitmap decodeStreamP(Request r, BufferedSource bs) { ImageDecoder.Source imageSource = ImageDecoder.createSource(ByteBuffer.wrap(bs.readByteArray())); return ImageDecoder.decodeBitmap( imageSource, (imageDecoder, imageInfo, src) -> { if (r.hasSize()) { imageDecoder.setTargetSize(r.targetWidth, r.targetHeight); } } }); }

Slide 22

Slide 22 text

• Android P • Improvements • OkHttp 2.x => 3.x
 • Okio integration 3.x Goals

Slide 23

Slide 23 text

Picasso

Slide 24

Slide 24 text

Picasso picasso.load(url) .placeholder(R.drawable.placeholder) .error(R.drawable.error) .fit() .into(view);

Slide 25

Slide 25 text

Picasso

Slide 26

Slide 26 text

Picasso fun loadImage( remoteUri: Uri, @ColorInt tintColor: Int? = null ) { val creator = picasso.load(remoteUri) .placeholder(avatarPlaceholder) .fit() if (transformTintColor != null) { creator.transform(TintTransformation(tintColor)) } creator.into(this) }

Slide 27

Slide 27 text

Picasso fun loadImage( awsAssetUri: Uri, height: Int, width: Int ) { val creator = picasso.load(awsAssetUri) .placeholder(avatarPlaceholder) .fit() .into(this) }

Slide 28

Slide 28 text

Picasso fun loadImage( awsAssetUri: Uri, height: Int, width: Int ) { val creator = picasso.load(awsAssetUri) .placeholder(avatarPlaceholder) .fit() .into(this) }

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

Picasso picasso.load(“http://shrek.jpg”) .placeholder(R.drawable.placeholder) .error(R.drawable.error) .fit() .into(view);

Slide 31

Slide 31 text

Picasso Request “http://shrek.jpg”

Slide 32

Slide 32 text

Picasso Request Request Transformer Request “http://shrek.jpg”

Slide 33

Slide 33 text

Picasso Request “http://shrek.jpg” Request Transformer Request “http://bar.com/20x20/shrek.jpg”

Slide 34

Slide 34 text

p://shrek.jpg

Slide 35

Slide 35 text

0101011010100 http://shrek.jpg

Slide 36

Slide 36 text

0101011010100 http://shrek.jpg

Slide 37

Slide 37 text

01010110101001101

Slide 38

Slide 38 text

01010110101001101

Slide 39

Slide 39 text

01010110101001101

Slide 40

Slide 40 text

01 01 0110 10100 1 1 0 1

Slide 41

Slide 41 text

01 01 0110 10100 1 1 0 1

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

0x20/shrek.jpg

Slide 45

Slide 45 text

http://bar.com/20x20/shrek.jpg

Slide 46

Slide 46 text

http://bar.com/20x20/shrek.jpg

Slide 47

Slide 47 text

0101011

Slide 48

Slide 48 text

0101011

Slide 49

Slide 49 text

0101011

Slide 50

Slide 50 text

0101011

Slide 51

Slide 51 text

0101011

Slide 52

Slide 52 text

01 010 1 1

Slide 53

Slide 53 text

01 010 1 1

Slide 54

Slide 54 text

01 010 1 1

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

?

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

/** * Sets the stable key for this request to be used instead of the * URI or resource ID when caching. * Two requests with the same value are considered to be for the * same resource. */ public RequestCreator stableKey(String stableKey) { data.stableKey(stableKey); return this; }

Slide 64

Slide 64 text

createNewPicasso(context, 1024, new CustomRequestHandler()); Picasso createNewPicasso( Context context, int cacheSize, RequestHandler requestHandler ) {e return new Picasso.Builder(context) e.withCacheSize(cacheSize) e.addRequestHandler(requestHandler) e.build(); }e

Slide 65

Slide 65 text

createChildPicasso(builder, 1024, new CustomRequestHandler()); Picasso createChildPicasso( Picasso.Builder builder, int cacheSize, RequestHandler requestHandler ) { return builder .withCacheSize(cacheSize) .addRequestHandler(requestHandler) .build(); }e

Slide 66

Slide 66 text

createChildPicasso(picasso, 1024, new CustomRequestHandler()); Picasso createChildPicasso( Picasso picasso, int cacheSize, RequestHandler requestHandler ) { return picasso.newBuilder() .withCacheSize(cacheSize) .addRequestHandler(requestHandler) .build(); }e builder Picasso.Builder builder, builder

Slide 67

Slide 67 text

createChildPicasso(picasso, 1024, new CustomRequestHandler()); Picasso createChildPicasso( Picasso picasso, int cacheSize, RequestHandler requestHandler ) { return picasso.newBuilder() .withCacheSize(cacheSize) .addRequestHandler(requestHandler) .build(); }

Slide 68

Slide 68 text

@Component( modules = RootModule.class ) @RootScope interface RootComponent { @Root Picasso picasso(); } @Module class RootModule { @Provides @RootScope @Root Picasso providePicasso(@App Context context) { return new Picasso.Builder(context) .withCacheSize(1024*1024) .build(); } }

Slide 69

Slide 69 text

@Component( modules = RootModule.class ) @RootScope interface RootComponent { @Root Picasso picasso(); } @Module class RootModule { @Provides @RootScope @Root Picasso providePicasso(@App Context context) { return new Picasso.Builder(context) .withCacheSize(1024*1024) .build(); } }

Slide 70

Slide 70 text

@Component( modules = RootModule.class ) @RootScope interface RootComponent { @Root Picasso picasso(); } @Module class RootModule { @Provides @RootScope @Root Picasso providePicasso(@App Context context) { return new Picasso.Builder(context) .withCacheSize(1024*1024) .build(); } }

Slide 71

Slide 71 text

@Component( dependencies = RootComponent.class, modules = ScreenModule.class ) @ScreenScope interface ScreenComponent { } @Module class ScreenModule { @Provides @ScreenScope @Screen Picasso providePicasso(@Root Picasso picasso) { return picasso.newBuilder() .withCacheSize(1024) .build(); } }

Slide 72

Slide 72 text

@Component( dependencies = RootComponent.class, modules = ScreenModule.class ) @ScreenScope interface ScreenComponent { } @Module class ScreenModule { @Provides @ScreenScope @Screen Picasso providePicasso(@Root Picasso picasso) { return picasso.newBuilder() .withCacheSize(1024) .build(); } }

Slide 73

Slide 73 text

@Component( dependencies = RootComponent.class, modules = ScreenModule.class ) @ScreenScope interface ScreenComponent { } @Module class ScreenModule { @Provides @ScreenScope @Screen Picasso providePicasso(@Root Picasso picasso) { return picasso.newBuilder() .withCacheSize(1024) .build(); } }

Slide 74

Slide 74 text

@Component( dependencies = RootComponent.class, modules = ScreenModule.class ) @ScreenScope interface ScreenComponent { } @Module class ScreenModule { @Provides @ScreenScope @Screen Picasso providePicasso(@Root Picasso picasso) { return picasso.newBuilder() .withCacheSize(1024) .build(); } }

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

/** * Image downloading, transformation, and caching manager. * * Use {@see PicassoProvider#get()} for a global singleton * instance or construct your own instance with {@link Builder}. */ public class Picasso implements LifecycleObserver { }

Slide 78

Slide 78 text

/** * Image downloading, transformation, and caching manager. * * Use {@see PicassoProvider#get()} for a global singleton * instance or construct your own instance with {@link Builder}. */ public class Picasso implements LifecycleObserver { }

Slide 79

Slide 79 text

class SampleActivity extends FragmentActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); … getLifecycle().addObserver(picasso); }

Slide 80

Slide 80 text

class SampleActivity extends FragmentActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); … getLifecycle().addObserver(picasso); }

Slide 81

Slide 81 text

@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) void cancelAll() { List actions = new ArrayList<>(targetToAction.values()); for (int i = 0, n = actions.size(); i < n; i++) { cancelExistingRequest(actions.get(i).getTarget()); } List deferredRequestCreators = new ArrayList<>(targetToDeferredRequestCreator.values()); for (int i = 0, n = deferredCreators.size(); i < n; i++) { deferredCreators.get(i).cancel(); } }

Slide 82

Slide 82 text

Picasso Request “http://shrek.jpg” Request Transformer Request’ “http://bar.com/20x20/shrek.jpg”

Slide 83

Slide 83 text

Picasso Request Transformer

Slide 84

Slide 84 text

ResourceRequestHandler AssetsRequestHandler NetworkRequestHandler FileRequestHandler Picasso Request Transformer

Slide 85

Slide 85 text

Picasso Request Transformer Handler Request Resource AssetsRequestHandler NetworkRequestHandler FileRequestHandler

Slide 86

Slide 86 text

Picasso Request Transformer Handler Request

Slide 87

Slide 87 text

Picasso Request Transformer Request Handler Bitmap

Slide 88

Slide 88 text

Bitmap Drawable Result Picasso Request Transformer Request Handler

Slide 89

Slide 89 text

Picasso Request Transformer Result Request Handler Greyscale Circle Tint

Slide 90

Slide 90 text

Greyscale Circle Tint Picasso Request Transformer Result Request Handler Transformation

Slide 91

Slide 91 text

Picasso Request Transformer Result Target Request Handler Transformation

Slide 92

Slide 92 text

Request Transformer Result Request Handler Transformation

Slide 93

Slide 93 text

Transformer Result Transformer Transformer

Slide 94

Slide 94 text

Transformer Transformer Transformer

Slide 95

Slide 95 text

Transformer Transformer Transformer

Slide 96

Slide 96 text

Transformer Transformer Transformer

Slide 97

Slide 97 text

custom interceptors Retry Bridge Cache Connect Call Server square/okhttp

Slide 98

Slide 98 text

No content

Slide 99

Slide 99 text

No content

Slide 100

Slide 100 text

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Picasso.with(this) .load("http://example.com/logo.png") .into(imageView); }

Slide 101

Slide 101 text

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Picasso.with(this) .load("http://example.com/logo.png") .into(imageView); }

Slide 102

Slide 102 text

public static Picasso with(Context context) { if (singleton == null) { synchronized (Picasso.class) { if (singleton == null) { singleton = new Builder(context).build(); } } } return singleton; }

Slide 103

Slide 103 text

public static Picasso with(Context context) { if (singleton == null) { synchronized (Picasso.class) { if (singleton == null) { singleton = new Builder(context).build(); } } } return singleton; }

Slide 104

Slide 104 text

public static void setSingletonInstance(Picasso picasso) { synchronized (Picasso.class) { if (singleton != null) { throw new IllegalStateException( "Singleton instance already exists."); } singleton = picasso; } }

Slide 105

Slide 105 text

public static void setSingletonInstance(Picasso picasso) { synchronized (Picasso.class) { if (singleton != null) { throw new IllegalStateException( "Singleton instance already exists."); } singleton = picasso; } }

Slide 106

Slide 106 text

@Module(includes = ThumborModule.class) final class ProductionPicassoModule { @Provides @Singleton static Picasso providePicasso( @App Context context, OkHttpClient client, Thumbor thumbor) { Picasso.RequestTransformer transformer = new PollexorRequestTransformer(thumbor); return new Picasso.Builder(context) .client(client) .requestTransformer(transformer) .listener((picasso, uri, e) -> Timber.d(e, uri.toString())); } }

Slide 107

Slide 107 text

@Module(includes = ThumborModule.class) final class ProductionPicassoModule { @Provides @Singleton static Picasso providePicasso( @App Context context, OkHttpClient client, Thumbor thumbor) { Picasso.RequestTransformer transformer = new PollexorRequestTransformer(thumbor); return new Picasso.Builder(context) .client(client) .requestTransformer(transformer) .listener((picasso, uri, e) -> Timber.d(e, uri.toString())); } }

Slide 108

Slide 108 text

No content

Slide 109

Slide 109 text

No content

Slide 110

Slide 110 text

public final class PicassoProvider { private static volatile Picasso instance; public static Picasso get() { if (instance == null) { synchronized (PicassoProvider.class) { if (instance == null) { if (PicassoContentProvider.context == null) { throw new IllegalStateException("context == null"); } instance = new Picasso.Builder(PicassoContentProvider.context).build(); } } } return instance; } }

Slide 111

Slide 111 text

public final class PicassoProvider { private static volatile Picasso instance; public static Picasso get() { if (instance == null) { synchronized (PicassoProvider.class) { if (instance == null) { if (PicassoContentProvider.context == null) { throw new IllegalStateException("context == null"); } instance = new Picasso.Builder(PicassoContentProvider.context).build(); } } } return instance; } }

Slide 112

Slide 112 text

public final class PicassoProvider { private static volatile Picasso instance; public static Picasso get() { if (instance == null) { synchronized (PicassoProvider.class) { if (instance == null) { if (PicassoContentProvider.context == null) { throw new IllegalStateException("context == null"); } instance = new Picasso.Builder(PicassoContentProvider.context).build(); } } } return instance; } }

Slide 113

Slide 113 text

public final class PicassoContentProvider extends ContentProvider { static Context context; @Override public boolean onCreate() { context = getContext(); return true; } … }

Slide 114

Slide 114 text

No content

Slide 115

Slide 115 text

Slide 116

Slide 116 text

No content

Slide 117

Slide 117 text

No content

Slide 118

Slide 118 text

interface ImageDecoder { class Image { @Nullable Bitmap bitmap; @Nullable Drawable drawable; int exifOrientation; } boolean canHandleSource(BufferedSource source); Image decodeImage(BufferedSource source, Request request) throws IOException; }

Slide 119

Slide 119 text

class ImageDecoderFactory { List decoders; ImageDecoder getImageDecoderForSource(BufferedSource source) { for (ImageDecoder decoder : decoders) { if (decoder.canHandleSource(source)) { return decoder; } } return null; } }

Slide 120

Slide 120 text

Picasso

Slide 121

Slide 121 text

Picasso?

Slide 122

Slide 122 text

• Android P
 • Improvements • OkHttp 2.x => 3.x
 • Okio integration 3.x Goals

Slide 123

Slide 123 text

Picasso

Slide 124

Slide 124 text

Picasso ResourceRequestHandler AssetsRequestHandler NetworkRequestHandler FileRequestHandler ...

Slide 125

Slide 125 text

Downloader Picasso ResourceRequestHandler AssetsRequestHandler NetworkRequestHandler FileRequestHandler ...

Slide 126

Slide 126 text

OkHttp 2.x HttpURLConnection Downloader Picasso ResourceRequestHandler AssetsRequestHandler NetworkRequestHandler FileRequestHandler ...

Slide 127

Slide 127 text

OkHttp 2.x HttpURLConnection OkHttp 3.x Downloader Picasso ResourceRequestHandler AssetsRequestHandler NetworkRequestHandler FileRequestHandler ...

Slide 128

Slide 128 text

OkHttp 3.x HttpURLConnection OkHttp 2.x Downloader Picasso ResourceRequestHandler AssetsRequestHandler NetworkRequestHandler FileRequestHandler ...

Slide 129

Slide 129 text

OkHttp 3.x Picasso ResourceRequestHandler AssetsRequestHandler NetworkRequestHandler FileRequestHandler ...

Slide 130

Slide 130 text

Picasso ResourceRequestHandler AssetsRequestHandler NetworkRequestHandler FileRequestHandler ... Call.Factory (OkHttp 3.x)

Slide 131

Slide 131 text

Picasso OkHttp

Slide 132

Slide 132 text

Okio Picasso OkHttp

Slide 133

Slide 133 text

Picasso OkHttp Retrofit Okio

Slide 134

Slide 134 text

Picasso OkHttp Okio Retrofit Moshi

Slide 135

Slide 135 text

Picasso OkHttp Okio Retrofit Moshi

Slide 136

Slide 136 text

Picasso OkHttp Okio Retrofit Moshi Wire

Slide 137

Slide 137 text

Picasso OkHttp Okio Retrofit Moshi Wire

Slide 138

Slide 138 text

• Android P • Improvements • OkHttp 2.x => 3.x
 • Okio integration 3.x Goals

Slide 139

Slide 139 text

java.io.IOException: Cannot reset at com.squareup.picasso.MarkableInputStream.reset(MarkableInputStream.java:99) at com.squareup.picasso.BitmapHunter.decodeStream(BitmapHunter.java:140) at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:217) at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:159) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764) at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:411)

Slide 140

Slide 140 text

nightmare_shrek.png

Slide 141

Slide 141 text

MAGIC nightmare_shrek.png

Slide 142

Slide 142 text

METADATA METADATA METADATA MAGIC nightmare_shrek.png

Slide 143

Slide 143 text

PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA METADATA METADATA METADATA MAGIC nightmare_shrek.png

Slide 144

Slide 144 text

PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA METADATA METADATA METADATA MAGIC

Slide 145

Slide 145 text

PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA METADATA METADATA METADATA MAGIC

Slide 146

Slide 146 text

PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA METADATA METADATA METADATA MAGIC

Slide 147

Slide 147 text

PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA METADATA METADATA METADATA MAGIC

Slide 148

Slide 148 text

PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA METADATA METADATA METADATA MAGIC

Slide 149

Slide 149 text

PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA METADATA METADATA METADATA MAGIC

Slide 150

Slide 150 text

InputStream PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA METADATA METADATA METADATA MAGIC

Slide 151

Slide 151 text

InputStream BitmapFactory inJustDecodeBounds=true MAGIC METADATA

Slide 152

Slide 152 text

InputStream BitmapFactory inJustDecodeBounds=true MAGIC METADATA

Slide 153

Slide 153 text

InputStream BitmapFactory inJustDecodeBounds=true MAGIC METADATA

Slide 154

Slide 154 text

InputStream BitmapFactory inJustDecodeBounds=true MAGIC METADATA JPEG?

Slide 155

Slide 155 text

InputStream BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADAT JPEG?

Slide 156

Slide 156 text

InputStream BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADAT

Slide 157

Slide 157 text

InputStream BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADAT

Slide 158

Slide 158 text

InputStream BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADAT

Slide 159

Slide 159 text

InputStream BitmapFactory inJustDecodeBounds=true MAGIC METADATA

Slide 160

Slide 160 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA

Slide 161

Slide 161 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA JPEG?

Slide 162

Slide 162 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA JPEG?

Slide 163

Slide 163 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA JPEG?

Slide 164

Slide 164 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA PNG?

Slide 165

Slide 165 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA PNG?

Slide 166

Slide 166 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA PNG!

Slide 167

Slide 167 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA PNG size?

Slide 168

Slide 168 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA PNG size?

Slide 169

Slide 169 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA PNG 1920x1080!

Slide 170

Slide 170 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA 2METADATA2 1METADATA1 PIXEL DATA PNG 1920x1080

Slide 171

Slide 171 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA 2METADATA2 1METADATA1 PIXEL DATA 1920x1080

Slide 172

Slide 172 text

InputStream BitmapFactory BitmapFactory inJustDecodeBounds=true MAGIC METADATA 2METADATA2 1METADATA1 PIXEL DATA 1920x1080 PIXEL DAT

Slide 173

Slide 173 text

InputStream BitmapFactory inJustDecodeBounds=true BitmapFactory PIXEL DATA MAGIC METADATA 2METADATA2 1METADATA1 PIXEL DATA 1920x1080

Slide 174

Slide 174 text

InputStream BitmapFactory inJustDecodeBounds=true BitmapFactory PIXEL DATA MAGIC METADATA 2METADATA2 1METADATA1 PIXEL DATA 1920x1080

Slide 175

Slide 175 text

InputStream BitmapFactory inJustDecodeBounds=true BitmapFactory PIXEL DATA MAGIC METADATA 2METADATA2 1METADATA1 PIXEL DATA 1920x1080

Slide 176

Slide 176 text

InputStream MAGIC METADATA

Slide 177

Slide 177 text

InputStream BitmapFactory inJustDecodeBounds=true MAGIC METADATA

Slide 178

Slide 178 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA MarkableInputStream

Slide 179

Slide 179 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA MarkableInputStream MAGIC METADATA METADATA METADATA PIXEL DATA

Slide 180

Slide 180 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA MarkableInputStream MAGIC METADATA METADATA METADATA PIXEL DATA 1920x1080

Slide 181

Slide 181 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA MarkableInputStream MAGIC METADATA METADATA METADATA PIXEL DATA 1920x1080

Slide 182

Slide 182 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA MarkableInputStream MAGIC METADATA METADATA METADATA PIXEL DATA 1920x1080 BitmapFactory MAGIC METADATA METADATA METADATA PIXEL DATA

Slide 183

Slide 183 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA MarkableInputStream MAGIC METADATA METADATA METADATA PIXEL DATA 1920x1080 MAGIC METADATA METADATA METADATA PIXEL DATA BitmapFactory

Slide 184

Slide 184 text

BitmapFactory inJustDecodeBounds=true MarkableInputStream MAGIC METADATA METADATA METADATA PIXEL DATA 1920x1080 BitmapFactory

Slide 185

Slide 185 text

PIXEL DATA PIXEL DATA PIXEL DATA BitmapFactory inJustDecodeBounds=true MarkableInputStream MAGIC METADATA METADATA METADATA PIXEL DATA 1920x1080 BitmapFactory

Slide 186

Slide 186 text

PIXEL DATA PIXEL DATA PIXEL DATA BitmapFactory inJustDecodeBounds=true MarkableInputStream MAGIC METADATA METADATA METADATA PIXEL DATA 1920x1080 BitmapFactory PIXEL DATA PIXEL DATA PIXEL DATA

Slide 187

Slide 187 text

PIXEL DATA PIXEL DATA PIXEL DATA BitmapFactory inJustDecodeBounds=true MarkableInputStream MAGIC METADATA METADATA METADATA PIXEL DATA 1920x1080 BitmapFactory PIXEL DATA PIXEL DATA PIXEL DATA

Slide 188

Slide 188 text

MAGIC METADATA METADATA METADATA PIXEL DATA MarkableInputStream MAGIC METADATA METADATA METADATA PIXEL DATA

Slide 189

Slide 189 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA MarkableInputStream MAGIC METADATA METADATA METADATA PIXEL DATA

Slide 190

Slide 190 text

BitmapFactory inJustDecodeBounds=true MAGIC METADATA METADATA METADATA PIXEL DATA MarkableInputStream MAGIC METADATA METADATA METADATA PIXEL DATA

Slide 191

Slide 191 text

MarkableInputStream BitmapFactory inJustDecodeBounds=true

Slide 192

Slide 192 text

PIXEL DATA PIXEL DATA PIXEL DATA MarkableInputStream BitmapFactory inJustDecodeBounds=true

Slide 193

Slide 193 text

PIXEL DATA PIXEL DATA PIXEL DATA MarkableInputStream BitmapFactory inJustDecodeBounds=true PIXEL DATA PIXEL DATA PIXEL DATA

Slide 194

Slide 194 text

MarkableInputStream BitmapFactory inJustDecodeBounds=true

Slide 195

Slide 195 text

MarkableInputStream BitmapFactory inJustDecodeBounds=true PIXEL DATA PIXEL DATA PIXEL DATA

Slide 196

Slide 196 text

MarkableInputStream BitmapFactory inJustDecodeBounds=true PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA

Slide 197

Slide 197 text

MarkableInputStream BitmapFactory inJustDecodeBounds=true

Slide 198

Slide 198 text

MarkableInputStream BitmapFactory inJustDecodeBounds=true PIXEL DATA PIXEL DATA

Slide 199

Slide 199 text

MarkableInputStream BitmapFactory inJustDecodeBounds=true PIXEL DATA PIXEL DATA PIXEL DATA PIXEL DATA

Slide 200

Slide 200 text

MarkableInputStream BitmapFactory inJustDecodeBounds=true PIXEL DATA PIXEL DATA

Slide 201

Slide 201 text

MarkableInputStream BitmapFactory inJustDecodeBounds=true ??? PIXEL DATA PIXEL DATA

Slide 202

Slide 202 text

MarkableInputStream BitmapFactory inJustDecodeBounds=true ??? PIXEL DATA PIXEL DATA

Slide 203

Slide 203 text

MarkableInputStream BitmapFactory inJustDecodeBounds=true ??? BitmapFactory PIXEL DATA PIXEL DATA

Slide 204

Slide 204 text

MarkableInputStream BitmapFactory inJustDecodeBounds=true ??? BitmapFactory java.io.IOException: Cannot reset at com.squareup.picasso.MarkableInputStream.reset(MarkableInputStream.java:99) at com.squareup.picasso.BitmapHunter.decodeStream(BitmapHunter.java:140) at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:217) at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:159) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764) at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:411)

Slide 205

Slide 205 text

BitmapFactory MarkableInputStream InputStream BitmapFactory

Slide 206

Slide 206 text

BitmapFactory MarkableInputStream InputStream Picasso 2.x BitmapFactory Picasso 3.x

Slide 207

Slide 207 text

BitmapFactory MarkableInputStream InputStream Picasso 2.x BitmapFactory BufferedSource Picasso 3.x

Slide 208

Slide 208 text

BitmapFactory MarkableInputStream InputStream Picasso 2.x BitmapFactory BufferedSource Picasso 3.x SourceBufferingInputStream

Slide 209

Slide 209 text

BitmapFactory BufferedSource SourceBufferingInputStream

Slide 210

Slide 210 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream

Slide 211

Slide 211 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream offset: 0

Slide 212

Slide 212 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 0

Slide 213

Slide 213 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 0 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC 1024

Slide 214

Slide 214 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC 0

Slide 215

Slide 215 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC

Slide 216

Slide 216 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC

Slide 217

Slide 217 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC

Slide 218

Slide 218 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 1024

Slide 219

Slide 219 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 1024

Slide 220

Slide 220 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 1024 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 2048

Slide 221

Slide 221 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 2048 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 1024

Slide 222

Slide 222 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 2048 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4

Slide 223

Slide 223 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 2048

Slide 224

Slide 224 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 2048

Slide 225

Slide 225 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 2048 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 3072

Slide 226

Slide 226 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 3072 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 2048

Slide 227

Slide 227 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 3072 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7

Slide 228

Slide 228 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 3072

Slide 229

Slide 229 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 3072

Slide 230

Slide 230 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset:x3072 8PIXEL DATA8 9PIXEL DATA9 3754

Slide 231

Slide 231 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 3754 8PIXEL DATA8 9PIXEL DATA9 x3072

Slide 232

Slide 232 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 3754 8PIXEL DATA8 9PIXEL DATA9

Slide 233

Slide 233 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 3754

Slide 234

Slide 234 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 3754 ???

Slide 235

Slide 235 text

BufferedSource 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC offset: 3754 ??? BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream

Slide 236

Slide 236 text

BitmapFactory InputStream BufferedSource 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream

Slide 237

Slide 237 text

BitmapFactory InputStream BufferedSource 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream

Slide 238

Slide 238 text

BitmapFactory InputStream BufferedSource 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream

Slide 239

Slide 239 text

BitmapFactory InputStream BufferedSource 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream

Slide 240

Slide 240 text

BitmapFactory InputStream BufferedSource 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream

Slide 241

Slide 241 text

BitmapFactory InputStream BufferedSource 8PIXEL DATA8 9PIXEL DATA9 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream

Slide 242

Slide 242 text

BitmapFactory InputStream BufferedSource BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream

Slide 243

Slide 243 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream offset: 0

Slide 244

Slide 244 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 1METADATA1 MAGIC offset: 0

Slide 245

Slide 245 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 1METADATA1 MAGIC offset: 341 1METADATA1 MAGIC

Slide 246

Slide 246 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 1METADATA1 MAGIC offset: 341 1METADATA1 MAGIC

Slide 247

Slide 247 text

BitmapFactory inJustDecodeBounds=true BufferedSource SourceBufferingInputStream 1METADATA1 MAGIC offset: 341 1METADATA1 MAGIC 1920x1080

Slide 248

Slide 248 text

BufferedSource 1METADATA1 MAGIC 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080

Slide 249

Slide 249 text

ExifInterface BufferedSource SourceBufferingInputStream 1METADATA1 MAGIC 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 0

Slide 250

Slide 250 text

ExifInterface BufferedSource SourceBufferingInputStream 1METADATA1 MAGIC 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 341 1METADATA1 MAGIC

Slide 251

Slide 251 text

ExifInterface BufferedSource SourceBufferingInputStream 1METADATA1 MAGIC 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 341 1METADATA1 MAGIC

Slide 252

Slide 252 text

ExifInterface BufferedSource SourceBufferingInputStream 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 341

Slide 253

Slide 253 text

ExifInterface BufferedSource SourceBufferingInputStream 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 341

Slide 254

Slide 254 text

ExifInterface BufferedSource SourceBufferingInputStream 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 341

Slide 255

Slide 255 text

ExifInterface BufferedSource SourceBufferingInputStream 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 341 90°

Slide 256

Slide 256 text

BufferedSource 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 341 90° ExifInterface SourceBufferingInputStream

Slide 257

Slide 257 text

BitmapFactory InputStream BufferedSource 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 341 90° ExifInterface SourceBufferingInputStream

Slide 258

Slide 258 text

BitmapFactory InputStream BufferedSource 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 341 90° ExifInterface SourceBufferingInputStream

Slide 259

Slide 259 text

BitmapFactory InputStream BufferedSource 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 1PIXEL DATA1 3METADATA3 2METADATA2 1METADATA1 MAGIC 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 341 90° ExifInterface SourceBufferingInputStream

Slide 260

Slide 260 text

BitmapFactory InputStream BufferedSource 2PIXEL DATA2 3PIXEL DATA3 4PIXEL DATA4 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 341 90° ExifInterface SourceBufferingInputStream

Slide 261

Slide 261 text

BitmapFactory InputStream BufferedSource 5PIXEL DATA5 6PIXEL DATA6 7PIXEL DATA7 8PIXEL DATA8 9PIXEL DATA9 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 341 90° ExifInterface SourceBufferingInputStream

Slide 262

Slide 262 text

BitmapFactory InputStream BufferedSource 8PIXEL DATA8 9PIXEL DATA9 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 341 90° ExifInterface SourceBufferingInputStream

Slide 263

Slide 263 text

BitmapFactory InputStream BufferedSource 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 341 90° ExifInterface SourceBufferingInputStream

Slide 264

Slide 264 text

BitmapFactory InputStream BufferedSource 1METADATA1 MAGIC offset: 341 BitmapFactory inJustDecodeBounds=true SourceBufferingInputStream 1920x1080 offset: 1024 1PIXEL DATA1 3METADATA3 2METADATA2 341 90° ExifInterface SourceBufferingInputStream

Slide 265

Slide 265 text

• Android P • Improvements • OkHttp 2.x => 3.x
 • Okio integration 3.x Goals

Slide 266

Slide 266 text

Picasso.with(context)X .load(url) .placeholder(R.drawable.placeholder) .error(R.drawable.error) .fit() .into(view);

Slide 267

Slide 267 text

PicassoProvider.get()X .load(url) .placeholder(R.drawable.placeholder) .error(R.drawable.error) .fit() .into(view); with context

Slide 268

Slide 268 text

picasso.load(url) .placeholder(R.drawable.placeholder) .error(R.drawable.error) .fit() .into(view);

Slide 269

Slide 269 text

abstract class RequestHandler { abstract boolean canHandleRequest(Request request); abstract Result load(Request request, int networkPolicy); }X

Slide 270

Slide 270 text

abstract class RequestHandler { abstract boolean canHandleRequest(Request request); abstract void load(Picasso picasso, Request request, Callback callback); }X Result int networkPolicy

Slide 271

Slide 271 text

• Better separation of concerns: Image/Target/RenderCall Coming Soon

Slide 272

Slide 272 text

• Better separation of concerns: Image/Target/RenderCall • Propagating Drawables to Target (animated GIFs!) Coming Soon

Slide 273

Slide 273 text

• Better separation of concerns: Image/Target/RenderCall • Propagating Drawables to Target (animated GIFs!) • Improved pipelining Coming Soon

Slide 274

Slide 274 text

• Better separation of concerns: Image/Target/RenderCall • Propagating Drawables to Target (animated GIFs!) • Improved pipelining • More? Let us know! Coming Soon

Slide 275

Slide 275 text

Rinsing the Brush: Picasso 3.0 @jrodbx @JakeWharton

Slide 276

Slide 276 text

PICASSO WILL RETURN 3.0