id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
14,400 | kiegroup/drools | drools-core/src/main/java/org/drools/core/rule/Collect.java | Collect.determineResultClassName | private String determineResultClassName(ClassObjectType objType) {
String className = objType.getClassName();
if ( List.class.getName().equals( className ) ) {
className = ArrayList.class.getName();
} else if ( Set.class.getName().equals( className ) ) {
className = HashS... | java | private String determineResultClassName(ClassObjectType objType) {
String className = objType.getClassName();
if ( List.class.getName().equals( className ) ) {
className = ArrayList.class.getName();
} else if ( Set.class.getName().equals( className ) ) {
className = HashS... | [
"private",
"String",
"determineResultClassName",
"(",
"ClassObjectType",
"objType",
")",
"{",
"String",
"className",
"=",
"objType",
".",
"getClassName",
"(",
")",
";",
"if",
"(",
"List",
".",
"class",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"className... | If the user uses an interface as a result type, use a default
concrete class.
List -> ArrayList
Collection -> ArrayList
Set -> HashSet | [
"If",
"the",
"user",
"uses",
"an",
"interface",
"as",
"a",
"result",
"type",
"use",
"a",
"default",
"concrete",
"class",
"."
] | 22b0275d6dbe93070b8090948502cf46eda543c4 | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/rule/Collect.java#L126-L136 |
14,401 | kiegroup/drools | drools-core/src/main/java/org/drools/core/base/ClassFieldAccessorFactory.java | ClassFieldAccessorFactory.buildClassHeader | protected static ClassWriter buildClassHeader(Class< ? > superClass, String className) {
ClassWriter cw = createClassWriter( superClass.getClassLoader(),
Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER,
className,
... | java | protected static ClassWriter buildClassHeader(Class< ? > superClass, String className) {
ClassWriter cw = createClassWriter( superClass.getClassLoader(),
Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER,
className,
... | [
"protected",
"static",
"ClassWriter",
"buildClassHeader",
"(",
"Class",
"<",
"?",
">",
"superClass",
",",
"String",
"className",
")",
"{",
"ClassWriter",
"cw",
"=",
"createClassWriter",
"(",
"superClass",
".",
"getClassLoader",
"(",
")",
",",
"Opcodes",
".",
"... | Builds the class header | [
"Builds",
"the",
"class",
"header"
] | 22b0275d6dbe93070b8090948502cf46eda543c4 | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/base/ClassFieldAccessorFactory.java#L277-L290 |
14,402 | kiegroup/drools | drools-core/src/main/java/org/drools/core/base/ClassFieldAccessorFactory.java | ClassFieldAccessorFactory.build3ArgConstructor | private static void build3ArgConstructor(final Class< ? > superClazz,
final String className,
final ClassWriter cw) {
MethodVisitor mv;
{
mv = cw.visitMethod( Opcodes.ACC_PUBLIC,
... | java | private static void build3ArgConstructor(final Class< ? > superClazz,
final String className,
final ClassWriter cw) {
MethodVisitor mv;
{
mv = cw.visitMethod( Opcodes.ACC_PUBLIC,
... | [
"private",
"static",
"void",
"build3ArgConstructor",
"(",
"final",
"Class",
"<",
"?",
">",
"superClazz",
",",
"final",
"String",
"className",
",",
"final",
"ClassWriter",
"cw",
")",
"{",
"MethodVisitor",
"mv",
";",
"{",
"mv",
"=",
"cw",
".",
"visitMethod",
... | Creates a constructor for the field extractor receiving
the index, field type and value type | [
"Creates",
"a",
"constructor",
"for",
"the",
"field",
"extractor",
"receiving",
"the",
"index",
"field",
"type",
"and",
"value",
"type"
] | 22b0275d6dbe93070b8090948502cf46eda543c4 | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/base/ClassFieldAccessorFactory.java#L296-L356 |
14,403 | kiegroup/drools | drools-core/src/main/java/org/drools/core/base/ClassFieldAccessorFactory.java | ClassFieldAccessorFactory.buildGetMethod | protected static void buildGetMethod(final Class< ? > originalClass,
final String className,
final Class< ? > superClass,
final Method getterMethod,
final C... | java | protected static void buildGetMethod(final Class< ? > originalClass,
final String className,
final Class< ? > superClass,
final Method getterMethod,
final C... | [
"protected",
"static",
"void",
"buildGetMethod",
"(",
"final",
"Class",
"<",
"?",
">",
"originalClass",
",",
"final",
"String",
"className",
",",
"final",
"Class",
"<",
"?",
">",
"superClass",
",",
"final",
"Method",
"getterMethod",
",",
"final",
"ClassWriter"... | Creates the proxy reader method for the given method | [
"Creates",
"the",
"proxy",
"reader",
"method",
"for",
"the",
"given",
"method"
] | 22b0275d6dbe93070b8090948502cf46eda543c4 | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/base/ClassFieldAccessorFactory.java#L361-L426 |
14,404 | kiegroup/drools | drools-workbench-models/drools-workbench-models-commons/src/main/java/org/drools/workbench/models/commons/backend/rule/ActionCallMethodBuilder.java | ActionCallMethodBuilder.supports | public boolean supports(final String line) {
final List<String> splits = new ArrayList<String>();
int depth = 0;
int textDepth = 0;
boolean escape = false;
StringBuffer split = new StringBuffer();
for (char c : line.toCharArray()) {
if (depth == 0 && c == '.')... | java | public boolean supports(final String line) {
final List<String> splits = new ArrayList<String>();
int depth = 0;
int textDepth = 0;
boolean escape = false;
StringBuffer split = new StringBuffer();
for (char c : line.toCharArray()) {
if (depth == 0 && c == '.')... | [
"public",
"boolean",
"supports",
"(",
"final",
"String",
"line",
")",
"{",
"final",
"List",
"<",
"String",
">",
"splits",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"int",
"depth",
"=",
"0",
";",
"int",
"textDepth",
"=",
"0",
";",
... | ActionCallMethods do not support chained method invocations | [
"ActionCallMethods",
"do",
"not",
"support",
"chained",
"method",
"invocations"
] | 22b0275d6dbe93070b8090948502cf46eda543c4 | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-workbench-models/drools-workbench-models-commons/src/main/java/org/drools/workbench/models/commons/backend/rule/ActionCallMethodBuilder.java#L67-L99 |
14,405 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/drawable/RoundedBitmapDrawable.java | RoundedBitmapDrawable.fromBitmapDrawable | public static RoundedBitmapDrawable fromBitmapDrawable(
Resources res,
BitmapDrawable bitmapDrawable) {
return new RoundedBitmapDrawable(res, bitmapDrawable.getBitmap(), bitmapDrawable.getPaint());
} | java | public static RoundedBitmapDrawable fromBitmapDrawable(
Resources res,
BitmapDrawable bitmapDrawable) {
return new RoundedBitmapDrawable(res, bitmapDrawable.getBitmap(), bitmapDrawable.getPaint());
} | [
"public",
"static",
"RoundedBitmapDrawable",
"fromBitmapDrawable",
"(",
"Resources",
"res",
",",
"BitmapDrawable",
"bitmapDrawable",
")",
"{",
"return",
"new",
"RoundedBitmapDrawable",
"(",
"res",
",",
"bitmapDrawable",
".",
"getBitmap",
"(",
")",
",",
"bitmapDrawable... | Creates a new RoundedBitmapDrawable from the given BitmapDrawable.
@param res resources to use for this drawable
@param bitmapDrawable bitmap drawable containing the bitmap to be used for this drawable
@return the RoundedBitmapDrawable that is created | [
"Creates",
"a",
"new",
"RoundedBitmapDrawable",
"from",
"the",
"given",
"BitmapDrawable",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/RoundedBitmapDrawable.java#L93-L97 |
14,406 | facebook/fresco | fbcore/src/main/java/com/facebook/common/file/FileUtils.java | FileUtils.mkdirs | public static void mkdirs(File directory) throws CreateDirectoryException {
if (directory.exists()) {
// file exists and *is* a directory
if (directory.isDirectory()) {
return;
}
// file exists, but is not a directory - delete it
if (!directory.delete()) {
throw new Cr... | java | public static void mkdirs(File directory) throws CreateDirectoryException {
if (directory.exists()) {
// file exists and *is* a directory
if (directory.isDirectory()) {
return;
}
// file exists, but is not a directory - delete it
if (!directory.delete()) {
throw new Cr... | [
"public",
"static",
"void",
"mkdirs",
"(",
"File",
"directory",
")",
"throws",
"CreateDirectoryException",
"{",
"if",
"(",
"directory",
".",
"exists",
"(",
")",
")",
"{",
"// file exists and *is* a directory",
"if",
"(",
"directory",
".",
"isDirectory",
"(",
")"... | Creates the specified directory, along with all parent paths if necessary
@param directory directory to be created
@throws CreateDirectoryException | [
"Creates",
"the",
"specified",
"directory",
"along",
"with",
"all",
"parent",
"paths",
"if",
"necessary"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/file/FileUtils.java#L26-L45 |
14,407 | facebook/fresco | fbcore/src/main/java/com/facebook/common/file/FileUtils.java | FileUtils.rename | public static void rename(File source, File target) throws RenameException {
Preconditions.checkNotNull(source);
Preconditions.checkNotNull(target);
// delete the target first - but ignore the result
target.delete();
if (source.renameTo(target)) {
return;
}
Throwable innerException ... | java | public static void rename(File source, File target) throws RenameException {
Preconditions.checkNotNull(source);
Preconditions.checkNotNull(target);
// delete the target first - but ignore the result
target.delete();
if (source.renameTo(target)) {
return;
}
Throwable innerException ... | [
"public",
"static",
"void",
"rename",
"(",
"File",
"source",
",",
"File",
"target",
")",
"throws",
"RenameException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"source",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"target",
")",
";",
"// delete ... | Renames the source file to the target file. If the target file exists, then we attempt to
delete it. If the delete or the rename operation fails, then we raise an exception
@param source the source file
@param target the new 'name' for the source file
@throws IOException | [
"Renames",
"the",
"source",
"file",
"to",
"the",
"target",
"file",
".",
"If",
"the",
"target",
"file",
"exists",
"then",
"we",
"attempt",
"to",
"delete",
"it",
".",
"If",
"the",
"delete",
"or",
"the",
"rename",
"operation",
"fails",
"then",
"we",
"raise"... | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/file/FileUtils.java#L54-L77 |
14,408 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/generic/GenericDraweeHierarchyBuilder.java | GenericDraweeHierarchyBuilder.init | private void init() {
mFadeDuration = DEFAULT_FADE_DURATION;
mDesiredAspectRatio = 0;
mPlaceholderImage = null;
mPlaceholderImageScaleType = DEFAULT_SCALE_TYPE;
mRetryImage = null;
mRetryImageScaleType = DEFAULT_SCALE_TYPE;
mFailureImage = null;
mFailureImageScaleType = DEFAULT_SCALE... | java | private void init() {
mFadeDuration = DEFAULT_FADE_DURATION;
mDesiredAspectRatio = 0;
mPlaceholderImage = null;
mPlaceholderImageScaleType = DEFAULT_SCALE_TYPE;
mRetryImage = null;
mRetryImageScaleType = DEFAULT_SCALE_TYPE;
mFailureImage = null;
mFailureImageScaleType = DEFAULT_SCALE... | [
"private",
"void",
"init",
"(",
")",
"{",
"mFadeDuration",
"=",
"DEFAULT_FADE_DURATION",
";",
"mDesiredAspectRatio",
"=",
"0",
";",
"mPlaceholderImage",
"=",
"null",
";",
"mPlaceholderImageScaleType",
"=",
"DEFAULT_SCALE_TYPE",
";",
"mRetryImage",
"=",
"null",
";",
... | Initializes this builder to its defaults. | [
"Initializes",
"this",
"builder",
"to",
"its",
"defaults",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/generic/GenericDraweeHierarchyBuilder.java#L80-L107 |
14,409 | facebook/fresco | fbcore/src/main/java/com/facebook/widget/text/span/BetterImageSpan.java | BetterImageSpan.normalizeAlignment | public static final @BetterImageSpanAlignment
int normalizeAlignment(int alignment) {
switch (alignment) {
case DynamicDrawableSpan.ALIGN_BOTTOM:
return ALIGN_BOTTOM;
case ALIGN_CENTER:
return ALIGN_CENTER;
case DynamicDrawableSpan.ALIGN_BASELINE:
default:
return AL... | java | public static final @BetterImageSpanAlignment
int normalizeAlignment(int alignment) {
switch (alignment) {
case DynamicDrawableSpan.ALIGN_BOTTOM:
return ALIGN_BOTTOM;
case ALIGN_CENTER:
return ALIGN_CENTER;
case DynamicDrawableSpan.ALIGN_BASELINE:
default:
return AL... | [
"public",
"static",
"final",
"@",
"BetterImageSpanAlignment",
"int",
"normalizeAlignment",
"(",
"int",
"alignment",
")",
"{",
"switch",
"(",
"alignment",
")",
"{",
"case",
"DynamicDrawableSpan",
".",
"ALIGN_BOTTOM",
":",
"return",
"ALIGN_BOTTOM",
";",
"case",
"ALI... | A helper function to allow dropping in BetterImageSpan as a replacement to ImageSpan,
and allowing for center alignment if passed in. | [
"A",
"helper",
"function",
"to",
"allow",
"dropping",
"in",
"BetterImageSpan",
"as",
"a",
"replacement",
"to",
"ImageSpan",
"and",
"allowing",
"for",
"center",
"alignment",
"if",
"passed",
"in",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/widget/text/span/BetterImageSpan.java#L45-L56 |
14,410 | facebook/fresco | fbcore/src/main/java/com/facebook/widget/text/span/BetterImageSpan.java | BetterImageSpan.getSize | @Override
public int getSize(
Paint paint,
CharSequence text,
int start,
int end,
Paint.FontMetricsInt fontMetrics) {
updateBounds();
if (fontMetrics == null) {
return mWidth;
}
int offsetAbove = getOffsetAboveBaseline(fontMetrics);
int offsetBelow = mHeight + ... | java | @Override
public int getSize(
Paint paint,
CharSequence text,
int start,
int end,
Paint.FontMetricsInt fontMetrics) {
updateBounds();
if (fontMetrics == null) {
return mWidth;
}
int offsetAbove = getOffsetAboveBaseline(fontMetrics);
int offsetBelow = mHeight + ... | [
"@",
"Override",
"public",
"int",
"getSize",
"(",
"Paint",
"paint",
",",
"CharSequence",
"text",
",",
"int",
"start",
",",
"int",
"end",
",",
"Paint",
".",
"FontMetricsInt",
"fontMetrics",
")",
"{",
"updateBounds",
"(",
")",
";",
"if",
"(",
"fontMetrics",
... | Returns the width of the image span and increases the height if font metrics are available. | [
"Returns",
"the",
"width",
"of",
"the",
"image",
"span",
"and",
"increases",
"the",
"height",
"if",
"font",
"metrics",
"are",
"available",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/widget/text/span/BetterImageSpan.java#L82-L113 |
14,411 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java | ProducerSequenceFactory.getEncodedImageProducerSequence | public Producer<CloseableReference<PooledByteBuffer>> getEncodedImageProducerSequence(
ImageRequest imageRequest) {
try {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("ProducerSequenceFactory#getEncodedImageProducerSequence");
}
validateEncodedImageRequest(imageReque... | java | public Producer<CloseableReference<PooledByteBuffer>> getEncodedImageProducerSequence(
ImageRequest imageRequest) {
try {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("ProducerSequenceFactory#getEncodedImageProducerSequence");
}
validateEncodedImageRequest(imageReque... | [
"public",
"Producer",
"<",
"CloseableReference",
"<",
"PooledByteBuffer",
">",
">",
"getEncodedImageProducerSequence",
"(",
"ImageRequest",
"imageRequest",
")",
"{",
"try",
"{",
"if",
"(",
"FrescoSystrace",
".",
"isTracing",
"(",
")",
")",
"{",
"FrescoSystrace",
"... | Returns a sequence that can be used for a request for an encoded image from either network or
local files.
@param imageRequest the request that will be submitted
@return the sequence that should be used to process the request | [
"Returns",
"a",
"sequence",
"that",
"can",
"be",
"used",
"for",
"a",
"request",
"for",
"an",
"encoded",
"image",
"from",
"either",
"network",
"or",
"local",
"files",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java#L135-L160 |
14,412 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java | ProducerSequenceFactory.getNetworkFetchEncodedImageProducerSequence | public Producer<CloseableReference<PooledByteBuffer>>
getNetworkFetchEncodedImageProducerSequence() {
synchronized (this) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection(
"ProducerSequenceFactory#getNetworkFetchEncodedImageProducerSequence");
}
if (mNetworkEnc... | java | public Producer<CloseableReference<PooledByteBuffer>>
getNetworkFetchEncodedImageProducerSequence() {
synchronized (this) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection(
"ProducerSequenceFactory#getNetworkFetchEncodedImageProducerSequence");
}
if (mNetworkEnc... | [
"public",
"Producer",
"<",
"CloseableReference",
"<",
"PooledByteBuffer",
">",
">",
"getNetworkFetchEncodedImageProducerSequence",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"FrescoSystrace",
".",
"isTracing",
"(",
")",
")",
"{",
"FrescoSystr... | Returns a sequence that can be used for a request for an encoded image from network. | [
"Returns",
"a",
"sequence",
"that",
"can",
"be",
"used",
"for",
"a",
"request",
"for",
"an",
"encoded",
"image",
"from",
"network",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java#L165-L189 |
14,413 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java | ProducerSequenceFactory.getLocalFileFetchEncodedImageProducerSequence | public Producer<CloseableReference<PooledByteBuffer>>
getLocalFileFetchEncodedImageProducerSequence() {
synchronized (this) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection(
"ProducerSequenceFactory#getLocalFileFetchEncodedImageProducerSequence");
}
if (mLocalF... | java | public Producer<CloseableReference<PooledByteBuffer>>
getLocalFileFetchEncodedImageProducerSequence() {
synchronized (this) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection(
"ProducerSequenceFactory#getLocalFileFetchEncodedImageProducerSequence");
}
if (mLocalF... | [
"public",
"Producer",
"<",
"CloseableReference",
"<",
"PooledByteBuffer",
">",
">",
"getLocalFileFetchEncodedImageProducerSequence",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"FrescoSystrace",
".",
"isTracing",
"(",
")",
")",
"{",
"FrescoSys... | Returns a sequence that can be used for a request for an encoded image from a local file. | [
"Returns",
"a",
"sequence",
"that",
"can",
"be",
"used",
"for",
"a",
"request",
"for",
"an",
"encoded",
"image",
"from",
"a",
"local",
"file",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java#L194-L218 |
14,414 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java | ProducerSequenceFactory.getEncodedImagePrefetchProducerSequence | public Producer<Void> getEncodedImagePrefetchProducerSequence(ImageRequest imageRequest) {
validateEncodedImageRequest(imageRequest);
switch (imageRequest.getSourceUriType()) {
case SOURCE_TYPE_NETWORK:
return getNetworkFetchToEncodedMemoryPrefetchSequence();
case SOURCE_TYPE_LOCAL_VIDEO_FI... | java | public Producer<Void> getEncodedImagePrefetchProducerSequence(ImageRequest imageRequest) {
validateEncodedImageRequest(imageRequest);
switch (imageRequest.getSourceUriType()) {
case SOURCE_TYPE_NETWORK:
return getNetworkFetchToEncodedMemoryPrefetchSequence();
case SOURCE_TYPE_LOCAL_VIDEO_FI... | [
"public",
"Producer",
"<",
"Void",
">",
"getEncodedImagePrefetchProducerSequence",
"(",
"ImageRequest",
"imageRequest",
")",
"{",
"validateEncodedImageRequest",
"(",
"imageRequest",
")",
";",
"switch",
"(",
"imageRequest",
".",
"getSourceUriType",
"(",
")",
")",
"{",
... | Returns a sequence that can be used for a prefetch request for an encoded image.
<p>Guaranteed to return the same sequence as
{@code getEncodedImageProducerSequence(request)}, except that it is pre-pended with a
{@link SwallowResultProducer}.
@param imageRequest the request that will be submitted
@return the sequence ... | [
"Returns",
"a",
"sequence",
"that",
"can",
"be",
"used",
"for",
"a",
"prefetch",
"request",
"for",
"an",
"encoded",
"image",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java#L229-L244 |
14,415 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java | ProducerSequenceFactory.getDecodedImageProducerSequence | public Producer<CloseableReference<CloseableImage>> getDecodedImageProducerSequence(
ImageRequest imageRequest) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("ProducerSequenceFactory#getDecodedImageProducerSequence");
}
Producer<CloseableReference<CloseableImage>> pipelineSeque... | java | public Producer<CloseableReference<CloseableImage>> getDecodedImageProducerSequence(
ImageRequest imageRequest) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("ProducerSequenceFactory#getDecodedImageProducerSequence");
}
Producer<CloseableReference<CloseableImage>> pipelineSeque... | [
"public",
"Producer",
"<",
"CloseableReference",
"<",
"CloseableImage",
">",
">",
"getDecodedImageProducerSequence",
"(",
"ImageRequest",
"imageRequest",
")",
"{",
"if",
"(",
"FrescoSystrace",
".",
"isTracing",
"(",
")",
")",
"{",
"FrescoSystrace",
".",
"beginSectio... | Returns a sequence that can be used for a request for a decoded image.
@param imageRequest the request that will be submitted
@return the sequence that should be used to process the request | [
"Returns",
"a",
"sequence",
"that",
"can",
"be",
"used",
"for",
"a",
"request",
"for",
"a",
"decoded",
"image",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java#L259-L278 |
14,416 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java | ProducerSequenceFactory.getDecodedImagePrefetchProducerSequence | public Producer<Void> getDecodedImagePrefetchProducerSequence(
ImageRequest imageRequest) {
Producer<CloseableReference<CloseableImage>> inputProducer =
getBasicDecodedImageSequence(imageRequest);
if (mUseBitmapPrepareToDraw) {
inputProducer = getBitmapPrepareSequence(inputProducer);
}
... | java | public Producer<Void> getDecodedImagePrefetchProducerSequence(
ImageRequest imageRequest) {
Producer<CloseableReference<CloseableImage>> inputProducer =
getBasicDecodedImageSequence(imageRequest);
if (mUseBitmapPrepareToDraw) {
inputProducer = getBitmapPrepareSequence(inputProducer);
}
... | [
"public",
"Producer",
"<",
"Void",
">",
"getDecodedImagePrefetchProducerSequence",
"(",
"ImageRequest",
"imageRequest",
")",
"{",
"Producer",
"<",
"CloseableReference",
"<",
"CloseableImage",
">>",
"inputProducer",
"=",
"getBasicDecodedImageSequence",
"(",
"imageRequest",
... | Returns a sequence that can be used for a prefetch request for a decoded image.
@param imageRequest the request that will be submitted
@return the sequence that should be used to process the request | [
"Returns",
"a",
"sequence",
"that",
"can",
"be",
"used",
"for",
"a",
"prefetch",
"request",
"for",
"a",
"decoded",
"image",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java#L286-L296 |
14,417 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java | ProducerSequenceFactory.getLocalVideoFileFetchSequence | private synchronized Producer<CloseableReference<CloseableImage>>
getLocalVideoFileFetchSequence() {
if (mLocalVideoFileFetchSequence == null) {
LocalVideoThumbnailProducer localVideoThumbnailProducer =
mProducerFactory.newLocalVideoThumbnailProducer();
mLocalVideoFileFetchSequence =
... | java | private synchronized Producer<CloseableReference<CloseableImage>>
getLocalVideoFileFetchSequence() {
if (mLocalVideoFileFetchSequence == null) {
LocalVideoThumbnailProducer localVideoThumbnailProducer =
mProducerFactory.newLocalVideoThumbnailProducer();
mLocalVideoFileFetchSequence =
... | [
"private",
"synchronized",
"Producer",
"<",
"CloseableReference",
"<",
"CloseableImage",
">",
">",
"getLocalVideoFileFetchSequence",
"(",
")",
"{",
"if",
"(",
"mLocalVideoFileFetchSequence",
"==",
"null",
")",
"{",
"LocalVideoThumbnailProducer",
"localVideoThumbnailProducer... | Bitmap cache get -> thread hand off -> multiplex -> bitmap cache ->
local video thumbnail | [
"Bitmap",
"cache",
"get",
"-",
">",
"thread",
"hand",
"off",
"-",
">",
"multiplex",
"-",
">",
"bitmap",
"cache",
"-",
">",
"local",
"video",
"thumbnail"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java#L535-L544 |
14,418 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java | ProducerSequenceFactory.newBitmapCacheGetToBitmapCacheSequence | private Producer<CloseableReference<CloseableImage>> newBitmapCacheGetToBitmapCacheSequence(
Producer<CloseableReference<CloseableImage>> inputProducer) {
BitmapMemoryCacheProducer bitmapMemoryCacheProducer =
mProducerFactory.newBitmapMemoryCacheProducer(inputProducer);
BitmapMemoryCacheKeyMultipl... | java | private Producer<CloseableReference<CloseableImage>> newBitmapCacheGetToBitmapCacheSequence(
Producer<CloseableReference<CloseableImage>> inputProducer) {
BitmapMemoryCacheProducer bitmapMemoryCacheProducer =
mProducerFactory.newBitmapMemoryCacheProducer(inputProducer);
BitmapMemoryCacheKeyMultipl... | [
"private",
"Producer",
"<",
"CloseableReference",
"<",
"CloseableImage",
">",
">",
"newBitmapCacheGetToBitmapCacheSequence",
"(",
"Producer",
"<",
"CloseableReference",
"<",
"CloseableImage",
">",
">",
"inputProducer",
")",
"{",
"BitmapMemoryCacheProducer",
"bitmapMemoryCac... | Bitmap cache get -> thread hand off -> multiplex -> bitmap cache
@param inputProducer producer providing the input to the bitmap cache
@return bitmap cache get to bitmap cache sequence | [
"Bitmap",
"cache",
"get",
"-",
">",
"thread",
"hand",
"off",
"-",
">",
"multiplex",
"-",
">",
"bitmap",
"cache"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java#L740-L751 |
14,419 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java | ProducerSequenceFactory.newLocalTransformationsSequence | private Producer<EncodedImage> newLocalTransformationsSequence(
Producer<EncodedImage> inputProducer,
ThumbnailProducer<EncodedImage>[] thumbnailProducers) {
Producer<EncodedImage> localImageProducer =
ProducerFactory.newAddImageTransformMetaDataProducer(inputProducer);
localImageProducer =
... | java | private Producer<EncodedImage> newLocalTransformationsSequence(
Producer<EncodedImage> inputProducer,
ThumbnailProducer<EncodedImage>[] thumbnailProducers) {
Producer<EncodedImage> localImageProducer =
ProducerFactory.newAddImageTransformMetaDataProducer(inputProducer);
localImageProducer =
... | [
"private",
"Producer",
"<",
"EncodedImage",
">",
"newLocalTransformationsSequence",
"(",
"Producer",
"<",
"EncodedImage",
">",
"inputProducer",
",",
"ThumbnailProducer",
"<",
"EncodedImage",
">",
"[",
"]",
"thumbnailProducers",
")",
"{",
"Producer",
"<",
"EncodedImage... | Branch on separate images
-> thumbnail resize and rotate -> thumbnail producers as provided
-> local image resize and rotate -> add meta data producer
@param inputProducer producer providing the input to add meta data producer
@param thumbnailProducers the thumbnail producers from which to request the image before
fall... | [
"Branch",
"on",
"separate",
"images",
"-",
">",
"thumbnail",
"resize",
"and",
"rotate",
"-",
">",
"thumbnail",
"producers",
"as",
"provided",
"-",
">",
"local",
"image",
"resize",
"and",
"rotate",
"-",
">",
"add",
"meta",
"data",
"producer"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java#L762-L776 |
14,420 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java | ProducerSequenceFactory.getPostprocessorSequence | private synchronized Producer<CloseableReference<CloseableImage>> getPostprocessorSequence(
Producer<CloseableReference<CloseableImage>> inputProducer) {
if (!mPostprocessorSequences.containsKey(inputProducer)) {
PostprocessorProducer postprocessorProducer =
mProducerFactory.newPostprocessorPr... | java | private synchronized Producer<CloseableReference<CloseableImage>> getPostprocessorSequence(
Producer<CloseableReference<CloseableImage>> inputProducer) {
if (!mPostprocessorSequences.containsKey(inputProducer)) {
PostprocessorProducer postprocessorProducer =
mProducerFactory.newPostprocessorPr... | [
"private",
"synchronized",
"Producer",
"<",
"CloseableReference",
"<",
"CloseableImage",
">",
">",
"getPostprocessorSequence",
"(",
"Producer",
"<",
"CloseableReference",
"<",
"CloseableImage",
">",
">",
"inputProducer",
")",
"{",
"if",
"(",
"!",
"mPostprocessorSequen... | post-processor producer -> copy producer -> inputProducer | [
"post",
"-",
"processor",
"producer",
"-",
">",
"copy",
"producer",
"-",
">",
"inputProducer"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java#L789-L799 |
14,421 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java | ProducerSequenceFactory.getDecodedImagePrefetchSequence | private synchronized Producer<Void> getDecodedImagePrefetchSequence(
Producer<CloseableReference<CloseableImage>> inputProducer) {
if (!mCloseableImagePrefetchSequences.containsKey(inputProducer)) {
SwallowResultProducer<CloseableReference<CloseableImage>> swallowResultProducer =
mProducerFact... | java | private synchronized Producer<Void> getDecodedImagePrefetchSequence(
Producer<CloseableReference<CloseableImage>> inputProducer) {
if (!mCloseableImagePrefetchSequences.containsKey(inputProducer)) {
SwallowResultProducer<CloseableReference<CloseableImage>> swallowResultProducer =
mProducerFact... | [
"private",
"synchronized",
"Producer",
"<",
"Void",
">",
"getDecodedImagePrefetchSequence",
"(",
"Producer",
"<",
"CloseableReference",
"<",
"CloseableImage",
">",
">",
"inputProducer",
")",
"{",
"if",
"(",
"!",
"mCloseableImagePrefetchSequences",
".",
"containsKey",
... | swallow result producer -> inputProducer | [
"swallow",
"result",
"producer",
"-",
">",
"inputProducer"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java#L804-L812 |
14,422 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java | ProducerSequenceFactory.getBitmapPrepareSequence | private synchronized Producer<CloseableReference<CloseableImage>> getBitmapPrepareSequence(
Producer<CloseableReference<CloseableImage>> inputProducer) {
Producer<CloseableReference<CloseableImage>> bitmapPrepareProducer =
mBitmapPrepareSequences.get(inputProducer);
if (bitmapPrepareProducer == n... | java | private synchronized Producer<CloseableReference<CloseableImage>> getBitmapPrepareSequence(
Producer<CloseableReference<CloseableImage>> inputProducer) {
Producer<CloseableReference<CloseableImage>> bitmapPrepareProducer =
mBitmapPrepareSequences.get(inputProducer);
if (bitmapPrepareProducer == n... | [
"private",
"synchronized",
"Producer",
"<",
"CloseableReference",
"<",
"CloseableImage",
">",
">",
"getBitmapPrepareSequence",
"(",
"Producer",
"<",
"CloseableReference",
"<",
"CloseableImage",
">",
">",
"inputProducer",
")",
"{",
"Producer",
"<",
"CloseableReference",
... | bitmap prepare producer -> inputProducer | [
"bitmap",
"prepare",
"producer",
"-",
">",
"inputProducer"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ProducerSequenceFactory.java#L817-L828 |
14,423 | facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imageformat/ImageFormatChecker.java | ImageFormatChecker.readHeaderFromStream | private static int readHeaderFromStream(
int maxHeaderLength,
final InputStream is,
final byte[] imageHeaderBytes)
throws IOException {
Preconditions.checkNotNull(is);
Preconditions.checkNotNull(imageHeaderBytes);
Preconditions.checkArgument(imageHeaderBytes.length >= maxHeaderLength... | java | private static int readHeaderFromStream(
int maxHeaderLength,
final InputStream is,
final byte[] imageHeaderBytes)
throws IOException {
Preconditions.checkNotNull(is);
Preconditions.checkNotNull(imageHeaderBytes);
Preconditions.checkArgument(imageHeaderBytes.length >= maxHeaderLength... | [
"private",
"static",
"int",
"readHeaderFromStream",
"(",
"int",
"maxHeaderLength",
",",
"final",
"InputStream",
"is",
",",
"final",
"byte",
"[",
"]",
"imageHeaderBytes",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"is",
")",
";"... | Reads up to maxHeaderLength bytes from is InputStream. If mark is supported by is, it is
used to restore content of the stream after appropriate amount of data is read.
Read bytes are stored in imageHeaderBytes, which should be capable of storing
maxHeaderLength bytes.
@param maxHeaderLength the maximum header length
@... | [
"Reads",
"up",
"to",
"maxHeaderLength",
"bytes",
"from",
"is",
"InputStream",
".",
"If",
"mark",
"is",
"supported",
"by",
"is",
"it",
"is",
"used",
"to",
"restore",
"content",
"of",
"the",
"stream",
"after",
"appropriate",
"amount",
"of",
"data",
"is",
"re... | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageformat/ImageFormatChecker.java#L85-L106 |
14,424 | facebook/fresco | samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java | DefaultZoomableController.reset | public void reset() {
FLog.v(TAG, "reset");
mGestureDetector.reset();
mPreviousTransform.reset();
mActiveTransform.reset();
onTransformChanged();
} | java | public void reset() {
FLog.v(TAG, "reset");
mGestureDetector.reset();
mPreviousTransform.reset();
mActiveTransform.reset();
onTransformChanged();
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"FLog",
".",
"v",
"(",
"TAG",
",",
"\"reset\"",
")",
";",
"mGestureDetector",
".",
"reset",
"(",
")",
";",
"mPreviousTransform",
".",
"reset",
"(",
")",
";",
"mActiveTransform",
".",
"reset",
"(",
")",
";",
"... | Rests the controller. | [
"Rests",
"the",
"controller",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java#L98-L104 |
14,425 | facebook/fresco | samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java | DefaultZoomableController.setImageBounds | @Override
public void setImageBounds(RectF imageBounds) {
if (!imageBounds.equals(mImageBounds)) {
mImageBounds.set(imageBounds);
onTransformChanged();
if (mImageBoundsListener != null) {
mImageBoundsListener.onImageBoundsSet(mImageBounds);
}
}
} | java | @Override
public void setImageBounds(RectF imageBounds) {
if (!imageBounds.equals(mImageBounds)) {
mImageBounds.set(imageBounds);
onTransformChanged();
if (mImageBoundsListener != null) {
mImageBoundsListener.onImageBoundsSet(mImageBounds);
}
}
} | [
"@",
"Override",
"public",
"void",
"setImageBounds",
"(",
"RectF",
"imageBounds",
")",
"{",
"if",
"(",
"!",
"imageBounds",
".",
"equals",
"(",
"mImageBounds",
")",
")",
"{",
"mImageBounds",
".",
"set",
"(",
"imageBounds",
")",
";",
"onTransformChanged",
"(",... | Sets the image bounds, in view-absolute coordinates. | [
"Sets",
"the",
"image",
"bounds",
"in",
"view",
"-",
"absolute",
"coordinates",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java#L200-L209 |
14,426 | facebook/fresco | samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java | DefaultZoomableController.getImageRelativeToViewAbsoluteTransform | public void getImageRelativeToViewAbsoluteTransform(Matrix outMatrix) {
outMatrix.setRectToRect(IDENTITY_RECT, mTransformedImageBounds, Matrix.ScaleToFit.FILL);
} | java | public void getImageRelativeToViewAbsoluteTransform(Matrix outMatrix) {
outMatrix.setRectToRect(IDENTITY_RECT, mTransformedImageBounds, Matrix.ScaleToFit.FILL);
} | [
"public",
"void",
"getImageRelativeToViewAbsoluteTransform",
"(",
"Matrix",
"outMatrix",
")",
"{",
"outMatrix",
".",
"setRectToRect",
"(",
"IDENTITY_RECT",
",",
"mTransformedImageBounds",
",",
"Matrix",
".",
"ScaleToFit",
".",
"FILL",
")",
";",
"}"
] | Gets the matrix that transforms image-relative coordinates to view-absolute coordinates.
The zoomable transformation is taken into account. | [
"Gets",
"the",
"matrix",
"that",
"transforms",
"image",
"-",
"relative",
"coordinates",
"to",
"view",
"-",
"absolute",
"coordinates",
".",
"The",
"zoomable",
"transformation",
"is",
"taken",
"into",
"account",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java#L276-L278 |
14,427 | facebook/fresco | samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java | DefaultZoomableController.mapViewToImage | public PointF mapViewToImage(PointF viewPoint) {
float[] points = mTempValues;
points[0] = viewPoint.x;
points[1] = viewPoint.y;
mActiveTransform.invert(mActiveTransformInverse);
mActiveTransformInverse.mapPoints(points, 0, points, 0, 1);
mapAbsoluteToRelative(points, points, 1);
return new ... | java | public PointF mapViewToImage(PointF viewPoint) {
float[] points = mTempValues;
points[0] = viewPoint.x;
points[1] = viewPoint.y;
mActiveTransform.invert(mActiveTransformInverse);
mActiveTransformInverse.mapPoints(points, 0, points, 0, 1);
mapAbsoluteToRelative(points, points, 1);
return new ... | [
"public",
"PointF",
"mapViewToImage",
"(",
"PointF",
"viewPoint",
")",
"{",
"float",
"[",
"]",
"points",
"=",
"mTempValues",
";",
"points",
"[",
"0",
"]",
"=",
"viewPoint",
".",
"x",
";",
"points",
"[",
"1",
"]",
"=",
"viewPoint",
".",
"y",
";",
"mAc... | Maps point from view-absolute to image-relative coordinates.
This takes into account the zoomable transformation. | [
"Maps",
"point",
"from",
"view",
"-",
"absolute",
"to",
"image",
"-",
"relative",
"coordinates",
".",
"This",
"takes",
"into",
"account",
"the",
"zoomable",
"transformation",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java#L284-L292 |
14,428 | facebook/fresco | samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java | DefaultZoomableController.mapImageToView | public PointF mapImageToView(PointF imagePoint) {
float[] points = mTempValues;
points[0] = imagePoint.x;
points[1] = imagePoint.y;
mapRelativeToAbsolute(points, points, 1);
mActiveTransform.mapPoints(points, 0, points, 0, 1);
return new PointF(points[0], points[1]);
} | java | public PointF mapImageToView(PointF imagePoint) {
float[] points = mTempValues;
points[0] = imagePoint.x;
points[1] = imagePoint.y;
mapRelativeToAbsolute(points, points, 1);
mActiveTransform.mapPoints(points, 0, points, 0, 1);
return new PointF(points[0], points[1]);
} | [
"public",
"PointF",
"mapImageToView",
"(",
"PointF",
"imagePoint",
")",
"{",
"float",
"[",
"]",
"points",
"=",
"mTempValues",
";",
"points",
"[",
"0",
"]",
"=",
"imagePoint",
".",
"x",
";",
"points",
"[",
"1",
"]",
"=",
"imagePoint",
".",
"y",
";",
"... | Maps point from image-relative to view-absolute coordinates.
This takes into account the zoomable transformation. | [
"Maps",
"point",
"from",
"image",
"-",
"relative",
"to",
"view",
"-",
"absolute",
"coordinates",
".",
"This",
"takes",
"into",
"account",
"the",
"zoomable",
"transformation",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java#L298-L305 |
14,429 | facebook/fresco | samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java | DefaultZoomableController.setTransform | public void setTransform(Matrix newTransform) {
FLog.v(TAG, "setTransform");
mActiveTransform.set(newTransform);
onTransformChanged();
} | java | public void setTransform(Matrix newTransform) {
FLog.v(TAG, "setTransform");
mActiveTransform.set(newTransform);
onTransformChanged();
} | [
"public",
"void",
"setTransform",
"(",
"Matrix",
"newTransform",
")",
"{",
"FLog",
".",
"v",
"(",
"TAG",
",",
"\"setTransform\"",
")",
";",
"mActiveTransform",
".",
"set",
"(",
"newTransform",
")",
";",
"onTransformChanged",
"(",
")",
";",
"}"
] | Sets a new zoom transformation. | [
"Sets",
"a",
"new",
"zoom",
"transformation",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java#L385-L389 |
14,430 | facebook/fresco | samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java | DefaultZoomableController.onTouchEvent | @Override
public boolean onTouchEvent(MotionEvent event) {
FLog.v(TAG, "onTouchEvent: action: ", event.getAction());
if (mIsEnabled && mIsGestureZoomEnabled) {
return mGestureDetector.onTouchEvent(event);
}
return false;
} | java | @Override
public boolean onTouchEvent(MotionEvent event) {
FLog.v(TAG, "onTouchEvent: action: ", event.getAction());
if (mIsEnabled && mIsGestureZoomEnabled) {
return mGestureDetector.onTouchEvent(event);
}
return false;
} | [
"@",
"Override",
"public",
"boolean",
"onTouchEvent",
"(",
"MotionEvent",
"event",
")",
"{",
"FLog",
".",
"v",
"(",
"TAG",
",",
"\"onTouchEvent: action: \"",
",",
"event",
".",
"getAction",
"(",
")",
")",
";",
"if",
"(",
"mIsEnabled",
"&&",
"mIsGestureZoomEn... | Notifies controller of the received touch event. | [
"Notifies",
"controller",
"of",
"the",
"received",
"touch",
"event",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java#L397-L404 |
14,431 | facebook/fresco | samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java | DefaultZoomableController.limit | private float limit(float value, float min, float max) {
return Math.min(Math.max(min, value), max);
} | java | private float limit(float value, float min, float max) {
return Math.min(Math.max(min, value), max);
} | [
"private",
"float",
"limit",
"(",
"float",
"value",
",",
"float",
"min",
",",
"float",
"max",
")",
"{",
"return",
"Math",
".",
"min",
"(",
"Math",
".",
"max",
"(",
"min",
",",
"value",
")",
",",
"max",
")",
";",
"}"
] | Limits the value to the given min and max range. | [
"Limits",
"the",
"value",
"to",
"the",
"given",
"min",
"and",
"max",
"range",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java#L593-L595 |
14,432 | facebook/fresco | samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java | DefaultZoomableController.canScrollInAllDirection | private boolean canScrollInAllDirection() {
return mTransformedImageBounds.left < mViewBounds.left - EPS &&
mTransformedImageBounds.top < mViewBounds.top - EPS &&
mTransformedImageBounds.right > mViewBounds.right + EPS &&
mTransformedImageBounds.bottom > mViewBounds.bottom + EPS;
} | java | private boolean canScrollInAllDirection() {
return mTransformedImageBounds.left < mViewBounds.left - EPS &&
mTransformedImageBounds.top < mViewBounds.top - EPS &&
mTransformedImageBounds.right > mViewBounds.right + EPS &&
mTransformedImageBounds.bottom > mViewBounds.bottom + EPS;
} | [
"private",
"boolean",
"canScrollInAllDirection",
"(",
")",
"{",
"return",
"mTransformedImageBounds",
".",
"left",
"<",
"mViewBounds",
".",
"left",
"-",
"EPS",
"&&",
"mTransformedImageBounds",
".",
"top",
"<",
"mViewBounds",
".",
"top",
"-",
"EPS",
"&&",
"mTransf... | Returns whether the scroll can happen in all directions. I.e. the image is not on any edge. | [
"Returns",
"whether",
"the",
"scroll",
"can",
"happen",
"in",
"all",
"directions",
".",
"I",
".",
"e",
".",
"the",
"image",
"is",
"not",
"on",
"any",
"edge",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java#L633-L638 |
14,433 | facebook/fresco | samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/util/DraweeUtil.java | DraweeUtil.createDraweeHierarchy | public static GenericDraweeHierarchy createDraweeHierarchy(
final Context context,
final Config config) {
FrescoSystrace.beginSection("DraweeUtil#createDraweeHierarchy");
GenericDraweeHierarchyBuilder builder =
new GenericDraweeHierarchyBuilder(context.getResources())
... | java | public static GenericDraweeHierarchy createDraweeHierarchy(
final Context context,
final Config config) {
FrescoSystrace.beginSection("DraweeUtil#createDraweeHierarchy");
GenericDraweeHierarchyBuilder builder =
new GenericDraweeHierarchyBuilder(context.getResources())
... | [
"public",
"static",
"GenericDraweeHierarchy",
"createDraweeHierarchy",
"(",
"final",
"Context",
"context",
",",
"final",
"Config",
"config",
")",
"{",
"FrescoSystrace",
".",
"beginSection",
"(",
"\"DraweeUtil#createDraweeHierarchy\"",
")",
";",
"GenericDraweeHierarchyBuilde... | Creates the Hierarchy using the information into the Config
@param context The Context
@param config The Config object
@return The Hierarchy to use | [
"Creates",
"the",
"Hierarchy",
"using",
"the",
"information",
"into",
"the",
"Config"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/util/DraweeUtil.java#L38-L71 |
14,434 | facebook/fresco | samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/util/DraweeUtil.java | DraweeUtil.setBgColor | public static void setBgColor(View view, final Config config) {
int[] colors = view.getContext().getResources().getIntArray(R.array.bg_colors);
final int bgColor = colors[config.bgColor];
view.setBackgroundColor(bgColor);
} | java | public static void setBgColor(View view, final Config config) {
int[] colors = view.getContext().getResources().getIntArray(R.array.bg_colors);
final int bgColor = colors[config.bgColor];
view.setBackgroundColor(bgColor);
} | [
"public",
"static",
"void",
"setBgColor",
"(",
"View",
"view",
",",
"final",
"Config",
"config",
")",
"{",
"int",
"[",
"]",
"colors",
"=",
"view",
".",
"getContext",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getIntArray",
"(",
"R",
".",
"array",
... | Utility method which set the bgColor based on configuration values
@param view The View to change the bgColor to
@param config The Config object | [
"Utility",
"method",
"which",
"set",
"the",
"bgColor",
"based",
"on",
"configuration",
"values"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/util/DraweeUtil.java#L107-L111 |
14,435 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/cache/StagingArea.java | StagingArea.put | public synchronized void put(final CacheKey key, final EncodedImage encodedImage) {
Preconditions.checkNotNull(key);
Preconditions.checkArgument(EncodedImage.isValid(encodedImage));
// we're making a 'copy' of this reference - so duplicate it
final EncodedImage oldEntry = mMap.put(key, EncodedImage.clo... | java | public synchronized void put(final CacheKey key, final EncodedImage encodedImage) {
Preconditions.checkNotNull(key);
Preconditions.checkArgument(EncodedImage.isValid(encodedImage));
// we're making a 'copy' of this reference - so duplicate it
final EncodedImage oldEntry = mMap.put(key, EncodedImage.clo... | [
"public",
"synchronized",
"void",
"put",
"(",
"final",
"CacheKey",
"key",
",",
"final",
"EncodedImage",
"encodedImage",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"key",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"EncodedImage",
".",
"isVali... | Stores key-value in this StagingArea. This call overrides previous value
of stored reference if
@param key
@param encodedImage EncodedImage to be associated with key | [
"Stores",
"key",
"-",
"value",
"in",
"this",
"StagingArea",
".",
"This",
"call",
"overrides",
"previous",
"value",
"of",
"stored",
"reference",
"if"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/cache/StagingArea.java#L48-L56 |
14,436 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/cache/StagingArea.java | StagingArea.clearAll | public void clearAll() {
final List<EncodedImage> old;
synchronized (this) {
old = new ArrayList<>(mMap.values());
mMap.clear();
}
for (int i = 0; i < old.size(); i++) {
EncodedImage encodedImage = old.get(i);
if (encodedImage != null) {
encodedImage.close();
}
... | java | public void clearAll() {
final List<EncodedImage> old;
synchronized (this) {
old = new ArrayList<>(mMap.values());
mMap.clear();
}
for (int i = 0; i < old.size(); i++) {
EncodedImage encodedImage = old.get(i);
if (encodedImage != null) {
encodedImage.close();
}
... | [
"public",
"void",
"clearAll",
"(",
")",
"{",
"final",
"List",
"<",
"EncodedImage",
">",
"old",
";",
"synchronized",
"(",
"this",
")",
"{",
"old",
"=",
"new",
"ArrayList",
"<>",
"(",
"mMap",
".",
"values",
"(",
")",
")",
";",
"mMap",
".",
"clear",
"... | Removes all items from the StagingArea. | [
"Removes",
"all",
"items",
"from",
"the",
"StagingArea",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/cache/StagingArea.java#L61-L73 |
14,437 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/cache/StagingArea.java | StagingArea.remove | public boolean remove(final CacheKey key) {
Preconditions.checkNotNull(key);
final EncodedImage encodedImage;
synchronized (this) {
encodedImage = mMap.remove(key);
}
if (encodedImage == null) {
return false;
}
try {
return encodedImage.isValid();
} finally {
enco... | java | public boolean remove(final CacheKey key) {
Preconditions.checkNotNull(key);
final EncodedImage encodedImage;
synchronized (this) {
encodedImage = mMap.remove(key);
}
if (encodedImage == null) {
return false;
}
try {
return encodedImage.isValid();
} finally {
enco... | [
"public",
"boolean",
"remove",
"(",
"final",
"CacheKey",
"key",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"key",
")",
";",
"final",
"EncodedImage",
"encodedImage",
";",
"synchronized",
"(",
"this",
")",
"{",
"encodedImage",
"=",
"mMap",
".",
"remo... | Removes item from the StagingArea.
@param key
@return true if item was removed | [
"Removes",
"item",
"from",
"the",
"StagingArea",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/cache/StagingArea.java#L80-L94 |
14,438 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/cache/StagingArea.java | StagingArea.remove | public synchronized boolean remove(final CacheKey key, final EncodedImage encodedImage) {
Preconditions.checkNotNull(key);
Preconditions.checkNotNull(encodedImage);
Preconditions.checkArgument(EncodedImage.isValid(encodedImage));
final EncodedImage oldValue = mMap.get(key);
if (oldValue == null) {... | java | public synchronized boolean remove(final CacheKey key, final EncodedImage encodedImage) {
Preconditions.checkNotNull(key);
Preconditions.checkNotNull(encodedImage);
Preconditions.checkArgument(EncodedImage.isValid(encodedImage));
final EncodedImage oldValue = mMap.get(key);
if (oldValue == null) {... | [
"public",
"synchronized",
"boolean",
"remove",
"(",
"final",
"CacheKey",
"key",
",",
"final",
"EncodedImage",
"encodedImage",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"key",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"encodedImage",
")",
";... | Removes key-value from the StagingArea. Both key and value must match.
@param key
@param encodedImage value corresponding to key
@return true if item was removed | [
"Removes",
"key",
"-",
"value",
"from",
"the",
"StagingArea",
".",
"Both",
"key",
"and",
"value",
"must",
"match",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/cache/StagingArea.java#L102-L128 |
14,439 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/cache/StagingArea.java | StagingArea.containsKey | public synchronized boolean containsKey(CacheKey key) {
Preconditions.checkNotNull(key);
if (!mMap.containsKey(key)) {
return false;
}
EncodedImage storedEncodedImage = mMap.get(key);
synchronized (storedEncodedImage) {
if (!EncodedImage.isValid(storedEncodedImage)) {
// Referenc... | java | public synchronized boolean containsKey(CacheKey key) {
Preconditions.checkNotNull(key);
if (!mMap.containsKey(key)) {
return false;
}
EncodedImage storedEncodedImage = mMap.get(key);
synchronized (storedEncodedImage) {
if (!EncodedImage.isValid(storedEncodedImage)) {
// Referenc... | [
"public",
"synchronized",
"boolean",
"containsKey",
"(",
"CacheKey",
"key",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"key",
")",
";",
"if",
"(",
"!",
"mMap",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"return",
"false",
";",
"}",
"Encoded... | Determine if an valid entry for the key exists in the staging area. | [
"Determine",
"if",
"an",
"valid",
"entry",
"for",
"the",
"key",
"exists",
"in",
"the",
"staging",
"area",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/cache/StagingArea.java#L161-L183 |
14,440 | facebook/fresco | samples/comparison/src/main/java/com/facebook/samples/comparison/urlsfetcher/ImageUrlsRequestBuilder.java | ImageUrlsRequestBuilder.addImageFormat | public ImageUrlsRequestBuilder addImageFormat(ImageFormat imageFormat, ImageSize imageSize) {
mRequestedImageFormats.put(imageFormat, imageSize);
return this;
} | java | public ImageUrlsRequestBuilder addImageFormat(ImageFormat imageFormat, ImageSize imageSize) {
mRequestedImageFormats.put(imageFormat, imageSize);
return this;
} | [
"public",
"ImageUrlsRequestBuilder",
"addImageFormat",
"(",
"ImageFormat",
"imageFormat",
",",
"ImageSize",
"imageSize",
")",
"{",
"mRequestedImageFormats",
".",
"put",
"(",
"imageFormat",
",",
"imageSize",
")",
";",
"return",
"this",
";",
"}"
] | Adds imageFormat to the set of image formats you want to download. imageSize specify
server-side resize options. | [
"Adds",
"imageFormat",
"to",
"the",
"set",
"of",
"image",
"formats",
"you",
"want",
"to",
"download",
".",
"imageSize",
"specify",
"server",
"-",
"side",
"resize",
"options",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/comparison/src/main/java/com/facebook/samples/comparison/urlsfetcher/ImageUrlsRequestBuilder.java#L37-L40 |
14,441 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalFetchProducer.java | LocalFetchProducer.getByteBufferBackedEncodedImage | protected EncodedImage getByteBufferBackedEncodedImage(
InputStream inputStream,
int length) throws IOException {
CloseableReference<PooledByteBuffer> ref = null;
try {
if (length <= 0) {
ref = CloseableReference.of(mPooledByteBufferFactory.newByteBuffer(inputStream));
} else {
... | java | protected EncodedImage getByteBufferBackedEncodedImage(
InputStream inputStream,
int length) throws IOException {
CloseableReference<PooledByteBuffer> ref = null;
try {
if (length <= 0) {
ref = CloseableReference.of(mPooledByteBufferFactory.newByteBuffer(inputStream));
} else {
... | [
"protected",
"EncodedImage",
"getByteBufferBackedEncodedImage",
"(",
"InputStream",
"inputStream",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"CloseableReference",
"<",
"PooledByteBuffer",
">",
"ref",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"length",
... | Creates a memory-backed encoded image from the stream. The stream is closed. | [
"Creates",
"a",
"memory",
"-",
"backed",
"encoded",
"image",
"from",
"the",
"stream",
".",
"The",
"stream",
"is",
"closed",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalFetchProducer.java#L77-L92 |
14,442 | facebook/fresco | animated-base/src/main/java/com/facebook/imagepipeline/animated/base/AnimatedImageResult.java | AnimatedImageResult.dispose | public synchronized void dispose() {
CloseableReference.closeSafely(mPreviewBitmap);
mPreviewBitmap = null;
CloseableReference.closeSafely(mDecodedFrames);
mDecodedFrames = null;
} | java | public synchronized void dispose() {
CloseableReference.closeSafely(mPreviewBitmap);
mPreviewBitmap = null;
CloseableReference.closeSafely(mDecodedFrames);
mDecodedFrames = null;
} | [
"public",
"synchronized",
"void",
"dispose",
"(",
")",
"{",
"CloseableReference",
".",
"closeSafely",
"(",
"mPreviewBitmap",
")",
";",
"mPreviewBitmap",
"=",
"null",
";",
"CloseableReference",
".",
"closeSafely",
"(",
"mDecodedFrames",
")",
";",
"mDecodedFrames",
... | Disposes the result, which releases the reference to any bitmaps. | [
"Disposes",
"the",
"result",
"which",
"releases",
"the",
"reference",
"to",
"any",
"bitmaps",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/animated-base/src/main/java/com/facebook/imagepipeline/animated/base/AnimatedImageResult.java#L118-L123 |
14,443 | facebook/fresco | fbcore/src/main/java/com/facebook/common/internal/ImmutableMap.java | ImmutableMap.copyOf | public static <K, V> ImmutableMap<K, V> copyOf(Map<? extends K, ? extends V> map) {
return new ImmutableMap<>(map);
} | java | public static <K, V> ImmutableMap<K, V> copyOf(Map<? extends K, ? extends V> map) {
return new ImmutableMap<>(map);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"ImmutableMap",
"<",
"K",
",",
"V",
">",
"copyOf",
"(",
"Map",
"<",
"?",
"extends",
"K",
",",
"?",
"extends",
"V",
">",
"map",
")",
"{",
"return",
"new",
"ImmutableMap",
"<>",
"(",
"map",
")",
";",
"... | Dummy method at the moment to help us enforce types. | [
"Dummy",
"method",
"at",
"the",
"moment",
"to",
"help",
"us",
"enforce",
"types",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/internal/ImmutableMap.java#L88-L90 |
14,444 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalExifThumbnailProducer.java | LocalExifThumbnailProducer.getRotationAngle | private int getRotationAngle(final ExifInterface exifInterface) {
return JfifUtil.getAutoRotateAngleFromOrientation(
Integer.parseInt(exifInterface.getAttribute(ExifInterface.TAG_ORIENTATION)));
} | java | private int getRotationAngle(final ExifInterface exifInterface) {
return JfifUtil.getAutoRotateAngleFromOrientation(
Integer.parseInt(exifInterface.getAttribute(ExifInterface.TAG_ORIENTATION)));
} | [
"private",
"int",
"getRotationAngle",
"(",
"final",
"ExifInterface",
"exifInterface",
")",
"{",
"return",
"JfifUtil",
".",
"getAutoRotateAngleFromOrientation",
"(",
"Integer",
".",
"parseInt",
"(",
"exifInterface",
".",
"getAttribute",
"(",
"ExifInterface",
".",
"TAG_... | Gets the correction angle based on the image's orientation | [
"Gets",
"the",
"correction",
"angle",
"based",
"on",
"the",
"image",
"s",
"orientation"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalExifThumbnailProducer.java#L162-L165 |
14,445 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/drawable/DrawableUtils.java | DrawableUtils.multiplyColorAlpha | public static int multiplyColorAlpha(int color, int alpha) {
if (alpha == 255) {
return color;
}
if (alpha == 0) {
return color & 0x00FFFFFF;
}
alpha = alpha + (alpha >> 7); // make it 0..256
int colorAlpha = color >>> 24;
int multipliedAlpha = colorAlpha * alpha >> 8;
return... | java | public static int multiplyColorAlpha(int color, int alpha) {
if (alpha == 255) {
return color;
}
if (alpha == 0) {
return color & 0x00FFFFFF;
}
alpha = alpha + (alpha >> 7); // make it 0..256
int colorAlpha = color >>> 24;
int multipliedAlpha = colorAlpha * alpha >> 8;
return... | [
"public",
"static",
"int",
"multiplyColorAlpha",
"(",
"int",
"color",
",",
"int",
"alpha",
")",
"{",
"if",
"(",
"alpha",
"==",
"255",
")",
"{",
"return",
"color",
";",
"}",
"if",
"(",
"alpha",
"==",
"0",
")",
"{",
"return",
"color",
"&",
"0x00FFFFFF"... | Multiplies the color with the given alpha.
@param color color to be multiplied
@param alpha value between 0 and 255
@return multiplied color | [
"Multiplies",
"the",
"color",
"with",
"the",
"given",
"alpha",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/DrawableUtils.java#L90-L101 |
14,446 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/drawable/DrawableUtils.java | DrawableUtils.getOpacityFromColor | public static int getOpacityFromColor(int color) {
int colorAlpha = color >>> 24;
if (colorAlpha == 255) {
return PixelFormat.OPAQUE;
} else if (colorAlpha == 0) {
return PixelFormat.TRANSPARENT;
} else {
return PixelFormat.TRANSLUCENT;
}
} | java | public static int getOpacityFromColor(int color) {
int colorAlpha = color >>> 24;
if (colorAlpha == 255) {
return PixelFormat.OPAQUE;
} else if (colorAlpha == 0) {
return PixelFormat.TRANSPARENT;
} else {
return PixelFormat.TRANSLUCENT;
}
} | [
"public",
"static",
"int",
"getOpacityFromColor",
"(",
"int",
"color",
")",
"{",
"int",
"colorAlpha",
"=",
"color",
">>>",
"24",
";",
"if",
"(",
"colorAlpha",
"==",
"255",
")",
"{",
"return",
"PixelFormat",
".",
"OPAQUE",
";",
"}",
"else",
"if",
"(",
"... | Gets the opacity from a color. Inspired by Android ColorDrawable.
@param color
@return opacity expressed by one of PixelFormat constants | [
"Gets",
"the",
"opacity",
"from",
"a",
"color",
".",
"Inspired",
"by",
"Android",
"ColorDrawable",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/DrawableUtils.java#L108-L117 |
14,447 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/platform/PlatformDecoderFactory.java | PlatformDecoderFactory.buildPlatformDecoder | public static PlatformDecoder buildPlatformDecoder(
PoolFactory poolFactory, boolean gingerbreadDecoderEnabled) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
int maxNumThreads = poolFactory.getFlexByteArrayPoolMaxNumThreads();
return new OreoDecoder(
poolFactory.getBitmapPool()... | java | public static PlatformDecoder buildPlatformDecoder(
PoolFactory poolFactory, boolean gingerbreadDecoderEnabled) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
int maxNumThreads = poolFactory.getFlexByteArrayPoolMaxNumThreads();
return new OreoDecoder(
poolFactory.getBitmapPool()... | [
"public",
"static",
"PlatformDecoder",
"buildPlatformDecoder",
"(",
"PoolFactory",
"poolFactory",
",",
"boolean",
"gingerbreadDecoderEnabled",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">=",
"Build",
".",
"VERSION_CODES",
".",
"O",
")",
"{",
... | Provide the implementation of the PlatformDecoder for the current platform using the provided
PoolFactory
@param poolFactory The PoolFactory
@return The PlatformDecoder implementation | [
"Provide",
"the",
"implementation",
"of",
"the",
"PlatformDecoder",
"for",
"the",
"current",
"platform",
"using",
"the",
"provided",
"PoolFactory"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/platform/PlatformDecoderFactory.java#L25-L42 |
14,448 | facebook/fresco | samples/showcase/src/main/java/com/facebook/fresco/samples/showcase/MainActivity.java | MainActivity.showFragment | private void showFragment(ShowcaseFragment fragment) {
final FragmentTransaction fragmentTransaction = getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_main, (Fragment) fragment);
if (fragment.getBackstackTag() != null) {
fragmentTransaction.addToBackStack(fragment.get... | java | private void showFragment(ShowcaseFragment fragment) {
final FragmentTransaction fragmentTransaction = getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_main, (Fragment) fragment);
if (fragment.getBackstackTag() != null) {
fragmentTransaction.addToBackStack(fragment.get... | [
"private",
"void",
"showFragment",
"(",
"ShowcaseFragment",
"fragment",
")",
"{",
"final",
"FragmentTransaction",
"fragmentTransaction",
"=",
"getSupportFragmentManager",
"(",
")",
".",
"beginTransaction",
"(",
")",
".",
"replace",
"(",
"R",
".",
"id",
".",
"conte... | Utility method to display a specific Fragment. If the tag is not null we add a backstack
@param fragment The Fragment to add | [
"Utility",
"method",
"to",
"display",
"a",
"specific",
"Fragment",
".",
"If",
"the",
"tag",
"is",
"not",
"null",
"we",
"add",
"a",
"backstack"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/showcase/src/main/java/com/facebook/fresco/samples/showcase/MainActivity.java#L273-L283 |
14,449 | facebook/fresco | static-webp/src/main/java/com/facebook/imagepipeline/nativecode/WebpTranscoderImpl.java | WebpTranscoderImpl.transcodeWebpToJpeg | @Override
public void transcodeWebpToJpeg(
InputStream inputStream,
OutputStream outputStream,
int quality) throws IOException {
StaticWebpNativeLoader.ensure();
nativeTranscodeWebpToJpeg(
Preconditions.checkNotNull(inputStream),
Preconditions.checkNotNull(outputStream),
... | java | @Override
public void transcodeWebpToJpeg(
InputStream inputStream,
OutputStream outputStream,
int quality) throws IOException {
StaticWebpNativeLoader.ensure();
nativeTranscodeWebpToJpeg(
Preconditions.checkNotNull(inputStream),
Preconditions.checkNotNull(outputStream),
... | [
"@",
"Override",
"public",
"void",
"transcodeWebpToJpeg",
"(",
"InputStream",
"inputStream",
",",
"OutputStream",
"outputStream",
",",
"int",
"quality",
")",
"throws",
"IOException",
"{",
"StaticWebpNativeLoader",
".",
"ensure",
"(",
")",
";",
"nativeTranscodeWebpToJp... | Transcodes webp image given by input stream into jpeg. | [
"Transcodes",
"webp",
"image",
"given",
"by",
"input",
"stream",
"into",
"jpeg",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/static-webp/src/main/java/com/facebook/imagepipeline/nativecode/WebpTranscoderImpl.java#L47-L57 |
14,450 | facebook/fresco | static-webp/src/main/java/com/facebook/imagepipeline/nativecode/WebpTranscoderImpl.java | WebpTranscoderImpl.transcodeWebpToPng | @Override
public void transcodeWebpToPng(
InputStream inputStream,
OutputStream outputStream) throws IOException {
StaticWebpNativeLoader.ensure();
nativeTranscodeWebpToPng(
Preconditions.checkNotNull(inputStream),
Preconditions.checkNotNull(outputStream));
} | java | @Override
public void transcodeWebpToPng(
InputStream inputStream,
OutputStream outputStream) throws IOException {
StaticWebpNativeLoader.ensure();
nativeTranscodeWebpToPng(
Preconditions.checkNotNull(inputStream),
Preconditions.checkNotNull(outputStream));
} | [
"@",
"Override",
"public",
"void",
"transcodeWebpToPng",
"(",
"InputStream",
"inputStream",
",",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"StaticWebpNativeLoader",
".",
"ensure",
"(",
")",
";",
"nativeTranscodeWebpToPng",
"(",
"Preconditions",
... | Transcodes Webp image given by input stream into png. | [
"Transcodes",
"Webp",
"image",
"given",
"by",
"input",
"stream",
"into",
"png",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/static-webp/src/main/java/com/facebook/imagepipeline/nativecode/WebpTranscoderImpl.java#L62-L70 |
14,451 | facebook/fresco | fbcore/src/main/java/com/facebook/common/executors/ConstrainedExecutorService.java | ConstrainedExecutorService.execute | @Override
public void execute(Runnable runnable) {
if (runnable == null) {
throw new NullPointerException("runnable parameter is null");
}
if (!mWorkQueue.offer(runnable)) {
throw new RejectedExecutionException(
mName + " queue is full, size=" + mWorkQueue.size());
}
final ... | java | @Override
public void execute(Runnable runnable) {
if (runnable == null) {
throw new NullPointerException("runnable parameter is null");
}
if (!mWorkQueue.offer(runnable)) {
throw new RejectedExecutionException(
mName + " queue is full, size=" + mWorkQueue.size());
}
final ... | [
"@",
"Override",
"public",
"void",
"execute",
"(",
"Runnable",
"runnable",
")",
"{",
"if",
"(",
"runnable",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"runnable parameter is null\"",
")",
";",
"}",
"if",
"(",
"!",
"mWorkQueue",
".... | Submit a task to be executed in the future.
@param runnable The task to be executed. | [
"Submit",
"a",
"task",
"to",
"be",
"executed",
"in",
"the",
"future",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/executors/ConstrainedExecutorService.java#L95-L113 |
14,452 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/producers/ThumbnailSizeChecker.java | ThumbnailSizeChecker.isImageBigEnough | public static boolean isImageBigEnough(int width, int height, ResizeOptions resizeOptions) {
if (resizeOptions == null) {
return getAcceptableSize(width) >= BitmapUtil.MAX_BITMAP_SIZE
&& getAcceptableSize(height) >= (int) BitmapUtil.MAX_BITMAP_SIZE;
} else {
return getAcceptableSize(width)... | java | public static boolean isImageBigEnough(int width, int height, ResizeOptions resizeOptions) {
if (resizeOptions == null) {
return getAcceptableSize(width) >= BitmapUtil.MAX_BITMAP_SIZE
&& getAcceptableSize(height) >= (int) BitmapUtil.MAX_BITMAP_SIZE;
} else {
return getAcceptableSize(width)... | [
"public",
"static",
"boolean",
"isImageBigEnough",
"(",
"int",
"width",
",",
"int",
"height",
",",
"ResizeOptions",
"resizeOptions",
")",
"{",
"if",
"(",
"resizeOptions",
"==",
"null",
")",
"{",
"return",
"getAcceptableSize",
"(",
"width",
")",
">=",
"BitmapUt... | Checks whether the producer may be able to produce images of the specified size. This makes no
promise about being able to produce images for a particular source, only generally being able
to produce output of the desired resolution.
@param width the desired width
@param height the desired height
@return true if the p... | [
"Checks",
"whether",
"the",
"producer",
"may",
"be",
"able",
"to",
"produce",
"images",
"of",
"the",
"specified",
"size",
".",
"This",
"makes",
"no",
"promise",
"about",
"being",
"able",
"to",
"produce",
"images",
"for",
"a",
"particular",
"source",
"only",
... | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/ThumbnailSizeChecker.java#L39-L47 |
14,453 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeControllerBuilder.java | AbstractDraweeControllerBuilder.init | private void init() {
mCallerContext = null;
mImageRequest = null;
mLowResImageRequest = null;
mMultiImageRequests = null;
mTryCacheOnlyFirst = true;
mControllerListener = null;
mControllerViewportVisibilityListener = null;
mTapToRetryEnabled = false;
mAutoPlayAnimations = false;
... | java | private void init() {
mCallerContext = null;
mImageRequest = null;
mLowResImageRequest = null;
mMultiImageRequests = null;
mTryCacheOnlyFirst = true;
mControllerListener = null;
mControllerViewportVisibilityListener = null;
mTapToRetryEnabled = false;
mAutoPlayAnimations = false;
... | [
"private",
"void",
"init",
"(",
")",
"{",
"mCallerContext",
"=",
"null",
";",
"mImageRequest",
"=",
"null",
";",
"mLowResImageRequest",
"=",
"null",
";",
"mMultiImageRequests",
"=",
"null",
";",
"mTryCacheOnlyFirst",
"=",
"true",
";",
"mControllerListener",
"=",... | Initializes this builder. | [
"Initializes",
"this",
"builder",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeControllerBuilder.java#L84-L96 |
14,454 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeControllerBuilder.java | AbstractDraweeControllerBuilder.build | @Override
public AbstractDraweeController build() {
validate();
// if only a low-res request is specified, treat it as a final request.
if (mImageRequest == null && mMultiImageRequests == null && mLowResImageRequest != null) {
mImageRequest = mLowResImageRequest;
mLowResImageRequest = null;
... | java | @Override
public AbstractDraweeController build() {
validate();
// if only a low-res request is specified, treat it as a final request.
if (mImageRequest == null && mMultiImageRequests == null && mLowResImageRequest != null) {
mImageRequest = mLowResImageRequest;
mLowResImageRequest = null;
... | [
"@",
"Override",
"public",
"AbstractDraweeController",
"build",
"(",
")",
"{",
"validate",
"(",
")",
";",
"// if only a low-res request is specified, treat it as a final request.",
"if",
"(",
"mImageRequest",
"==",
"null",
"&&",
"mMultiImageRequests",
"==",
"null",
"&&",
... | Builds the specified controller. | [
"Builds",
"the",
"specified",
"controller",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeControllerBuilder.java#L285-L296 |
14,455 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeControllerBuilder.java | AbstractDraweeControllerBuilder.validate | protected void validate() {
Preconditions.checkState(
(mMultiImageRequests == null) || (mImageRequest == null),
"Cannot specify both ImageRequest and FirstAvailableImageRequests!");
Preconditions.checkState(
(mDataSourceSupplier == null) ||
(mMultiImageRequests == null && mIm... | java | protected void validate() {
Preconditions.checkState(
(mMultiImageRequests == null) || (mImageRequest == null),
"Cannot specify both ImageRequest and FirstAvailableImageRequests!");
Preconditions.checkState(
(mDataSourceSupplier == null) ||
(mMultiImageRequests == null && mIm... | [
"protected",
"void",
"validate",
"(",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"(",
"mMultiImageRequests",
"==",
"null",
")",
"||",
"(",
"mImageRequest",
"==",
"null",
")",
",",
"\"Cannot specify both ImageRequest and FirstAvailableImageRequests!\"",
")",
";... | Validates the parameters before building a controller. | [
"Validates",
"the",
"parameters",
"before",
"building",
"a",
"controller",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeControllerBuilder.java#L299-L307 |
14,456 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeControllerBuilder.java | AbstractDraweeControllerBuilder.buildController | protected AbstractDraweeController buildController() {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("AbstractDraweeControllerBuilder#buildController");
}
AbstractDraweeController controller = obtainController();
controller.setRetainImageOnFailure(getRetainImageOnFailure());
co... | java | protected AbstractDraweeController buildController() {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("AbstractDraweeControllerBuilder#buildController");
}
AbstractDraweeController controller = obtainController();
controller.setRetainImageOnFailure(getRetainImageOnFailure());
co... | [
"protected",
"AbstractDraweeController",
"buildController",
"(",
")",
"{",
"if",
"(",
"FrescoSystrace",
".",
"isTracing",
"(",
")",
")",
"{",
"FrescoSystrace",
".",
"beginSection",
"(",
"\"AbstractDraweeControllerBuilder#buildController\"",
")",
";",
"}",
"AbstractDrawe... | Builds a regular controller. | [
"Builds",
"a",
"regular",
"controller",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeControllerBuilder.java#L310-L324 |
14,457 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeControllerBuilder.java | AbstractDraweeControllerBuilder.obtainDataSourceSupplier | protected Supplier<DataSource<IMAGE>> obtainDataSourceSupplier(
final DraweeController controller, final String controllerId) {
if (mDataSourceSupplier != null) {
return mDataSourceSupplier;
}
Supplier<DataSource<IMAGE>> supplier = null;
// final image supplier;
if (mImageRequest != nu... | java | protected Supplier<DataSource<IMAGE>> obtainDataSourceSupplier(
final DraweeController controller, final String controllerId) {
if (mDataSourceSupplier != null) {
return mDataSourceSupplier;
}
Supplier<DataSource<IMAGE>> supplier = null;
// final image supplier;
if (mImageRequest != nu... | [
"protected",
"Supplier",
"<",
"DataSource",
"<",
"IMAGE",
">",
">",
"obtainDataSourceSupplier",
"(",
"final",
"DraweeController",
"controller",
",",
"final",
"String",
"controllerId",
")",
"{",
"if",
"(",
"mDataSourceSupplier",
"!=",
"null",
")",
"{",
"return",
... | Gets the top-level data source supplier to be used by a controller. | [
"Gets",
"the",
"top",
"-",
"level",
"data",
"source",
"supplier",
"to",
"be",
"used",
"by",
"a",
"controller",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeControllerBuilder.java#L332-L363 |
14,458 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeControllerBuilder.java | AbstractDraweeControllerBuilder.maybeBuildAndSetGestureDetector | protected void maybeBuildAndSetGestureDetector(AbstractDraweeController controller) {
GestureDetector gestureDetector = controller.getGestureDetector();
if (gestureDetector == null) {
gestureDetector = GestureDetector.newInstance(mContext);
controller.setGestureDetector(gestureDetector);
}
} | java | protected void maybeBuildAndSetGestureDetector(AbstractDraweeController controller) {
GestureDetector gestureDetector = controller.getGestureDetector();
if (gestureDetector == null) {
gestureDetector = GestureDetector.newInstance(mContext);
controller.setGestureDetector(gestureDetector);
}
} | [
"protected",
"void",
"maybeBuildAndSetGestureDetector",
"(",
"AbstractDraweeController",
"controller",
")",
"{",
"GestureDetector",
"gestureDetector",
"=",
"controller",
".",
"getGestureDetector",
"(",
")",
";",
"if",
"(",
"gestureDetector",
"==",
"null",
")",
"{",
"g... | Installs a gesture detector to the given controller. | [
"Installs",
"a",
"gesture",
"detector",
"to",
"the",
"given",
"controller",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeControllerBuilder.java#L438-L444 |
14,459 | facebook/fresco | fbcore/src/main/java/com/facebook/common/util/UriUtil.java | UriUtil.isLocalContactUri | public static boolean isLocalContactUri(Uri uri) {
return isLocalContentUri(uri)
&& ContactsContract.AUTHORITY.equals(uri.getAuthority())
&& !uri.getPath().startsWith(LOCAL_CONTACT_IMAGE_URI.getPath());
} | java | public static boolean isLocalContactUri(Uri uri) {
return isLocalContentUri(uri)
&& ContactsContract.AUTHORITY.equals(uri.getAuthority())
&& !uri.getPath().startsWith(LOCAL_CONTACT_IMAGE_URI.getPath());
} | [
"public",
"static",
"boolean",
"isLocalContactUri",
"(",
"Uri",
"uri",
")",
"{",
"return",
"isLocalContentUri",
"(",
"uri",
")",
"&&",
"ContactsContract",
".",
"AUTHORITY",
".",
"equals",
"(",
"uri",
".",
"getAuthority",
"(",
")",
")",
"&&",
"!",
"uri",
".... | Checks if the given URI is a general Contact URI, and not a specific display photo.
@param uri the URI to check
@return true if the uri is a Contact URI, and is not already specifying a display photo. | [
"Checks",
"if",
"the",
"given",
"URI",
"is",
"a",
"general",
"Contact",
"URI",
"and",
"not",
"a",
"specific",
"display",
"photo",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/util/UriUtil.java#L121-L125 |
14,460 | facebook/fresco | fbcore/src/main/java/com/facebook/common/util/UriUtil.java | UriUtil.isLocalCameraUri | public static boolean isLocalCameraUri(Uri uri) {
String uriString = uri.toString();
return uriString.startsWith(MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString())
|| uriString.startsWith(MediaStore.Images.Media.INTERNAL_CONTENT_URI.toString());
} | java | public static boolean isLocalCameraUri(Uri uri) {
String uriString = uri.toString();
return uriString.startsWith(MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString())
|| uriString.startsWith(MediaStore.Images.Media.INTERNAL_CONTENT_URI.toString());
} | [
"public",
"static",
"boolean",
"isLocalCameraUri",
"(",
"Uri",
"uri",
")",
"{",
"String",
"uriString",
"=",
"uri",
".",
"toString",
"(",
")",
";",
"return",
"uriString",
".",
"startsWith",
"(",
"MediaStore",
".",
"Images",
".",
"Media",
".",
"EXTERNAL_CONTEN... | Checks if the given URI is for a photo from the device's local media store.
@param uri the URI to check
@return true if the URI points to a media store photo | [
"Checks",
"if",
"the",
"given",
"URI",
"is",
"for",
"a",
"photo",
"from",
"the",
"device",
"s",
"local",
"media",
"store",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/util/UriUtil.java#L133-L137 |
14,461 | facebook/fresco | fbcore/src/main/java/com/facebook/common/util/UriUtil.java | UriUtil.getRealPathFromUri | @Nullable
public static String getRealPathFromUri(ContentResolver contentResolver, final Uri srcUri) {
String result = null;
if (isLocalContentUri(srcUri)) {
Cursor cursor = null;
try {
cursor = contentResolver.query(srcUri, null, null, null, null);
if (cursor != null && cursor.mov... | java | @Nullable
public static String getRealPathFromUri(ContentResolver contentResolver, final Uri srcUri) {
String result = null;
if (isLocalContentUri(srcUri)) {
Cursor cursor = null;
try {
cursor = contentResolver.query(srcUri, null, null, null, null);
if (cursor != null && cursor.mov... | [
"@",
"Nullable",
"public",
"static",
"String",
"getRealPathFromUri",
"(",
"ContentResolver",
"contentResolver",
",",
"final",
"Uri",
"srcUri",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"isLocalContentUri",
"(",
"srcUri",
")",
")",
"{",
"Cursor... | Get the path of a file from the Uri.
@param contentResolver the content resolver which will query for the source file
@param srcUri The source uri
@return The Path for the file or null if doesn't exists | [
"Get",
"the",
"path",
"of",
"a",
"file",
"from",
"the",
"Uri",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/util/UriUtil.java#L205-L227 |
14,462 | facebook/fresco | fbcore/src/main/java/com/facebook/common/util/UriUtil.java | UriUtil.getUriForQualifiedResource | public static Uri getUriForQualifiedResource(String packageName, int resourceId) {
return new Uri.Builder()
.scheme(QUALIFIED_RESOURCE_SCHEME)
.authority(packageName)
.path(String.valueOf(resourceId))
.build();
} | java | public static Uri getUriForQualifiedResource(String packageName, int resourceId) {
return new Uri.Builder()
.scheme(QUALIFIED_RESOURCE_SCHEME)
.authority(packageName)
.path(String.valueOf(resourceId))
.build();
} | [
"public",
"static",
"Uri",
"getUriForQualifiedResource",
"(",
"String",
"packageName",
",",
"int",
"resourceId",
")",
"{",
"return",
"new",
"Uri",
".",
"Builder",
"(",
")",
".",
"scheme",
"(",
"QUALIFIED_RESOURCE_SCHEME",
")",
".",
"authority",
"(",
"packageName... | Returns a URI for the given resource ID in the given package. Use this method only if you need
to specify a package name different to your application's main package.
@param packageName a package name (e.g. com.facebook.myapp.plugin)
@param resourceId to resource ID to use
@return the URI | [
"Returns",
"a",
"URI",
"for",
"the",
"given",
"resource",
"ID",
"in",
"the",
"given",
"package",
".",
"Use",
"this",
"method",
"only",
"if",
"you",
"need",
"to",
"specify",
"a",
"package",
"name",
"different",
"to",
"your",
"application",
"s",
"main",
"p... | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/util/UriUtil.java#L262-L268 |
14,463 | facebook/fresco | native-imagetranscoder/src/main/java/com/facebook/imagepipeline/nativecode/NativeJpegTranscoder.java | NativeJpegTranscoder.transcodeJpeg | @VisibleForTesting
public static void transcodeJpeg(
final InputStream inputStream,
final OutputStream outputStream,
final int rotationAngle,
final int scaleNumerator,
final int quality)
throws IOException {
NativeJpegTranscoderSoLoader.ensure();
Preconditions.checkArgument... | java | @VisibleForTesting
public static void transcodeJpeg(
final InputStream inputStream,
final OutputStream outputStream,
final int rotationAngle,
final int scaleNumerator,
final int quality)
throws IOException {
NativeJpegTranscoderSoLoader.ensure();
Preconditions.checkArgument... | [
"@",
"VisibleForTesting",
"public",
"static",
"void",
"transcodeJpeg",
"(",
"final",
"InputStream",
"inputStream",
",",
"final",
"OutputStream",
"outputStream",
",",
"final",
"int",
"rotationAngle",
",",
"final",
"int",
"scaleNumerator",
",",
"final",
"int",
"qualit... | Transcodes an image to match the specified rotation angle and the scale factor.
@param inputStream The {@link InputStream} of the image that will be transcoded.
@param outputStream The {@link OutputStream} where the newly created image is written to.
@param rotationAngle 0, 90, 180 or 270
@param scaleNumerator 1 - 16,... | [
"Transcodes",
"an",
"image",
"to",
"match",
"the",
"specified",
"rotation",
"angle",
"and",
"the",
"scale",
"factor",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/native-imagetranscoder/src/main/java/com/facebook/imagepipeline/nativecode/NativeJpegTranscoder.java#L143-L165 |
14,464 | facebook/fresco | native-imagetranscoder/src/main/java/com/facebook/imagepipeline/nativecode/NativeJpegTranscoder.java | NativeJpegTranscoder.transcodeJpegWithExifOrientation | @VisibleForTesting
public static void transcodeJpegWithExifOrientation(
final InputStream inputStream,
final OutputStream outputStream,
final int exifOrientation,
final int scaleNumerator,
final int quality)
throws IOException {
NativeJpegTranscoderSoLoader.ensure();
Precon... | java | @VisibleForTesting
public static void transcodeJpegWithExifOrientation(
final InputStream inputStream,
final OutputStream outputStream,
final int exifOrientation,
final int scaleNumerator,
final int quality)
throws IOException {
NativeJpegTranscoderSoLoader.ensure();
Precon... | [
"@",
"VisibleForTesting",
"public",
"static",
"void",
"transcodeJpegWithExifOrientation",
"(",
"final",
"InputStream",
"inputStream",
",",
"final",
"OutputStream",
"outputStream",
",",
"final",
"int",
"exifOrientation",
",",
"final",
"int",
"scaleNumerator",
",",
"final... | Transcodes an image to match the specified exif orientation and the scale factor.
@param inputStream The {@link InputStream} of the image that will be transcoded.
@param outputStream The {@link OutputStream} where the newly created image is written to.
@param exifOrientation 0, 90, 180 or 270
@param scaleNumerator 1 -... | [
"Transcodes",
"an",
"image",
"to",
"match",
"the",
"specified",
"exif",
"orientation",
"and",
"the",
"scale",
"factor",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/native-imagetranscoder/src/main/java/com/facebook/imagepipeline/nativecode/NativeJpegTranscoder.java#L185-L208 |
14,465 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/request/ImageRequest.java | ImageRequest.getSourceUriType | private static @SourceUriType int getSourceUriType(final Uri uri) {
if (uri == null) {
return SOURCE_TYPE_UNKNOWN;
}
if (UriUtil.isNetworkUri(uri)) {
return SOURCE_TYPE_NETWORK;
} else if (UriUtil.isLocalFileUri(uri)) {
if (MediaUtils.isVideo(MediaUtils.extractMime(uri.getPath()))) {
... | java | private static @SourceUriType int getSourceUriType(final Uri uri) {
if (uri == null) {
return SOURCE_TYPE_UNKNOWN;
}
if (UriUtil.isNetworkUri(uri)) {
return SOURCE_TYPE_NETWORK;
} else if (UriUtil.isLocalFileUri(uri)) {
if (MediaUtils.isVideo(MediaUtils.extractMime(uri.getPath()))) {
... | [
"private",
"static",
"@",
"SourceUriType",
"int",
"getSourceUriType",
"(",
"final",
"Uri",
"uri",
")",
"{",
"if",
"(",
"uri",
"==",
"null",
")",
"{",
"return",
"SOURCE_TYPE_UNKNOWN",
";",
"}",
"if",
"(",
"UriUtil",
".",
"isNetworkUri",
"(",
"uri",
")",
"... | This is a utility method which returns the type of Uri
@param uri The Uri to test
@return The type of the given Uri if available or SOURCE_TYPE_UNKNOWN if not | [
"This",
"is",
"a",
"utility",
"method",
"which",
"returns",
"the",
"type",
"of",
"Uri"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/request/ImageRequest.java#L339-L364 |
14,466 | facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingLruMap.java | CountingLruMap.getFirstKey | @Nullable
public synchronized K getFirstKey() {
return mMap.isEmpty() ? null : mMap.keySet().iterator().next();
} | java | @Nullable
public synchronized K getFirstKey() {
return mMap.isEmpty() ? null : mMap.keySet().iterator().next();
} | [
"@",
"Nullable",
"public",
"synchronized",
"K",
"getFirstKey",
"(",
")",
"{",
"return",
"mMap",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"mMap",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"}"
] | Gets the key of the first element in the map. | [
"Gets",
"the",
"key",
"of",
"the",
"first",
"element",
"in",
"the",
"map",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingLruMap.java#L56-L59 |
14,467 | facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingLruMap.java | CountingLruMap.put | @Nullable
public synchronized V put(K key, V value) {
// We do remove and insert instead of just replace, in order to cause a structural change
// to the map, as we always want the latest inserted element to be last in the queue.
V oldValue = mMap.remove(key);
mSizeInBytes -= getValueSizeInBytes(oldVa... | java | @Nullable
public synchronized V put(K key, V value) {
// We do remove and insert instead of just replace, in order to cause a structural change
// to the map, as we always want the latest inserted element to be last in the queue.
V oldValue = mMap.remove(key);
mSizeInBytes -= getValueSizeInBytes(oldVa... | [
"@",
"Nullable",
"public",
"synchronized",
"V",
"put",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"// We do remove and insert instead of just replace, in order to cause a structural change",
"// to the map, as we always want the latest inserted element to be last in the queue.",
"... | Adds the element to the map, and removes the old element with the same key if any. | [
"Adds",
"the",
"element",
"to",
"the",
"map",
"and",
"removes",
"the",
"old",
"element",
"with",
"the",
"same",
"key",
"if",
"any",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingLruMap.java#L85-L94 |
14,468 | facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingLruMap.java | CountingLruMap.remove | @Nullable
public synchronized V remove(K key) {
V oldValue = mMap.remove(key);
mSizeInBytes -= getValueSizeInBytes(oldValue);
return oldValue;
} | java | @Nullable
public synchronized V remove(K key) {
V oldValue = mMap.remove(key);
mSizeInBytes -= getValueSizeInBytes(oldValue);
return oldValue;
} | [
"@",
"Nullable",
"public",
"synchronized",
"V",
"remove",
"(",
"K",
"key",
")",
"{",
"V",
"oldValue",
"=",
"mMap",
".",
"remove",
"(",
"key",
")",
";",
"mSizeInBytes",
"-=",
"getValueSizeInBytes",
"(",
"oldValue",
")",
";",
"return",
"oldValue",
";",
"}"... | Removes the element from the map. | [
"Removes",
"the",
"element",
"from",
"the",
"map",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingLruMap.java#L97-L102 |
14,469 | facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingLruMap.java | CountingLruMap.clear | public synchronized ArrayList<V> clear() {
ArrayList<V> oldValues = new ArrayList<>(mMap.values());
mMap.clear();
mSizeInBytes = 0;
return oldValues;
} | java | public synchronized ArrayList<V> clear() {
ArrayList<V> oldValues = new ArrayList<>(mMap.values());
mMap.clear();
mSizeInBytes = 0;
return oldValues;
} | [
"public",
"synchronized",
"ArrayList",
"<",
"V",
">",
"clear",
"(",
")",
"{",
"ArrayList",
"<",
"V",
">",
"oldValues",
"=",
"new",
"ArrayList",
"<>",
"(",
"mMap",
".",
"values",
"(",
")",
")",
";",
"mMap",
".",
"clear",
"(",
")",
";",
"mSizeInBytes",... | Clears the map. | [
"Clears",
"the",
"map",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingLruMap.java#L120-L125 |
14,470 | facebook/fresco | imagepipeline-base/src/main/java/com/facebook/cache/disk/DefaultDiskStorage.java | DefaultDiskStorage.getSubdirectoryPath | private String getSubdirectoryPath(String resourceId) {
String subdirectory = String.valueOf(Math.abs(resourceId.hashCode() % SHARDING_BUCKET_COUNT));
return mVersionDirectory + File.separator + subdirectory;
} | java | private String getSubdirectoryPath(String resourceId) {
String subdirectory = String.valueOf(Math.abs(resourceId.hashCode() % SHARDING_BUCKET_COUNT));
return mVersionDirectory + File.separator + subdirectory;
} | [
"private",
"String",
"getSubdirectoryPath",
"(",
"String",
"resourceId",
")",
"{",
"String",
"subdirectory",
"=",
"String",
".",
"valueOf",
"(",
"Math",
".",
"abs",
"(",
"resourceId",
".",
"hashCode",
"(",
")",
"%",
"SHARDING_BUCKET_COUNT",
")",
")",
";",
"r... | Gets the directory to use to store the given key
@param resourceId the id of the file we're going to store
@return the directory to store the file in | [
"Gets",
"the",
"directory",
"to",
"use",
"to",
"store",
"the",
"given",
"key"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/cache/disk/DefaultDiskStorage.java#L226-L229 |
14,471 | facebook/fresco | animated-drawable/src/main/java/com/facebook/fresco/animation/drawable/AnimatedDrawable2.java | AnimatedDrawable2.jumpToFrame | public void jumpToFrame(int targetFrameNumber) {
if (mAnimationBackend == null || mFrameScheduler == null) {
return;
}
// In order to jump to a given frame, we have to compute the correct start time
mLastFrameAnimationTimeMs = mFrameScheduler.getTargetRenderTimeMs(targetFrameNumber);
mStartTim... | java | public void jumpToFrame(int targetFrameNumber) {
if (mAnimationBackend == null || mFrameScheduler == null) {
return;
}
// In order to jump to a given frame, we have to compute the correct start time
mLastFrameAnimationTimeMs = mFrameScheduler.getTargetRenderTimeMs(targetFrameNumber);
mStartTim... | [
"public",
"void",
"jumpToFrame",
"(",
"int",
"targetFrameNumber",
")",
"{",
"if",
"(",
"mAnimationBackend",
"==",
"null",
"||",
"mFrameScheduler",
"==",
"null",
")",
"{",
"return",
";",
"}",
"// In order to jump to a given frame, we have to compute the correct start time"... | Jump immediately to the given frame number. The animation will not be paused if
it is running. If the animation is not running, the animation will not be started.
@param targetFrameNumber the frame number to jump to | [
"Jump",
"immediately",
"to",
"the",
"given",
"frame",
"number",
".",
"The",
"animation",
"will",
"not",
"be",
"paused",
"if",
"it",
"is",
"running",
".",
"If",
"the",
"animation",
"is",
"not",
"running",
"the",
"animation",
"will",
"not",
"be",
"started",
... | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/animated-drawable/src/main/java/com/facebook/fresco/animation/drawable/AnimatedDrawable2.java#L323-L332 |
14,472 | facebook/fresco | animated-drawable/src/main/java/com/facebook/fresco/animation/drawable/AnimatedDrawable2.java | AnimatedDrawable2.getLoopDurationMs | public long getLoopDurationMs() {
if (mAnimationBackend == null) {
return 0;
}
if (mFrameScheduler != null) {
return mFrameScheduler.getLoopDurationMs();
}
int loopDurationMs = 0;
for (int i = 0; i < mAnimationBackend.getFrameCount(); i++) {
loopDurationMs += mAnimationBackend.... | java | public long getLoopDurationMs() {
if (mAnimationBackend == null) {
return 0;
}
if (mFrameScheduler != null) {
return mFrameScheduler.getLoopDurationMs();
}
int loopDurationMs = 0;
for (int i = 0; i < mAnimationBackend.getFrameCount(); i++) {
loopDurationMs += mAnimationBackend.... | [
"public",
"long",
"getLoopDurationMs",
"(",
")",
"{",
"if",
"(",
"mAnimationBackend",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"mFrameScheduler",
"!=",
"null",
")",
"{",
"return",
"mFrameScheduler",
".",
"getLoopDurationMs",
"(",
")",
";... | Get the animation duration for 1 loop by summing all frame durations.
@return the duration of 1 animation loop in ms | [
"Get",
"the",
"animation",
"duration",
"for",
"1",
"loop",
"by",
"summing",
"all",
"frame",
"durations",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/animated-drawable/src/main/java/com/facebook/fresco/animation/drawable/AnimatedDrawable2.java#L339-L351 |
14,473 | facebook/fresco | animated-drawable/src/main/java/com/facebook/fresco/animation/drawable/AnimatedDrawable2.java | AnimatedDrawable2.onLevelChange | @Override
protected boolean onLevelChange(int level) {
if (mIsRunning) {
// If the client called start on us, they expect us to run the animation. In that case,
// we ignore level changes.
return false;
}
if (mLastFrameAnimationTimeMs != level) {
mLastFrameAnimationTimeMs = level;
... | java | @Override
protected boolean onLevelChange(int level) {
if (mIsRunning) {
// If the client called start on us, they expect us to run the animation. In that case,
// we ignore level changes.
return false;
}
if (mLastFrameAnimationTimeMs != level) {
mLastFrameAnimationTimeMs = level;
... | [
"@",
"Override",
"protected",
"boolean",
"onLevelChange",
"(",
"int",
"level",
")",
"{",
"if",
"(",
"mIsRunning",
")",
"{",
"// If the client called start on us, they expect us to run the animation. In that case,",
"// we ignore level changes.",
"return",
"false",
";",
"}",
... | Set the animation to the given level. The level represents the animation time in ms.
If the animation time is greater than the last frame time for the last loop, the last
frame will be displayed.
If the animation is running (e.g. if {@link #start()} has been called, the level change
will be ignored. In this case, {@li... | [
"Set",
"the",
"animation",
"to",
"the",
"given",
"level",
".",
"The",
"level",
"represents",
"the",
"animation",
"time",
"in",
"ms",
".",
"If",
"the",
"animation",
"time",
"is",
"greater",
"than",
"the",
"last",
"frame",
"time",
"for",
"the",
"last",
"lo... | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/animated-drawable/src/main/java/com/facebook/fresco/animation/drawable/AnimatedDrawable2.java#L467-L480 |
14,474 | facebook/fresco | fbcore/src/main/java/com/facebook/common/util/Hex.java | Hex.encodeHex | public static String encodeHex(byte[] array, boolean zeroTerminated) {
char[] cArray = new char[array.length * 2];
int j = 0;
for (int i = 0; i < array.length; i++) {
int index = array[i] & 0xFF;
if (index == 0 && zeroTerminated) {
break;
}
cArray[j++] = FIRST_CHAR[index];
... | java | public static String encodeHex(byte[] array, boolean zeroTerminated) {
char[] cArray = new char[array.length * 2];
int j = 0;
for (int i = 0; i < array.length; i++) {
int index = array[i] & 0xFF;
if (index == 0 && zeroTerminated) {
break;
}
cArray[j++] = FIRST_CHAR[index];
... | [
"public",
"static",
"String",
"encodeHex",
"(",
"byte",
"[",
"]",
"array",
",",
"boolean",
"zeroTerminated",
")",
"{",
"char",
"[",
"]",
"cArray",
"=",
"new",
"char",
"[",
"array",
".",
"length",
"*",
"2",
"]",
";",
"int",
"j",
"=",
"0",
";",
"for"... | Quickly converts a byte array to a hexadecimal string representation.
@param array byte array, possibly zero-terminated. | [
"Quickly",
"converts",
"a",
"byte",
"array",
"to",
"a",
"hexadecimal",
"string",
"representation",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/util/Hex.java#L68-L83 |
14,475 | facebook/fresco | fbcore/src/main/java/com/facebook/common/util/Hex.java | Hex.decodeHex | public static byte[] decodeHex(String hexString) {
int length = hexString.length();
if ((length & 0x01) != 0) {
throw new IllegalArgumentException("Odd number of characters.");
}
boolean badHex = false;
byte[] out = new byte[length >> 1];
for (int i = 0, j = 0; j < length; i++) {
i... | java | public static byte[] decodeHex(String hexString) {
int length = hexString.length();
if ((length & 0x01) != 0) {
throw new IllegalArgumentException("Odd number of characters.");
}
boolean badHex = false;
byte[] out = new byte[length >> 1];
for (int i = 0, j = 0; j < length; i++) {
i... | [
"public",
"static",
"byte",
"[",
"]",
"decodeHex",
"(",
"String",
"hexString",
")",
"{",
"int",
"length",
"=",
"hexString",
".",
"length",
"(",
")",
";",
"if",
"(",
"(",
"length",
"&",
"0x01",
")",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumen... | Quickly converts a hexadecimal string to a byte array. | [
"Quickly",
"converts",
"a",
"hexadecimal",
"string",
"to",
"a",
"byte",
"array",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/util/Hex.java#L88-L130 |
14,476 | facebook/fresco | imagepipeline-backends/imagepipeline-okhttp3/src/main/java/com/facebook/imagepipeline/backends/okhttp3/OkHttpNetworkFetcher.java | OkHttpNetworkFetcher.handleException | private void handleException(final Call call, final Exception e, final Callback callback) {
if (call.isCanceled()) {
callback.onCancellation();
} else {
callback.onFailure(e);
}
} | java | private void handleException(final Call call, final Exception e, final Callback callback) {
if (call.isCanceled()) {
callback.onCancellation();
} else {
callback.onFailure(e);
}
} | [
"private",
"void",
"handleException",
"(",
"final",
"Call",
"call",
",",
"final",
"Exception",
"e",
",",
"final",
"Callback",
"callback",
")",
"{",
"if",
"(",
"call",
".",
"isCanceled",
"(",
")",
")",
"{",
"callback",
".",
"onCancellation",
"(",
")",
";"... | Handles exceptions.
<p> OkHttp notifies callers of cancellations via an IOException. If IOException is caught
after request cancellation, then the exception is interpreted as successful cancellation
and onCancellation is called. Otherwise onFailure is called. | [
"Handles",
"exceptions",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-backends/imagepipeline-okhttp3/src/main/java/com/facebook/imagepipeline/backends/okhttp3/OkHttpNetworkFetcher.java#L215-L221 |
14,477 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeController.java | AbstractDraweeController.initialize | protected void initialize(String id, Object callerContext) {
init(id, callerContext);
mJustConstructed = false;
} | java | protected void initialize(String id, Object callerContext) {
init(id, callerContext);
mJustConstructed = false;
} | [
"protected",
"void",
"initialize",
"(",
"String",
"id",
",",
"Object",
"callerContext",
")",
"{",
"init",
"(",
"id",
",",
"callerContext",
")",
";",
"mJustConstructed",
"=",
"false",
";",
"}"
] | Initializes this controller with the new id and caller context.
This allows for reusing of the existing controller instead of instantiating a new one.
This method should be called when the controller is in detached state.
@param id unique id for this controller
@param callerContext tag and context for this controller | [
"Initializes",
"this",
"controller",
"with",
"the",
"new",
"id",
"and",
"caller",
"context",
".",
"This",
"allows",
"for",
"reusing",
"of",
"the",
"existing",
"controller",
"instead",
"of",
"instantiating",
"a",
"new",
"one",
".",
"This",
"method",
"should",
... | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeController.java#L119-L122 |
14,478 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeController.java | AbstractDraweeController.addControllerListener | public void addControllerListener(ControllerListener<? super INFO> controllerListener) {
Preconditions.checkNotNull(controllerListener);
if (mControllerListener instanceof InternalForwardingListener) {
((InternalForwardingListener<INFO>) mControllerListener).addListener(controllerListener);
return;
... | java | public void addControllerListener(ControllerListener<? super INFO> controllerListener) {
Preconditions.checkNotNull(controllerListener);
if (mControllerListener instanceof InternalForwardingListener) {
((InternalForwardingListener<INFO>) mControllerListener).addListener(controllerListener);
return;
... | [
"public",
"void",
"addControllerListener",
"(",
"ControllerListener",
"<",
"?",
"super",
"INFO",
">",
"controllerListener",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"controllerListener",
")",
";",
"if",
"(",
"mControllerListener",
"instanceof",
"InternalFo... | Adds controller listener. | [
"Adds",
"controller",
"listener",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeController.java#L259-L274 |
14,479 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeController.java | AbstractDraweeController.removeControllerListener | public void removeControllerListener(ControllerListener<? super INFO> controllerListener) {
Preconditions.checkNotNull(controllerListener);
if (mControllerListener instanceof InternalForwardingListener) {
((InternalForwardingListener<INFO>) mControllerListener).removeListener(controllerListener);
re... | java | public void removeControllerListener(ControllerListener<? super INFO> controllerListener) {
Preconditions.checkNotNull(controllerListener);
if (mControllerListener instanceof InternalForwardingListener) {
((InternalForwardingListener<INFO>) mControllerListener).removeListener(controllerListener);
re... | [
"public",
"void",
"removeControllerListener",
"(",
"ControllerListener",
"<",
"?",
"super",
"INFO",
">",
"controllerListener",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"controllerListener",
")",
";",
"if",
"(",
"mControllerListener",
"instanceof",
"Interna... | Removes controller listener. | [
"Removes",
"controller",
"listener",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/controller/AbstractDraweeController.java#L277-L286 |
14,480 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/drawable/ArrayDrawable.java | ArrayDrawable.getDrawable | @Nullable
public Drawable getDrawable(int index) {
Preconditions.checkArgument(index >= 0);
Preconditions.checkArgument(index < mLayers.length);
return mLayers[index];
} | java | @Nullable
public Drawable getDrawable(int index) {
Preconditions.checkArgument(index >= 0);
Preconditions.checkArgument(index < mLayers.length);
return mLayers[index];
} | [
"@",
"Nullable",
"public",
"Drawable",
"getDrawable",
"(",
"int",
"index",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"index",
">=",
"0",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"index",
"<",
"mLayers",
".",
"length",
")",
";",
"re... | Gets the drawable at the specified index.
@param index index of drawable to get
@return drawable at the specified index | [
"Gets",
"the",
"drawable",
"at",
"the",
"specified",
"index",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/ArrayDrawable.java#L75-L80 |
14,481 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalContentUriThumbnailFetchProducer.java | LocalContentUriThumbnailFetchProducer.getThumbnail | private @Nullable EncodedImage getThumbnail(ResizeOptions resizeOptions, int imageId)
throws IOException {
int thumbnailKind = getThumbnailKind(resizeOptions);
if (thumbnailKind == NO_THUMBNAIL) {
return null;
}
Cursor thumbnailCursor = null;
try {
thumbnailCursor = MediaStore.Imag... | java | private @Nullable EncodedImage getThumbnail(ResizeOptions resizeOptions, int imageId)
throws IOException {
int thumbnailKind = getThumbnailKind(resizeOptions);
if (thumbnailKind == NO_THUMBNAIL) {
return null;
}
Cursor thumbnailCursor = null;
try {
thumbnailCursor = MediaStore.Imag... | [
"private",
"@",
"Nullable",
"EncodedImage",
"getThumbnail",
"(",
"ResizeOptions",
"resizeOptions",
",",
"int",
"imageId",
")",
"throws",
"IOException",
"{",
"int",
"thumbnailKind",
"=",
"getThumbnailKind",
"(",
"resizeOptions",
")",
";",
"if",
"(",
"thumbnailKind",
... | stored thumbnails. | [
"stored",
"thumbnails",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalContentUriThumbnailFetchProducer.java#L115-L145 |
14,482 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalContentUriThumbnailFetchProducer.java | LocalContentUriThumbnailFetchProducer.getThumbnailKind | private static int getThumbnailKind(ResizeOptions resizeOptions) {
if (ThumbnailSizeChecker.isImageBigEnough(
MICRO_THUMBNAIL_DIMENSIONS.width(),
MICRO_THUMBNAIL_DIMENSIONS.height(),
resizeOptions)) {
return MediaStore.Images.Thumbnails.MICRO_KIND;
} else if (ThumbnailSizeChecker.i... | java | private static int getThumbnailKind(ResizeOptions resizeOptions) {
if (ThumbnailSizeChecker.isImageBigEnough(
MICRO_THUMBNAIL_DIMENSIONS.width(),
MICRO_THUMBNAIL_DIMENSIONS.height(),
resizeOptions)) {
return MediaStore.Images.Thumbnails.MICRO_KIND;
} else if (ThumbnailSizeChecker.i... | [
"private",
"static",
"int",
"getThumbnailKind",
"(",
"ResizeOptions",
"resizeOptions",
")",
"{",
"if",
"(",
"ThumbnailSizeChecker",
".",
"isImageBigEnough",
"(",
"MICRO_THUMBNAIL_DIMENSIONS",
".",
"width",
"(",
")",
",",
"MICRO_THUMBNAIL_DIMENSIONS",
".",
"height",
"(... | when scaling it to fit a view will not be significant. | [
"when",
"scaling",
"it",
"to",
"fit",
"a",
"view",
"will",
"not",
"be",
"significant",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalContentUriThumbnailFetchProducer.java#L151-L165 |
14,483 | facebook/fresco | samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/data/impl/ContentProviderSimpleAdapter.java | ContentProviderSimpleAdapter.getInternalPhotoSimpleAdapter | public static ContentProviderSimpleAdapter getInternalPhotoSimpleAdapter(Context context) {
return new ContentProviderSimpleAdapter(MediaStore.Images.Media.INTERNAL_CONTENT_URI, context);
} | java | public static ContentProviderSimpleAdapter getInternalPhotoSimpleAdapter(Context context) {
return new ContentProviderSimpleAdapter(MediaStore.Images.Media.INTERNAL_CONTENT_URI, context);
} | [
"public",
"static",
"ContentProviderSimpleAdapter",
"getInternalPhotoSimpleAdapter",
"(",
"Context",
"context",
")",
"{",
"return",
"new",
"ContentProviderSimpleAdapter",
"(",
"MediaStore",
".",
"Images",
".",
"Media",
".",
"INTERNAL_CONTENT_URI",
",",
"context",
")",
"... | Creates and returns a SimpleAdapter for Internal Photos
@param context The Context
@return The SimpleAdapter for local photo | [
"Creates",
"and",
"returns",
"a",
"SimpleAdapter",
"for",
"Internal",
"Photos"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/data/impl/ContentProviderSimpleAdapter.java#L47-L49 |
14,484 | facebook/fresco | samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/data/impl/ContentProviderSimpleAdapter.java | ContentProviderSimpleAdapter.getExternalPhotoSimpleAdapter | public static ContentProviderSimpleAdapter getExternalPhotoSimpleAdapter(Context context) {
return new ContentProviderSimpleAdapter(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, context);
} | java | public static ContentProviderSimpleAdapter getExternalPhotoSimpleAdapter(Context context) {
return new ContentProviderSimpleAdapter(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, context);
} | [
"public",
"static",
"ContentProviderSimpleAdapter",
"getExternalPhotoSimpleAdapter",
"(",
"Context",
"context",
")",
"{",
"return",
"new",
"ContentProviderSimpleAdapter",
"(",
"MediaStore",
".",
"Images",
".",
"Media",
".",
"EXTERNAL_CONTENT_URI",
",",
"context",
")",
"... | Creates and returns a SimpleAdapter for External Photos
@param context The Context
@return The SimpleAdapter for local photo | [
"Creates",
"and",
"returns",
"a",
"SimpleAdapter",
"for",
"External",
"Photos"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/scrollperf/src/main/java/com/facebook/samples/scrollperf/data/impl/ContentProviderSimpleAdapter.java#L57-L59 |
14,485 | facebook/fresco | samples/comparison/src/main/java/com/facebook/samples/comparison/MainActivity.java | MainActivity.getDisplayHeight | public int getDisplayHeight() {
Display display = getWindowManager().getDefaultDisplay();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2) {
return display.getHeight();
} else {
final Point size = new Point();
display.getSize(size);
return size.y;
}
} | java | public int getDisplayHeight() {
Display display = getWindowManager().getDefaultDisplay();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2) {
return display.getHeight();
} else {
final Point size = new Point();
display.getSize(size);
return size.y;
}
} | [
"public",
"int",
"getDisplayHeight",
"(",
")",
"{",
"Display",
"display",
"=",
"getWindowManager",
"(",
")",
".",
"getDefaultDisplay",
"(",
")",
";",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
"<",
"Build",
".",
"VERSION_CODES",
".",
"HONEYCOMB_MR2"... | Determines display's height. | [
"Determines",
"display",
"s",
"height",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/comparison/src/main/java/com/facebook/samples/comparison/MainActivity.java#L503-L512 |
14,486 | facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imageformat/ImageFormatCheckerUtils.java | ImageFormatCheckerUtils.asciiBytes | public static byte[] asciiBytes(String value) {
Preconditions.checkNotNull(value);
try {
return value.getBytes("ASCII");
} catch (UnsupportedEncodingException uee) {
// won't happen
throw new RuntimeException("ASCII not found!", uee);
}
} | java | public static byte[] asciiBytes(String value) {
Preconditions.checkNotNull(value);
try {
return value.getBytes("ASCII");
} catch (UnsupportedEncodingException uee) {
// won't happen
throw new RuntimeException("ASCII not found!", uee);
}
} | [
"public",
"static",
"byte",
"[",
"]",
"asciiBytes",
"(",
"String",
"value",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"value",
")",
";",
"try",
"{",
"return",
"value",
".",
"getBytes",
"(",
"\"ASCII\"",
")",
";",
"}",
"catch",
"(",
"Unsupporte... | Helper method that transforms provided string into it's byte representation
using ASCII encoding.
@param value the string to use
@return byte array representing ascii encoded value | [
"Helper",
"method",
"that",
"transforms",
"provided",
"string",
"into",
"it",
"s",
"byte",
"representation",
"using",
"ASCII",
"encoding",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageformat/ImageFormatCheckerUtils.java#L24-L32 |
14,487 | facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imageformat/ImageFormatCheckerUtils.java | ImageFormatCheckerUtils.startsWithPattern | public static boolean startsWithPattern(
final byte[] byteArray,
final byte[] pattern) {
Preconditions.checkNotNull(byteArray);
Preconditions.checkNotNull(pattern);
if (pattern.length > byteArray.length) {
return false;
}
for (int i = 0; i < pattern.length; ++i) {
if (byteAr... | java | public static boolean startsWithPattern(
final byte[] byteArray,
final byte[] pattern) {
Preconditions.checkNotNull(byteArray);
Preconditions.checkNotNull(pattern);
if (pattern.length > byteArray.length) {
return false;
}
for (int i = 0; i < pattern.length; ++i) {
if (byteAr... | [
"public",
"static",
"boolean",
"startsWithPattern",
"(",
"final",
"byte",
"[",
"]",
"byteArray",
",",
"final",
"byte",
"[",
"]",
"pattern",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"byteArray",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
... | Checks if byteArray interpreted as sequence of bytes starts with pattern
starting at position equal to offset.
@param byteArray the byte array to be checked
@param pattern the pattern to check
@return true if byteArray starts with pattern | [
"Checks",
"if",
"byteArray",
"interpreted",
"as",
"sequence",
"of",
"bytes",
"starts",
"with",
"pattern",
"starting",
"at",
"position",
"equal",
"to",
"offset",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageformat/ImageFormatCheckerUtils.java#L41-L57 |
14,488 | facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imageformat/ImageFormatCheckerUtils.java | ImageFormatCheckerUtils.indexOfPattern | public static int indexOfPattern(
final byte[] byteArray,
final int byteArrayLen,
final byte[] pattern,
final int patternLen) {
Preconditions.checkNotNull(byteArray);
Preconditions.checkNotNull(pattern);
if (patternLen > byteArrayLen) {
return -1;
}
byte first = patter... | java | public static int indexOfPattern(
final byte[] byteArray,
final int byteArrayLen,
final byte[] pattern,
final int patternLen) {
Preconditions.checkNotNull(byteArray);
Preconditions.checkNotNull(pattern);
if (patternLen > byteArrayLen) {
return -1;
}
byte first = patter... | [
"public",
"static",
"int",
"indexOfPattern",
"(",
"final",
"byte",
"[",
"]",
"byteArray",
",",
"final",
"int",
"byteArrayLen",
",",
"final",
"byte",
"[",
"]",
"pattern",
",",
"final",
"int",
"patternLen",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
... | Checks if byteArray interpreted as sequence of bytes contains the pattern.
@param byteArray the byte array to be checked
@param pattern the pattern to check
@return index of beginning of pattern, if found; otherwise -1 | [
"Checks",
"if",
"byteArray",
"interpreted",
"as",
"sequence",
"of",
"bytes",
"contains",
"the",
"pattern",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageformat/ImageFormatCheckerUtils.java#L65-L100 |
14,489 | facebook/fresco | samples/comparison/src/main/java/com/facebook/samples/comparison/instrumentation/Instrumentation.java | Instrumentation.onDraw | public void onDraw(final Canvas canvas) {
mPaint.setColor(0xC0000000);
mTextRect.set(0, 0, mView.getWidth(), 35);
canvas.drawRect(mTextRect, mPaint);
mPaint.setColor(Color.WHITE);
canvas.drawText("[" + mTag + "]", 10, 15, mPaint);
String message = "Not started";
switch (mState) {
cas... | java | public void onDraw(final Canvas canvas) {
mPaint.setColor(0xC0000000);
mTextRect.set(0, 0, mView.getWidth(), 35);
canvas.drawRect(mTextRect, mPaint);
mPaint.setColor(Color.WHITE);
canvas.drawText("[" + mTag + "]", 10, 15, mPaint);
String message = "Not started";
switch (mState) {
cas... | [
"public",
"void",
"onDraw",
"(",
"final",
"Canvas",
"canvas",
")",
"{",
"mPaint",
".",
"setColor",
"(",
"0xC0000000",
")",
";",
"mTextRect",
".",
"set",
"(",
"0",
",",
"0",
",",
"mView",
".",
"getWidth",
"(",
")",
",",
"35",
")",
";",
"canvas",
"."... | Draws overlay with request state for easier visual inspection. | [
"Draws",
"overlay",
"with",
"request",
"state",
"for",
"easier",
"visual",
"inspection",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/comparison/src/main/java/com/facebook/samples/comparison/instrumentation/Instrumentation.java#L105-L129 |
14,490 | facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imageutils/WebpUtil.java | WebpUtil.getVP8Dimension | private static @Nullable Pair<Integer, Integer> getVP8Dimension(final InputStream is)
throws IOException {
// We need to skip 7 bytes
is.skip(7);
// And then check the signature
final short sign1 = getShort(is);
final short sign2 = getShort(is);
final short sign3 = getShort(is);
if (si... | java | private static @Nullable Pair<Integer, Integer> getVP8Dimension(final InputStream is)
throws IOException {
// We need to skip 7 bytes
is.skip(7);
// And then check the signature
final short sign1 = getShort(is);
final short sign2 = getShort(is);
final short sign3 = getShort(is);
if (si... | [
"private",
"static",
"@",
"Nullable",
"Pair",
"<",
"Integer",
",",
"Integer",
">",
"getVP8Dimension",
"(",
"final",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"// We need to skip 7 bytes",
"is",
".",
"skip",
"(",
"7",
")",
";",
"// And then check th... | We manage the Simple WebP case
@param is The InputStream we're reading
@return The dimensions if any
@throws IOException In case or error reading from the InputStream | [
"We",
"manage",
"the",
"Simple",
"WebP",
"case"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageutils/WebpUtil.java#L94-L108 |
14,491 | facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imageutils/WebpUtil.java | WebpUtil.getVP8LDimension | private static @Nullable Pair<Integer, Integer> getVP8LDimension(final InputStream is)
throws IOException {
// Skip 4 bytes
getInt(is);
//We have a check here
final byte check = getByte(is);
if (check != 0x2F) {
return null;
}
int data1 = ((byte) is.read()) & 0xFF;
int data2 ... | java | private static @Nullable Pair<Integer, Integer> getVP8LDimension(final InputStream is)
throws IOException {
// Skip 4 bytes
getInt(is);
//We have a check here
final byte check = getByte(is);
if (check != 0x2F) {
return null;
}
int data1 = ((byte) is.read()) & 0xFF;
int data2 ... | [
"private",
"static",
"@",
"Nullable",
"Pair",
"<",
"Integer",
",",
"Integer",
">",
"getVP8LDimension",
"(",
"final",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"// Skip 4 bytes",
"getInt",
"(",
"is",
")",
";",
"//We have a check here",
"final",
"byt... | We manage the Lossless WebP case
@param is The InputStream we're reading
@return The dimensions if any
@throws IOException In case or error reading from the InputStream | [
"We",
"manage",
"the",
"Lossless",
"WebP",
"case"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageutils/WebpUtil.java#L117-L134 |
14,492 | facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imageutils/WebpUtil.java | WebpUtil.getVP8XDimension | private static Pair<Integer, Integer> getVP8XDimension(final InputStream is) throws IOException {
// We have to skip 8 bytes
is.skip(8);
// Read 3 bytes for width and height
return new Pair<>(read3Bytes(is) + 1, read3Bytes(is) + 1);
} | java | private static Pair<Integer, Integer> getVP8XDimension(final InputStream is) throws IOException {
// We have to skip 8 bytes
is.skip(8);
// Read 3 bytes for width and height
return new Pair<>(read3Bytes(is) + 1, read3Bytes(is) + 1);
} | [
"private",
"static",
"Pair",
"<",
"Integer",
",",
"Integer",
">",
"getVP8XDimension",
"(",
"final",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"// We have to skip 8 bytes",
"is",
".",
"skip",
"(",
"8",
")",
";",
"// Read 3 bytes for width and height",
... | We manage the Extended WebP case
@param is The InputStream we're reading
@return The dimensions if any
@throws IOException In case or error reading from the InputStream | [
"We",
"manage",
"the",
"Extended",
"WebP",
"case"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageutils/WebpUtil.java#L143-L148 |
14,493 | facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imageutils/WebpUtil.java | WebpUtil.compare | private static boolean compare(byte[] what, String with) {
if (what.length != with.length()) {
return false;
}
for (int i = 0; i < what.length; i++) {
if (with.charAt(i) != what[i]) {
return false;
}
}
return true;
} | java | private static boolean compare(byte[] what, String with) {
if (what.length != with.length()) {
return false;
}
for (int i = 0; i < what.length; i++) {
if (with.charAt(i) != what[i]) {
return false;
}
}
return true;
} | [
"private",
"static",
"boolean",
"compare",
"(",
"byte",
"[",
"]",
"what",
",",
"String",
"with",
")",
"{",
"if",
"(",
"what",
".",
"length",
"!=",
"with",
".",
"length",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"="... | Compares some bytes with the text we're expecting
@param what The bytes to compare
@param with The string those bytes should contains
@return True if they match and false otherwise | [
"Compares",
"some",
"bytes",
"with",
"the",
"text",
"we",
"re",
"expecting"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageutils/WebpUtil.java#L157-L167 |
14,494 | facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/memory/BucketsBitmapPool.java | BucketsBitmapPool.alloc | @Override
protected Bitmap alloc(int size) {
return Bitmap.createBitmap(
1,
(int) Math.ceil(size / (double) BitmapUtil.RGB_565_BYTES_PER_PIXEL),
Bitmap.Config.RGB_565);
} | java | @Override
protected Bitmap alloc(int size) {
return Bitmap.createBitmap(
1,
(int) Math.ceil(size / (double) BitmapUtil.RGB_565_BYTES_PER_PIXEL),
Bitmap.Config.RGB_565);
} | [
"@",
"Override",
"protected",
"Bitmap",
"alloc",
"(",
"int",
"size",
")",
"{",
"return",
"Bitmap",
".",
"createBitmap",
"(",
"1",
",",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"size",
"/",
"(",
"double",
")",
"BitmapUtil",
".",
"RGB_565_BYTES_PER_PIXEL... | Allocate a bitmap that has a backing memory allocation of 'size' bytes.
This is configuration agnostic so the size is the actual size in bytes of the bitmap.
@param size the 'size' in bytes of the bitmap
@return a new bitmap with the specified size in memory | [
"Allocate",
"a",
"bitmap",
"that",
"has",
"a",
"backing",
"memory",
"allocation",
"of",
"size",
"bytes",
".",
"This",
"is",
"configuration",
"agnostic",
"so",
"the",
"size",
"is",
"the",
"actual",
"size",
"in",
"bytes",
"of",
"the",
"bitmap",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/memory/BucketsBitmapPool.java#L52-L58 |
14,495 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/drawable/RoundedDrawable.java | RoundedDrawable.setRadius | @Override
public void setRadius(float radius) {
Preconditions.checkState(radius >= 0);
Arrays.fill(mCornerRadii, radius);
mRadiiNonZero = (radius != 0);
mIsPathDirty = true;
invalidateSelf();
} | java | @Override
public void setRadius(float radius) {
Preconditions.checkState(radius >= 0);
Arrays.fill(mCornerRadii, radius);
mRadiiNonZero = (radius != 0);
mIsPathDirty = true;
invalidateSelf();
} | [
"@",
"Override",
"public",
"void",
"setRadius",
"(",
"float",
"radius",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"radius",
">=",
"0",
")",
";",
"Arrays",
".",
"fill",
"(",
"mCornerRadii",
",",
"radius",
")",
";",
"mRadiiNonZero",
"=",
"(",
"rad... | Specify radius for the corners of the rectangle. If this is > 0, then the
drawable is drawn in a round-rectangle, rather than a rectangle.
@param radius the radius for the corners of the rectangle | [
"Specify",
"radius",
"for",
"the",
"corners",
"of",
"the",
"rectangle",
".",
"If",
"this",
"is",
">",
"0",
"then",
"the",
"drawable",
"is",
"drawn",
"in",
"a",
"round",
"-",
"rectangle",
"rather",
"than",
"a",
"rectangle",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/RoundedDrawable.java#L101-L108 |
14,496 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/drawable/RoundedDrawable.java | RoundedDrawable.setPadding | @Override
public void setPadding(float padding) {
if (mPadding != padding) {
mPadding = padding;
mIsPathDirty = true;
invalidateSelf();
}
} | java | @Override
public void setPadding(float padding) {
if (mPadding != padding) {
mPadding = padding;
mIsPathDirty = true;
invalidateSelf();
}
} | [
"@",
"Override",
"public",
"void",
"setPadding",
"(",
"float",
"padding",
")",
"{",
"if",
"(",
"mPadding",
"!=",
"padding",
")",
"{",
"mPadding",
"=",
"padding",
";",
"mIsPathDirty",
"=",
"true",
";",
"invalidateSelf",
"(",
")",
";",
"}",
"}"
] | Sets the padding for the bitmap.
@param padding | [
"Sets",
"the",
"padding",
"for",
"the",
"bitmap",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/RoundedDrawable.java#L170-L177 |
14,497 | facebook/fresco | drawee/src/main/java/com/facebook/drawee/drawable/RoundedDrawable.java | RoundedDrawable.setScaleDownInsideBorders | @Override
public void setScaleDownInsideBorders(boolean scaleDownInsideBorders) {
if (mScaleDownInsideBorders != scaleDownInsideBorders) {
mScaleDownInsideBorders = scaleDownInsideBorders;
mIsPathDirty = true;
invalidateSelf();
}
} | java | @Override
public void setScaleDownInsideBorders(boolean scaleDownInsideBorders) {
if (mScaleDownInsideBorders != scaleDownInsideBorders) {
mScaleDownInsideBorders = scaleDownInsideBorders;
mIsPathDirty = true;
invalidateSelf();
}
} | [
"@",
"Override",
"public",
"void",
"setScaleDownInsideBorders",
"(",
"boolean",
"scaleDownInsideBorders",
")",
"{",
"if",
"(",
"mScaleDownInsideBorders",
"!=",
"scaleDownInsideBorders",
")",
"{",
"mScaleDownInsideBorders",
"=",
"scaleDownInsideBorders",
";",
"mIsPathDirty",... | Sets whether image should be scaled down inside borders.
@param scaleDownInsideBorders | [
"Sets",
"whether",
"image",
"should",
"be",
"scaled",
"down",
"inside",
"borders",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/RoundedDrawable.java#L190-L197 |
14,498 | facebook/fresco | samples/showcase/src/main/java/com/facebook/fresco/samples/showcase/imagepipeline/ImagePipelineBitmapFactoryFragment.java | ImagePipelineBitmapFactoryFragment.createRainbowBitmap | private CloseableReference<Bitmap> createRainbowBitmap() {
final int w = 256;
final int h = 256;
mOriginalBitmap = mPlatformBitmapFactory.createBitmap(w, h, Bitmap.Config.ARGB_8888);
final int[] colors = new int[w * h];
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
final... | java | private CloseableReference<Bitmap> createRainbowBitmap() {
final int w = 256;
final int h = 256;
mOriginalBitmap = mPlatformBitmapFactory.createBitmap(w, h, Bitmap.Config.ARGB_8888);
final int[] colors = new int[w * h];
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
final... | [
"private",
"CloseableReference",
"<",
"Bitmap",
">",
"createRainbowBitmap",
"(",
")",
"{",
"final",
"int",
"w",
"=",
"256",
";",
"final",
"int",
"h",
"=",
"256",
";",
"mOriginalBitmap",
"=",
"mPlatformBitmapFactory",
".",
"createBitmap",
"(",
"w",
",",
"h",
... | Creates a new bitmap with a HSV map at value=1 | [
"Creates",
"a",
"new",
"bitmap",
"with",
"a",
"HSV",
"map",
"at",
"value",
"=",
"1"
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/showcase/src/main/java/com/facebook/fresco/samples/showcase/imagepipeline/ImagePipelineBitmapFactoryFragment.java#L132-L149 |
14,499 | facebook/fresco | samples/animation2/src/main/java/com/facebook/samples/animation2/utils/AnimationBackendUtils.java | AnimationBackendUtils.wrapAnimationBackendWithInactivityCheck | public static AnimationBackend wrapAnimationBackendWithInactivityCheck(
final Context context,
final AnimationBackend animationBackend) {
AnimationBackendDelegateWithInactivityCheck.InactivityListener inactivityListener =
new AnimationBackendDelegateWithInactivityCheck.InactivityListener() {
... | java | public static AnimationBackend wrapAnimationBackendWithInactivityCheck(
final Context context,
final AnimationBackend animationBackend) {
AnimationBackendDelegateWithInactivityCheck.InactivityListener inactivityListener =
new AnimationBackendDelegateWithInactivityCheck.InactivityListener() {
... | [
"public",
"static",
"AnimationBackend",
"wrapAnimationBackendWithInactivityCheck",
"(",
"final",
"Context",
"context",
",",
"final",
"AnimationBackend",
"animationBackend",
")",
"{",
"AnimationBackendDelegateWithInactivityCheck",
".",
"InactivityListener",
"inactivityListener",
"... | Wraps the given animation backend with an activity check.
When no frame has been drawn for more than 2 seconds, an inactivity toast message will
be displayed.
@param context the context to be used for displaying the toast message
@param animationBackend the backend to wrap with the inactivity check
@return the wrapped... | [
"Wraps",
"the",
"given",
"animation",
"backend",
"with",
"an",
"activity",
"check",
".",
"When",
"no",
"frame",
"has",
"been",
"drawn",
"for",
"more",
"than",
"2",
"seconds",
"an",
"inactivity",
"toast",
"message",
"will",
"be",
"displayed",
"."
] | 0b85879d51c5036d5e46e627a6651afefc0b971a | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/animation2/src/main/java/com/facebook/samples/animation2/utils/AnimationBackendUtils.java#L37-L62 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.