@@ -1209,31 +1209,42 @@ public T apply(@NonNull BaseRequestOptions<?> o) {
1209
1209
return selfOrThrowIfLocked ();
1210
1210
}
1211
1211
1212
+ /**
1213
+ * Returns {@code true} if this {@link BaseRequestOptions} is equivalent to the given
1214
+ * {@link BaseRequestOptions} (has all of the same options and sizes).
1215
+ *
1216
+ * <p>This method is identical to {@link #equals(Object)}, but this can not be overridden. We need
1217
+ * to use this method instead of {@link #equals(Object)}, because child classes may have additional
1218
+ * fields, such as listeners and models, that should not be considered when checking for equality.
1219
+ */
1220
+ public final boolean isEquivalentTo (BaseRequestOptions <?> other ) {
1221
+ return Float .compare (other .sizeMultiplier , sizeMultiplier ) == 0
1222
+ && errorId == other .errorId
1223
+ && Util .bothNullOrEqual (errorPlaceholder , other .errorPlaceholder )
1224
+ && placeholderId == other .placeholderId
1225
+ && Util .bothNullOrEqual (placeholderDrawable , other .placeholderDrawable )
1226
+ && fallbackId == other .fallbackId
1227
+ && Util .bothNullOrEqual (fallbackDrawable , other .fallbackDrawable )
1228
+ && isCacheable == other .isCacheable
1229
+ && overrideHeight == other .overrideHeight
1230
+ && overrideWidth == other .overrideWidth
1231
+ && isTransformationRequired == other .isTransformationRequired
1232
+ && isTransformationAllowed == other .isTransformationAllowed
1233
+ && useUnlimitedSourceGeneratorsPool == other .useUnlimitedSourceGeneratorsPool
1234
+ && onlyRetrieveFromCache == other .onlyRetrieveFromCache
1235
+ && diskCacheStrategy .equals (other .diskCacheStrategy )
1236
+ && priority == other .priority
1237
+ && options .equals (other .options )
1238
+ && transformations .equals (other .transformations )
1239
+ && resourceClass .equals (other .resourceClass )
1240
+ && Util .bothNullOrEqual (signature , other .signature )
1241
+ && Util .bothNullOrEqual (theme , other .theme );
1242
+ }
1243
+
1212
1244
@ Override
1213
1245
public boolean equals (Object o ) {
1214
1246
if (o instanceof BaseRequestOptions <?>) {
1215
- BaseRequestOptions <?> other = (BaseRequestOptions <?>) o ;
1216
- return Float .compare (other .sizeMultiplier , sizeMultiplier ) == 0
1217
- && errorId == other .errorId
1218
- && Util .bothNullOrEqual (errorPlaceholder , other .errorPlaceholder )
1219
- && placeholderId == other .placeholderId
1220
- && Util .bothNullOrEqual (placeholderDrawable , other .placeholderDrawable )
1221
- && fallbackId == other .fallbackId
1222
- && Util .bothNullOrEqual (fallbackDrawable , other .fallbackDrawable )
1223
- && isCacheable == other .isCacheable
1224
- && overrideHeight == other .overrideHeight
1225
- && overrideWidth == other .overrideWidth
1226
- && isTransformationRequired == other .isTransformationRequired
1227
- && isTransformationAllowed == other .isTransformationAllowed
1228
- && useUnlimitedSourceGeneratorsPool == other .useUnlimitedSourceGeneratorsPool
1229
- && onlyRetrieveFromCache == other .onlyRetrieveFromCache
1230
- && diskCacheStrategy .equals (other .diskCacheStrategy )
1231
- && priority == other .priority
1232
- && options .equals (other .options )
1233
- && transformations .equals (other .transformations )
1234
- && resourceClass .equals (other .resourceClass )
1235
- && Util .bothNullOrEqual (signature , other .signature )
1236
- && Util .bothNullOrEqual (theme , other .theme );
1247
+ return isEquivalentTo ((BaseRequestOptions <?>) o );
1237
1248
}
1238
1249
return false ;
1239
1250
}
0 commit comments