<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>picasso &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<atom:link href="https://blog.sephiroth.it/tag/picasso/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.sephiroth.it</link>
	<description>programmer by pure chance</description>
	<lastBuildDate>Tue, 28 Jan 2014 20:28:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://blog.sephiroth.it/wp-content/uploads/2019/03/cropped-sepy-big-32x32.png</url>
	<title>picasso &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<link>https://blog.sephiroth.it</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>More Picasso changes</title>
		<link>https://blog.sephiroth.it/2014/01/28/more-picasso-changes/</link>
					<comments>https://blog.sephiroth.it/2014/01/28/more-picasso-changes/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Tue, 28 Jan 2014 20:28:24 +0000</pubDate>
				<category><![CDATA[android]]></category>
		<category><![CDATA[fork]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[gradle]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[picasso]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1663</guid>

					<description><![CDATA[I recently added more changes to my forked version of the Picasso library. Delay Added withDelay(long ms) method in the RequestCreator class. Basically it will delay the load of the passed resource by n milliseconds. [cce] Picasso.with( context ) .load( url ) .withDelay( 100 ) .into( image ); [/cce] Batch toggle on/off In the original &#8230; <a href="https://blog.sephiroth.it/2014/01/28/more-picasso-changes/" class="more-link">Continue reading <span class="screen-reader-text">More Picasso changes</span></a>]]></description>
										<content:encoded><![CDATA[<p>I recently added more changes to my <a href="https://github.com/sephiroth74/picasso">forked</a> version of the <a href="https://github.com/square/picasso">Picasso</a> library.</p>
<p><strong>Delay</strong></p>
<p>Added <em>withDelay(long ms)</em> method in the RequestCreator class. Basically it will delay the load of the passed resource by <strong><em>n</em></strong> milliseconds.</p>
<p>[cce]<br />
Picasso.with( context )<br />
	.load( url )<br />
	.withDelay( 100 )<br />
	.into( image );<br />
[/cce]</p>
<p><strong>Batch toggle on/off</strong></p>
<p>In the original Picasso code all the &#8220;complete&#8221; events are dispatched using a batch operation, this means that you can have at the same time 3/4 &#8220;complete&#8221; events being triggered, which eventually can cause lags in the UI.<br />
In this fork the batch is disabled by default and can be re-enabled by using:</p>
<p>[cce]<br />
Picasso.with( context )<br />
	.setUseBatch( true );<br />
[/cce]</p>
<p>Fork or download the source from GitHub: <br />
<a href="https://github.com/sephiroth74/picasso">https://github.com/sephiroth74/picasso</a></p>
<p>Link the library in your build.gradle:<br /> <strong>compile &#8220;it.sephiroth.android.library.picasso:picasso:+&#8221;</strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2014/01/28/more-picasso-changes/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Forking Picasso</title>
		<link>https://blog.sephiroth.it/2013/10/16/forking-picasso/</link>
					<comments>https://blog.sephiroth.it/2013/10/16/forking-picasso/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Wed, 16 Oct 2013 18:12:50 +0000</pubDate>
				<category><![CDATA[android]]></category>
		<category><![CDATA[fork]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[picasso]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1651</guid>

					<description><![CDATA[Recently I started using this nice library, Picasso, for my Android projects. Basically it&#8217;s a library which allows you to load any type of images (local or remote, assets or resources) asynchronously&#160;into your ImageView. It will load them in background for you, this not blocking the UI. It has also an internal cache system and &#8230; <a href="https://blog.sephiroth.it/2013/10/16/forking-picasso/" class="more-link">Continue reading <span class="screen-reader-text">Forking Picasso</span></a>]]></description>
										<content:encoded><![CDATA[<p>Recently I started using this nice library, <a href="https://github.com/square/picasso" target="_blank">Picasso</a>, for my Android projects.<br />
Basically it&#8217;s a library which allows you to load any type of images (local or remote, assets or resources) asynchronously into your ImageView. It will load them in background for you, this not blocking the UI. It has also an internal cache system and it also comes with some useful features like &#8220;fade&#8221; ( when an image is loaded into the view it will automatically create a fade in effect ), &#8220;transform&#8221; ( you want to post transform the loaded bitmap ), &#8220;resize&#8221;, &#8220;fit&#8221; and more.</p>
<p>You can find a better explanation of the project here: <a href="http://square.github.io/picasso/">http://square.github.io/picasso/</a></p>
<p>By the way, long story short, as often happens, when you start to use a 3rd party library you also find it&#8217;s limitations and you want to make your own changes to fit your particular needs. In fact I made a <a href="https://github.com/sephiroth74/picasso" target="_blank">fork</a> of this library starting adding my changes.</p>
<p>Here&#8217;s a first list of changes I made:</p>
<p><strong>Cache</strong></p>
<p>Added the possibility to use an external cache instance per request.<br />
Example:</p>
<p>[cce]// creating a cache object with 1MB max size<br />
Cache cache = new LruCache( 1024*1024*1 );</p>
<p>// now create a new request which will use this cache object<br />
Picasso.with( this ).load( file ).withCache( myCache ).into( imageView );[/cce]</p>
<blockquote><p>Remember to clear the cache when you don&#8217;t need that anymore ( using cache.clear() )</p></blockquote>
<p><strong>Generators</strong></p>
<p>Generators can be used to load images which cannot be loaded using the common scheme convention. There are different situations when you need to generate a Bitmap which is not directly related to a file or url or even a real bitmap resource.</p>
<p>In this case you can use the scheme &#8220;custom.resource&#8221; with a Generator.<br />
A Generator is a simple interface with only one method:</p>
<p>[cce]public interface Generator {<br />
	Bitmap decode( String path ) throws IOException;<br />
}[/cce]</p>
<p>So you can use a generator in this way:</p>
<p>[cce]Picasso.with(this)<br />
	.load( Uri.parse( &#8220;custom.resource://&#8221; + file ) )<br />
	.withGenerator( new Generator() {<br />
		@Override<br />
			public Bitmap decode( String path ) throws IOException {<br />
				return whatever(path);<br />
			}<br />
		} ).into( imageView );<br />
[/cce]</p>
<p><strong>Resize</strong></p>
<p>Both the original Picasso methods resize and resizeDimen have been modified in the followings new methods:</p>
<p>[cce]public RequestCreator resizeDimen(int targetWidthResId, int targetHeightResId, boolean onlyIfBigger);<br />
public RequestCreator resize(int targetWidth, int targetHeight, boolean onlyIfBigger);[/cce]</p>
<p>basically you can pass an option to skip the resize operation if the loaded bitmap is smaller than the passed `targetWidth` and `targetHeight`</p>
<p><strong>BitmapFactory.Options</strong></p>
<p>Picasso uses a default BitmapFactory.Options object, every time, to decode the required Bitmap.</p>
<p>I&#8217;ve added a method `withOptions` in the RequestCreator which allow you to pass your own Options object which will be used to decode the image.<br />
Example:</p>
<p>[cce]BitmapFactory.Options options = new BitmapFactory.Options();<br />
options.inPreferredConfig = Config.RGB_565;</p>
<p>Picasso.with(this)<br />
	.load(file)<br />
	.withOptions(options)<br />
	.into(imageView);<br />
[/cce]</p>
<p><a href="https://github.com/sephiroth74/picasso" target="_blank">https://github.com/sephiroth74/picasso</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2013/10/16/forking-picasso/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
