拼多多跨境 v1.0.0版本的 MD5 值为:46d7e086dc764eefcdcf4fedc6f7a054
以下内容为反编译后的 MainActivity.java 源代码,内容仅作参考
package co.median.android;
import H0.AbstractC0171p;
import H0.C0172q;
import H0.I;
import H0.J;
import H0.M;
import H0.c0;
import H0.j0;
import H0.k0;
import H0.w0;
import L0.a;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.hardware.SensorManager;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Parcel;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.telephony.PhoneStateListener;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.webkit.CookieManager;
import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.result.ActivityResult;
import androidx.appcompat.app.AbstractActivityC0236d;
import androidx.appcompat.app.AbstractC0233a;
import androidx.appcompat.app.AbstractC0234b;
import androidx.appcompat.widget.Toolbar;
import androidx.browser.customtabs.a;
import androidx.browser.customtabs.b;
import androidx.core.view.A;
import androidx.core.view.K0;
import androidx.core.view.Z;
import androidx.core.view.n0;
import androidx.drawerlayout.widget.DrawerLayout;
import co.median.android.MainActivity;
import co.median.android.MySwipeRefreshLayout;
import co.median.android.l;
import co.median.android.qjrzdm.R;
import co.median.android.u;
import co.median.android.widget.GoNativeDrawerLayout;
import co.median.android.widget.SwipeHistoryNavigationLayout;
import co.median.android.widget.WebViewContainerView;
import co.median.android.widget.b;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.progressindicator.CircularProgressIndicator;
import java.io.File;
import java.net.CookieHandler;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;
import java.util.Stack;
import java.util.UUID;
import java.util.regex.Pattern;
import o1.C0471a;
import org.json.JSONException;
import org.json.JSONObject;
import v0.C0565a;
public class MainActivity extends AbstractActivityC0236d implements Observer, L0.g, b.j, C0471a.InterfaceC0117a, u.b {
private static final String f6737S0 = "co.median.android.MainActivity";
protected String f6738A0;
private Stack f6739B0;
private n f6740C0;
private String f6743F0;
private String f6744G0;
private PhoneStateListener f6745H0;
private SignalStrength f6747I0;
private WebViewContainerView f6748J;
private L0.i f6750K;
private androidx.activity.result.b f6751K0;
private androidx.activity.result.b f6753L0;
private View f6756N;
private String f6758O;
private boolean f6759O0;
private String f6761P0;
private ValueCallback f6762Q;
private c0 f6763Q0;
private ValueCallback f6764R;
private String f6765R0;
private Uri f6766S;
private GoNativeDrawerLayout f6767T;
private View f6768U;
private ExpandableListView f6769V;
private CircularProgressIndicator f6770W;
private MySwipeRefreshLayout f6771X;
private SwipeHistoryNavigationLayout f6772Y;
private RelativeLayout f6773Z;
private AbstractC0234b f6775b0;
private v f6778e0;
private co.median.android.a f6779f0;
private boolean f6780g0;
private Menu f6785l0;
private String f6786m0;
private co.median.android.e f6789p0;
private co.median.android.h f6790q0;
private co.median.android.o f6791r0;
private s f6792s0;
private m f6793t0;
private M f6794u0;
private BroadcastReceiver f6795v0;
private BroadcastReceiver f6796w0;
private BroadcastReceiver f6797x0;
protected String f6799z0;
private boolean f6746I = false;
boolean f6752L = false;
private Stack f6754M = new Stack();
private boolean f6760P = true;
private co.median.android.m f6774a0 = null;
private ConnectivityManager f6776c0 = null;
private r f6777d0 = null;
private boolean f6781h0 = false;
private Handler f6782i0 = new Handler();
private float f6783j0 = 0.0f;
private boolean f6784k0 = false;
private final Runnable f6787n0 = new d();
private C0471a f6788o0 = new C0471a(this);
private boolean f6798y0 = false;
private ArrayList f6741D0 = new ArrayList();
private ArrayList f6742E0 = new ArrayList();
private boolean f6749J0 = false;
private String f6755M0 = "";
private boolean f6757N0 = false;
class a implements Runnable {
a() {
}
@Override
public void run() {
MainActivity.this.A2();
}
}
class b implements Runnable {
final String f6801g;
b(String str) {
this.f6801g = str;
}
@Override
public void run() {
MainActivity.this.z2(this.f6801g);
}
}
public static class c {
static final int[] f6803a;
static {
int[] iArr = new int[a.EnumC0011a.values().length];
f6803a = iArr;
try {
iArr[a.EnumC0011a.UNSPECIFIED.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f6803a[a.EnumC0011a.PORTRAIT.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
f6803a[a.EnumC0011a.LANDSCAPE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
public class d implements Runnable {
d() {
}
public void b() {
MainActivity.this.v1();
}
@Override
public void run() {
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public final void run() {
MainActivity.d.this.b();
}
});
MainActivity.this.f6782i0.postDelayed(MainActivity.this.f6787n0, 100L);
}
}
class e implements ViewTreeObserver.OnPreDrawListener {
final ViewGroup f6805g;
e(ViewGroup viewGroup) {
this.f6805g = viewGroup;
}
@Override
public boolean onPreDraw() {
if (!MainActivity.this.f6759O0 && MainActivity.this.f6780g0) {
return false;
}
this.f6805g.getViewTreeObserver().removeOnPreDrawListener(this);
return true;
}
}
class f implements SwipeHistoryNavigationLayout.a {
final L0.a f6807a;
f(L0.a aVar) {
this.f6807a = aVar;
}
@Override
public boolean a() {
if (MainActivity.this.f6750K.getMaxHorizontalScroll() <= 0 || MainActivity.this.f6750K.getScrollX() >= MainActivity.this.f6750K.getMaxHorizontalScroll()) {
return MainActivity.this.r1();
}
return false;
}
@Override
public boolean b() {
return this.f6807a.f1123F;
}
@Override
public void c() {
}
@Override
public void d() {
}
@Override
public String e() {
return "";
}
@Override
public boolean f() {
if (!this.f6807a.f1123F || !MainActivity.this.q1()) {
return false;
}
MainActivity.this.S1();
return true;
}
@Override
public boolean g() {
if (!this.f6807a.f1123F || !MainActivity.this.r1()) {
return false;
}
MainActivity.this.T1();
return true;
}
@Override
public boolean h() {
if (MainActivity.this.f6750K.getMaxHorizontalScroll() <= 0 || MainActivity.this.f6750K.getScrollX() <= 0) {
return MainActivity.this.q1();
}
return false;
}
}
class g extends BroadcastReceiver {
g() {
}
@Override
public void onReceive(Context context, Intent intent) {
String url;
if (!"io.gonative.android.AppConfig.processedNavigationTitles".equals(intent.getAction()) || (url = MainActivity.this.f6750K.getUrl()) == null) {
return;
}
String V2 = MainActivity.this.V2(url);
if (V2 != null) {
MainActivity.this.setTitle(V2);
} else {
MainActivity.this.setTitle(R.string.app_name);
}
}
}
class h extends BroadcastReceiver {
h() {
}
@Override
public void onReceive(Context context, Intent intent) {
String url;
if (!"io.gonative.android.AppConfig.processedNavigationLevels".equals(intent.getAction()) || (url = MainActivity.this.f6750K.getUrl()) == null) {
return;
}
MainActivity.this.I2(MainActivity.this.a3(url));
}
}
class i extends BroadcastReceiver {
i() {
}
@Override
public void onReceive(Context context, Intent intent) {
if ("io.gonative.android.MainActivity.Extra.BROADCAST_RECEIVER_ACTION_WEBVIEW_LIMIT_REACHED".equals(intent.getAction())) {
String stringExtra = intent.getStringExtra("excessWindowId");
if (TextUtils.isEmpty(stringExtra)) {
if (MainActivity.this.I1().g(MainActivity.this.f6786m0)) {
return;
}
MainActivity.this.finish();
} else if (stringExtra.equals(MainActivity.this.f6786m0)) {
MainActivity.this.finish();
}
}
}
}
public class j extends AbstractC0234b {
final L0.a f6812l;
j(Activity activity, DrawerLayout drawerLayout, int i2, int i3, L0.a aVar) {
super(activity, drawerLayout, i2, i3);
this.f6812l = aVar;
}
@Override
public void b(View view) {
MainActivity.this.invalidateOptionsMenu();
MainActivity.this.f6767T.setDisableTouch(false);
}
@Override
public void d(View view) {
MainActivity.this.invalidateOptionsMenu();
MainActivity.this.f6767T.setDisableTouch(this.f6812l.f1123F && MainActivity.this.q1());
}
}
public class k implements Runnable {
k() {
}
@Override
public void run() {
MainActivity.this.f6771X.setRefreshing(false);
}
}
public class l extends PhoneStateListener {
l() {
}
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
MainActivity.this.f6747I0 = signalStrength;
MainActivity.this.A2();
if (MainActivity.this.f6743F0 != null) {
MainActivity mainActivity = MainActivity.this;
mainActivity.z2(mainActivity.f6743F0);
}
}
}
private class m extends BroadcastReceiver {
private m() {
}
@Override
public void onReceive(Context context, Intent intent) {
MainActivity.this.y2();
if (MainActivity.this.f6743F0 != null) {
MainActivity mainActivity = MainActivity.this;
mainActivity.z2(mainActivity.f6743F0);
}
}
}
public interface n {
void a(boolean z2);
}
public interface o {
void a(String[] strArr, int[] iArr);
}
public class p {
String[] f6817a;
o f6818b;
p(String[] strArr, o oVar) {
this.f6817a = strArr;
this.f6818b = oVar;
}
}
public class q {
public q() {
}
public void lambda$onReadyState$0(String str) {
MainActivity.this.w1(str);
}
@JavascriptInterface
public void onReadyState(final String str) {
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public final void run() {
MainActivity.q.this.lambda$onReadyState$0(str);
}
});
}
}
public void A2() {
String str = this.f6744G0;
if (str == null) {
return;
}
z2(str);
this.f6744G0 = null;
}
private int B1(Bundle bundle) {
Parcel obtain = Parcel.obtain();
obtain.writeValue(bundle);
byte[] marshall = obtain.marshall();
obtain.recycle();
return marshall.length;
}
private void B2(a.EnumC0011a enumC0011a) {
int i2;
int i3 = c.f6803a[enumC0011a.ordinal()];
if (i3 != 1) {
if (i3 != 2) {
if (i3 == 3) {
i2 = 6;
} else {
return;
}
} else {
setRequestedOrientation(1);
return;
}
} else {
i2 = -1;
}
setRequestedOrientation(i2);
}
private String C1() {
ActivityInfo activityInfo;
ResolveInfo resolveActivity = getPackageManager().resolveActivity(new Intent("android.intent.action.VIEW", Uri.parse("http://www.google.com")), 65536);
if (resolveActivity == null || (activityInfo = resolveActivity.activityInfo) == null) {
return null;
}
return activityInfo.packageName;
}
private void D2(boolean z2) {
Toolbar toolbar;
if (this.f6780g0) {
L0.a U2 = L0.a.U(this);
if (U2.f1141L) {
GoNativeDrawerLayout goNativeDrawerLayout = this.f6767T;
if (goNativeDrawerLayout != null) {
goNativeDrawerLayout.setDrawerLockMode(!z2 ? 1 : 0);
}
if ((this.f6760P || U2.f1148N0) && z2 && (toolbar = (Toolbar) findViewById(R.id.toolbar)) != null) {
toolbar.setVisibility(0);
}
AbstractC0233a C02 = C0();
if (C02 != null) {
C02.v(z2);
}
}
}
}
private void G2() {
L0.a U2 = L0.a.U(this);
a.EnumC0011a enumC0011a = U2.f1239t;
if (enumC0011a != null) {
B2(enumC0011a);
return;
}
if (getResources().getBoolean(R.bool.isTablet)) {
a.EnumC0011a enumC0011a2 = U2.f1245v;
if (enumC0011a2 != null) {
B2(enumC0011a2);
return;
}
} else {
a.EnumC0011a enumC0011a3 = U2.f1242u;
if (enumC0011a3 != null) {
B2(enumC0011a3);
return;
}
}
if (U2.f1251x) {
return;
}
B2(a.EnumC0011a.UNSPECIFIED);
}
private void K2() {
co.median.android.m mVar = new co.median.android.m(this, this.f6769V);
this.f6774a0 = mVar;
try {
mVar.m("default");
this.f6769V.setAdapter(this.f6774a0);
} catch (Exception e2) {
L0.f.a().c(f6737S0, "Error setting up menu", e2);
}
this.f6769V.setOnGroupClickListener(this.f6774a0);
this.f6769V.setOnChildClickListener(this.f6774a0);
}
private void L2() {
this.f6777d0 = new r(this, (Spinner) findViewById(R.id.profile_picker));
new t(this, (Spinner) findViewById(R.id.segmented_control));
}
private void M2(String str) {
if (!F0.d.a("FORCE_DARK")) {
Log.d(f6737S0, "Dark mode feature is not supported");
return;
}
if (this.f6750K.getSettings() == null) {
return;
}
if ("dark".equals(str)) {
F0.b.b(this.f6750K.getSettings(), 2);
} else if ("light".equals(str)) {
F0.b.b(this.f6750K.getSettings(), 0);
} else {
int i2 = getResources().getConfiguration().uiMode & 48;
if (i2 == 0 || i2 == 16) {
F0.b.b(this.f6750K.getSettings(), 0);
} else if (i2 == 32) {
F0.b.b(this.f6750K.getSettings(), 2);
}
if (F0.d.a("FORCE_DARK_STRATEGY")) {
F0.b.c(this.f6750K.getSettings(), 1);
}
}
J2();
}
private void N2(boolean z2) {
L0.a U2 = L0.a.U(this);
this.f6767T = (GoNativeDrawerLayout) findViewById(R.id.drawer_layout);
this.f6768U = findViewById(R.id.left_drawer);
this.f6769V = (ExpandableListView) findViewById(R.id.drawer_list);
if (!z2) {
this.f6767T.setDrawerLockMode(1);
return;
}
this.f6767T.setDrawerLockMode(0);
this.f6767T.Y(R.drawable.drawer_shadow, 8388611);
j jVar = new j(this, this.f6767T, R.string.drawer_open, R.string.drawer_close, U2);
this.f6775b0 = jVar;
jVar.j(true);
this.f6775b0.e().c(getResources().getColor(R.color.titleTextColor));
this.f6767T.c(this.f6775b0);
K2();
if (U2.f1153P != null) {
this.f6791r0.addObserver(this);
}
}
private String P1(Intent intent) {
String str;
if (intent == null) {
return null;
}
String stringExtra = intent.getStringExtra("targetUrl");
if (stringExtra != null && !stringExtra.isEmpty()) {
return stringExtra;
}
if (!"android.intent.action.VIEW".equals(intent.getAction())) {
return null;
}
Uri data = intent.getData();
if (data == null || !(data.getScheme().endsWith(".http") || data.getScheme().endsWith(".https"))) {
return intent.getDataString();
}
Uri.Builder buildUpon = data.buildUpon();
if (!data.getScheme().endsWith(".https")) {
str = data.getScheme().endsWith(".http") ? "http" : "https";
return buildUpon.build().toString();
}
buildUpon.scheme(str);
return buildUpon.build().toString();
}
private void P2(double d2) {
if (d2 > 0.0d) {
this.f6782i0.postDelayed(new Runnable() {
@Override
public final void run() {
MainActivity.this.O2();
}
}, (int) (d2 * 1000.0d));
} else {
O2();
}
}
private void S2() {
this.f6782i0.removeCallbacks(this.f6787n0);
}
public void T1() {
if (co.median.android.n.g()) {
V1();
}
this.f6750K.goForward();
}
private void T2(boolean z2, int i2) {
if (z2 && L0.a.U(this).f1217l1) {
new Handler().postDelayed(new k(), i2);
} else {
this.f6771X.setRefreshing(false);
}
}
private void W1() {
File file = new File(getCacheDir(), "webviewDatabase");
if (file.mkdirs()) {
Log.v(f6737S0, "databasePath " + file.toString() + " exists");
}
k0.a().c(this);
new co.median.android.b(this).b();
this.f6792s0 = ((GoNativeApplication) getApplication()).g();
}
private boolean X1() {
if (Build.VERSION.SDK_INT < 29) {
return false;
}
try {
int identifier = getResources().getIdentifier("config_navBarInteractionMode", "integer", "android");
if (identifier > 0) {
return getResources().getInteger(identifier) == 2;
}
return false;
} catch (Resources.NotFoundException e2) {
L0.f.a().c(f6737S0, "isAndroidGestureEnabled: ", e2);
return false;
}
}
private void X2(boolean z2) {
co.median.android.m mVar;
String str;
if (this.f6774a0 == null) {
K2();
}
try {
if (z2) {
mVar = this.f6774a0;
str = "loggedIn";
} else {
mVar = this.f6774a0;
str = "default";
}
mVar.m(str);
} catch (Exception e2) {
L0.f.a().c(f6737S0, e2.getMessage(), e2);
}
}
private boolean Y1(Uri uri) {
ArrayList arrayList;
if (uri == null || (arrayList = L0.a.U(this).f1213k0) == null || arrayList.isEmpty()) {
return false;
}
return arrayList.contains(uri.getHost());
}
private boolean Z2(String str, String str2) {
if (str == null || str2 == null) {
return false;
}
if (str.endsWith("/")) {
str = str.substring(0, str.length() - 1);
}
if (str2.endsWith("/")) {
str2 = str2.substring(0, str2.length() - 1);
}
if (str.startsWith("http://")) {
str = "https://" + str.substring(7);
}
return str.equals(str2);
}
private boolean a2() {
GoNativeDrawerLayout goNativeDrawerLayout = this.f6767T;
return goNativeDrawerLayout != null && goNativeDrawerLayout.F(this.f6768U);
}
private boolean b2() {
return androidx.core.content.a.a(this, "android.permission.ACCESS_FINE_LOCATION") == 0 && androidx.core.content.a.a(this, "android.permission.ACCESS_COARSE_LOCATION") == 0;
}
private void b3() {
}
public static void e2(Boolean bool) {
Log.d(f6737S0, "clearWebviewCookies: onReceiveValue callback: " + bool);
}
public void f2(String str, L0.c cVar) {
try {
cVar.e(this, new JSONObject(str));
} catch (JSONException unused) {
cVar.e(this, Uri.parse(str));
}
}
public boolean g2() {
return this.f6750K.getWebViewScrollY() > 0;
}
public static n0 h2(ViewGroup viewGroup, View view, n0 n0Var) {
androidx.core.graphics.f f2 = n0Var.f(n0.m.d());
((LinearLayout.LayoutParams) viewGroup.getLayoutParams()).bottomMargin = f2.f4449d;
return n0.f4770b;
}
public void i2(Boolean bool) {
Q(this.f6755M0, false);
}
public void j2(ActivityResult activityResult) {
m2(L0.k.b("median_appbrowser_closed", null));
}
public void k2(String str, co.median.android.l lVar) {
this.f6750K.loadUrl(str);
lVar.k(null);
}
public static void l2(boolean z2) {
Log.d(f6737S0, "promptLocationService: " + z2);
}
private void n2() {
if (this.f6745H0 != null) {
return;
}
this.f6745H0 = new l();
try {
TelephonyManager telephonyManager = (TelephonyManager) getSystemService("phone");
if (telephonyManager == null) {
L0.f.a().b(f6737S0, "Error getting system telephony manager");
} else {
telephonyManager.listen(this.f6745H0, 256);
}
} catch (Exception e2) {
L0.f.a().c(f6737S0, "Error listening for signal strength", e2);
}
}
public boolean r1() {
return this.f6750K.canGoForward();
}
private void s2() {
this.f6750K.stopLoading();
B();
X2(false);
this.f6791r0.g();
this.f6750K.loadUrl(L0.a.U(this).T());
}
public void w1(String str) {
double d2 = L0.a.U(this).f1151O0;
if (str.equals("loading") || (Double.isNaN(d2) && str.equals("interactive"))) {
this.f6798y0 = true;
} else if ((!Double.isNaN(d2) && str.equals("interactive")) || (this.f6798y0 && str.equals("complete"))) {
if (str.equals("interactive")) {
P2(d2);
} else {
O2();
}
if (this.f6759O0) {
S2();
}
}
if (str.equals("complete") || str.equals("interactive")) {
w2();
}
}
public void w2() {
this.f6759O0 = true;
S2();
}
public void y2() {
L0.i iVar = this.f6750K;
if (iVar != null && iVar.getProgress() >= 100) {
String url = this.f6750K.getUrl();
if ((url != null && !url.equals("file:///android_asset/offline.html")) || this.f6754M.isEmpty() || Z1()) {
return;
}
o2((String) this.f6754M.pop());
}
}
public void z2(String str) {
NetworkInfo activeNetworkInfo = this.f6776c0.getActiveNetworkInfo();
boolean z2 = activeNetworkInfo != null && activeNetworkInfo.isConnected();
String typeName = activeNetworkInfo != null ? activeNetworkInfo.getTypeName() : "DISCONNECTED";
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("connected", z2);
jSONObject.put("type", typeName);
if (this.f6747I0 != null) {
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("cdmaDbm", this.f6747I0.getCdmaDbm());
jSONObject2.put("cdmaEcio", this.f6747I0.getCdmaEcio());
jSONObject2.put("evdoDbm", this.f6747I0.getEvdoDbm());
jSONObject2.put("evdoEcio", this.f6747I0.getEvdoEcio());
jSONObject2.put("evdoSnr", this.f6747I0.getEvdoSnr());
jSONObject2.put("gsmBitErrorRate", this.f6747I0.getGsmBitErrorRate());
jSONObject2.put("gsmSignalStrength", this.f6747I0.getGsmSignalStrength());
jSONObject2.put("level", this.f6747I0.getLevel());
jSONObject.put("cellSignalStrength", jSONObject2);
}
m2(L0.k.b(str, jSONObject));
} catch (JSONException e2) {
L0.f.a().c(f6737S0, "JSON error sending connectivity", e2);
}
}
@Override
public void A(String str) {
if (this.f6794u0 == null || TextUtils.isEmpty(str)) {
return;
}
m2(L0.k.b(str, this.f6794u0.c()));
}
public String A1() {
return this.f6786m0;
}
@Override
public void B() {
final CookieManager cookieManager = CookieManager.getInstance();
cookieManager.removeAllCookies(new ValueCallback() {
@Override
public final void onReceiveValue(Object obj) {
MainActivity.e2((Boolean) obj);
}
});
AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
@Override
public final void run() {
cookieManager.flush();
}
});
}
@Override
public void C(Map map) {
JSONObject b2 = J.b(map);
String str = (String) map.get("callback");
if (str == null || str.isEmpty()) {
return;
}
final String b3 = L0.k.b(str, b2);
new Handler(getMainLooper()).post(new Runnable() {
@Override
public final void run() {
MainActivity.this.m2(b3);
}
});
}
public void C2(Uri uri) {
this.f6766S = uri;
}
public GoNativeDrawerLayout D1() {
return this.f6767T;
}
@Override
public void E(String str) {
this.f6743F0 = str;
n2();
new Handler().postDelayed(new b(str), 500L);
}
public AbstractC0234b E1() {
return this.f6775b0;
}
public void E2(boolean z2) {
F2(z2, null);
}
@Override
public void F(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
new C0172q(this).c(str);
this.f6765R0 = str;
this.f6757N0 = true;
if (Build.VERSION.SDK_INT >= 31) {
j0.e(this, str);
} else {
j0.d(str);
}
}
public co.median.android.e F1() {
return this.f6789p0;
}
public void F2(boolean z2, MenuItem menuItem) {
for (int i2 = 0; i2 < this.f6785l0.size(); i2++) {
MenuItem item = this.f6785l0.getItem(i2);
if (item != menuItem) {
item.setVisible(z2);
item.setEnabled(z2);
}
}
}
public co.median.android.h G1() {
return this.f6790q0;
}
public RelativeLayout H1() {
return this.f6773Z;
}
public void H2(ValueCallback valueCallback) {
this.f6764R = valueCallback;
}
@Override
public void I(String str) {
if (str.isEmpty()) {
setTitle(R.string.app_name);
} else {
setTitle(str);
}
}
public co.median.android.l I1() {
return ((GoNativeApplication) getApplication()).j();
}
public void I2(int i2) {
I1().l(this.f6786m0, i2);
}
@Override
public void J(String str, String str2) {
if (TextUtils.isEmpty(str)) {
return;
}
Uri parse = Uri.parse(str);
if ("internal".equals(str2)) {
o2(str);
return;
}
if ("external".equals(str2)) {
v2(parse);
return;
}
if ("appbrowser".equals(str2)) {
u2(parse);
return;
}
L0.a U2 = L0.a.U(this);
if (!U2.f1129H || U2.f1132I <= 0 || I1().e() < U2.f1132I || !t2(str)) {
Intent intent = new Intent(this, (Class<?>) MainActivity.class);
intent.putExtra("isRoot", false);
intent.putExtra("url", str);
intent.putExtra("ignoreInterceptMaxWindows", true);
startActivityForResult(intent, 400);
}
}
public String J1() {
return this.f6761P0;
}
public void J2() {
this.f6750K.a(String.format("document.documentElement.setAttribute('data-color-scheme-option', '%s');", this.f6765R0));
}
@Override
public boolean K() {
boolean isLocationEnabled;
if (!b2()) {
return false;
}
if (Build.VERSION.SDK_INT < 28) {
return Settings.Secure.getInt(getContentResolver(), "location_mode", 0) != 0;
}
isLocationEnabled = ((LocationManager) getSystemService(LocationManager.class)).isLocationEnabled();
return isLocationEnabled;
}
public int K1() {
return I1().c(this.f6786m0);
}
@Override
public void L() {
String url = this.f6750K.getUrl();
if (url == null || !url.equals("file:///android_asset/offline.html")) {
this.f6799z0 = this.f6738A0;
this.f6750K.loadUrl(url);
return;
}
if (this.f6750K.canGoBack()) {
this.f6750K.goBack();
} else {
String str = this.f6758O;
if (str != null) {
this.f6750K.loadUrl(str);
}
}
W2();
}
public void L1(String[] strArr, o oVar) {
for (String str : strArr) {
if (androidx.core.content.a.a(this, str) != 0) {
if (oVar != null) {
this.f6741D0.add(new p(strArr, oVar));
}
androidx.core.app.b.m(this, strArr, 199);
return;
}
}
if (oVar != null) {
int length = strArr.length;
int[] iArr = new int[length];
for (int i2 = 0; i2 < length; i2++) {
iArr[i2] = 0;
}
oVar.a(strArr, iArr);
}
}
@Override
public void M() {
L();
T2(true, 1000);
}
public r M1() {
return this.f6777d0;
}
public void N1(n nVar) {
if (b2()) {
nVar.a(true);
return;
}
if (androidx.core.app.b.n(this, "android.permission.ACCESS_FINE_LOCATION") || androidx.core.app.b.n(this, "android.permission.ACCESS_COARSE_LOCATION")) {
Toast.makeText(this, R.string.request_permission_explanation_geolocation, 0).show();
}
this.f6740C0 = nVar;
androidx.core.app.b.m(this, new String[]{"android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"}, 102);
}
public q O1() {
return new q();
}
public void O2() {
this.f6784k0 = false;
this.f6798y0 = false;
if (!this.f6781h0) {
this.f6770W.setVisibility(4);
return;
}
this.f6781h0 = false;
this.f6756N.animate().alpha(0.0f).setDuration(300L).setStartDelay(150L);
this.f6770W.animate().alpha(0.0f).setDuration(60L);
}
@Override
public void P(boolean z2) {
Z.b(getWindow(), !z2);
}
@Override
public void Q(String str, boolean z2) {
Boolean bool;
if (z2) {
this.f6755M0 = str;
this.f6751K0.a("android.permission.READ_PHONE_STATE");
return;
}
Map b2 = I.b(this);
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
if (defaultSharedPreferences.getBoolean("hasLaunched", false)) {
bool = Boolean.FALSE;
} else {
defaultSharedPreferences.edit().putBoolean("hasLaunched", true).commit();
bool = Boolean.TRUE;
}
b2.put("isFirstLaunch", bool);
b2.putAll(((GoNativeApplication) getApplication()).f6732r.b(this));
m2(L0.k.b(str, new JSONObject(b2)));
}
public int Q1() {
return I1().d(this.f6786m0);
}
public void Q2() {
this.f6784k0 = false;
this.f6781h0 = false;
this.f6798y0 = false;
S2();
this.f6756N.setAlpha(0.0f);
this.f6770W.setVisibility(4);
}
public L0.i R1() {
return this.f6750K;
}
public void R2() {
this.f6787n0.run();
}
@Override
public void S() {
this.f6743F0 = null;
}
public void S1() {
if (this.f6750K == null) {
return;
}
if (co.median.android.n.g()) {
V1();
}
this.f6750K.goBack();
}
@Override
public void T(String str) {
if (str.isEmpty()) {
return;
}
((ClipboardManager) getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText("copy", str));
}
@Override
public void U(androidx.fragment.app.c cVar) {
Z();
Toast.makeText(this, R.string.cleared_cache, 0).show();
}
public void U1(final String str) {
if (str.isEmpty()) {
return;
}
final L0.c cVar = ((GoNativeApplication) getApplication()).f6732r;
runOnUiThread(new Runnable() {
@Override
public final void run() {
MainActivity.this.f2(str, cVar);
}
});
}
public void U2(L0.i iVar, boolean z2, boolean z3) {
this.f6748J.b(this, this.f6780g0);
((View) iVar).scrollTo(0, 0);
View view = (View) this.f6750K;
if (!z3) {
Bundle bundle = new Bundle();
this.f6750K.c(bundle);
this.f6739B0.add(bundle);
}
if (iVar != view) {
ViewParent parent = iVar.getParent();
if (parent instanceof ViewGroup) {
((ViewGroup) parent).removeView((View) iVar);
}
ViewGroup viewGroup = (ViewGroup) view.getParent();
int indexOfChild = viewGroup.indexOfChild(view);
viewGroup.removeView(view);
View view2 = (View) iVar;
viewGroup.addView(view2, indexOfChild);
view2.setLayoutParams(view.getLayoutParams());
y.a((co.median.android.n) view);
if (!this.f6752L) {
((L0.i) view).destroy();
}
}
this.f6752L = z2;
this.f6750K = iVar;
String str = this.f6799z0;
if (str != null) {
m2(str);
this.f6799z0 = null;
}
}
@Override
public void V(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
K0 a2 = Z.a(getWindow(), getWindow().getDecorView());
str.hashCode();
char c2 = 65535;
switch (str.hashCode()) {
case 3005871:
if (str.equals("auto")) {
c2 = 0;
break;
}
break;
case 3075958:
if (str.equals("dark")) {
c2 = 1;
break;
}
break;
case 102970646:
if (str.equals("light")) {
c2 = 2;
break;
}
break;
}
switch (c2) {
case 0:
int i2 = getResources().getConfiguration().uiMode & 48;
if (i2 != 32) {
if (i2 != 16) {
L0.f.a().b(f6737S0, "updateStatusBarStyle: Current mode is undefined");
return;
}
a2.b(true);
return;
}
a2.b(false);
return;
case 1:
a2.b(false);
return;
case 2:
a2.b(true);
return;
default:
return;
}
}
public void V1() {
View view;
((GoNativeApplication) getApplication()).f6732r.r(this);
if (L0.a.U(this).f1217l1) {
return;
}
this.f6781h0 = true;
float f2 = 1.0f;
this.f6770W.setAlpha(1.0f);
this.f6770W.setVisibility(0);
if (this.f6784k0) {
view = this.f6756N;
} else {
view = this.f6756N;
f2 = 1.0f - this.f6783j0;
}
view.setAlpha(f2);
P2(10.0d);
}
public String V2(String str) {
ArrayList arrayList = L0.a.U(this).f1168U;
String str2 = null;
if (arrayList != null) {
Iterator it = arrayList.iterator();
while (it.hasNext()) {
HashMap hashMap = (HashMap) it.next();
if (((Pattern) hashMap.get("regex")).matcher(str).matches() && hashMap.containsKey("title")) {
str2 = (String) hashMap.get("title");
}
}
}
return str2;
}
@Override
public void W(String str, String str2) {
String url = this.f6750K.getUrl();
if (TextUtils.isEmpty(str)) {
str = url;
} else {
try {
URI uri = new URI(str);
if (!uri.isAbsolute()) {
str = new URI(url).resolve(uri).toString();
}
} catch (URISyntaxException unused) {
}
}
if (TextUtils.isEmpty(str)) {
return;
}
if (!TextUtils.isEmpty(str2)) {
str = str2 + System.lineSeparator() + str;
}
Intent intent = new Intent("android.intent.action.SEND");
intent.setType("text/plain");
intent.putExtra("android.intent.extra.TEXT", str);
startActivity(Intent.createChooser(intent, getString(R.string.action_share)));
}
public void W2() {
this.f6791r0.g();
}
@Override
public void X() {
if (t0().g0("ShakeDialogFragment") != null) {
return;
}
new u().O1(t0(), "ShakeDialogFragment");
}
@Override
public void Y(JSONObject jSONObject) {
if (this.f6792s0 == null) {
return;
}
if (jSONObject != null) {
JSONObject optJSONObject = jSONObject.optJSONObject("customData");
if (optJSONObject == null) {
try {
optJSONObject = new JSONObject(jSONObject.optString("customData"));
} catch (JSONException e2) {
L0.f.a().c(f6737S0, "GoNative Registration JSONException:- " + e2.getMessage(), e2);
}
}
if (optJSONObject != null) {
this.f6792s0.h(optJSONObject);
}
}
this.f6792s0.g();
}
public void Y2() {
if (L0.a.U(this).f1178Y) {
setTitle(this.f6750K.getTitle());
}
}
@Override
public void Z() {
this.f6750K.clearCache(true);
}
public boolean Z1() {
NetworkInfo activeNetworkInfo = this.f6776c0.getActiveNetworkInfo();
return activeNetworkInfo == null || !activeNetworkInfo.isConnected();
}
@Override
public void m2(String str) {
if (str == null) {
return;
}
this.f6750K.a(str);
}
@Override
public void a0() {
this.f6778e0.h();
}
public int a3(String str) {
ArrayList arrayList = L0.a.U(this).f1162S;
if (arrayList == null) {
return -1;
}
for (int i2 = 0; i2 < arrayList.size(); i2++) {
if (((Pattern) arrayList.get(i2)).matcher(str).matches()) {
return ((Integer) L0.a.U(this).f1165T.get(i2)).intValue();
}
}
return -1;
}
@Override
public void c(JSONObject jSONObject, int i2) {
v vVar = this.f6778e0;
if (vVar == null) {
return;
}
vVar.q(jSONObject, i2);
}
public boolean c2() {
return !this.f6780g0;
}
@Override
public void d(String str) {
M m2 = this.f6794u0;
if (m2 == null) {
return;
}
m2.e(str);
}
public boolean d2() {
return this.f6749J0;
}
@Override
public void f(boolean z2) {
this.f6760P = z2;
D2(z2);
}
@Override
public void g() {
String str = L0.a.U(this).f1139K0;
this.f6765R0 = str;
F(str);
}
@Override
public void h(boolean z2) {
int i2;
AbstractC0233a C02 = C0();
View decorView = getWindow().getDecorView();
int systemUiVisibility = decorView.getSystemUiVisibility();
int i3 = 519 | 6144;
if (z2) {
i2 = systemUiVisibility | i3;
if (C02 != null) {
C02.m();
}
} else {
i2 = systemUiVisibility & (~i3);
if (C02 != null && L0.a.U(this).f1148N0) {
C02.F();
}
this.f6750K.clearFocus();
}
decorView.setSystemUiVisibility(i2);
if (!z2 || L0.a.U(this).f1239t == a.EnumC0011a.LANDSCAPE) {
G2();
} else {
setRequestedOrientation(4);
}
}
@Override
public void k(float f2) {
WindowManager.LayoutParams attributes = getWindow().getAttributes();
attributes.screenBrightness = f2;
getWindow().setAttributes(attributes);
}
@Override
public void l(String str) {
String str2;
if (TextUtils.isEmpty(str)) {
return;
}
HashMap hashMap = new HashMap();
ClipboardManager clipboardManager = (ClipboardManager) getSystemService("clipboard");
if (clipboardManager.hasPrimaryClip()) {
CharSequence text = clipboardManager.getPrimaryClip().getItemAt(0).getText();
if (text != null) {
hashMap.put("data", text.toString());
m2(L0.k.b(str, new JSONObject(hashMap)));
}
str2 = "Clipboard item is not a string.";
} else {
str2 = "No Clipboard item available.";
}
hashMap.put("error", str2);
m2(L0.k.b(str, new JSONObject(hashMap)));
}
@Override
public void m(String str) {
c0 c0Var = this.f6763Q0;
if (c0Var != null) {
c0Var.b(str);
}
}
@Override
public void n(String str) {
if (str == null) {
return;
}
this.f6744G0 = str;
if (this.f6745H0 != null) {
z2(str);
} else {
n2();
new Handler().postDelayed(new a(), 500L);
}
}
@Override
public void o() {
if (I1().g(this.f6786m0)) {
return;
}
finish();
}
public void o2(String str) {
p2(str, false);
}
@Override
public void onActivityResult(int i2, int i3, Intent intent) {
boolean z2;
String str;
super.onActivityResult(i2, i3, intent);
((GoNativeApplication) getApplication()).f6732r.l(this, i2, i3, intent);
if (intent != null && intent.getBooleanExtra("exit", false)) {
finish();
}
if (intent != null) {
str = intent.getStringExtra("url");
z2 = intent.getBooleanExtra("success", false);
} else {
z2 = false;
str = null;
}
if (i2 == 300 && i3 == -1) {
if (str != null) {
o2(str);
} else {
this.f6750K.setCheckLoginSignup(false);
this.f6750K.loadUrl(L0.a.U(this).T());
}
if (L0.a.U(this).f1141L) {
X2(z2);
}
}
if (i2 == 400 && i3 == -1 && str != null) {
int intExtra = intent.getIntExtra("urlLevel", -1);
int c2 = I1().c(this.f6786m0);
if (intExtra == -1 || c2 == -1 || intExtra > c2) {
this.f6799z0 = intent.getStringExtra("postLoadJavascript");
o2(str);
} else {
setResult(-1, intent);
finish();
}
}
if (i2 == 100) {
if (i3 != -1) {
s1();
return;
}
if (intent != null && intent.getData() != null) {
ValueCallback valueCallback = this.f6762Q;
if (valueCallback != null) {
valueCallback.onReceiveValue(intent.getData());
this.f6762Q = null;
}
ValueCallback valueCallback2 = this.f6764R;
if (valueCallback2 != null) {
valueCallback2.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(i3, intent));
this.f6764R = null;
return;
}
return;
}
if (intent == null || intent.getClipData() == null) {
if (this.f6766S == null) {
s1();
return;
}
Uri a2 = new J0.a().a(this, this.f6766S);
ValueCallback valueCallback3 = this.f6762Q;
if (valueCallback3 != null) {
valueCallback3.onReceiveValue(a2);
this.f6762Q = null;
}
ValueCallback valueCallback4 = this.f6764R;
if (valueCallback4 != null) {
valueCallback4.onReceiveValue(new Uri[]{a2});
this.f6764R = null;
}
getContentResolver().delete(this.f6766S, null, null);
this.f6766S = null;
return;
}
ClipData clipData = intent.getClipData();
ArrayList arrayList = new ArrayList(clipData.getItemCount());
for (int i4 = 0; i4 < clipData.getItemCount(); i4++) {
ClipData.Item itemAt = clipData.getItemAt(i4);
if (itemAt.getUri() != null) {
arrayList.add(itemAt.getUri());
}
}
if (this.f6762Q != null) {
if (arrayList.size() > 0) {
this.f6762Q.onReceiveValue((Uri) arrayList.get(0));
} else {
this.f6762Q.onReceiveValue(null);
}
this.f6762Q = null;
}
ValueCallback valueCallback5 = this.f6764R;
if (valueCallback5 != null) {
valueCallback5.onReceiveValue((Uri[]) arrayList.toArray(new Uri[arrayList.size()]));
this.f6764R = null;
}
}
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
this.f6779f0.C();
GoNativeApplication goNativeApplication = (GoNativeApplication) getApplication();
AbstractC0234b abstractC0234b = this.f6775b0;
if (abstractC0234b != null) {
abstractC0234b.g(configuration);
}
goNativeApplication.f6732r.q(this);
}
@Override
public void onCreate(Bundle bundle) {
String str;
boolean z2;
ImageView imageView;
RelativeLayout relativeLayout;
L0.a U2 = L0.a.U(this);
GoNativeApplication goNativeApplication = (GoNativeApplication) getApplication();
co.median.android.l j2 = goNativeApplication.j();
boolean booleanExtra = getIntent().getBooleanExtra("isRoot", true);
this.f6780g0 = booleanExtra;
if (booleanExtra) {
i0.c.c(this);
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public final void run() {
MainActivity.this.w2();
}
}, 7000L);
}
String stringExtra = getIntent().getStringExtra("source");
this.f6761P0 = stringExtra;
this.f6761P0 = TextUtils.isEmpty(stringExtra) ? "default" : this.f6761P0;
if (U2.f1251x) {
h(true);
}
G2();
if (U2.f1248w) {
getWindow().addFlags(128);
}
this.f6783j0 = U2.f1181Z0;
this.f6765R0 = j0.a(this);
if (Build.VERSION.SDK_INT <= 30) {
if (bundle == null || !bundle.getBoolean("ignoreThemeSetup", false)) {
j0.d(this.f6765R0);
} else {
Log.d(f6737S0, "onCreate: configuration change from setupAppTheme(), ignoring theme setup");
}
}
super.onCreate(bundle);
this.f6786m0 = UUID.randomUUID().toString();
int intExtra = getIntent().getIntExtra("urlLevel", -1);
int intExtra2 = getIntent().getIntExtra("parentUrlLevel", -1);
if (bundle != null) {
this.f6786m0 = bundle.getString("activityId", this.f6786m0);
this.f6780g0 = bundle.getBoolean("isRoot", this.f6780g0);
intExtra = bundle.getInt("urlLevel", intExtra);
intExtra2 = bundle.getInt("parentUrlLevel", intExtra2);
}
j2.a(this.f6786m0, this.f6780g0);
j2.m(this.f6786m0, intExtra, intExtra2);
if (U2.f1129H) {
j2.j(this.f6786m0, getIntent().getBooleanExtra("ignoreInterceptMaxWindows", false));
}
if (this.f6780g0) {
W1();
}
this.f6791r0 = goNativeApplication.f();
this.f6790q0 = new co.median.android.h(this);
this.f6789p0 = new co.median.android.e(this);
this.f6763Q0 = new c0(this);
goNativeApplication.h().p(this);
this.f6776c0 = (ConnectivityManager) getSystemService("connectivity");
setContentView(R.layout.activity_gonative);
goNativeApplication.f6732r.h(this, this.f6780g0);
final ViewGroup viewGroup = (ViewGroup) findViewById(android.R.id.content);
viewGroup.getViewTreeObserver().addOnPreDrawListener(new e(viewGroup));
this.f6770W = (CircularProgressIndicator) findViewById(R.id.progress);
this.f6773Z = (RelativeLayout) findViewById(R.id.fullscreen);
MySwipeRefreshLayout mySwipeRefreshLayout = (MySwipeRefreshLayout) findViewById(R.id.swipe_refresh);
this.f6771X = mySwipeRefreshLayout;
mySwipeRefreshLayout.setEnabled(U2.f1120E);
this.f6771X.setOnRefreshListener(this);
this.f6771X.setCanChildScrollUpCallback(new MySwipeRefreshLayout.a() {
@Override
public final boolean a() {
boolean g2;
g2 = MainActivity.this.g2();
return g2;
}
});
if (X1()) {
U2.f1123F = false;
}
SwipeHistoryNavigationLayout swipeHistoryNavigationLayout = (SwipeHistoryNavigationLayout) findViewById(R.id.swipe_history_nav);
this.f6772Y = swipeHistoryNavigationLayout;
swipeHistoryNavigationLayout.setEnabled(U2.f1123F);
this.f6772Y.setSwipeNavListener(new f(U2));
this.f6771X.setColorSchemeColors(getResources().getColor(R.color.pull_to_refresh_color));
this.f6772Y.setActiveColor(getResources().getColor(R.color.pull_to_refresh_color));
this.f6771X.setProgressBackgroundColorSchemeColor(getResources().getColor(R.color.swipe_nav_background));
this.f6772Y.setBackgroundColor(getResources().getColor(R.color.swipe_nav_background));
if (this.f6780g0 && (U2.f1148N0 || U2.f1141L)) {
L2();
}
CookieHandler.setDefault(new w0());
String stringExtra2 = getIntent().getStringExtra("postLoadJavascript");
this.f6799z0 = stringExtra2;
this.f6738A0 = stringExtra2;
this.f6739B0 = new Stack();
v vVar = new v(this, (BottomNavigationView) findViewById(R.id.bottom_navigation));
this.f6778e0 = vVar;
vVar.r(false);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
if (C0() == null) {
M0(toolbar);
}
if (!U2.f1148N0 && !U2.f1141L) {
C0().m();
}
if (!U2.f1163S0 && !U2.f1166T0 && (relativeLayout = (RelativeLayout) findViewById(R.id.header_layout)) != null) {
relativeLayout.setVisibility(8);
}
if (!U2.f1163S0 && (imageView = (ImageView) findViewById(R.id.app_logo)) != null) {
imageView.setVisibility(8);
}
TextView textView = (TextView) findViewById(R.id.app_name);
if (textView != null) {
if (U2.f1166T0) {
textView.setText(U2.f1200g);
} else {
textView.setVisibility(4);
}
}
co.median.android.a aVar = new co.median.android.a(this);
this.f6779f0 = aVar;
aVar.B(this.f6780g0);
if (toolbar != null && toolbar.getOverflowIcon() != null) {
toolbar.getOverflowIcon().setColorFilter(getResources().getColor(R.color.titleTextColor), PorterDuff.Mode.SRC_ATOP);
}
if (goNativeApplication.k()) {
goNativeApplication.l();
} else {
this.f6756N = findViewById(R.id.webviewOverlay);
WebViewContainerView webViewContainerView = (WebViewContainerView) findViewById(R.id.webviewContainer);
this.f6748J = webViewContainerView;
this.f6750K = webViewContainerView.getWebview();
this.f6748J.b(this, this.f6780g0);
M2(this.f6765R0);
if (bundle != null) {
Bundle bundle2 = bundle.getBundle("webViewState");
if (bundle2 != null) {
this.f6750K.e(bundle2);
z2 = true;
} else {
z2 = false;
}
this.f6750K.scrollTo(bundle.getInt("scrollX", 0), bundle.getInt("scrollY", 0));
if (z2) {
str = this.f6750K.getUrl();
this.f6779f0.D(str);
}
}
Intent intent = getIntent();
String P12 = P1(intent);
if (P12 == null && this.f6780g0) {
P12 = U2.T();
}
if (P12 == null) {
P12 = intent.getStringExtra("url");
}
if (P12 != null) {
Map c2 = goNativeApplication.f6732r.c(this, this.f6780g0);
if (c2 == null || c2.isEmpty()) {
str = P12;
} else {
Uri.Builder buildUpon = Uri.parse(P12).buildUpon();
for (Map.Entry entry : c2.entrySet()) {
buildUpon.appendQueryParameter((String) entry.getKey(), (String) entry.getValue());
}
str = buildUpon.build().toString();
}
this.f6758O = str;
this.f6750K.loadUrl(str);
} else {
if (!intent.getBooleanExtra("io.gonative.android.MainActivity.Extra.WEBVIEW_WINDOW_OPEN", false)) {
L0.f.a().b(f6737S0, "No url specified for MainActivity");
}
str = P12;
}
this.f6779f0.D(str);
}
N2(this.f6780g0 && U2.f1141L);
androidx.core.view.M.F0(viewGroup, new A() {
@Override
public final androidx.core.view.n0 a(View view, androidx.core.view.n0 n0Var) {
androidx.core.view.n0 h2;
h2 = MainActivity.h2(viewGroup, view, n0Var);
return h2;
}
});
P(U2.f1172V0);
V(U2.f1175W0);
this.f6794u0 = new M(this, viewGroup);
View view = this.f6768U;
if (view != null) {
view.setBackgroundColor(getResources().getColor(R.color.sidebarBackground));
}
this.f6795v0 = new g();
C0565a.b(this).c(this.f6795v0, new IntentFilter("io.gonative.android.AppConfig.processedNavigationTitles"));
this.f6796w0 = new h();
C0565a.b(this).c(this.f6796w0, new IntentFilter("io.gonative.android.AppConfig.processedNavigationLevels"));
this.f6797x0 = new i();
C0565a.b(this).c(this.f6797x0, new IntentFilter("io.gonative.android.MainActivity.Extra.BROADCAST_RECEIVER_ACTION_WEBVIEW_LIMIT_REACHED"));
b3();
this.f6751K0 = q0(new b.c(), new androidx.activity.result.a() {
@Override
public final void a(Object obj) {
MainActivity.this.i2((Boolean) obj);
}
});
this.f6753L0 = q0(new b.d(), new androidx.activity.result.a() {
@Override
public final void a(Object obj) {
MainActivity.this.j2((ActivityResult) obj);
}
});
if (U2.b4) {
w2();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.topmenu, menu);
this.f6785l0 = menu;
co.median.android.a aVar = this.f6779f0;
if (aVar == null) {
return true;
}
aVar.h(menu);
return true;
}
@Override
protected void onDestroy() {
super.onDestroy();
GoNativeApplication goNativeApplication = (GoNativeApplication) getApplication();
goNativeApplication.f6732r.i(this);
goNativeApplication.j().h(this.f6786m0);
co.median.android.e eVar = this.f6789p0;
if (eVar != null) {
eVar.v();
}
L0.i iVar = this.f6750K;
if (iVar != null) {
iVar.stopLoading();
ViewGroup viewGroup = (ViewGroup) this.f6750K.getParent();
if (viewGroup != null) {
viewGroup.removeView((View) this.f6750K);
}
if (!this.f6752L) {
this.f6750K.destroy();
this.f6750K = null;
}
}
this.f6791r0.deleteObserver(this);
if (this.f6795v0 != null) {
C0565a.b(this).e(this.f6795v0);
}
if (this.f6796w0 != null) {
C0565a.b(this).e(this.f6796w0);
}
if (this.f6797x0 != null) {
C0565a.b(this).e(this.f6797x0);
}
v vVar = this.f6778e0;
if (vVar != null) {
vVar.s();
}
if (goNativeApplication.h() != null) {
goNativeApplication.h().s(this);
}
}
@Override
public boolean onKeyDown(int i2, KeyEvent keyEvent) {
if (i2 == 4) {
if (L0.a.U(this).f1186b0 || this.f6750K.d()) {
return true;
}
if (a2()) {
this.f6767T.j();
return true;
}
if (q1()) {
S1();
return true;
}
if (!this.f6739B0.isEmpty()) {
Bundle bundle = (Bundle) this.f6739B0.pop();
co.median.android.n nVar = new co.median.android.n(this);
nVar.e(bundle);
U2(nVar, false, true);
return true;
}
}
if (((GoNativeApplication) getApplication()).f6732r.s(i2, keyEvent)) {
return true;
}
return super.onKeyDown(i2, keyEvent);
}
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
String P12 = P1(intent);
if (P12 == null || P12.isEmpty()) {
Log.w(f6737S0, "Received intent without url");
((GoNativeApplication) getApplication()).f6732r.j(this, intent);
} else {
if (Z2(P12, this.f6750K.getUrl())) {
return;
}
o2(P12);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
AbstractC0234b abstractC0234b = this.f6775b0;
if (abstractC0234b != null && abstractC0234b.h(menuItem)) {
return true;
}
co.median.android.a aVar = this.f6779f0;
if (aVar != null && aVar.x(menuItem)) {
return true;
}
if (menuItem.getItemId() != 16908332) {
return super.onOptionsItemSelected(menuItem);
}
if (!this.f6779f0.q()) {
finish();
return true;
}
this.f6779f0.n();
this.f6779f0.A(false);
return true;
}
@Override
public void onPause() {
super.onPause();
GoNativeApplication goNativeApplication = (GoNativeApplication) getApplication();
goNativeApplication.f6732r.k(this);
this.f6746I = true;
S2();
if (this.f6750K != null && goNativeApplication.f6732r.x()) {
this.f6750K.onPause();
}
m mVar = this.f6793t0;
if (mVar != null) {
unregisterReceiver(mVar);
}
CookieManager.getInstance().flush();
this.f6788o0.d();
}
@Override
protected void onPostCreate(Bundle bundle) {
super.onPostCreate(bundle);
((GoNativeApplication) getApplication()).f6732r.u(this, bundle, this.f6780g0);
AbstractC0234b abstractC0234b = this.f6775b0;
if (abstractC0234b != null) {
abstractC0234b.l();
}
}
@Override
public void onRequestPermissionsResult(int i2, String[] strArr, int[] iArr) {
super.onRequestPermissionsResult(i2, strArr, iArr);
((GoNativeApplication) getApplication()).f6732r.v(this, i2, strArr, iArr);
if (i2 == 102) {
n nVar = this.f6740C0;
if (nVar != null) {
if (iArr.length >= 2 && iArr[0] == 0 && iArr[1] == 0) {
nVar.a(true);
} else {
nVar.a(false);
}
this.f6740C0 = null;
return;
}
return;
}
if (i2 != 199) {
return;
}
Iterator it = this.f6741D0.iterator();
while (it.hasNext()) {
p pVar = (p) it.next();
if (pVar.f6817a.length == strArr.length) {
int i3 = 0;
while (true) {
String[] strArr2 = pVar.f6817a;
if (i3 >= strArr2.length || i3 >= strArr.length) {
break;
} else if (!strArr2[i3].equals(strArr[i3])) {
break;
} else {
i3++;
}
}
o oVar = pVar.f6818b;
if (oVar != null) {
oVar.a(strArr, iArr);
}
it.remove();
}
}
if (this.f6741D0.size() != 0 || this.f6742E0.size() <= 0) {
return;
}
Iterator it2 = this.f6742E0.iterator();
while (it2.hasNext()) {
startActivity((Intent) it2.next());
it2.remove();
}
}
@Override
public void onResume() {
String str;
super.onResume();
GoNativeApplication goNativeApplication = (GoNativeApplication) getApplication();
goNativeApplication.p(false);
goNativeApplication.f6732r.m(this);
L0.i iVar = this.f6750K;
if (iVar != null) {
iVar.onResume();
}
L0.a U2 = L0.a.U(this);
if (this.f6746I) {
this.f6746I = false;
if (U2.f1117D) {
m2(L0.k.b("median_app_resumed", null));
str = "gonative_app_resumed";
} else {
str = "_median_app_resumed";
}
m2(L0.k.b(str, null));
}
y2();
m mVar = new m();
this.f6793t0 = mVar;
registerReceiver(mVar, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
this.f6791r0.g();
if (U2.f1183a0) {
SensorManager sensorManager = (SensorManager) getSystemService("sensor");
this.f6788o0.b(15);
this.f6788o0.c(sensorManager);
}
}
@Override
public void onSaveInstanceState(Bundle bundle) {
if (this.f6750K != null) {
Bundle bundle2 = new Bundle();
this.f6750K.c(bundle2);
bundle.putBundle("webViewState", bundle2);
bundle.putString("activityId", this.f6786m0);
bundle.putBoolean("isRoot", I1().g(this.f6786m0));
bundle.putInt("urlLevel", I1().d(this.f6786m0));
bundle.putInt("parentUrlLevel", I1().c(this.f6786m0));
bundle.putInt("scrollX", this.f6750K.getWebViewScrollX());
bundle.putInt("scrollY", this.f6750K.getWebViewScrollY());
}
if (this.f6757N0) {
bundle.putBoolean("ignoreThemeSetup", true);
}
if (B1(bundle) > 512000) {
bundle.clear();
}
super.onSaveInstanceState(bundle);
}
@Override
protected void onStart() {
super.onStart();
((GoNativeApplication) getApplication()).f6732r.n(this);
if (L0.a.U(this).f1247v1) {
AbstractC0171p.d(this);
}
}
@Override
protected void onStop() {
super.onStop();
((GoNativeApplication) getApplication()).f6732r.o(this);
if (this.f6780g0 && L0.a.U(this).f1233r) {
this.f6750K.clearCache(true);
}
}
public void p1(String str) {
if (str == null) {
return;
}
if (this.f6754M.isEmpty() || !((String) this.f6754M.peek()).equals(str)) {
this.f6754M.push(str);
}
t1(str);
P2(0.3d);
}
public void p2(String str, boolean z2) {
v vVar;
if (str == null) {
return;
}
this.f6799z0 = null;
this.f6738A0 = null;
if (str.equalsIgnoreCase("median_logout") || str.equalsIgnoreCase("gonative_logout")) {
s2();
} else {
this.f6750K.loadUrl(str);
}
if (z2 || (vVar = this.f6778e0) == null) {
return;
}
vVar.m(str, null);
}
@Override
public void q(int i2) {
getWindow().setStatusBarColor(i2);
}
public boolean q1() {
L0.i iVar = this.f6750K;
if (iVar == null) {
return false;
}
return iVar.canGoBack();
}
public void q2(String str, String str2) {
r2(str, str2, false);
}
@Override
public void r(String str, String str2, boolean z2, boolean z3) {
this.f6789p0.j(str, str2, z2, z3);
}
public void r2(String str, String str2, boolean z2) {
v vVar;
String url = this.f6750K.getUrl();
if (str == null || url == null || !str.equals(url)) {
this.f6799z0 = str2;
this.f6738A0 = str2;
this.f6750K.loadUrl(str);
} else {
m2(str2);
this.f6738A0 = str2;
}
if (z2 || (vVar = this.f6778e0) == null) {
return;
}
vVar.m(str, str2);
}
@Override
public void s() {
N1(new n() {
@Override
public final void a(boolean z2) {
MainActivity.l2(z2);
}
});
}
public void s1() {
ValueCallback valueCallback = this.f6762Q;
if (valueCallback != null) {
valueCallback.onReceiveValue(null);
this.f6762Q = null;
}
ValueCallback valueCallback2 = this.f6764R;
if (valueCallback2 != null) {
valueCallback2.onReceiveValue(null);
this.f6764R = null;
}
this.f6766S = null;
}
@Override
public void setTitle(CharSequence charSequence) {
super.setTitle(charSequence);
co.median.android.a aVar = this.f6779f0;
if (aVar != null) {
aVar.F(charSequence);
}
}
public void t1(String str) {
if (str.equals(this.f6789p0.o())) {
return;
}
v vVar = this.f6778e0;
if (vVar != null) {
vVar.g(str);
}
co.median.android.a aVar = this.f6779f0;
if (aVar != null) {
aVar.m(str);
}
s sVar = this.f6792s0;
if (sVar != null) {
sVar.d(str);
}
co.median.android.m mVar = this.f6774a0;
if (mVar != null) {
mVar.b(str);
}
}
public boolean t2(final String str) {
L0.a U2 = L0.a.U(this);
final co.median.android.l I12 = I1();
if (!U2.f1135J || !L0.k.k(str, U2.T())) {
String b2 = I12.b();
Intent intent = new Intent("io.gonative.android.MainActivity.Extra.BROADCAST_RECEIVER_ACTION_WEBVIEW_LIMIT_REACHED");
intent.putExtra("excessWindowId", b2);
C0565a.b(this).d(intent);
I12.h(b2);
return false;
}
this.f6780g0 = true;
I12.i(this.f6786m0);
I12.m(this.f6786m0, -1, -1);
W1();
if (U2.f1148N0 || U2.f1141L) {
L2();
}
N2(U2.f1141L);
co.median.android.a aVar = this.f6779f0;
if (aVar != null) {
aVar.B(this.f6780g0);
this.f6779f0.D(str);
}
AbstractC0234b abstractC0234b = this.f6775b0;
if (abstractC0234b != null && U2.f1141L) {
abstractC0234b.l();
}
I12.j(this.f6786m0, true);
Intent intent2 = new Intent("io.gonative.android.MainActivity.Extra.BROADCAST_RECEIVER_ACTION_WEBVIEW_LIMIT_REACHED");
intent2.putExtra("newRootUrl", str);
C0565a.b(this).d(intent2);
I12.k(new l.b() {
@Override
public final void a() {
MainActivity.this.k2(str, I12);
}
});
return true;
}
@Override
public void u(boolean z2, int i2) {
if (z2) {
getWindow().addFlags(i2);
} else {
getWindow().clearFlags(i2);
}
}
public void u1(String str) {
v vVar = this.f6778e0;
if (vVar != null) {
vVar.f(str);
}
co.median.android.m mVar = this.f6774a0;
if (mVar != null) {
mVar.b(str);
}
L0.a U2 = L0.a.U(this);
boolean z2 = false;
D2(U2.i0(str) && this.f6760P);
GoNativeDrawerLayout goNativeDrawerLayout = this.f6767T;
if (goNativeDrawerLayout == null || goNativeDrawerLayout.s(8388611) == 1) {
return;
}
GoNativeDrawerLayout goNativeDrawerLayout2 = this.f6767T;
if (U2.f1123F && q1()) {
z2 = true;
}
goNativeDrawerLayout2.setDisableTouch(z2);
}
public void u2(Uri uri) {
if (uri == null) {
return;
}
try {
androidx.browser.customtabs.b a2 = new b.d().c(new a.C0025a().c(androidx.core.content.a.b(this, R.color.colorPrimary)).b(androidx.core.content.a.b(this, R.color.titleTextColor)).a()).a();
a2.f3659a.setData(uri);
this.f6753L0.a(a2.f3659a);
} catch (Exception e2) {
if (e2 instanceof ActivityNotFoundException) {
Toast.makeText(this, R.string.app_not_installed, 1).show();
L0.f.a().d(f6737S0, getString(R.string.app_not_installed), e2, 2);
return;
}
L0.f.a().c(f6737S0, "openAppBrowser: launchError - uri: " + uri, e2);
}
}
@Override
public void update(Observable observable, Object obj) {
if (observable instanceof co.median.android.o) {
X2(((co.median.android.o) observable).h());
}
}
@Override
public void v(int i2) {
v vVar = this.f6778e0;
if (vVar == null) {
return;
}
vVar.n(i2, false);
}
public void v1() {
this.f6750K.a("if (median_status_checker && typeof median_status_checker.onReadyState === 'function') median_status_checker.onReadyState(document.readyState);");
}
public void v2(Uri uri) {
if (uri == null) {
return;
}
try {
Intent intent = new Intent("android.intent.action.VIEW", uri);
intent.addFlags(268435456);
if (Y1(uri)) {
intent.setPackage(C1());
}
startActivity(intent);
} catch (Exception e2) {
if (e2 instanceof ActivityNotFoundException) {
Toast.makeText(this, R.string.app_not_installed, 1).show();
L0.f.a().d(f6737S0, getString(R.string.app_not_installed), e2, 2);
return;
}
L0.f.a().c(f6737S0, "openExternalBrowser: launchError - uri: " + uri, e2);
}
}
@Override
public void x(boolean z2) {
this.f6749J0 = z2;
}
public void x1() {
this.f6767T.j();
}
public void x2() {
if (this.f6771X != null) {
this.f6771X.setEnabled(L0.a.U(this).f1120E);
}
}
@Override
public void y(String str) {
c0 c0Var = this.f6763Q0;
if (c0Var != null) {
c0Var.c(str);
}
}
public void y1() {
MySwipeRefreshLayout mySwipeRefreshLayout = this.f6771X;
if (mySwipeRefreshLayout != null) {
mySwipeRefreshLayout.setEnabled(true);
}
}
@Override
public void z(boolean z2) {
if (z2) {
AbstractC0171p.h(this);
} else {
AbstractC0171p.c(this);
}
}
public co.median.android.a z1() {
return this.f6779f0;
}
}