I think a few have heard of Fresco, and many have not heard of it at all. In this article I will try to describe the functionality of the library.
So,
Fresco is a multifunctional library for asynchronous loading and displaying images with three levels of caching (2 in memory, 1 in internal storage). Supported formats: JPEG, PNG, GIF and WebP. Also with the help of Fresco you can put the ProgressBar directly on the View, which is very convenient.
Using FrescoTo use, you must add a dependency in Gradle:
compile 'com.facebook.fresco:fresco:0.6.1'
or using maven
<dependency> <groupId>com.facebook.fresco</groupId> <artifactId>fresco</artifactId> <version>0.6.1</version> </dependency>
')
Next, the fresco requires that it be initialized, there are two options: either initialize each time to the onCreate Activity, or initialize once to the Application.
Fresco.initialize(context);
Add Internet Permission to the manifest if you plan to download images from the outside.
<uses-permission android:name="android.permission.INTERNET"/>
In places where you plan to use Fresco, you need to use the class inherited from GenericDraweeView instead of ImageView, but do not worry if you do not need special chips that the library does not provide, you can use SimpleDraweeView, courtesy of Fresco.
An example of using XML:
<com.facebook.drawee.view.SimpleDraweeView android:id="@+id/simpleDraweeView" android:layout_width="match_parent" android:layout_height="match_parent" fresco:fadeDuration="300" fresco:roundAsCircle="false" />
To upload an image:
Uri uri = Uri.parse("https://raw.githubusercontent.com/facebook/fresco/gh-pages/static/fresco-logo.png"); SimpleDraweeView draweeView = (SimpleDraweeView) findViewById(R.id.simpleDraweeView); draweeView.setImageURI(uri);
As you can see, everything is extremely simple.
So: as you can see, the Fresco library is harder to connect and use than, for example, Picasso, but if you have little Picasso functionality and something atypical is required, then the Fresco library is ideal for you, since it is flexible and expandable almost everywhere .
Link to documentation:
http://frescolib.orgGitHub Link:
https://github.com/facebook/fresco