Files
rr3-apk/decompiled/sources/com/tapjoy/TJAdUnitActivity.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

184 lines
6.3 KiB
Java

package com.tapjoy;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.ViewGroup;
import com.ironsource.v8;
import com.tapjoy.TJAdUnitConstants;
import com.tapjoy.TapjoyErrorMessage;
/* loaded from: classes4.dex */
public class TJAdUnitActivity extends TJActivity {
public static TJAdUnitActivity i;
public TJAdUnit f;
public TJPlacementData g;
public final Handler e = new Handler(Looper.getMainLooper());
public boolean h = false;
@Override // com.tapjoy.TJActivity
public final void a() {
a(false);
}
@Override // com.tapjoy.TJActivity, android.view.View.OnClickListener
public void onClick(View view) {
a(false);
}
@Override // android.app.Activity, android.content.ComponentCallbacks
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
TJAdUnit tJAdUnit = this.f;
if (tJAdUnit != null) {
tJAdUnit.notifyOrientationChanged();
}
}
@Override // com.tapjoy.TJActivity, android.app.Activity
public final void onCreate(Bundle bundle) {
TapjoyLog.d("TJAdUnitActivity", "TJAdUnitActivity onCreate: " + bundle);
super.onCreate(bundle);
i = this;
Bundle extras = getIntent().getExtras();
String string = extras != null ? extras.getString(TJAdUnitConstants.EXTRA_TJ_PLACEMENT_NAME) : null;
TJPlacementData tJPlacementData = string != null ? (TJPlacementData) TJMemoryDataStorage.getInstance().get(string) : null;
this.g = tJPlacementData;
if (tJPlacementData == null) {
TapjoyLog.e("TJAdUnitActivity", new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.SDK_ERROR, "Failed to launch AdUnit Activity"));
finish();
return;
}
if (tJPlacementData.getContentViewId() != null) {
TapjoyConnectCore.getInstance().viewWillOpen(this.g.getContentViewId());
}
if (TJPlacementManager.a(this.g.getKey()) != null) {
this.f = TJPlacementManager.a(this.g.getKey()).getAdUnit();
} else {
this.f = new TJAdUnit();
}
if (!this.f.hasCalledLoad()) {
TapjoyLog.d("TJAdUnitActivity", "No content loaded for ad unit -- loading now");
this.f.load(this.g, false, this);
}
this.f.setAdUnitActivity(this);
try {
setRequestedOrientation(TJDeviceUtils.INSTANCE.getScreenOrientation(this));
View backgroundView = this.f.getBackgroundView();
backgroundView.setLayoutParams(this.b);
if (backgroundView.getParent() != null) {
((ViewGroup) backgroundView.getParent()).removeView(backgroundView);
}
TJWebView webView = this.f.getWebView();
webView.setLayoutParams(this.b);
if (webView.getParent() != null) {
((ViewGroup) webView.getParent()).removeView(webView);
}
this.a.addView(backgroundView);
this.a.addView(webView);
if (this.g.hasProgressSpinner()) {
setProgressSpinnerVisibility(true);
} else {
setProgressSpinnerVisibility(false);
}
this.a.addView(this.d);
this.a.addView(this.c);
setContentView(this.a);
this.f.setVisible(true);
} catch (Exception e) {
TapjoyLog.e("TJAdUnitActivity", e.getMessage());
}
}
@Override // android.app.Activity
public final void onDestroy() {
super.onDestroy();
if (!this.h) {
b();
}
i = null;
}
@Override // android.app.Activity
public final void onPause() {
TJPlacementData tJPlacementData;
super.onPause();
TapjoyLog.d("TJAdUnitActivity", v8.h.t0);
TJAdUnit tJAdUnit = this.f;
if (tJAdUnit != null) {
tJAdUnit.pause();
} else {
finish();
}
if (isFinishing() && (tJPlacementData = this.g) != null && tJPlacementData.shouldHandleDismissOnPause()) {
TapjoyLog.d("TJAdUnitActivity", "is Finishing");
b();
}
}
@Override // android.app.Activity
public final void onResume() {
TapjoyLog.d("TJAdUnitActivity", v8.h.u0);
super.onResume();
TJAdUnit tJAdUnit = this.f;
if (tJAdUnit != null) {
tJAdUnit.resume();
}
}
@Override // android.app.Activity
public final void onStart() {
super.onStart();
TapjoyLog.d("TJAdUnitActivity", "onStart");
}
@Override // android.app.Activity
public final void onStop() {
super.onStop();
TapjoyLog.d("TJAdUnitActivity", "onStop");
}
public final void a(boolean z) {
TJAdUnit tJAdUnit = this.f;
if (tJAdUnit != null) {
if (!tJAdUnit.getCloseRequested()) {
TapjoyLog.d("TJAdUnitActivity", TJAdUnitConstants.String.CLOSE_REQUESTED);
this.f.closeRequested(z);
this.e.postDelayed(new l(this), 1000L);
}
} else {
finish();
}
if (this.g != null) {
TJMemoryDataStorage.getInstance().remove(this.g.getPlacementName());
}
}
public final void b() {
TJPlacement a;
i = null;
this.h = true;
TJAdUnit tJAdUnit = this.f;
if (tJAdUnit != null) {
tJAdUnit.destroy();
}
TJPlacementData tJPlacementData = this.g;
if (tJPlacementData != null) {
if (tJPlacementData.getContentViewId() != null) {
TapjoyConnectCore.getInstance().viewDidClose(this.g.getContentViewId());
}
TJCorePlacement a2 = TJPlacementManager.a(this.g.getKey());
if (a2 == null || (a = a2.a("SHOW")) == null || a.getListener() == null) {
return;
}
TapjoyLog.i("TJCorePlacement", "Content dismissed for placement " + a2.d.getPlacementName());
TJPlacementListener tJPlacementListener = a.c;
if (tJPlacementListener != null) {
tJPlacementListener.onContentDismiss(a);
}
}
}
}