96. Facebook Fresco Framework Library Source Usage Basics

Source: Internet
Author: User
Tags webp

Open Source project links

Facebook fresco repository: Git clone Https://github.com/facebook/fresco

Facebook Fresco home page: ">http://fresco-cn.org/docs/index.html#

Fresco Demo:https://github.com/yanbober/android-blog-source/tree/master/fresco-android-cn-demo

Background Introduction

Recent micro-blog and forum Fire a Facebook lib, in fact, nothing introduced, the following text from Fresco homepage, can only say that he duang Duang Duang on the big.

Fresco is a powerful picture loading component. The fresco is designed with a module called Image pipeline. It is responsible for loading images from the network, from the local file system, local resources. To maximize space and CPU time, it contains a level 3 cache design (level 2 memory, Level 1 files). The fresco design has a drawees module that conveniently displays the loading diagram, freeing up memory and space consumption when the picture is no longer displayed on the screen. Fresco supports Android2.3 (API level 9) and above systems.

The best features

Memory management

An uncompressed picture, bitmap in Android, consumes a lot of memory. Large memory usage is bound to cause more frequent GC. Under 5.0, the GC will significantly cause the interface to stutter. In the system below 5.0, Fresco puts the picture in a special memory area. Of course, when the picture is not displayed, the memory that is occupied is automatically released. This will make the app smoother and reduce the oom caused by image memory usage. Fresco is performing as well on low-end machines, and you no longer have to after thinking the memory footprint of your images.

Progressive rendering of images

Progressive JPEG image format has been popular for several years, progressive picture format first presents a rough outline of the picture, and then as the picture continues to download, showing a gradually clear picture, which for mobile devices, especially slow network has great positive, can bring a better user experience.

The image Library of Android itself does not support this format, but fresco supports it. When used, as always, just need to provide a picture of the URI, the rest of the matter, fresco will handle.

GIF graphs and WEBP formats

Yes, support for loading GIF graph, support WEBP format.

Rendering of images

Fresco's drawees design brings some useful features:

    • Custom Center focus (very helpful for displaying pictures such as faces).
    • Fillet chart, of course the circle is OK.
    • After the download fails, click reproduce download.
    • Custom-occupied bitmaps, custom overlay, or progress bars.
    • Specifies the overlay when the user presses.

Loading of images

Fresco's image pipeline design allows users to control the loading of images in multiple ways:

    • Specify a different remote path for the same picture, or use a picture that already exists in the local cache.
    • Show a low-resolution image first, and then display the HD image after downloading the HD image.
    • Load completion callback notification.
    • For this map, if you have an EXIF thumbnail, you can display the thumbnail before the large map load is complete.
    • Zoom or rotate the picture.
    • Process the downloaded picture.
    • WEBP support.
Real combat a dick explode the function of the sky

I have found a few steps to take note of when using the actual combat:

    1. Jcenter and Mavencentral already have this library.
    2. In application init remember to declare name in the Android management file, otherwise it is easy to jump the pit.

Now it's just a simple test experience the basic functionality of this cock-exploding library, which will continue to be added in the future:

Sample code: Click I download

IMAGE Pipeline Guide

96. Facebook Fresco Framework Library Source Usage Basics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.