QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 MainNotificationRepairView.java 源代码,内容仅作参考
package com.tencent.mtt.external.setting;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.base.functionwindow.MttFunctionwindowProxy;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.base.utils.permission.PermissionUtils;
import com.tencent.mtt.browser.push.facade.IPushNotificationDialogService;
import com.tencent.mtt.external.setting.facade.SettingView;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.mtt.newskin.viewBuilder.IImageBuilder;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.setting.MultiProcessSettingManager;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.view.dialog.alert.NewQBAlertDialogBuilder;
import com.tencent.mtt.view.dialog.alert.QBGuideAlertDialog;
import com.tencent.mtt.view.dialog.newui.SimpleDialogBuilder;
import com.tencent.mtt.view.dialog.newui.dialog.DialogBase;
import com.tencent.mtt.view.dialog.newui.view.ViewOnClickListener;
import com.tencent.mtt.view.setting.SettingItem;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import qb.a.e;
import qb.a.f;
import qb.a.g;
final class MainNotificationRepairView extends SettingView implements View.OnClickListener {
private static final String[] f59475a = {"vivo_notif_guide_dlg_content.png", "vivo_highpower_guide_dlg_content.png", "notificationrepair_guide_dlg_bg.png"};
private static final String[] f59476b = {"oppo_notif_guide_dlg_content.png", "oppo_highpower_guide_dlg_content.png", "notificationrepair_guide_dlg_bg.png"};
private static final String[] f59477c = {"https://res.imtt.qq.com/push_sys/push/vivo_notification_guide_dlg_gif.gif", "https://res.imtt.qq.com/push_sys/push/vivo_highpower_guide_dlg_gif.gif"};
private static final String[] f59478d = {"https://res.imtt.qq.com/push_sys/push/oppo_notification_guide_dlg_gif.gif", "https://res.imtt.qq.com/push_sys/push/oppo_highpower_guide_dlg_gif.gif"};
private static final String e = MttResources.l(R.string.avm);
private static final String f = MttResources.l(R.string.avl);
private static final int g = MttResources.c(e.f);
private static final int h = MttResources.c(R.color.theme_color_setting_item_explain_text);
private ImageView i;
private SettingItem j;
private TextView k;
private SettingItem l;
private TextView m;
private TextView n;
private boolean o;
public MainNotificationRepairView(Context context, Bundle bundle, MttFunctionwindowProxy mttFunctionwindowProxy) {
super(context);
this.o = MultiProcessSettingManager.a().getBoolean("is_highpower_consumption_enabled", false);
e();
a("_0");
}
private void a(final Context context, final boolean z) {
String str;
String str2;
int i;
String l;
boolean z2;
if (DeviceUtils.aC) {
String[] strArr = f59476b;
str = z ? strArr[0] : strArr[1];
String[] strArr2 = f59478d;
str2 = z ? strArr2[0] : strArr2[1];
} else if (DeviceUtils.t) {
String[] strArr3 = f59475a;
str = z ? strArr3[0] : strArr3[1];
String[] strArr4 = f59477c;
str2 = z ? strArr4[0] : strArr4[1];
} else {
str = "";
str2 = null;
}
String str3 = str;
String str4 = str2;
if (z) {
i = R.string.ai9;
} else {
if (DeviceUtils.aC) {
l = MttResources.l(R.string.ai_);
z2 = true;
final QBGuideAlertDialog a2 = new NewQBAlertDialogBuilder().a("立即设置", 13).a(context, f59475a[2], str3, l, str4, z2);
a2.a(new View.OnClickListener() {
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
if (view.getId() == 105) {
MainNotificationRepairView.this.a(z ? "_12" : "_22");
if (!z) {
MainNotificationRepairView.this.o = true;
}
MainNotificationRepairView.this.b(context, z);
}
a2.dismiss();
EventCollector.getInstance().onViewClicked(view);
}
});
a2.show();
}
i = R.string.ai8;
}
l = MttResources.l(i);
z2 = false;
final QBGuideAlertDialog a22 = new NewQBAlertDialogBuilder().a("立即设置", 13).a(context, f59475a[2], str3, l, str4, z2);
a22.a(new View.OnClickListener() {
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
if (view.getId() == 105) {
MainNotificationRepairView.this.a(z ? "_12" : "_22");
if (!z) {
MainNotificationRepairView.this.o = true;
}
MainNotificationRepairView.this.b(context, z);
}
a22.dismiss();
EventCollector.getInstance().onViewClicked(view);
}
});
a22.show();
}
public void a(String str) {
String str2 = DeviceUtils.aC ? "CB706" : DeviceUtils.t ? "CB906" : null;
if (str2 == null || str == null) {
return;
}
StatManager.b().c(str2 + str);
}
private boolean a(String[] strArr) {
for (String str : strArr) {
if (!b(str)) {
return false;
}
}
return true;
}
public void b(Context context, boolean z) {
Intent intent;
try {
String str = "app_name";
if (DeviceUtils.aC) {
intent = new Intent();
intent.setComponent(z ? new ComponentName("com.coloros.notificationmanager", "com.coloros.notificationmanager.AppDetailPreferenceActivity") : new ComponentName("com.coloros.oppoguardelf", "com.coloros.powermanager.fuelgaue.PowerAppsBgSetting"));
if ((DeviceUtils.aF || DeviceUtils.aG) && !z) {
intent.putExtra("pkgName", "com.tencent.mtt");
str = "title";
} else {
intent.putExtra("pkg_name", "com.tencent.mtt");
}
intent.putExtra(str, "QQ浏览器");
intent.putExtra("class_name", "com.tencent.mtt.SplashActivity");
} else {
if (!DeviceUtils.t) {
return;
}
if (z) {
intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.setData(Uri.fromParts("package", context.getPackageName(), null));
} else {
intent = new Intent();
intent.setComponent(new ComponentName("com.vivo.abe", "com.vivo.applicationbehaviorengine.ui.ExcessivePowerManagerActivity"));
intent.putExtra("pkg_name", "com.tencent.mtt");
intent.putExtra("app_name", "QQ浏览器");
intent.putExtra("class_name", "com.tencent.mtt.SplashActivity");
}
}
intent.setFlags(268435456);
context.startActivity(intent);
} catch (Exception unused) {
Intent intent2 = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
intent2.setData(Uri.fromParts("package", context.getPackageName(), null));
context.startActivity(intent2);
}
}
private boolean b(String str) {
File[] listFiles = ((IPushNotificationDialogService) QBContext.getInstance().getService(IPushNotificationDialogService.class)).getPushDir().listFiles();
if (listFiles != null) {
int i = 0;
while (i < listFiles.length && !str.equals(listFiles[i].getName())) {
i++;
}
if (i < listFiles.length) {
return true;
}
}
return false;
}
public void f() {
SimpleDialogBuilder.e().e("后台保护是否已经开启?").a("已开启").c("未开启").a_(new ViewOnClickListener() {
@Override
public void onClick(View view, DialogBase dialogBase) {
dialogBase.dismiss();
MultiProcessSettingManager.a().setBoolean("is_highpower_consumption_enabled", true);
MainNotificationRepairView.this.o = true;
MainNotificationRepairView.this.e();
}
}).c(new ViewOnClickListener() {
@Override
public void onClick(View view, DialogBase dialogBase) {
dialogBase.dismiss();
MultiProcessSettingManager.a().setBoolean("is_highpower_consumption_enabled", false);
MainNotificationRepairView.this.o = false;
MainNotificationRepairView.this.e();
}
}).e();
}
@Override
public void b() {
super.b();
e();
}
@Override
public boolean ce_() {
if (PermissionUtils.a(getContext())) {
a("_13");
}
if (MultiProcessSettingManager.a().getBoolean("is_highpower_consumption_enabled", false)) {
a("_23");
}
return super.ce_();
}
@Override
public void d() {
super.d();
e();
if (MultiProcessSettingManager.a().getBoolean("is_highpower_consumption_dialog_show", false) || !this.o) {
return;
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
MultiProcessSettingManager.a().setBoolean("is_highpower_consumption_dialog_show", true);
MainNotificationRepairView.this.f();
}
}, 300L);
}
void e() {
TextView textView;
PublicSettingManager a2;
String l;
String string;
TextView textView2;
PublicSettingManager a3;
String l2;
String string2;
IImageBuilder g2;
InputStream inputStream;
if (this.i == null) {
this.i = new ImageView(getContext());
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(MttResources.g(f.bx), MttResources.g(f.bx));
layoutParams.topMargin = MttResources.g(f.v);
layoutParams.gravity = 17;
this.i.setLayoutParams(layoutParams);
this.i.setScaleType(ImageView.ScaleType.FIT_XY);
if (b("notificationrepair_view_logo.png")) {
InputStream inputStream2 = null;
r2 = null;
Bitmap bitmap = null;
try {
inputStream = ContextHolder.getAppContext().getContentResolver().openInputStream(Uri.fromFile(new File(((IPushNotificationDialogService) QBContext.getInstance().getService(IPushNotificationDialogService.class)).getPushDir().getPath() + File.separator + "notificationrepair_view_logo.png")));
} catch (FileNotFoundException unused) {
inputStream = null;
} catch (Throwable th) {
th = th;
}
try {
bitmap = BitmapFactory.decodeStream(inputStream);
} catch (FileNotFoundException unused2) {
} catch (Throwable th2) {
th = th2;
inputStream2 = inputStream;
if (inputStream2 != null) {
try {
inputStream2.close();
} catch (Exception unused3) {
}
}
throw th;
}
} else {
((IPushNotificationDialogService) QBContext.getInstance().getService(IPushNotificationDialogService.class)).downLoadNotifPic();
g2 = SimpleSkinBuilder.a(this.i).g(g.bW);
}
g2.f();
addView(this.i);
}
if (this.n != null) {
this.n = new TextView(getContext());
FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-1, -2);
int h2 = MttResources.h(f.cT);
layoutParams2.setMargins(h2, 0, h2, 0);
this.n.setLayoutParams(layoutParams2);
this.n.setGravity(17);
this.n.setPadding(0, MttResources.h(f.z), 0, MttResources.h(f.z));
this.n.setTextSize(0, MttResources.h(f.da));
SimpleSkinBuilder.a(this.n).g(e.f85871a).f();
this.n.setTypeface(Typeface.DEFAULT_BOLD);
if (PermissionUtils.a(getContext()) && MultiProcessSettingManager.a().getBoolean("is_highpower_consumption_enabled", false)) {
textView2 = this.n;
string2 = PublicSettingManager.a().getString("key_notif_repair_view_content", "");
} else {
if (PermissionUtils.a(getContext()) || MultiProcessSettingManager.a().getBoolean("is_highpower_consumption_enabled", false)) {
textView2 = this.n;
a3 = PublicSettingManager.a();
l2 = MttResources.l(R.string.aij);
} else {
textView2 = this.n;
a3 = PublicSettingManager.a();
l2 = MttResources.l(R.string.aik);
}
string2 = a3.getString("key_notif_repair_view_content", l2);
}
textView2.setText(string2);
addView(this.n);
} else {
if (PermissionUtils.a(getContext()) && MultiProcessSettingManager.a().getBoolean("is_highpower_consumption_enabled", false)) {
textView = this.n;
string = PublicSettingManager.a().getString("key_notif_repair_view_content", "");
} else {
if (PermissionUtils.a(getContext()) || MultiProcessSettingManager.a().getBoolean("is_highpower_consumption_enabled", false)) {
textView = this.n;
a2 = PublicSettingManager.a();
l = MttResources.l(R.string.aij);
} else {
textView = this.n;
a2 = PublicSettingManager.a();
l = MttResources.l(R.string.aik);
}
string = a2.getString("key_notif_repair_view_content", l);
}
textView.setText(string);
}
if (this.j != null) {
this.j = new SettingItem(getContext(), 100, this.D);
this.j.setId(0);
this.j.setOnClickListener(this);
this.j.setMainText(PublicSettingManager.a().getString("key_notif_repair_view_setitem_1_main", MttResources.l(R.string.aio)));
if (PermissionUtils.a(getContext())) {
this.j.a(e, h);
this.j.setEnabled(false);
} else {
this.j.a(f, g);
this.j.setEnabled(true);
}
addView(this.j);
} else if (PermissionUtils.a(getContext())) {
this.j.a(e, h);
this.j.setEnabled(false);
} else {
this.j.a(f, g);
this.j.setEnabled(true);
}
if (this.k == null) {
this.k = new TextView(getContext());
this.k.setTextSize(0, MttResources.h(f.cD));
this.k.setText(PublicSettingManager.a().getString("key_notif_repair_view_setitem_1_second", MttResources.l(R.string.aip)));
LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, -2);
this.k.setLayoutParams(layoutParams3);
layoutParams3.setMargins(MttResources.h(f.cT), MttResources.h(R.dimen.a3q), 0, MttResources.h(R.dimen.a3q));
this.k.setGravity(3);
this.k.setTextColor(MttResources.c(e.M));
addView(this.k);
}
if (this.l != null) {
this.l = new SettingItem(getContext(), 102, this.D);
this.l.setId(1);
this.l.setOnClickListener(this);
this.l.setMainText(PublicSettingManager.a().getString("key_notif_repair_view_setitem_2_main", MttResources.l(R.string.aiq)));
if (MultiProcessSettingManager.a().getBoolean("is_highpower_consumption_enabled", false)) {
this.l.a(e, h);
this.l.setEnabled(false);
} else {
this.l.a(f, g);
this.l.setEnabled(true);
}
addView(this.l);
} else if (MultiProcessSettingManager.a().getBoolean("is_highpower_consumption_enabled", false)) {
this.l.a(e, h);
this.l.setEnabled(false);
} else {
this.l.a(f, g);
this.l.setEnabled(true);
}
if (this.m != null) {
this.m = new TextView(getContext());
this.m.setTextSize(0, MttResources.h(f.cD));
this.m.setText(PublicSettingManager.a().getString("key_notif_repair_view_setitem_2_second", MttResources.l(R.string.air)));
LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams(-1, -2);
this.m.setLayoutParams(layoutParams4);
layoutParams4.setMargins(MttResources.h(f.cT), MttResources.h(R.dimen.a3q), 0, 0);
this.m.setGravity(3);
this.m.setTextColor(MttResources.c(e.M));
addView(this.m);
}
}
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis - this.C > 300) {
this.C = currentTimeMillis;
int id = view.getId();
if (id == 0) {
a("_11");
if (a(f59475a) || a(f59476b)) {
a(getContext(), true);
} else {
b(getContext(), true);
((IPushNotificationDialogService) QBContext.getInstance().getService(IPushNotificationDialogService.class)).downLoadNotifPic();
}
} else if (id == 1) {
a("_21");
if (a(f59475a) || a(f59476b)) {
a(getContext(), false);
} else {
b(getContext(), false);
((IPushNotificationDialogService) QBContext.getInstance().getService(IPushNotificationDialogService.class)).downLoadNotifPic();
this.o = true;
}
}
}
EventCollector.getInstance().onViewClicked(view);
}
}