com.facebook.common.internal.Objects Java Examples

The following examples show how to use com.facebook.common.internal.Objects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImagePipeline.java    From fresco with MIT License 6 votes vote down vote up
/**
 * Returns a DataSource supplier that will on get submit the request for execution and return a
 * DataSource representing the pending results of the task.
 *
 * @param imageRequest the request to submit (what to execute).
 * @param callerContext the caller context of the caller of data source supplier
 * @param requestLevel which level to look down until for the image
 * @return a DataSource representing pending results and completion of the request
 */
public Supplier<DataSource<CloseableReference<CloseableImage>>> getDataSourceSupplier(
    final ImageRequest imageRequest,
    final Object callerContext,
    final ImageRequest.RequestLevel requestLevel) {
  return new Supplier<DataSource<CloseableReference<CloseableImage>>>() {
    @Override
    public DataSource<CloseableReference<CloseableImage>> get() {
      return fetchDecodedImage(imageRequest, callerContext, requestLevel);
    }

    @Override
    public String toString() {
      return Objects.toStringHelper(this).add("uri", imageRequest.getSourceUri()).toString();
    }
  };
}
 
Example #2
Source File: FrescoVitoImageDecodeOptions.java    From fresco with MIT License 6 votes vote down vote up
@Override
public boolean equals(Object obj) {
  if (this == obj) {
    return false;
  }
  if (obj == null || getClass() != obj.getClass()) return false;

  FrescoVitoImageDecodeOptions that = (FrescoVitoImageDecodeOptions) obj;

  if (!Objects.equal(parentBounds, that.parentBounds)
      || !Objects.equal(focusPoint, that.focusPoint)
      || !Objects.equal(scaleType, that.scaleType)) {
    return false;
  }
  return super.equals(obj);
}
 
Example #3
Source File: ImageOptions.java    From fresco with MIT License 6 votes vote down vote up
@Override
protected Objects.ToStringHelper toStringHelper() {
  return super.toStringHelper()
      .add("placeholderRes", mPlaceholderRes)
      .add("placeholderDrawable", mPlaceholderDrawable)
      .add("placeholderScaleType", mPlaceholderScaleType)
      .add("placeholderFocusPoint", mPlaceholderFocusPoint)
      .add("placeholderApplyRoundingOptions", mPlaceholderApplyRoundingOptions)
      .add("progressRes", mProgressRes)
      .add("progressDrawable", mProgressDrawable)
      .add("progressScaleType", mProgressScaleType)
      .add("errorRes", mErrorRes)
      .add("errorScaleType", mErrorScaleType)
      .add("errorFocusPoint", mErrorFocusPoint)
      .add("actualImageColorFilter", mActualImageColorFilter)
      .add("overlayRes", mOverlayRes)
      .add("resizeToViewport", mResizeToViewport)
      .add("autoPlay", mAutoPlay)
      .add("fadeDurationMs", mFadeDurationMs);
}
 
Example #4
Source File: ImageRequest.java    From fresco with MIT License 6 votes vote down vote up
@Override
public int hashCode() {
  final CacheKey postprocessorCacheKey =
      mPostprocessor != null ? mPostprocessor.getPostprocessorCacheKey() : null;
  return Objects.hashCode(
      mCacheChoice,
      mSourceUri,
      mLocalThumbnailPreviewsEnabled,
      mBytesRange,
      mRequestPriority,
      mLowestPermittedRequestLevel,
      mIsDiskCacheEnabled,
      mIsMemoryCacheEnabled,
      mImageDecodeOptions,
      mDecodePrefetches,
      mResizeOptions,
      mRotationOptions,
      postprocessorCacheKey,
      mResizingAllowedOverride);
}
 
Example #5
Source File: ImageRequest.java    From fresco with MIT License 6 votes vote down vote up
@Override
public String toString() {
  return Objects.toStringHelper(this)
      .add("uri", mSourceUri)
      .add("cacheChoice", mCacheChoice)
      .add("decodeOptions", mImageDecodeOptions)
      .add("postprocessor", mPostprocessor)
      .add("priority", mRequestPriority)
      .add("resizeOptions", mResizeOptions)
      .add("rotationOptions", mRotationOptions)
      .add("bytesRange", mBytesRange)
      .add("resizingAllowedOverride", mResizingAllowedOverride)
      .add("progressiveRenderingEnabled", mProgressiveRenderingEnabled)
      .add("localThumbnailPreviewsEnabled", mLocalThumbnailPreviewsEnabled)
      .add("lowestPermittedRequestLevel", mLowestPermittedRequestLevel)
      .add("isDiskCacheEnabled", mIsDiskCacheEnabled)
      .add("isMemoryCacheEnabled", mIsMemoryCacheEnabled)
      .add("decodePrefetches", mDecodePrefetches)
      .toString();
}
 
Example #6
Source File: AbstractDraweeControllerBuilder.java    From FanXin-based-HuanXin with GNU General Public License v2.0 6 votes vote down vote up
/** Creates a data source supplier for the given image request. */
protected Supplier<DataSource<IMAGE>> getDataSourceSupplierForRequest(
    final REQUEST imageRequest,
    final boolean bitmapCacheOnly) {
  final Object callerContext = getCallerContext();
  return new Supplier<DataSource<IMAGE>>() {
    @Override
    public DataSource<IMAGE> get() {
      return getDataSourceForRequest(imageRequest, callerContext, bitmapCacheOnly);
    }
    @Override
    public String toString() {
      return Objects.toStringHelper(this)
          .add("request", imageRequest.toString())
          .toString();
    }
  };
}
 
Example #7
Source File: ImagePipeline.java    From fresco with MIT License 6 votes vote down vote up
/**
 * Returns a DataSource supplier that will on get submit the request for execution and return a
 * DataSource representing the pending results of the task.
 *
 * @param imageRequest the request to submit (what to execute).
 * @param callerContext the caller context of the caller of data source supplier
 * @param requestLevel which level to look down until for the image
 * @param requestListener additional image request listener independent of ImageRequest listeners
 * @return a DataSource representing pending results and completion of the request
 */
public Supplier<DataSource<CloseableReference<CloseableImage>>> getDataSourceSupplier(
    final ImageRequest imageRequest,
    final Object callerContext,
    final ImageRequest.RequestLevel requestLevel,
    final @Nullable RequestListener requestListener) {
  return new Supplier<DataSource<CloseableReference<CloseableImage>>>() {
    @Override
    public DataSource<CloseableReference<CloseableImage>> get() {
      return fetchDecodedImage(imageRequest, callerContext, requestLevel, requestListener);
    }

    @Override
    public String toString() {
      return Objects.toStringHelper(this).add("uri", imageRequest.getSourceUri()).toString();
    }
  };
}
 
Example #8
Source File: ImagePipeline.java    From FanXin-based-HuanXin with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a DataSource supplier that will on get submit the request for execution and return a
 * DataSource representing the pending results of the task.
 * @param imageRequest the request to submit (what to execute).
 * @param bitmapCacheOnly whether to only look for the image in the bitmap cache
 * @return a DataSource representing pending results and completion of the request
 */
public Supplier<DataSource<CloseableReference<CloseableImage>>> getDataSourceSupplier(
    final ImageRequest imageRequest,
    final Object callerContext,
    final boolean bitmapCacheOnly) {
  return new Supplier<DataSource<CloseableReference<CloseableImage>>>() {
    @Override
    public DataSource<CloseableReference<CloseableImage>> get() {
      if (bitmapCacheOnly) {
        return fetchImageFromBitmapCache(imageRequest, callerContext);
      } else {
        return fetchDecodedImage(imageRequest, callerContext);
      }
    }
    @Override
    public String toString() {
      return Objects.toStringHelper(this)
          .add("uri", imageRequest.getSourceUri())
          .toString();
    }
  };
}
 
Example #9
Source File: ImagePipeline.java    From fresco with MIT License 6 votes vote down vote up
/**
 * Returns a DataSource supplier that will on get submit the request for execution and return a
 * DataSource representing the pending results of the task.
 *
 * @param imageRequest the request to submit (what to execute).
 * @param callerContext the caller context of the caller of data source supplier
 * @param requestLevel which level to look down until for the image
 * @param requestListener additional image request listener independent of ImageRequest listeners
 * @param uiComponentId optional UI component ID requesting the image
 * @return a DataSource representing pending results and completion of the request
 */
public Supplier<DataSource<CloseableReference<CloseableImage>>> getDataSourceSupplier(
    final ImageRequest imageRequest,
    final Object callerContext,
    final ImageRequest.RequestLevel requestLevel,
    final @Nullable RequestListener requestListener,
    final @Nullable String uiComponentId) {
  return new Supplier<DataSource<CloseableReference<CloseableImage>>>() {
    @Override
    public DataSource<CloseableReference<CloseableImage>> get() {
      return fetchDecodedImage(
          imageRequest, callerContext, requestLevel, requestListener, uiComponentId);
    }

    @Override
    public String toString() {
      return Objects.toStringHelper(this).add("uri", imageRequest.getSourceUri()).toString();
    }
  };
}
 
Example #10
Source File: ImagePipeline.java    From fresco with MIT License 6 votes vote down vote up
/**
 * Returns a DataSource supplier that will on get submit the request for execution and return a
 * DataSource representing the pending results of the task.
 *
 * @param imageRequest the request to submit (what to execute).
 * @return a DataSource representing pending results and completion of the request
 */
public Supplier<DataSource<CloseableReference<PooledByteBuffer>>>
    getEncodedImageDataSourceSupplier(
        final ImageRequest imageRequest, final Object callerContext) {
  return new Supplier<DataSource<CloseableReference<PooledByteBuffer>>>() {
    @Override
    public DataSource<CloseableReference<PooledByteBuffer>> get() {
      return fetchEncodedImage(imageRequest, callerContext);
    }

    @Override
    public String toString() {
      return Objects.toStringHelper(this).add("uri", imageRequest.getSourceUri()).toString();
    }
  };
}
 
Example #11
Source File: AbstractDraweeControllerBuilder.java    From fresco with MIT License 6 votes vote down vote up
/** Creates a data source supplier for the given image request. */
protected Supplier<DataSource<IMAGE>> getDataSourceSupplierForRequest(
    final DraweeController controller,
    final String controllerId,
    final REQUEST imageRequest,
    final CacheLevel cacheLevel) {
  final Object callerContext = getCallerContext();
  return new Supplier<DataSource<IMAGE>>() {
    @Override
    public DataSource<IMAGE> get() {
      return getDataSourceForRequest(
          controller, controllerId, imageRequest, callerContext, cacheLevel);
    }

    @Override
    public String toString() {
      return Objects.toStringHelper(this).add("request", imageRequest.toString()).toString();
    }
  };
}
 
Example #12
Source File: ImageDecodeOptions.java    From fresco with MIT License 5 votes vote down vote up
protected Objects.ToStringHelper toStringHelper() {
  return Objects.toStringHelper(this)
      .add("minDecodeIntervalMs", minDecodeIntervalMs)
      .add("maxDimensionPx", maxDimensionPx)
      .add("decodePreviewFrame", decodePreviewFrame)
      .add("useLastFrameForPreview", useLastFrameForPreview)
      .add("decodeAllFrames", decodeAllFrames)
      .add("forceStaticImage", forceStaticImage)
      .add("bitmapConfigName", bitmapConfig.name())
      .add("customImageDecoder", customImageDecoder)
      .add("bitmapTransformation", bitmapTransformation)
      .add("colorSpace", colorSpace);
}
 
Example #13
Source File: DecodedImageOptions.java    From fresco with MIT License 5 votes vote down vote up
@Override
protected Objects.ToStringHelper toStringHelper() {
  return super.toStringHelper()
      .add("resizeOptions", mResizeOptions)
      .add("rotationOptions", mResizeOptions)
      .add("postprocessor", mPostprocessor)
      .add("imageDecodeOptions", mImageDecodeOptions)
      .add("roundingOptions", mRoundingOptions)
      .add("borderOptions", mBorderOptions)
      .add("actualImageScaleType", mActualImageScaleType)
      .add("actualImageFocusPoint", mActualImageFocusPoint)
      .add("localThumbnailPreviewsEnabled", mLocalThumbnailPreviewsEnabled)
      .add("bitmapConfig", mBitmapConfig);
}
 
Example #14
Source File: ImageOptions.java    From fresco with MIT License 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj == null || getClass() != obj.getClass()) return false;
  ImageOptions other = (ImageOptions) obj;
  if (mPlaceholderRes != other.mPlaceholderRes
      || !Objects.equal(mPlaceholderDrawable, other.mPlaceholderDrawable)
      || !Objects.equal(mPlaceholderScaleType, other.mPlaceholderScaleType)
      || !Objects.equal(mPlaceholderFocusPoint, other.mPlaceholderFocusPoint)
      || mPlaceholderApplyRoundingOptions != other.mPlaceholderApplyRoundingOptions
      || mErrorRes != other.mErrorRes
      || !Objects.equal(mErrorScaleType, other.mErrorScaleType)
      || !Objects.equal(mErrorFocusPoint, other.mErrorFocusPoint)
      || mOverlayRes != other.mOverlayRes
      || mProgressRes != other.mProgressRes
      || mProgressDrawable != other.mProgressDrawable
      || mProgressScaleType != other.mProgressScaleType
      || !Objects.equal(mActualImageColorFilter, other.mActualImageColorFilter)
      || mResizeToViewport != other.mResizeToViewport
      || mFadeDurationMs != other.mFadeDurationMs
      || mAutoPlay != other.mAutoPlay) {
    return false;
  }
  return equalDecodedOptions(other);
}
 
Example #15
Source File: DecodedImageOptions.java    From fresco with MIT License 5 votes vote down vote up
protected boolean equalDecodedOptions(DecodedImageOptions other) {
  if (!Objects.equal(mResizeOptions, other.mResizeOptions)
      || !Objects.equal(mRotationOptions, other.mRotationOptions)
      || !Objects.equal(mPostprocessor, other.mPostprocessor)
      || !Objects.equal(mImageDecodeOptions, other.mImageDecodeOptions)
      || !Objects.equal(mRoundingOptions, other.mRoundingOptions)
      || !Objects.equal(mBorderOptions, other.mBorderOptions)
      || !Objects.equal(mActualImageScaleType, other.mActualImageScaleType)
      || !Objects.equal(mActualImageFocusPoint, other.mActualImageFocusPoint)
      || mLocalThumbnailPreviewsEnabled != other.mLocalThumbnailPreviewsEnabled
      || !Objects.equal(mBitmapConfig, other.mBitmapConfig)) {
    return false;
  }
  return equalEncodedOptions(other);
}
 
Example #16
Source File: EncodedImageOptions.java    From fresco with MIT License 5 votes vote down vote up
protected boolean equalEncodedOptions(EncodedImageOptions other) {
  if (!Objects.equal(mPriority, other.mPriority)
      || !Objects.equal(mCacheChoice, other.mCacheChoice)) {
    return false;
  }
  return true;
}
 
Example #17
Source File: VitoImageRequest.java    From fresco with MIT License 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj == null || getClass() != obj.getClass()) return false;
  VitoImageRequest other = (VitoImageRequest) obj;
  return resources == other.resources
      && Objects.equal(imageSource, other.imageSource)
      && Objects.equal(imageOptions, other.imageOptions);
}
 
Example #18
Source File: RoundingOptions.java    From fresco with MIT License 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj == null || getClass() != obj.getClass()) {
    return false;
  }

  RoundingOptions that = (RoundingOptions) obj;
  return mIsCircular == that.mIsCircular
      && mCornerRadius == that.mCornerRadius
      && Objects.equal(mCornerRadii, that.mCornerRadii)
      && mAntiAliasing == that.mAntiAliasing;
}
 
Example #19
Source File: IncreasingQualityImageSource.java    From fresco with MIT License 5 votes vote down vote up
@Override
public String toString() {
  return Objects.toStringHelper(this)
      .add("lowRes", mLowResImageSource)
      .add("highRes", mHighResImageSource)
      .toString();
}
 
Example #20
Source File: FrescoVitoImageDecodeOptions.java    From fresco with MIT License 5 votes vote down vote up
@Override
protected Objects.ToStringHelper toStringHelper() {
  return super.toStringHelper()
      .add("parentBounds", parentBounds)
      .add("focusPoint", focusPoint)
      .add("scaleType", scaleType);
}
 
Example #21
Source File: ImageRequest.java    From fresco with MIT License 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (!(o instanceof ImageRequest)) {
    return false;
  }
  ImageRequest request = (ImageRequest) o;
  if (mLocalThumbnailPreviewsEnabled != request.mLocalThumbnailPreviewsEnabled) return false;
  if (mIsDiskCacheEnabled != request.mIsDiskCacheEnabled) return false;
  if (mIsMemoryCacheEnabled != request.mIsMemoryCacheEnabled) return false;
  if (!Objects.equal(mSourceUri, request.mSourceUri)
      || !Objects.equal(mCacheChoice, request.mCacheChoice)
      || !Objects.equal(mSourceFile, request.mSourceFile)
      || !Objects.equal(mBytesRange, request.mBytesRange)
      || !Objects.equal(mImageDecodeOptions, request.mImageDecodeOptions)
      || !Objects.equal(mResizeOptions, request.mResizeOptions)
      || !Objects.equal(mRequestPriority, request.mRequestPriority)
      || !Objects.equal(mLowestPermittedRequestLevel, request.mLowestPermittedRequestLevel)
      || !Objects.equal(mDecodePrefetches, request.mDecodePrefetches)
      || !Objects.equal(mResizingAllowedOverride, request.mResizingAllowedOverride)
      || !Objects.equal(mRotationOptions, request.mRotationOptions)) {
    return false;
  }
  final CacheKey thisPostprocessorKey =
      mPostprocessor != null ? mPostprocessor.getPostprocessorCacheKey() : null;
  final CacheKey thatPostprocessorKey =
      request.mPostprocessor != null ? request.mPostprocessor.getPostprocessorCacheKey() : null;
  return Objects.equal(thisPostprocessorKey, thatPostprocessorKey);
}
 
Example #22
Source File: BitmapMemoryCacheKey.java    From fresco with MIT License 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (!(o instanceof BitmapMemoryCacheKey)) {
    return false;
  }
  BitmapMemoryCacheKey otherKey = (BitmapMemoryCacheKey) o;
  return mHash == otherKey.mHash
      && mSourceString.equals(otherKey.mSourceString)
      && Objects.equal(this.mResizeOptions, otherKey.mResizeOptions)
      && Objects.equal(this.mRotationOptions, otherKey.mRotationOptions)
      && Objects.equal(mImageDecodeOptions, otherKey.mImageDecodeOptions)
      && Objects.equal(mPostprocessorCacheKey, otherKey.mPostprocessorCacheKey)
      && Objects.equal(mPostprocessorName, otherKey.mPostprocessorName);
}
 
Example #23
Source File: ImagePipelineFactory.java    From fresco with MIT License 5 votes vote down vote up
@Nullable
public String reportData() {
  return Objects.toStringHelper("ImagePipelineFactory")
      .add("bitmapCountingMemoryCache", mBitmapCountingMemoryCache.reportData())
      .add("encodedCountingMemoryCache", mEncodedCountingMemoryCache.reportData())
      .toString();
}
 
Example #24
Source File: DraweeHolder.java    From fresco with MIT License 5 votes vote down vote up
@Override
public String toString() {
  return Objects.toStringHelper(this)
      .add("controllerAttached", mIsControllerAttached)
      .add("holderAttached", mIsHolderAttached)
      .add("drawableVisible", mIsVisible)
      .add("events", mEventTracker.toString())
      .toString();
}
 
Example #25
Source File: ScaleTypeDrawable.java    From fresco with MIT License 5 votes vote down vote up
/**
 * Sets the scale type.
 *
 * @param scaleType scale type to set
 */
public void setScaleType(ScaleType scaleType) {
  if (Objects.equal(mScaleType, scaleType)) {
    return;
  }

  mScaleType = scaleType;
  mScaleTypeState = null;
  configureBounds();
  invalidateSelf();
}
 
Example #26
Source File: AbstractDraweeController.java    From fresco with MIT License 5 votes vote down vote up
@Override
public String toString() {
  return Objects.toStringHelper(this)
      .add("isAttached", mIsAttached)
      .add("isRequestSubmitted", mIsRequestSubmitted)
      .add("hasFetchFailed", mHasFetchFailed)
      .add("fetchedImage", getImageHash(mFetchedImage))
      .add("events", mEventTracker.toString())
      .toString();
}
 
Example #27
Source File: BitmapMemoryCacheKey.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (!(o instanceof BitmapMemoryCacheKey)) {
    return false;
  }

  BitmapMemoryCacheKey otherKey = (BitmapMemoryCacheKey) o;
  return mHash == otherKey.mHash &&
      mSourceString.equals(otherKey.mSourceString) &&
      Objects.equal(this.mResizeOptions, otherKey.mResizeOptions) &&
      mAutoRotated == otherKey.mAutoRotated &&
      Objects.equal(mImageDecodeOptions, otherKey.mImageDecodeOptions);
}
 
Example #28
Source File: DraweeHolder.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String toString() {
  return Objects.toStringHelper(this)
      .add("controllerAttached", mIsControllerAttached)
      .add("holderAttached", mIsHolderAttached)
      .add("drawableVisible", mIsVisible)
      .add("activityStarted", mIsActivityStarted)
      .add("events", mEventTracker.toString())
      .toString();
}
 
Example #29
Source File: AbstractDraweeController.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String toString() {
  return Objects.toStringHelper(this)
      .add("isAttached", mIsAttached)
      .add("isRequestSubmitted", mIsRequestSubmitted)
      .add("hasFetchFailed", mHasFetchFailed)
      .add("fetchedImage", getImageHash(mFetchedImage))
      .add("events", mEventTracker.toString())
      .toString();
}
 
Example #30
Source File: PipelineDraweeController.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String toString() {
  return Objects.toStringHelper(this)
      .add("super", super.toString())
      .add("dataSourceSupplier", mDataSourceSupplier)
      .toString();
}