forked from facebook/fresco
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c02c3eb
Showing
571 changed files
with
64,296 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.gradle | ||
.DS_Store | ||
.idea | ||
build/ | ||
local.properties | ||
localhost/ | ||
obj/ | ||
*.iml | ||
Gemfile | ||
Gemfile.lock | ||
_site/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
c12c66149ad074b6ea361af87e0f884a0ada443c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Contributing to Fresco | ||
We want to make contributing to this project as easy and transparent as | ||
possible. | ||
|
||
## Pull Requests | ||
We actively welcome your pull requests. | ||
|
||
1. Fork the repo and create your branch from `master`. | ||
2. If you've added code that should be tested, add tests | ||
3. If you've changed APIs, update the documentation. | ||
4. Ensure the test suite passes. | ||
5. Make sure your code lints. | ||
6. If you haven't already, complete the Contributor License Agreement ("CLA"). | ||
|
||
## Contributor License Agreement ("CLA") | ||
In order to accept your pull request, we need you to submit a CLA. You only need | ||
to do this once to work on any of Facebook's open source projects. | ||
|
||
Complete your CLA here: <https://code.facebook.com/cla>. | ||
|
||
## Our Development Process | ||
Each pull request is first submitted into Facebook's internal repositories by a | ||
Facebook team member. Once the commit has successfully passed Facebook's internal | ||
test suite, it will be exported back out from Facebook's repository. We endeavour | ||
to do this as soon as possible for all commits. | ||
|
||
## Issues | ||
We use GitHub issues to track public bugs. Please ensure your description is | ||
clear and has sufficient instructions to be able to reproduce the issue. | ||
|
||
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe | ||
disclosure of security bugs. In those cases, please go through the process | ||
outlined on that page and do not file a public issue. | ||
|
||
## Coding Style | ||
* 2 spaces for indentation rather than tabs | ||
* 100 character line length | ||
* Although officially archived, we still follow the practice of Oracle's | ||
[Coding Conventions for the Java Programming Language](http://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html). | ||
|
||
## License | ||
By contributing to Fresco, you agree that your contributions will be licensed | ||
under its BSD license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
BSD License | ||
|
||
For Fresco software | ||
|
||
Copyright (c) 2015-present, Facebook, Inc. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name Facebook nor the names of its contributors may be used to | ||
endorse or promote products derived from this software without specific | ||
prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Additional Grant of Patent Rights | ||
|
||
"Software" means the Fresco software distributed by Facebook, Inc. | ||
|
||
Facebook hereby grants you a perpetual, worldwide, royalty-free, non-exclusive, | ||
irrevocable (subject to the termination provision below) license under any | ||
rights in any patent claims owned by Facebook, to make, have made, use, sell, | ||
offer to sell, import, and otherwise transfer the Software. For avoidance of | ||
doubt, no license is granted under Facebook’s rights in any patent claims that | ||
are infringed by (i) modifications to the Software made by you or a third party, | ||
or (ii) the Software in combination with any software or other technology | ||
provided by you or a third party. | ||
|
||
The license granted hereunder will terminate, automatically and without notice, | ||
for anyone that makes any claim (including by filing any lawsuit, assertion or | ||
other action) alleging (a) direct, indirect, or contributory infringement or | ||
inducement to infringe any patent: (i) by Facebook or any of its subsidiaries or | ||
affiliates, whether or not such claim is related to the Software, (ii) by any | ||
party if such claim arises in whole or in part from any software, product or | ||
service of Facebook or any of its subsidiaries or affiliates, whether or not | ||
such claim is related to the Software, or (iii) by any party relating to the | ||
Software; or (b) that any right in any patent claim of Facebook is invalid or | ||
unenforceable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Fresco | ||
|
||
Fresco is a powerful system for displaying images in Android applications. | ||
|
||
Fresco takes care of image loading and display, so you don't have to. It will load images from the network, local storage, or local resources, and display a placeholder until the image has arrived. It has two levels of cache; one in memory and another in internal storage. | ||
|
||
In Android 4.x and lower, Fresco puts images in a special region of Android memory. This lets your application run faster - and suffer the dreaded `OutOfMemoryError` much less often. | ||
|
||
Fresco also supports: | ||
|
||
* streaming of progressive JPEGs | ||
* display of animated GIFs and WebPs | ||
* extensive customization of image loading and display | ||
* and many more! | ||
|
||
Find out more at our [website](http://facebook.github.io/fresco/index.html). | ||
|
||
## Requirements | ||
|
||
Fresco can be included in any Android application. | ||
|
||
Fresco supports Android 2.3 (Gingerbread) and later. | ||
|
||
## Using Fresco in your application | ||
|
||
If you are building with Gradle, simply add the following line to the `dependencies` section of your `build.gradle` file: | ||
|
||
```groovy | ||
compile 'com.facebook.fresco:fresco:0.1.0+' | ||
``` | ||
|
||
See our [download](http://facebook.github.io/fresco/docs/download-fresco.html) page for other options. | ||
|
||
## Building Fresco from source | ||
|
||
Install the Android [SDK](https://developer.android.com/sdk/index.html#Other) if you haven't already. Then run the Android SDK Manager and install the Android Support Library and Android Support Repository. | ||
|
||
Download the Android [NDK](https://developer.android.com/tools/sdk/ndk/index.html). Then add the directory containing it to your PATH environment variable. | ||
|
||
Then just do | ||
|
||
```sh | ||
git clone https://github.com/facebook/fresco.git | ||
cd fresco | ||
./gradlew build | ||
``` | ||
|
||
## Join the Fresco community | ||
|
||
Please use our [issues page](https://github.com/facebook/fresco/issues) to let us know of any problems. | ||
|
||
For pull requests, please see the [CONTRIBUTING](https://github.com/facebook/fresco/blob/master/CONTRIBUTING.md) file for information on how to help out. | ||
|
||
## License | ||
Fresco is [BSD-licensed](https://github.com/facebook/fresco/blob/master/LICENSE). We also provide an additional [patent grant](https://github.com/facebook/fresco/blob/master/PATENTS). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath "com.android.tools.build:gradle:${ANDROID_GRADLE_PLUGIN_VERSION}" | ||
classpath "com.palominolabs.gradle.task:gradle-git-clone-task:${GRADLE_GIT_CLONE_TASK_VERSION}" | ||
classpath "de.undercouch:gradle-download-task:${GRADLE_DOWNLOAD_TASK_VERSION}" | ||
classpath "org.robolectric:robolectric-gradle-plugin:${ROBOLECTRIC_GRADLE_PLUGIN_VERSION}" | ||
|
||
// NOTE: Do not place your application dependencies here; they belong | ||
// in the individual module build.gradle files | ||
} | ||
} | ||
|
||
subprojects { | ||
|
||
repositories { | ||
mavenLocal() | ||
jcenter() | ||
mavenCentral() | ||
} | ||
} | ||
|
||
repositories { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apply plugin: 'com.android.library' | ||
|
||
project.group = GROUP | ||
version = VERSION_NAME | ||
|
||
dependencies { | ||
compile project(':drawee') | ||
compile project(':fbcore') | ||
compile project(':imagepipeline') | ||
} | ||
apply from: rootProject.file('release.gradle') | ||
|
||
android { | ||
buildToolsVersion "21.1.2" | ||
compileSdkVersion 21 | ||
|
||
packagingOptions { | ||
exclude 'LICENSE' | ||
exclude 'LICENSE.txt' | ||
exclude 'META-INF/LICENSE' | ||
exclude 'META-INF/LICENSE.txt' | ||
exclude 'META-INF/NOTICE' | ||
exclude 'META-INF/NOTICE.txt' | ||
} | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
from android.sourceSets.main.java.srcDirs | ||
classifier = 'sources' | ||
} | ||
artifacts.add('archives', sourcesJar) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
POM_NAME=Fresco | ||
POM_DESCRIPTION=A system to load and display images and manage their memory on Android | ||
POM_ARTIFACT_ID=fresco | ||
POM_PACKAGING=aar | ||
|
11 changes: 11 additions & 0 deletions
11
drawee-backends/drawee-pipeline/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.facebook.drawee.backends.pipeline" | ||
> | ||
|
||
<uses-sdk | ||
android:minSdkVersion="9" | ||
android:targetSdkVersion="21" | ||
/> | ||
</manifest> |
72 changes: 72 additions & 0 deletions
72
...-backends/drawee-pipeline/src/main/java/com/facebook/drawee/backends/pipeline/Fresco.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
package com.facebook.drawee.backends.pipeline; | ||
|
||
import android.content.Context; | ||
|
||
import com.facebook.drawee.view.SimpleDraweeView; | ||
import com.facebook.imagepipeline.core.ImagePipeline; | ||
import com.facebook.imagepipeline.core.ImagePipelineConfig; | ||
import com.facebook.imagepipeline.core.ImagePipelineFactory; | ||
|
||
/** | ||
* Fresco entry point. | ||
* | ||
* <p/> You must initialize this class before use. The simplest way is to just do | ||
* {#code Fresco.initialize(Context)}. | ||
*/ | ||
public class Fresco { | ||
private static PipelineDraweeControllerBuilderSupplier sDraweeControllerBuilderSupplier; | ||
|
||
private Fresco() {} | ||
|
||
/** Initializes Fresco with the default config. */ | ||
public static void initialize(Context context) { | ||
ImagePipelineFactory.initialize(context); | ||
initializeDrawee(context); | ||
} | ||
|
||
/** Initializes Fresco with the specified config. */ | ||
public static void initialize(Context context, ImagePipelineConfig imagePipelineConfig) { | ||
ImagePipelineFactory.initialize(imagePipelineConfig); | ||
initializeDrawee(context); | ||
} | ||
|
||
private static void initializeDrawee(Context context) { | ||
sDraweeControllerBuilderSupplier = new PipelineDraweeControllerBuilderSupplier(context); | ||
SimpleDraweeView.initialize(sDraweeControllerBuilderSupplier); | ||
} | ||
|
||
/** Gets the supplier of Fresco Drawee controller builders. */ | ||
public static PipelineDraweeControllerBuilderSupplier getDraweeControllerBuilderSupplier() { | ||
return sDraweeControllerBuilderSupplier; | ||
} | ||
|
||
/** Returns a new instance of Fresco Drawee controller builder. */ | ||
public static PipelineDraweeControllerBuilder newDraweeControllerBuilder() { | ||
return sDraweeControllerBuilderSupplier.get(); | ||
} | ||
|
||
public static ImagePipelineFactory getImagePipelineFactory() { | ||
return ImagePipelineFactory.getInstance(); | ||
} | ||
|
||
/** Gets the image pipeline instance. */ | ||
public static ImagePipeline getImagePipeline() { | ||
return getImagePipelineFactory().getImagePipeline(); | ||
} | ||
|
||
/** Shuts Fresco down. */ | ||
public static void shutDown() { | ||
sDraweeControllerBuilderSupplier = null; | ||
SimpleDraweeView.shutDown(); | ||
ImagePipelineFactory.shutDown(); | ||
} | ||
} |
Oops, something went wrong.