NetCapture v2.1.82021972349版本的 MD5 值为:dfbd8054127041af5d65fa43eaf2e1d0
以下内容为反编译后的 MainCaptureActivity.java 源代码,内容仅作参考
package com.minhui.networkcapture;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.navigation.ActivityKt;
import androidx.navigation.NavController;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavControllerKt;
import androidx.navigation.ui.NavigationViewKt;
import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog;
import com.google.android.material.navigation.NavigationView;
import com.minhui.networkcapture.ads.AdsConstant;
import com.minhui.networkcapture.ads.banner.MyAdsView;
import com.minhui.networkcapture.ads.interstitial.InterstitialManager;
import com.minhui.networkcapture.base.BaseActivity;
import com.minhui.networkcapture.copyright.CopyRightCheckManager;
import com.minhui.networkcapture.event.FloatOpenEvent;
import com.minhui.networkcapture.floatview.FloatViewService;
import com.minhui.networkcapture.ui.CaptureFilterActivity;
import com.minhui.networkcapture.ui.SearchActivity;
import com.minhui.networkcapture.utils.AppConstants;
import com.minhui.networkcapture.utils.ContextUtil;
import com.minhui.vpn.ProxyConfig;
import com.minhui.vpn.VpnServiceHelper;
import com.minhui.vpn.certificate.CertificateManager;
import com.minhui.vpn.log.VPNLog;
import com.minhui.vpn.service.CaptureVpnService;
import com.minhui.vpn.signcheck.SignCheckManager;
import java.util.HashMap;
import java.util.Set;
import kotlin.Metadata;
import kotlin.TypeCastException;
import kotlin.collections.SetsKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import org.greenrobot.eventbus.EventBus;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000d\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\f\b\u0007\u0018\u0000 :2\u00020\u0001:\u0001:B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u001c\u001a\u00020\u001dH\u0002J\b\u0010\u001e\u001a\u00020\u001dH\u0002J\b\u0010\u001f\u001a\u00020\u0006H\u0014J\b\u0010 \u001a\u00020\u001dH\u0002J\b\u0010!\u001a\u00020\fH\u0014J\"\u0010\"\u001a\u00020\u001d2\u0006\u0010#\u001a\u00020\u00062\u0006\u0010$\u001a\u00020\u00062\b\u0010%\u001a\u0004\u0018\u00010&H\u0014J\u0012\u0010'\u001a\u00020\u001d2\b\u0010(\u001a\u0004\u0018\u00010)H\u0014J\u0010\u0010*\u001a\u00020\f2\u0006\u0010+\u001a\u00020,H\u0016J\u0010\u0010-\u001a\u00020\f2\u0006\u0010.\u001a\u00020/H\u0016J\b\u00100\u001a\u00020\fH\u0016J\b\u00101\u001a\u00020\u001dH\u0002J\b\u00102\u001a\u00020\u001dH\u0002J\b\u00103\u001a\u00020\u001dH\u0002J\b\u00104\u001a\u00020\u001dH\u0002J\u0006\u00105\u001a\u00020\u001dJ\b\u00106\u001a\u00020\u001dH\u0002J\b\u00107\u001a\u00020\u001dH\u0002J\b\u00108\u001a\u00020\u001dH\u0002J\b\u00109\u001a\u00020\u001dH\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082D¢\u0006\u0002\n\u0000R\u0014\u0010\u0005\u001a\u00020\u0006X\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\bR\u000e\u0010\t\u001a\u00020\nX\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\u000e\u001a\u00020\fX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000e\u0010\u000f\"\u0004\b\u0010\u0010\u0011R\u000e\u0010\u0012\u001a\u00020\u0013X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0014\u001a\u00020\u0015X\u0082.¢\u0006\u0002\n\u0000R\u001a\u0010\u0016\u001a\u00020\u0017X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0018\u0010\u0019\"\u0004\b\u001a\u0010\u001b¨\u0006;"}, d2 = {"Lcom/minhui/networkcapture/MainCaptureActivity;", "Lcom/minhui/networkcapture/base/BaseActivity;", "()V", "ONE_HOUR", "", "REQUEST_CERT", "", "getREQUEST_CERT", "()I", "appBarConfiguration", "Landroidx/navigation/ui/AppBarConfiguration;", "hasAskInstallCert", "", "hasAskOpenFloat", "isNotAskFloat", "()Z", "setNotAskFloat", "(Z)V", "sharedPreferences", "Landroid/content/SharedPreferences;", "vpnButton", "Landroid/widget/TextView;", "vpnStatusListener", "Lcom/minhui/vpn/ProxyConfig$VpnStatusListener;", "getVpnStatusListener", "()Lcom/minhui/vpn/ProxyConfig$VpnStatusListener;", "setVpnStatusListener", "(Lcom/minhui/vpn/ProxyConfig$VpnStatusListener;)V", "checkReview", "", "closeVpn", "getLayout", "initAdas", "isMainActivity", "onActivityResult", "requestCode", "resultCode", "data", "Landroid/content/Intent;", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onCreateOptionsMenu", "menu", "Landroid/view/Menu;", "onOptionsItemSelected", "item", "Landroid/view/MenuItem;", "onSupportNavigateUp", "openFloatAndOpenVpn", "performOpenVpn", "showGotoStarDialog", "showInstallCertDialog", "showNeedFloatOpenDialog", "showOpenFloatDialog", "showRecommend", "showSolveProblemDialog", "startVPN", "Companion", "app_nogoogleplay_no_prpRelease"}, k = 1, mv = {1, 1, 16})
public final class MainCaptureActivity extends BaseActivity {
public static final String LOG_TAG = "MainCaptureActivity";
public static final int OVERLAY_PERMISSION_REQ_CODE = 106;
private HashMap _$_findViewCache;
private AppBarConfiguration appBarConfiguration;
private boolean hasAskInstallCert;
private boolean hasAskOpenFloat;
private boolean isNotAskFloat;
private SharedPreferences sharedPreferences;
private TextView vpnButton;
private final int REQUEST_CERT = 105;
private final long ONE_HOUR = 86400000;
private ProxyConfig.VpnStatusListener vpnStatusListener = new MainCaptureActivity$vpnStatusListener$1(this);
public void _$_clearFindViewByIdCache() {
HashMap hashMap = this._$_findViewCache;
if (hashMap != null) {
hashMap.clear();
}
}
public View _$_findCachedViewById(int i) {
if (this._$_findViewCache == null) {
this._$_findViewCache = new HashMap();
}
View view = (View) this._$_findViewCache.get(Integer.valueOf(i));
if (view != null) {
return view;
}
View findViewById = findViewById(i);
this._$_findViewCache.put(Integer.valueOf(i), findViewById);
return findViewById;
}
@Override
protected int getLayout() {
return R.layout.activity_main_capture;
}
@Override
protected boolean isMainActivity() {
return true;
}
public static final SharedPreferences access$getSharedPreferences$p(MainCaptureActivity mainCaptureActivity) {
SharedPreferences sharedPreferences = mainCaptureActivity.sharedPreferences;
if (sharedPreferences == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
}
return sharedPreferences;
}
public static final TextView access$getVpnButton$p(MainCaptureActivity mainCaptureActivity) {
TextView textView = mainCaptureActivity.vpnButton;
if (textView == null) {
Intrinsics.throwUninitializedPropertyAccessException("vpnButton");
}
return textView;
}
public final int getREQUEST_CERT() {
return this.REQUEST_CERT;
}
public final ProxyConfig.VpnStatusListener getVpnStatusListener() {
return this.vpnStatusListener;
}
public final void setVpnStatusListener(ProxyConfig.VpnStatusListener vpnStatusListener) {
Intrinsics.checkParameterIsNotNull(vpnStatusListener, "<set-?>");
this.vpnStatusListener = vpnStatusListener;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View findViewById = findViewById(R.id.toolbar);
Intrinsics.checkExpressionValueIsNotNull(findViewById, "findViewById(R.id.toolbar)");
setSupportActionBar((Toolbar) findViewById);
View findViewById2 = findViewById(R.id.run_state);
if (findViewById2 == null) {
throw new TypeCastException("null cannot be cast to non-null type android.widget.TextView");
}
TextView textView = (TextView) findViewById2;
this.vpnButton = textView;
if (textView == null) {
Intrinsics.throwUninitializedPropertyAccessException("vpnButton");
}
textView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
if (VpnServiceHelper.vpnRunningStatus()) {
MainCaptureActivity.this.closeVpn();
} else {
MainCaptureActivity.this.performOpenVpn();
}
}
});
SharedPreferences sharedPreferences = getSharedPreferences(AppConstants.DATA_SAVE, 0);
Intrinsics.checkExpressionValueIsNotNull(sharedPreferences, "getSharedPreferences(App…VE, Context.MODE_PRIVATE)");
this.sharedPreferences = sharedPreferences;
View findViewById3 = findViewById(R.id.drawer_layout);
Intrinsics.checkExpressionValueIsNotNull(findViewById3, "findViewById(R.id.drawer_layout)");
View findViewById4 = findViewById(R.id.nav_view);
Intrinsics.checkExpressionValueIsNotNull(findViewById4, "findViewById(R.id.nav_view)");
NavigationView navigationView = (NavigationView) findViewById4;
NavController findNavController = ActivityKt.findNavController(this, R.id.nav_host_fragment);
Set of = SetsKt.setOf((Object[]) new Integer[]{Integer.valueOf(R.id.nav_home), Integer.valueOf(R.id.nav_history), Integer.valueOf(R.id.nav_setting)});
final MainCaptureActivity$onCreate$$inlined$AppBarConfiguration$1 mainCaptureActivity$onCreate$$inlined$AppBarConfiguration$1 = new Function0<Boolean>() {
@Override
public Boolean invoke() {
return Boolean.valueOf(invoke2());
}
public final boolean invoke2() {
return false;
}
};
AppBarConfiguration build = new AppBarConfiguration.Builder((Set<Integer>) of).setDrawerLayout((DrawerLayout) findViewById3).setFallbackOnNavigateUpListener(new AppBarConfiguration.OnNavigateUpListener() {
@Override
public final boolean onNavigateUp() {
Object invoke = Function0.this.invoke();
Intrinsics.checkExpressionValueIsNotNull(invoke, "invoke(...)");
return ((Boolean) invoke).booleanValue();
}
}).build();
Intrinsics.checkExpressionValueIsNotNull(build, "AppBarConfiguration.Buil…eUpListener)\n .build()");
this.appBarConfiguration = build;
if (build == null) {
Intrinsics.throwUninitializedPropertyAccessException("appBarConfiguration");
}
androidx.navigation.ui.ActivityKt.setupActionBarWithNavController(this, findNavController, build);
NavigationViewKt.setupWithNavController(navigationView, findNavController);
this.handler = new Handler();
if (ContextUtil.isProVersion(getApplicationContext())) {
checkReview();
} else {
recommendPro(getString(R.string.pro_recommend));
}
SharedPreferences sharedPreferences2 = this.sharedPreferences;
if (sharedPreferences2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
}
if (sharedPreferences2.getBoolean(AppConstants.ENABLE_FLOATING_WINDOW, false)) {
FloatViewService.startService(getApplicationContext());
}
MainCaptureActivity mainCaptureActivity = this;
SignCheckManager.instance.check(mainCaptureActivity);
if (ContextUtil.isGooglePlayChannel(getApplicationContext()) && ContextUtil.isProVersion(getApplicationContext())) {
SharedPreferences sharedPreferences3 = this.sharedPreferences;
if (sharedPreferences3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
}
if (sharedPreferences3.getBoolean(AppConstants.HAS_OPEN_CAPTURE, false)) {
new CopyRightCheckManager(mainCaptureActivity).doCheck();
} else {
SharedPreferences sharedPreferences4 = this.sharedPreferences;
if (sharedPreferences4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
}
sharedPreferences4.edit().putBoolean(AppConstants.HAS_OPEN_CAPTURE, true).apply();
}
}
ProxyConfig.Instance.registerVpnStatusListener(this.vpnStatusListener);
initAdas();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 2015 && resultCode == -1) {
VpnServiceHelper.startVpnService(getApplicationContext());
return;
}
if (requestCode == this.REQUEST_CERT && resultCode == -1) {
SharedPreferences sharedPreferences = this.sharedPreferences;
if (sharedPreferences == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
}
sharedPreferences.edit().putBoolean(AppConstants.HAS_INSTALL_ROOT_CERTIFICATE, true).apply();
performOpenVpn();
return;
}
if (requestCode == 106) {
if (Build.VERSION.SDK_INT >= 23) {
if (Settings.canDrawOverlays(getApplicationContext())) {
openFloatAndOpenVpn();
return;
}
return;
}
performOpenVpn();
}
}
private final void initAdas() {
this.handler.postDelayed(new Runnable() {
@Override
public final void run() {
VPNLog.d(MainCaptureActivity.LOG_TAG, "start add com.minhui.networkcapture.ads");
InterstitialManager.getInstance().initContext(MainCaptureActivity.this.getApplicationContext());
View findViewById = MainCaptureActivity.this.findViewById(R.id.ads_container);
if (findViewById == null) {
throw new TypeCastException("null cannot be cast to non-null type com.minhui.networkcapture.ads.banner.MyAdsView");
}
((MyAdsView) findViewById).initAds(AdsConstant.MAIN_BANNER_ID);
}
}, 2000L);
}
private final void checkReview() {
if (ContextUtil.isGooglePlayChannel(getApplicationContext())) {
SharedPreferences sharedPreferences = this.sharedPreferences;
if (sharedPreferences == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
}
if (sharedPreferences.getBoolean(AppConstants.HAS_FULL_USE_APP, false)) {
SharedPreferences sharedPreferences2 = this.sharedPreferences;
if (sharedPreferences2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
}
if (sharedPreferences2.getBoolean(AppConstants.HAS_SHOW_RECOMMEND, false)) {
return;
}
SharedPreferences sharedPreferences3 = this.sharedPreferences;
if (sharedPreferences3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
}
if (System.currentTimeMillis() - sharedPreferences3.getLong(AppConstants.LAST_RECOMMAND_TIME, 0L) < this.ONE_HOUR) {
return;
}
SharedPreferences sharedPreferences4 = this.sharedPreferences;
if (sharedPreferences4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
}
sharedPreferences4.edit().putLong(AppConstants.LAST_RECOMMAND_TIME, System.currentTimeMillis()).apply();
showRecommend();
}
}
}
private final void showRecommend() {
new AlertDialog.Builder(this).setTitle(getString(R.string.do_you_like_the_app)).setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
MainCaptureActivity.this.showGotoStarDialog();
dialogInterface.dismiss();
}
}).setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
MainCaptureActivity.this.showSolveProblemDialog();
dialogInterface.dismiss();
MainCaptureActivity.access$getSharedPreferences$p(MainCaptureActivity.this).edit().putBoolean(AppConstants.HAS_SHOW_RECOMMEND, true).apply();
}
}).show();
}
public final void showGotoStarDialog() {
if (ContextUtil.isGooglePlayChannel(getApplicationContext())) {
new AlertDialog.Builder(this).setTitle(getString(R.string.do_you_want_star)).setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
String packageName = MainCaptureActivity.this.getPackageName();
try {
try {
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=" + packageName));
intent.setPackage("com.android.vending");
MainCaptureActivity.this.startActivity(intent);
} catch (Exception unused) {
MainCaptureActivity.this.launchBrowser("https://play.google.com/store/apps/details?id=" + packageName);
}
} catch (Exception unused2) {
}
MainCaptureActivity.access$getSharedPreferences$p(MainCaptureActivity.this).edit().putBoolean(AppConstants.HAS_SHOW_RECOMMEND, true).apply();
}
}).setNegativeButton(getString(R.string.not_now), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
}).show();
}
}
public final void showSolveProblemDialog() {
new AlertDialog.Builder(this).setMessage(getString(R.string.any_device_send_email)).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
}).show();
}
public final void closeVpn() {
VpnServiceHelper.changeVpnRunningStatus(this, false, getResources().getString(R.string.app_name));
VpnServiceHelper.needCapture = false;
}
private final void startVPN() {
SSLVPNUtils.startVPN(this);
VpnServiceHelper.needCapture = true;
}
public final void performOpenVpn() {
SharedPreferences sharedPreferences = this.sharedPreferences;
if (sharedPreferences == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
}
boolean z = sharedPreferences.getBoolean(AppConstants.HAS_INSTALL_ROOT_CERTIFICATE, false);
SharedPreferences sharedPreferences2 = this.sharedPreferences;
if (sharedPreferences2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
}
boolean z2 = sharedPreferences2.getBoolean(AppConstants.ENABLE_FLOATING_WINDOW, false);
SharedPreferences sharedPreferences3 = this.sharedPreferences;
if (sharedPreferences3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
}
boolean z3 = sharedPreferences3.getBoolean(AppConstants.NO_ASK_OPEN_FLOAT, false);
if (!z && !this.hasAskInstallCert && Build.VERSION.SDK_INT < 30) {
this.hasAskInstallCert = true;
showInstallCertDialog();
} else if (!z2 && !this.hasAskOpenFloat && !z3) {
this.hasAskOpenFloat = true;
showOpenFloatDialog();
} else {
startVPN();
}
}
private final void showInstallCertDialog() {
new AlertDialog.Builder(this).setMessage(getString(R.string.install_root_to_http)).setPositiveButton(getString(R.string.install), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
CertificateManager.getInstance().installCert(MainCaptureActivity.this);
}
}).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
MainCaptureActivity.this.performOpenVpn();
}
}).show();
}
public final void showNeedFloatOpenDialog() {
new AlertDialog.Builder(this).setMessage(getString(R.string.need_open_float_function)).setPositiveButton(getString(R.string.go), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
try {
Intent intent = new Intent("android.settings.action.MANAGE_OVERLAY_PERMISSION");
intent.setData(Uri.parse("package:" + MainCaptureActivity.this.getPackageName()));
MainCaptureActivity.this.startActivityForResult(intent, 106);
} catch (Exception e) {
e.printStackTrace();
}
}
}).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
MainCaptureActivity.this.performOpenVpn();
}
}).show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
Intrinsics.checkParameterIsNotNull(menu, "menu");
getMenuInflater().inflate(R.menu.main_capture, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intrinsics.checkParameterIsNotNull(item, "item");
int itemId = item.getItemId();
if (itemId == R.id.action_filter) {
startActivity(new Intent(this, (Class<?>) CaptureFilterActivity.class));
} else if (itemId == R.id.action_search && CaptureVpnService.lastVpnStartTimeFormat != null) {
SearchActivity.startActivity(this, CaptureVpnService.lastVpnStartTimeFormat);
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onSupportNavigateUp() {
NavController findNavController = ActivityKt.findNavController(this, R.id.nav_host_fragment);
AppBarConfiguration appBarConfiguration = this.appBarConfiguration;
if (appBarConfiguration == null) {
Intrinsics.throwUninitializedPropertyAccessException("appBarConfiguration");
}
return NavControllerKt.navigateUp(findNavController, appBarConfiguration) || super.onSupportNavigateUp();
}
public final boolean getIsNotAskFloat() {
return this.isNotAskFloat;
}
public final void setNotAskFloat(boolean z) {
this.isNotAskFloat = z;
}
private final void showOpenFloatDialog() {
new MaterialDialog.Builder(this).content(R.string.open_float_function_to_good_use).negativeText(R.string.cancel).onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public final void onClick(MaterialDialog dialog, DialogAction which) {
Intrinsics.checkParameterIsNotNull(dialog, "dialog");
Intrinsics.checkParameterIsNotNull(which, "which");
dialog.dismiss();
MainCaptureActivity.this.performOpenVpn();
}
}).checkBoxPrompt(getString(R.string.do_not_ask), false, new CompoundButton.OnCheckedChangeListener() {
@Override
public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
MainCaptureActivity.this.setNotAskFloat(z);
}
}).positiveText(R.string.enable).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public final void onClick(MaterialDialog dialog, DialogAction which) {
Intrinsics.checkParameterIsNotNull(dialog, "dialog");
Intrinsics.checkParameterIsNotNull(which, "which");
dialog.dismiss();
if (Build.VERSION.SDK_INT < 23) {
MainCaptureActivity.this.openFloatAndOpenVpn();
} else if (Settings.canDrawOverlays(MainCaptureActivity.this.getApplicationContext())) {
MainCaptureActivity.this.openFloatAndOpenVpn();
} else {
MainCaptureActivity.this.showNeedFloatOpenDialog();
}
}
}).dismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
MainCaptureActivity.access$getSharedPreferences$p(MainCaptureActivity.this).edit().putBoolean(AppConstants.NO_ASK_OPEN_FLOAT, MainCaptureActivity.this.getIsNotAskFloat()).apply();
}
}).show();
}
public final void openFloatAndOpenVpn() {
SharedPreferences sharedPreferences = this.sharedPreferences;
if (sharedPreferences == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
}
sharedPreferences.edit().putBoolean(AppConstants.ENABLE_FLOATING_WINDOW, true).apply();
FloatViewService.startService(getApplicationContext());
EventBus.getDefault().post(new FloatOpenEvent());
performOpenVpn();
}
}