package com.facebook.samples.zoomable; import android.content.Context; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.RectF; import android.graphics.drawable.Animatable; import android.util.AttributeSet; import android.view.GestureDetector; import android.view.MotionEvent; import androidx.annotation.Nullable; import androidx.core.view.ScrollingView; import c.f.g.c.c; import c.f.g.e.g; import c.f.g.e.v; import c.f.l.b.d; import c.f.l.b.e; import com.airbnb.lottie.parser.AnimatableValueParser; import com.facebook.drawee.controller.AbstractDraweeController; import com.facebook.drawee.controller.ControllerListener; import com.facebook.drawee.drawable.ScalingUtils$ScaleType; import com.facebook.drawee.generic.GenericDraweeHierarchy; import com.facebook.drawee.interfaces.DraweeController; import com.facebook.drawee.view.DraweeView; import java.util.Objects; public class ZoomableDraweeView extends DraweeView implements ScrollingView { public static final Class i = ZoomableDraweeView.class; public boolean j = false; public final RectF k = new RectF(); public final RectF l = new RectF(); public DraweeController m; public e n; public GestureDetector o; public boolean p = true; public final ControllerListener q = new a(); public final e.a r; /* renamed from: s reason: collision with root package name */ public final d f2197s; public class a extends c { public a() { } @Override // c.f.g.c.c, com.facebook.drawee.controller.ControllerListener public void onFinalImageSet(String str, @Nullable Object obj, @Nullable Animatable animatable) { ZoomableDraweeView zoomableDraweeView = ZoomableDraweeView.this; Class cls = ZoomableDraweeView.i; zoomableDraweeView.getLogTag(); zoomableDraweeView.hashCode(); int i = c.f.d.e.a.a; if (!((c.f.l.b.c) zoomableDraweeView.n).f508c) { zoomableDraweeView.b(); ((c.f.l.b.c) zoomableDraweeView.n).k(true); } } @Override // c.f.g.c.c, com.facebook.drawee.controller.ControllerListener public void onRelease(String str) { ZoomableDraweeView zoomableDraweeView = ZoomableDraweeView.this; Class cls = ZoomableDraweeView.i; zoomableDraweeView.getLogTag(); zoomableDraweeView.hashCode(); int i = c.f.d.e.a.a; ((c.f.l.b.c) zoomableDraweeView.n).k(false); } } public class b implements e.a { public b() { } } public ZoomableDraweeView(Context context, AttributeSet attributeSet) { super(context, attributeSet); b bVar = new b(); this.r = bVar; d dVar = new d(); this.f2197s = dVar; c.f.g.f.a aVar = new c.f.g.f.a(context.getResources()); ScalingUtils$ScaleType scalingUtils$ScaleType = ScalingUtils$ScaleType.a; aVar.n = v.l; AnimatableValueParser.J2(aVar, context, attributeSet); setAspectRatio(aVar.e); setHierarchy(aVar.a()); c.f.l.b.b bVar2 = new c.f.l.b.b(new c.f.l.a.b(new c.f.l.a.a())); this.n = bVar2; bVar2.b = bVar; this.o = new GestureDetector(getContext(), dVar); } public final void a(@Nullable DraweeController draweeController, @Nullable DraweeController draweeController2) { DraweeController controller = getController(); if (controller instanceof AbstractDraweeController) { ((AbstractDraweeController) controller).A(this.q); } if (draweeController instanceof AbstractDraweeController) { ((AbstractDraweeController) draweeController).f(this.q); } this.m = draweeController2; super.setController(draweeController); } public void b() { RectF rectF = this.k; g gVar = getHierarchy().f; Matrix matrix = g.i; gVar.n(matrix); rectF.set(gVar.getBounds()); matrix.mapRect(rectF); this.l.set(0.0f, 0.0f, (float) getWidth(), (float) getHeight()); e eVar = this.n; RectF rectF2 = this.k; c.f.l.b.c cVar = (c.f.l.b.c) eVar; if (!rectF2.equals(cVar.e)) { cVar.e.set(rectF2); cVar.i(); } e eVar2 = this.n; ((c.f.l.b.c) eVar2).d.set(this.l); c.f.d.e.a.j(getLogTag(), "updateZoomableControllerBounds: view %x, view bounds: %s, image bounds: %s", Integer.valueOf(hashCode()), this.l, this.k); } @Override // android.view.View, androidx.core.view.ScrollingView public int computeHorizontalScrollExtent() { return (int) ((c.f.l.b.c) this.n).d.width(); } @Override // android.view.View, androidx.core.view.ScrollingView public int computeHorizontalScrollOffset() { c.f.l.b.c cVar = (c.f.l.b.c) this.n; return (int) (cVar.d.left - cVar.f.left); } @Override // android.view.View, androidx.core.view.ScrollingView public int computeHorizontalScrollRange() { return (int) ((c.f.l.b.c) this.n).f.width(); } @Override // android.view.View, androidx.core.view.ScrollingView public int computeVerticalScrollExtent() { return (int) ((c.f.l.b.c) this.n).d.height(); } @Override // android.view.View, androidx.core.view.ScrollingView public int computeVerticalScrollOffset() { c.f.l.b.c cVar = (c.f.l.b.c) this.n; return (int) (cVar.d.top - cVar.f.top); } @Override // android.view.View, androidx.core.view.ScrollingView public int computeVerticalScrollRange() { return (int) ((c.f.l.b.c) this.n).f.height(); } public Class getLogTag() { return i; } public e getZoomableController() { return this.n; } @Override // android.widget.ImageView, android.view.View public void onDraw(Canvas canvas) { int save = canvas.save(); canvas.concat(((c.f.l.b.c) this.n).h); super.onDraw(canvas); canvas.restoreToCount(save); } @Override // android.view.View public void onLayout(boolean z2, int i2, int i3, int i4, int i5) { getLogTag(); hashCode(); int i6 = c.f.d.e.a.a; super.onLayout(z2, i2, i3, i4, i5); b(); } @Override // com.facebook.drawee.view.DraweeView, android.view.View public boolean onTouchEvent(MotionEvent motionEvent) { motionEvent.getActionMasked(); getLogTag(); hashCode(); int i2 = c.f.d.e.a.a; if (this.o.onTouchEvent(motionEvent)) { getLogTag(); hashCode(); return true; } if (this.j) { if (((c.f.l.b.c) this.n).h(motionEvent)) { return true; } } else if (((c.f.l.b.c) this.n).h(motionEvent)) { if ((!this.p && !this.n.a()) || (this.p && !((c.f.l.b.c) this.n).l)) { getParent().requestDisallowInterceptTouchEvent(true); } getLogTag(); hashCode(); return true; } if (super.onTouchEvent(motionEvent)) { getLogTag(); hashCode(); return true; } MotionEvent obtain = MotionEvent.obtain(motionEvent); obtain.setAction(3); this.o.onTouchEvent(obtain); ((c.f.l.b.c) this.n).h(obtain); obtain.recycle(); return false; } public void setAllowTouchInterceptionWhileZoomed(boolean z2) { this.p = z2; } @Override // com.facebook.drawee.view.DraweeView public void setController(@Nullable DraweeController draweeController) { a(null, null); ((c.f.l.b.c) this.n).k(false); a(draweeController, null); } public void setExperimentalSimpleTouchHandlingEnabled(boolean z2) { this.j = z2; } public void setIsLongpressEnabled(boolean z2) { this.o.setIsLongpressEnabled(z2); } public void setTapListener(@Nullable GestureDetector.SimpleOnGestureListener simpleOnGestureListener) { if (simpleOnGestureListener == null) { this.f2197s.i = new GestureDetector.SimpleOnGestureListener(); return; } this.f2197s.i = simpleOnGestureListener; } public void setZoomableController(e eVar) { Objects.requireNonNull(eVar); ((c.f.l.b.c) this.n).b = null; this.n = eVar; ((c.f.l.b.c) eVar).b = this.r; } }