QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 HoverSniffLayout.java 源代码,内容仅作参考
package com.tencent.mtt.browser.plugin.ui;
import android.content.Context;
import android.graphics.Outline;
import android.os.Build;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewOutlineProvider;
import android.widget.FrameLayout;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.browser.setting.manager.SkinEventHub;
import com.tencent.mtt.browser.setting.manager.SkinManager;
import com.tencent.mtt.browser.setting.skin.ISkinChangeListener;
import com.tencent.mtt.browser.setting.skin.SkinChangeEvent;
import com.tencent.mtt.lottie.LottieAnimationView;
import com.tencent.mtt.lottie.RenderMode;
import com.tencent.mtt.newskin.badgeview.BadgeHelper;
import com.tencent.mtt.newskin.badgeview.IBadge;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
public class HoverSniffLayout extends FrameLayout implements View.OnClickListener, View.OnTouchListener, ISkinChangeListener {
public IBadge f43740a;
FrameLayout f43741b;
private LottieAnimationView f43742c;
private Runnable f43743d;
private boolean e;
private int f;
private int g;
private int h;
private int i;
private int j;
private float k;
private float l;
private int m;
private int n;
private float o;
private float p;
public HoverSniffLayout(Context context) {
super(context);
setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
this.f = ViewConfiguration.get(getContext()).getScaledTouchSlop();
this.f43742c = new LottieAnimationView(context);
this.f43742c.setOnClickListener(this);
this.f43742c.setOnTouchListener(this);
this.f43741b = new FrameLayout(context);
this.f43741b.setLayoutParams(new FrameLayout.LayoutParams(MttResources.s(52), MttResources.s(52)));
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(MttResources.s(50), MttResources.s(50));
this.f43742c.setBackgroundColor(-526345);
this.f43742c.setElevation(MttResources.s(1));
if (Build.VERSION.SDK_INT >= 28) {
this.f43742c.setOutlineAmbientShadowColor(855638016);
}
this.f43742c.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(0, 0, HoverSniffLayout.this.f43742c.getWidth(), HoverSniffLayout.this.f43742c.getHeight(), MttResources.s(25));
}
});
this.f43742c.setClipToOutline(true);
this.f43742c.setAnimationFromUrl("https://static.res.qq.com/nav/hoverSniff/hover_sniff.json");
layoutParams.gravity = 17;
this.f43741b.addView(this.f43742c, layoutParams);
addView(this.f43741b);
this.f43740a = BadgeHelper.a(this.f43741b);
}
private float a(float f) {
float width = this.f43741b.getWidth() / 2;
return f - width <= ((float) MttResources.s(110)) ? r0 + MttResources.s(110) : width + f >= ((float) (getHeight() - MttResources.s(65))) ? (getHeight() - r0) - MttResources.s(65) : f;
}
private float b(float f) {
float width = this.f43741b.getWidth() / 2;
return f - width <= ((float) MttResources.s(5)) ? r0 + MttResources.s(5) : width + f >= ((float) (getWidth() - MttResources.s(5))) ? (getWidth() - r0) - MttResources.s(5) : f;
}
private void b() {
requestLayout();
}
public void a() {
LottieAnimationView lottieAnimationView;
float f;
this.f43742c.setVisibility(0);
if (SkinManager.s().l()) {
lottieAnimationView = this.f43742c;
f = 0.2f;
} else {
lottieAnimationView = this.f43742c;
f = 1.0f;
}
lottieAnimationView.setAlpha(f);
this.f43742c.removeAllAnimatorListener();
if (Build.VERSION.SDK_INT == 24 || Build.VERSION.SDK_INT == 25) {
this.f43742c.setRenderMode(RenderMode.SOFTWARE);
}
this.f43742c.playAnimation();
}
public void a(boolean z, float f, float f2) {
Runnable runnable;
if (z) {
this.e = false;
b();
} else {
if (Math.abs(this.k - f) >= this.o / 2.0f || Math.abs(this.l - f2) >= this.p / 2.0f || (runnable = this.f43743d) == null) {
return;
}
runnable.run();
}
}
public void a(boolean z, String str) {
a(z, str, MttResources.s(0), MttResources.s(0));
}
public void a(boolean z, String str, int i, int i2) {
a(z, str, i, i2, 1);
}
public void a(boolean z, String str, int i, int i2, int i3) {
if (z) {
this.f43740a.b(i2).a(i).a(str);
} else {
this.f43740a.b();
}
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
SkinEventHub.a().b(this);
}
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
this.f43743d.run();
EventCollector.getInstance().onViewClicked(view);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
SkinEventHub.a().a(this);
}
@Override
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
if (this.m <= 0) {
this.m = getWidth() - MttResources.s(75);
this.n = getHeight() - MttResources.s(190);
int i5 = this.m;
this.g = i5;
this.h = i5 + this.f43741b.getWidth();
int i6 = this.n;
this.i = i6;
this.j = i6 + this.f43741b.getWidth();
}
this.f43741b.layout(this.g, this.i, this.h, this.j);
}
@Override
public void onSkinChanged(SkinChangeEvent skinChangeEvent) {
LottieAnimationView lottieAnimationView;
float f;
if (SkinManager.s().l()) {
lottieAnimationView = this.f43742c;
f = 0.2f;
} else {
lottieAnimationView = this.f43742c;
f = 1.0f;
}
lottieAnimationView.setAlpha(f);
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (isEnabled()) {
int action = motionEvent.getAction();
if (action == 0) {
this.o = this.f43741b.getWidth();
this.p = this.f43741b.getHeight();
this.k = motionEvent.getRawX();
this.l = motionEvent.getRawY();
} else if (action == 1) {
a(this.e, motionEvent.getRawX(), motionEvent.getRawY());
} else {
if (action != 2 || (Math.abs(this.k - motionEvent.getRawX()) < this.f && Math.abs(this.l - motionEvent.getRawY()) < this.f)) {
return true;
}
this.e = true;
float b2 = b(motionEvent.getRawX());
float a2 = a(motionEvent.getRawY());
double d2 = b2;
this.g = (int) (d2 - (this.f43741b.getWidth() / 2.0d));
this.h = (int) (d2 + (this.f43741b.getWidth() / 2.0d));
double d3 = a2;
this.i = (int) (d3 - (this.f43741b.getHeight() / 2.0d));
this.j = (int) (d3 + (this.f43741b.getHeight() / 2.0d));
requestLayout();
}
}
return true;
}
public void setClickListener(Runnable runnable) {
this.f43743d = runnable;
}
public void setNeedTopRightIcon(boolean z) {
a(z, null);
}
}