Skip to content

Commit

Permalink
Added InflateHierarchyListener to GenericDraweeView
Browse files Browse the repository at this point in the history
Reviewed By: defHLT

Differential Revision: D50414811

fbshipit-source-id: 78f7dd85b0a35b03e9ac01b9365869042be8fbd0
  • Loading branch information
oprisnik authored and facebook-github-bot committed Oct 23, 2023
1 parent aab29ae commit 493316c
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
@Nullsafe(Nullsafe.Mode.LOCAL)
public class GenericDraweeView extends DraweeView<GenericDraweeHierarchy> {

private static @Nullable InflateHierarchyListener sInflateHierarchyListener;

public static void setInflateHierarchyListener(
@Nullable InflateHierarchyListener inflateHierarchyListener) {
sInflateHierarchyListener = inflateHierarchyListener;
}

public interface InflateHierarchyListener {
void onInflateHierarchy(
GenericDraweeView draweeview, Context context, @Nullable AttributeSet attrs);
}

public GenericDraweeView(Context context, GenericDraweeHierarchy hierarchy) {
super(context);
setHierarchy(hierarchy);
Expand Down Expand Up @@ -61,6 +73,9 @@ protected void inflateHierarchy(Context context, @Nullable AttributeSet attrs) {
GenericDraweeHierarchyInflater.inflateBuilder(context, attrs);
setAspectRatio(builder.getDesiredAspectRatio());
setHierarchy(builder.build());
if (sInflateHierarchyListener != null) {
sInflateHierarchyListener.onInflateHierarchy(this, context, attrs);
}
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
Expand Down

0 comments on commit 493316c

Please sign in to comment.