Permalink
Show file tree
Hide file tree
1 comment
on commit
sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Android: Enable apps to provide a custom configuration to Fresco
Summary: The `FrescoModule` supports providing a custom image pipeline configuration. This module is created by `MainReactPackage` but `MainReactPackage` doesn't expose any way to customize the Fresco configuration. This change adds a parameter to `MainReactPackage`'s constructor so that the `FrescoModule`'s configuration can be customized by the app. A couple of design choices were made in this change: - `MainReactPackage`'s new constructor parameter is a `MainPackageConfig`. Introducing `MainPackageConfig` enables `MainReactPackage` to nicely support new optional configuration options in the future. Imagine the alternative of each optional configuration being a separate parameter to the `MainReactPackage` constructor. - `FrescoModule` exposes its default configuration as a builder object through the `getDefaultConfigBuilder` method. This enables app's to start with `FrescoModule`'s default configuration and then modify it. **Test plan (required)** Verified that passing a custom config based on React Nati Closes #10906 Differential Revision: D4237054 Pulled By: mkonicek fbshipit-source-id: 8a62a6f0e77ca5f6d35238950094686756262196
- Loading branch information
Adam Comella
authored and
Facebook Github Bot
committed
Nov 28, 2016
1 parent
fde4fb1
commit 8b199a7
Showing
4 changed files
with
67 additions
and
3 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
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
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,42 @@ | ||
/** | ||
* 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.react.shell; | ||
|
||
import com.facebook.imagepipeline.core.ImagePipelineConfig; | ||
|
||
/** | ||
* Configuration for {@link MainReactPackage} | ||
*/ | ||
public class MainPackageConfig { | ||
|
||
private ImagePipelineConfig mFrescoConfig; | ||
|
||
private MainPackageConfig(Builder builder) { | ||
mFrescoConfig = builder.mFrescoConfig; | ||
} | ||
|
||
public ImagePipelineConfig getFrescoConfig() { | ||
return mFrescoConfig; | ||
} | ||
|
||
public static class Builder { | ||
|
||
private ImagePipelineConfig mFrescoConfig; | ||
|
||
public Builder setFrescoConfig(ImagePipelineConfig frescoConfig) { | ||
mFrescoConfig = frescoConfig; | ||
return this; | ||
} | ||
|
||
public MainPackageConfig build() { | ||
return new MainPackageConfig(this); | ||
} | ||
} | ||
} |
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
8b199a7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up! up! I think it is a good request.