Files
rr3-apk/decompiled-community/sources/com/tapjoy/TJWebViewActivity.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

293 lines
11 KiB
Java

package com.tapjoy;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.PersistableBundle;
import android.view.View;
import android.webkit.URLUtil;
import android.webkit.WebView;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.gms.drive.DriveFile;
import com.tapjoy.TJAdUnitConstants;
import com.unity3d.ads.adplayer.AndroidWebViewClient;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes4.dex */
public class TJWebViewActivity extends TJActivity {
public View e;
public TJWebView f;
public TJAdUnitJSBridge g;
public class BridgeDelegate extends TJJSBridgeDelegate {
public BridgeDelegate() {
}
@Override // com.tapjoy.TJJSBridgeDelegate
public boolean dismiss() {
super.dismiss();
TJWebViewActivity.this.finish();
return true;
}
@Override // com.tapjoy.TJJSBridgeDelegate
public boolean fireContentReady() {
super.fireContentReady();
TJWebViewActivity.this.setProgressSpinnerVisibility(false);
return true;
}
@Override // com.tapjoy.TJJSBridgeDelegate
public Context getContext() {
return TJWebViewActivity.this;
}
@Override // com.tapjoy.TJJSBridgeDelegate
public Map<String, Object> getOrientation() {
HashMap hashMap = new HashMap();
TJDeviceUtils tJDeviceUtils = TJDeviceUtils.INSTANCE;
int screenWidth = tJDeviceUtils.getScreenWidth(TJWebViewActivity.this);
int screenHeight = tJDeviceUtils.getScreenHeight(TJWebViewActivity.this);
hashMap.put("orientation", tJDeviceUtils.getOrientationString(screenWidth, screenHeight));
hashMap.put("width", Integer.valueOf(screenWidth));
hashMap.put("height", Integer.valueOf(screenHeight));
return hashMap;
}
@Override // com.tapjoy.TJJSBridgeDelegate
public int getStatusBarHeight() {
Context context = getContext();
if (context == null) {
return 0;
}
return TJDeviceUtils.INSTANCE.getStatusBarHeight(context);
}
@Override // com.tapjoy.TJJSBridgeDelegate
public void getTextZoom(TJTaskHandler<Float> tJTaskHandler) {
TapjoyUtil.runOnMainThread(new h1(this, tJTaskHandler));
}
@Override // com.tapjoy.TJJSBridgeDelegate
public WebView getWebView() {
return TJWebViewActivity.this.f;
}
@Override // com.tapjoy.TJJSBridgeDelegate
public void setBackgroundColor(String str, TJTaskHandler<Boolean> tJTaskHandler) {
TapjoyUtil.runOnMainThread(new e1(this, str, tJTaskHandler));
}
@Override // com.tapjoy.TJJSBridgeDelegate
public void setCloseButtonClickable(boolean z) {
super.setCloseButtonClickable(z);
TapjoyUtil.runOnMainThread(new g1(this, z));
}
@Override // com.tapjoy.TJJSBridgeDelegate
public void setCloseButtonVisible(boolean z) {
super.setCloseButtonVisible(z);
TapjoyUtil.runOnMainThread(new f1(this, z));
}
@Override // com.tapjoy.TJJSBridgeDelegate
public boolean setOrientation(int i) {
TJWebViewActivity.this.setRequestedOrientation(i);
return true;
}
@Override // com.tapjoy.TJJSBridgeDelegate
public void setTextZoom(float f) {
TapjoyUtil.runOnMainThread(new i1(this, f));
}
@Override // com.tapjoy.TJJSBridgeDelegate
public void shouldClose(boolean z) {
if (z) {
TJWebViewActivity.this.finish();
}
}
@Override // com.tapjoy.TJJSBridgeDelegate
public boolean unsetOrientation() {
TJWebViewActivity.this.setRequestedOrientation(-1);
return true;
}
}
@Override // android.app.Activity, android.content.ComponentCallbacks
public void onConfigurationChanged(@NonNull Configuration configuration) {
super.onConfigurationChanged(configuration);
if (this.g != null) {
TJDeviceUtils tJDeviceUtils = TJDeviceUtils.INSTANCE;
int screenWidth = tJDeviceUtils.getScreenWidth(this);
int screenHeight = tJDeviceUtils.getScreenHeight(this);
this.g.notifyOrientationChanged(tJDeviceUtils.getOrientationString(screenWidth, screenHeight), screenWidth, screenHeight);
}
}
@Override // com.tapjoy.TJActivity, android.app.Activity
public final void onCreate(Bundle bundle) {
String str;
String str2;
boolean z;
Bundle extras;
super.onCreate(bundle);
setRequestedOrientation(TJDeviceUtils.INSTANCE.getScreenOrientation(this));
Intent intent = getIntent();
if (intent == null || (extras = intent.getExtras()) == null) {
str = null;
str2 = null;
z = false;
} else {
String str3 = extras.containsKey("url") ? (String) intent.getExtras().get("url") : null;
z = extras.containsKey(TJAdUnitConstants.String.REUSE_HTML) ? ((Boolean) intent.getExtras().get(TJAdUnitConstants.String.REUSE_HTML)).booleanValue() : false;
str2 = extras.containsKey(TJAdUnitConstants.String.HTML) ? (String) intent.getExtras().get(TJAdUnitConstants.String.HTML) : null;
str = str3;
}
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
View view = new View(this);
this.e = view;
view.setBackgroundColor(0);
this.a.addView(this.e, -1, -1);
TJWebView tJWebView = new TJWebView(this);
this.f = tJWebView;
tJWebView.setWebViewClient(new j1(this));
this.g = new TJAdUnitJSBridge(new BridgeDelegate());
if (z) {
this.f.loadDataWithBaseURL(str, str2, "text/html", "UTF-8", null);
} else {
this.f.loadUrl(str);
}
this.a.addView(this.f, -1, -1);
this.a.addView(this.d);
this.a.addView(this.c);
setContentView(this.a, layoutParams);
}
@Override // android.app.Activity
public final void onDestroy() {
this.a.removeAllViews();
TJWebView tJWebView = this.f;
if (tJWebView != null) {
tJWebView.loadUrl(AndroidWebViewClient.BLANK_PAGE);
this.f.destroy();
this.f = null;
}
TJAdUnitJSBridge tJAdUnitJSBridge = this.g;
if (tJAdUnitJSBridge != null) {
tJAdUnitJSBridge.destroy();
this.g = null;
}
super.onDestroy();
}
@Override // android.app.Activity
public final void onPause() {
super.onPause();
TJWebView tJWebView = this.f;
if (tJWebView != null) {
tJWebView.onPause();
}
TJAdUnitJSBridge tJAdUnitJSBridge = this.g;
if (tJAdUnitJSBridge != null) {
tJAdUnitJSBridge.setEnabled(false);
this.g.pause();
}
}
@Override // android.app.Activity
public final void onResume() {
super.onResume();
TJWebView tJWebView = this.f;
if (tJWebView != null) {
tJWebView.onResume();
}
TJAdUnitJSBridge tJAdUnitJSBridge = this.g;
if (tJAdUnitJSBridge != null) {
tJAdUnitJSBridge.setEnabled(true);
this.g.resume();
}
}
@Override // android.app.Activity
public final void onStart() {
super.onStart();
}
@Override // android.app.Activity
public final void onStop() {
super.onStop();
}
@Override // com.tapjoy.TJActivity
public final void a() {
TJAdUnitJSBridge tJAdUnitJSBridge = this.g;
if (tJAdUnitJSBridge == null || tJAdUnitJSBridge.closeRequested) {
return;
}
TapjoyLog.d("TJWebViewActivity", TJAdUnitConstants.String.CLOSE_REQUESTED);
this.g.closeRequested(Boolean.FALSE);
new Handler(getMainLooper()).postDelayed(new d1(this), 1000L);
}
public final boolean a(String str) {
try {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) getSystemService("connectivity")).getActiveNetworkInfo();
if (activeNetworkInfo != null && activeNetworkInfo.isAvailable()) {
if (activeNetworkInfo.isConnected() && URLUtil.isValidUrl(str)) {
try {
String host = new URL(TapjoyConnectCore.getInstance().getHostURL()).getHost();
if ((host != null && str.contains(host)) || str.contains(TapjoyConnectCore.getInstance().getRedirectDomain()) || str.contains(TapjoyUtil.getRedirectDomain(TapjoyConnectCore.getInstance().getPlacementURL()))) {
return false;
}
} catch (MalformedURLException unused) {
}
if (this.g.allowRedirect) {
Uri parse = Uri.parse(str);
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(parse);
intent.addFlags(DriveFile.MODE_READ_ONLY);
if (this.f.getContext() != null) {
try {
this.f.getContext().startActivity(intent);
return true;
} catch (Exception e) {
TapjoyLog.e("TJWebViewActivity", "Exception in loading URL. " + e.getMessage());
}
}
} else if (str.startsWith("javascript:")) {
try {
this.f.evaluateJavascript(str.replaceFirst("javascript:", ""), null);
return true;
} catch (Exception e2) {
TapjoyLog.e("TJWebViewActivity", "Exception in evaluateJavascript. Device not supported. " + e2.toString());
}
}
return false;
}
}
} catch (Exception e3) {
TapjoyLog.d("TJWebViewActivity", "Exception getting NetworkInfo: " + e3.getLocalizedMessage());
}
showErrorDialog();
return true;
}
@Override // android.app.Activity
public void onCreate(@Nullable Bundle bundle, @Nullable PersistableBundle persistableBundle) {
super.onCreate(bundle, persistableBundle);
}
}