Giter Site home page Giter Site logo

facebook / fresco Goto Github PK

View Code? Open in Web Editor NEW
17.1K 849.0 3.7K 75.05 MB

An Android library for managing images and the memory they use.

Home Page: https://frescolib.org/

License: MIT License

Java 69.19% C++ 4.26% C 1.28% Makefile 0.25% Python 0.24% Kotlin 24.75% Shell 0.02%

fresco's Introduction

Fresco

Fresco Logo

Build Status License

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 much more!

Find out more at our website.

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:

implementation 'com.facebook.fresco:fresco:3.2.0'

For full details, visit the documentation on our web site, available in English and Chinese:

Join the Fresco community

Please use our issues page to let us know of any problems.

For pull requests, please see the CONTRIBUTING file for information on how to help out. See our documentation for information on how to build from source.

License

Fresco is MIT-licensed.

fresco's People

Contributors

aagnes-zz avatar alsutton avatar cgrushko avatar defhlt avatar eldk avatar erikandre avatar foghina avatar ianchilds avatar jeremydubreil avatar joelmarcey avatar kirwan avatar korden avatar lukkm avatar massimocarli avatar mrmannwood avatar oprisnik avatar pasqualeanatriello avatar passy avatar plamenko avatar sashkostashuk avatar sblackshear avatar simocfb avatar steelrooter avatar tutchiio avatar tyronen avatar wizh avatar xapienz avatar xiphirx avatar zertosh avatar zmroczek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fresco's Issues

crash in Nexus5

F/libc ( 7134): heap corruption detected by dlmalloc
F/libc ( 7134): Fatal signal 6 (SIGABRT) at 0x00001bde (code=-6), thread 7134 (esco.frescotest)

F/libc ( 7267): Fatal signal 6 (SIGABRT) at 0x00001c63 (code=-6), thread 7276 (FinalizerDaemon)

F/libc ( 7433): Fatal signal 7 (SIGBUS) at 0x0000000d (code=1), thread 7442 (FinalizerDaemon)

roundAsCircle does not apply

Hi,

I've specified the XML attribute, fresco:roundAsCircle="true", in the following code and the image is still displaying as a square.

< com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/profile_picture"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
fresco:roundAsCircle="true"/>

I've made sure to add the custom namespace, fresco, to the top-level element:

< android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:fresco="http:/schemas.android.com/apk/res-auto"
...>

How do you import&run the sample?

I keep getting:

"Error:Execution failed for task ':imagepipeline:ndk_build_gifimage'.
A problem occurred starting process 'command 'ndk-build''
"

The license of the document

Fresco is really really great.
What it's the license of the document? Also BSD?
May I translate the document into Chinese and publish to github pages?

Incorrect Uri scheme for local app assets

Android assets may be accessed using an Uri of this format file:///android_asset/... but Fresco uses the asset://... scheme which leads to incompatibility with other solutions.

E.g. when switching using Square's Picasso with Fresco, all Uris need to be changed to work with Fresco.

Use one builder to build multiple Hierarchys....

is this code doable or encouraged or is there a better way....
I'm attempting to put iconFontDrawables in the placeholder of multiple drawees Views.

So, I'm using one builder to set multiple hierarchy is this cool? or nah....

GenericDraweeHierarchyBuilder builder =
                new GenericDraweeHierarchyBuilder(getResources());

        GenericDraweeHierarchy radioPauseButtonHierarchy = builder
                .setFadeDuration(300)
                .setPlaceholderImage(iconicFontDrawablePause)
                .build();

        GenericDraweeHierarchy radioPlayButtonHierarchy = builder
                .setFadeDuration(300)
                .setPlaceholderImage(iconicFontDrawablePlay)
                .build();

        GenericDraweeHierarchy radioBuyNowButtonHierarchy = builder
                .setFadeDuration(300)
                .setPlaceholderImage(iconicFontDrawableBuyNow)
                .build();

 buyNowButton.setHierarchy(radioBuyNowButtonHierarchy);
 playButton.setHierarchy(radioPlayButtonHierarchy);
 pauseButton.setHierarchy(radioPauseButtonHierarchy);

SimpleDraweeView doesn't work in edit mode

The following classes could not be instantiated:
- com.facebook.drawee.view.SimpleDraweeView (Open Class, Show Exception)
 Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE  Exception Details java.lang.NullPointerException: SimpleDraweeView was not initialized!   at 
com.facebook.common.internal.Preconditions.checkNotNull(Preconditions.java:226)   at 
com.facebook.drawee.view.SimpleDraweeView.init(SimpleDraweeView.java:68)   at 
com.facebook.drawee.view.SimpleDraweeView.<init>(SimpleDraweeView.java:59)   at 
java.lang.reflect.Constructor.newInstance(Constructor.java:422)   at 
android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806)   at 
android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at 
android.view.LayoutInflater.rInflate(LayoutInflater.java:782)   at 
android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809)   at 
android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at 
android.view.LayoutInflater.rInflate(LayoutInflater.java:782)   at 
android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809)   at 
android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at 
android.view.LayoutInflater.rInflate(LayoutInflater.java:782)   at 
android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809)   at 
android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at 
android.view.LayoutInflater.rInflate(LayoutInflater.java:782)   at 
android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809)   at 
android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at 
android.view.LayoutInflater.rInflate(LayoutInflater.java:782)   at 
android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809)   at 
android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at 
android.view.LayoutInflater.rInflate(LayoutInflater.java:782)   at 
android.view.LayoutInflater.inflate(LayoutInflater.java:504)   at 
android.view.LayoutInflater.inflate(LayoutInflater.java:385)

Supporting other widget?

The ImageView can be replaced by SimpleDraweeView in Fresco, but is Fresco supporting other widgets in Android, such as TextView or Layout,sometimes we need loading an image to the background of view?

Process 'command 'ndk-build.cmd'' finished with non-zero exit value 2

hi, i replace commandLine ndk-build imagepipeline.gradle to ndk-build.cmd and encoutered blow problem
build-local.mk
:imagepipeline:ndk_build_gifimage FAILED
Error:Execution failed for task ':imagepipeline:ndk_build_gifimage'.

Process 'command 'ndk-build.cmd'' finished with non-zero exit value 2

Add a means of exposing the underlying Bitmap

Right now, the library doesn't appear to make retrieving the underlying bitmap in a Drawee. While this is understandable, it also makes postprocessing impossible for any users that want to do it.

An example would be for use in the Palette library, which requires an input Bitmap for the color extraction.

Add callbacks for when a Drawee view is ready

Forgive me if there is something for this already and I just missed it. It's often convenient to postpone some action until after the image is done loading. Examples include showing and dismissing a progress dialog, generating color extraction (which would go in tandem well with #19), etc.

Using OkHttp -- Docs clarification...

So I'm reading the docs on using OkHttp and it indicates that my gradle file should not have compile 'com.facebook.fresco:fresco:0.1.0+' if I'm trying to use Fresco with OkHttp. However, unless I add that dependency, I have no Fresco to initialize.

Should I be including three dependencies as follows? If so, I think the docs could be clearer...

    compile 'com.facebook.fresco:fresco:0.1.0+'
    compile "com.facebook.fresco:drawee:0.1.0+"
    compile "com.facebook.fresco:imagepipeline-okhttp:0.1.0+"

http://frescolib.org/docs/using-other-network-layers.html#_

Support for animated GIF's

Does this support GIF type images? There is this gist that Glide is using.

Picasso doesn't support it but Glide does and since Fresco is supported by Facebook I would like to know if there will be support for this if not already.

It is also nice to have a comparison list between different image management libraries.

Thanks.

Fresco and OpenCV

Hello,

I am having some techinical issues with Fresco and OpenCV.
I am compiling OpenCV from source using the Android NDK, and after including Fresco i get the following exception:
Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/xxx-1/base.apk"],nativeLibraryDirectories=[/data/app/xxx-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libopencv_java.so"

It seems that, somehow with Fresco included, the libopencv_java.so doesn't get included in my application.
After removing the Fresco library it seems to work as intended.

In my build.gradle i am compiling OpenCV with the following task:

sourceSets.main.jni.srcDirs = []
task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') {
    commandLine "path to ndk-build.cmd",
            'NDK_PROJECT_PATH=build/intermediates/ndk',
            'NDK_LIBS_OUT=src/main/jniLibs',
            'APP_BUILD_SCRIPT=src/main/jni/Android.mk',
            'NDK_APPLICATION_MK=src/main/jni/Application.mk'
}

tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn ndkBuild
}

I do not know what's creating this error, but I hope you can help me.
Thank you - Christian.

Requesting progressive rendering

From the progressive rendering section in the docs:

Uri uri;
ImageRequest request = ImageRequestBuilder
    .newBuilderWithSource(uri)
    .setProgressiveRenderingEnabled(true)
    .build();
PipelineDraweeController controller = Fresco.newControllerBuilder()
    .setImageRequest(requests)
    .setOldController(mSimpleDraweeView.getController())
    .build();
mSimpleDraweeView.setController(controller);

It looks as if there is no Fresco.newControllerBuilder, only Fresco.newDraweeControllerBuilder(). And with that modification, the assignment to PipelineDraweeController gives an incompatible types error.

Just a note as this sample code might want to be tweaked for clarity. It seems to compile and work with a DraweeController type.

Loading images in Widgets

I am supposing that this won't be possible based on the way this library is architected and how widgets work. If there is a possibility can you please give me a hint on how should I approach this and I could make a PR if I have something done.

You should use provided rather than compile for javax.annotation:javax.annotation-api

You need the annotations at compile time, not at run time, so "provided" is preferred. There is no need to distribute the source for the annotations. This is actually an issue for me because another library I depend on also packages the annotations (in a jar), and I'm getting an dex error because of the multiple definitions. I'm checking with my company to see whether I can sign your agreements to file a pull request.

I have problem with use Uri scheme for local app res

my code:
'Uri uri = Uri.parse("res://"+getResources().getResourcePackageName(R.raw.local_img));'

error:
'Caused by: com.facebook.imagepipeline.request.ImageRequestBuilder$BuilderException: Invalid request builder: Resource URI path must be a resource id.
at com.facebook.imagepipeline.request.ImageRequestBuilder.validate(ImageRequestBuilder.java:217)
at com.facebook.imagepipeline.request.ImageRequestBuilder.build(ImageRequestBuilder.java:188)
at com.facebook.imagepipeline.request.ImageRequest.fromUri(ImageRequest.java:59)'

Multiple issues

Well, i've just been trying to integrate it, so far i've found some (outdated?) docs:
http://frescolib.org/docs/progressive-jpegs.html#_

PipelineDraweeController controller = Fresco.newControllerBuilder() .setImageRequest(requests)    
.setOldController(mSimpleDraweeView.getOldController()) .build();

I had to cast the new controller builder to PipelineDraweeController, getOldController() is not a function defined in DraweeView, i only have 'getController'.
Further to that, i finally got it to compile, only to be given 'SimpleDraweeView was not initialized!' I dont see anywhere on the Getting started that i need to do any special initialization other than the usual view finding?
edit Changing to a plain 'DraweeView' stopped the crash however, I'm also not sure how to actually start the image load?

            ProgressiveJpegConfig pjpegConfig = new ProgressiveJpegConfig() {
            @Override
            public int getNextScanNumberToDecode(int scanNumber) {
                return scanNumber + 2;
            }

            public QualityInfo getQualityInfo(int scanNumber) {
                boolean isGoodEnough = (scanNumber > 5);
                return ImmutableQualityInfo.of(scanNumber, isGoodEnough, false);
            }
        };
        ImagePipelineConfig config = ImagePipelineConfig.newBuilder(DetailsActivity.this)

                .setProgressiveJpegConfig(pjpegConfig)

                .build();
        Fresco.initialize(DetailsActivity.this, config);

        ImageRequest request = ImageRequestBuilder
                .newBuilderWithSource(getUriFromUrl(url))
                .setProgressiveRenderingEnabled(true)
                .build();
        PipelineDraweeController controller =  (PipelineDraweeController)       Fresco.newDraweeControllerBuilder()
                .setImageRequest(request)
                .setOldController(i.getController())
                .build();

        i.setController(controller);

From the looks of all your docs, 'setController' is that poiint, but the javadoc has no mention of this and i seem to see no loading occurring?

null pointer at <init>

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.facebook.drawee.view.DraweeHolder.setController(com.facebook.drawee.interfaces.DraweeController)' on a null object reference
at com.facebook.drawee.view.DraweeView.setImageDrawable(DraweeView.java:140)
at com.kakao.topic.ui.widget.TopicImageView.setImageDrawable(TopicImageView.java:96)
at android.widget.ImageView.(ImageView.java:159)
at android.widget.ImageView.(ImageView.java:140)
at android.widget.ImageView.(ImageView.java:136)
at com.facebook.drawee.view.DraweeView.(DraweeView.java:51)
at com.facebook.drawee.view.GenericDraweeView.(GenericDraweeView.java:73)
at com.facebook.drawee.view.SimpleDraweeView.(SimpleDraweeView.java:58)

I overrided SimpleDraweeView, and used this view in xml.
When I add 'src' attribute, I got this error..
DraweeView.java:140
mDraweeHolder.setController(null);
mDraweeHolder can be null when ImageView class attempting to setImageDrawable in constructor

Get multiple images from postProcess

I have an image I want it to be processed ,but on the other hand I need both images the processed image and the original one to be passed to the ControllerListener (I need an array of imageInfo insted of only the processed imageInfo), can I do it now or should I wait ?

Windows os How to build?

My Environment

  • os : WIndows 7 Ultimake
  • SET ANDROID_HOME=C:\android-sdk-windows
  • SET PATH=C:\android-ndk-r10d;%PATH%

Run

  • gradlew build

Result

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':imagepipeline:ndk_build_gifimage'.

A problem occurred starting process 'command 'ndk-build''

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

....... ㅜ.ㅡ

Retry

  • gradlew build -- stacktrace

Result

* What went wrong:
Execution failed for task ':imagepipeline:ndk_build_gifimage'.

A problem occurred starting process 'command 'ndk-build''

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':imagepipeline:ndk_build_gifimage'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
...

Setting background image to color with roundAsCircle="true" should be masked by circle

At the moment, displaying the image with roundAsCircle set to true creates a square around the circle as a background when setting backgroundImage to @color/white or any other color resource.

In my opinion, it makes sense for the circle to be used as a mask for the background.

Current code:

Proposed fix:

Appologies for the teribble photo shopping, just trying get point across.

RoundingParams.setBorder(..) does not work

I am not able to show a border to an image. Neither through code, nor XML.

    GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources());
    RoundingParams roundingParams = RoundingParams.fromCornersRadius(25.0f).setBorder(android.R.color.holo_red_dark, 2.0f);
    GenericDraweeHierarchy hierarchy = builder
            .setFadeDuration(1000)
            .setRoundingParams(roundingParams)
            .setPlaceholderImage(getResources().getDrawable(R.drawable.ic_launcher))
            .build();

    imageView.setHierarchy(hierarchy);
    imageView.setImageURI(uri);

编译不通过

大家好:
我下载一份代码,在android studio中编译不通过,报的是下面错误,麻烦帮忙看一下,解决一下,谢谢!错误代码:
Execution failed for task ‘:imagepipeline:ndk_build_gifimage',
>A problem occurred starting process ' command' ndk-build''

Custom Uri handlers / accepting arbitrary InputStreams

The current Uri handlers are great for many cases, but in our app (and many others) we store our media encrypted on disk. Because of this, vanilla ContentProviders are unavailable as an option as we'd have to write a temporary unencrypted version to disk (ewww). The other option in Fresco would be to setup a localhost HTTP server that streams the unencrypted version (ewwwwww), which is a lot of unnecessary overhead.

If, however, Fresco allowed additional custom Uri handlers that provide InputStreams, we'd be golden. Alternatively, having a setImageInputStream alongside setImageUri would also suffice.

Using selector drawable xml doesnt work

When the resource is an xml it doesnt work for me.

this is the xml:

selector xmlns:android="http://schemas.android.com/apk/res/android"<
>item android:drawable="@drawable/image_selected"<
>android:state_selected="true" /<
>item android:drawable="@drawable/image_unselected" /<
/selector<

this is how im trying to use it (id is the drawable value from the R file):

Uri uri = Uri.parse("res://" + sContext.getResources().getResourcePackageName(id) + "/" + id);
simpleDraweeView.setImageURI(uri);

this code works great when the id is an actual image (png for example).

Error: duplicate files during packaging of APK ('lib/armeabi/libgif.so')

Fresco has a dependency that clashes with another library that my project is heavily dependent on.

Origin 1: /build/intermediates/exploded-aar/pl.droidsonroids.gif/android-gif-drawable/1.0.11/jni/armeabi/libgif.so

Origin 2: /build/intermediates/exploded-aar/com.facebook.fresco/imagepipeline/0.1.0/jni/armeabi/libgif.so

The "duplicate filed during packaging" error instructs to add this to the build.gradle file:

android {
packagingOptions {
exclude 'lib/armeabi/libgif.so'
}
}

but this does not solve the issue...

Has anyone else had this issue yet?
If so is there a way of properly excluding this as a dependency from one or the other?

SimpleDraweeView.setImageURI(String) should be SimpleDraweeView.setImageURI(Uri)

In the example on this page

https://github.com/facebook/fresco/blob/gh-pages/docs/00-index.md

it reads

SimpleDraweeView draweeView = (SimpleDraweeView) findViewById(R.id.my_image_view);
draweeView.setImageURI("http://frescolib.org/static/fresco-logo.png");

but when I try to compile, I get the following

Error:(80, 19) error: no suitable method found for setImageURI(String)
method SimpleDraweeView.setImageURI(Uri,Object) is not applicable
(actual and formal argument lists differ in length)
method SimpleDraweeView.setImageURI(Uri) is not applicable
(actual argument String cannot be converted to Uri by method invocation conversion)

Shouldn't it read something like this instead?

    Uri uri = Uri.parse("http://frescolib.org/static/fresco-logo.png");
    SimpleDraweeView draweeView = (SimpleDraweeView) findViewById(R.id.my_image_view);
    draweeView.setImageURI(uri);

Playing animations

The docs say :

Uri uri;
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
    .setAutoPlayAnimation(true)
    . // other setters
    .build();

But ImageRequestBuilder class has no method named setAutoPlayAnimation()

Setting fresco:pressedStateOverlayImage to a color in layout XML causes crash

Using the following XML

<com.facebook.drawee.view.SimpleDraweeView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/image_view"
        fresco:placeholderImage="@drawable/download_photo"
        fresco:failureImage="@drawable/photo_error"
        fresco:actualImageScaleType="centerCrop"
        fresco:placeholderImageScaleType="centerInside"
        fresco:failureImageScaleType="centerInside"
        fresco:pressedStateOverlayImage="@color/black_overlay"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:contentDescription="@string/accessibility_photo"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"/>

causes a crash in Jellybean, API level 18, and Lollipop, API 22, when inflating the view

FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #10: Error inflating class com.facebook.drawee.view.SimpleDraweeView
        at android.view.LayoutInflater.createView(LayoutInflater.java:620)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 

When I remove the fresco:pressedStateOverlayImage="@color/black_overlay" then the Inflater works and the app behaves as expected without a crash. Using any color also results in a crash so that is not the problem. Perhaps the documentation is incorrect and a color cannot be used?

can't open file in assets folder

I tried SimpleDraweeView.setImageURI and set a file:///android_asset resource.

xx.setImageURI(Uri.parse("file:///android_asset/....jpg"));
But it shows an error:
can't open '/android_asset/xxx.jpg'
And if I use:
xx.setImageDrawable(new BitmapDrawable(getAssets().open("xxx.jpg")));
This is correct.
I am new to android. Do I make some mistakes? If there are some problems, please let me know. :-)

Use Fresco with SubsamplingImageView

I am working on an app that requires handling large image. Currently we are cutting the image into several small pieces. (But as you may think of, the OOM is always bugging us). I would like to know if fresco is able to handle that nicely or not? Thanks.

Mac os How to build?

:imagepipeline:ndk_build_gifimage FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':imagepipeline:ndk_build_gifimage'.

    A problem occurred starting process 'command 'ndk-build''

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 11.279 secs
kongnandembp:fresco kongnan$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/kongnan/Documents/AndroidSDK/android-ndk-r10d
kongnandembp:fresco kongnan$ ndk-build
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/Users/kongnan/Documents/AndroidSDK/android-ndk-r10d/build/core/build-local.mk:148: *** Android NDK: Aborting . Stop.
kongnandembp:fresco kongnan$

BaseBitmapDataSubscriber not work T_T

ImagePipeline imagePipeline = Fresco.getImagePipeline();
ImageRequest imageRequest = ImageRequestBuilder
.newBuilderWithSource(Uri.fromFile(new File(customBG.get(0))))
.setAutoRotateEnabled(false)
.setLocalThumbnailPreviewsEnabled(true)
.setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH)
.setProgressiveRenderingEnabled(false)
.setResizeOptions(new ResizeOptions(width, height))
.build();
DataSource <CloseableReference> dataSource = imagePipeline.fetchDecodedImage(imageRequest, getAppContext());
dataSource.subscribe(new BaseBitmapDataSubscriber() {
@OverRide
protected void onNewResultImpl(@nullable Bitmap bitmap) {
LogUtils.v("DEBUG91", "onNewResultImpl : " + bitmap);
}

            @Override
            protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
                LogUtils.v("DEBUG91", "onFailureImpl");
            }
        }, new Executor() {
            @Override
            public void execute(Runnable command) {
                LogUtils.v("DEBUG91", "Executor : " + command.toString());
            }
        });

Split common package into a standalone lib

Great Library! and I saw lots of commons classes for android. How about to split those classes in common package into a new lib. so people can use it like guava in java.

That would be very very helpful! THX

com.facebook.drawee.view.SimpleDraweeView Class could not be found.

This is my activity_main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:fresco="http:/schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin">

    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/my_image_view"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        fresco:placeholderImage="@drawable/my_placeholder"
        />

</LinearLayout>
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.view.SimpleDraweeView;


public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Fresco.initialize(getApplicationContext());
        SimpleDraweeView draweeView = (SimpleDraweeView) findViewById(R.id.my_image_view);
        draweeView.setImageURI(Uri.parse("http://image_uri"));
    }

}

screen shot 2015-03-27 at 12 49 13 pm

I have already included compile 'com.facebook.fresco:fresco:0.1.0+' in the gradle file.

The Android SDK version is:-

compileSdkVersion 21
buildToolsVersion "21.1.2"

Still i am get the error that Drawee Class cannot be found.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.