Initial commit
This commit is contained in:
444
sources/com/unity3d/ads/adunit/AdUnitActivity.java
Normal file
444
sources/com/unity3d/ads/adunit/AdUnitActivity.java
Normal file
@@ -0,0 +1,444 @@
|
||||
package com.unity3d.ads.adunit;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import com.baidu.cloud.media.player.misc.IMediaFormat;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import com.unity3d.ads.api.AdUnit;
|
||||
import com.unity3d.ads.api.VideoPlayer;
|
||||
import com.unity3d.ads.log.DeviceLog;
|
||||
import com.unity3d.ads.misc.ViewUtilities;
|
||||
import com.unity3d.ads.video.VideoPlayerView;
|
||||
import com.unity3d.ads.webplayer.WebPlayer;
|
||||
import com.unity3d.ads.webview.WebViewApp;
|
||||
import com.unity3d.ads.webview.WebViewEventCategory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AdUnitActivity extends Activity {
|
||||
public static final String EXTRA_ACTIVITY_ID = "activityId";
|
||||
public static final String EXTRA_KEEP_SCREEN_ON = "keepScreenOn";
|
||||
public static final String EXTRA_KEY_EVENT_LIST = "keyEvents";
|
||||
public static final String EXTRA_ORIENTATION = "orientation";
|
||||
public static final String EXTRA_SYSTEM_UI_VISIBILITY = "systemUiVisibility";
|
||||
public static final String EXTRA_VIEWS = "views";
|
||||
private int _activityId;
|
||||
boolean _keepScreenOn;
|
||||
private ArrayList<Integer> _keyEventList;
|
||||
protected AdUnitRelativeLayout _layout;
|
||||
private int _orientation = -1;
|
||||
private int _systemUiVisibility;
|
||||
private RelativeLayout _videoContainer;
|
||||
private String[] _views;
|
||||
private WebPlayer _webPlayer;
|
||||
|
||||
private void createVideoPlayer() {
|
||||
if (this._videoContainer == null) {
|
||||
this._videoContainer = new RelativeLayout(this);
|
||||
}
|
||||
if (VideoPlayer.getVideoPlayerView() == null) {
|
||||
VideoPlayer.setVideoPlayerView(new VideoPlayerView(this));
|
||||
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
|
||||
layoutParams.addRule(13);
|
||||
VideoPlayer.getVideoPlayerView().setLayoutParams(layoutParams);
|
||||
this._videoContainer.addView(VideoPlayer.getVideoPlayerView());
|
||||
}
|
||||
}
|
||||
|
||||
private void createWebPlayer() {
|
||||
if (this._webPlayer == null) {
|
||||
this._webPlayer = new WebPlayer(this, com.unity3d.ads.api.WebPlayer.getWebSettings(), com.unity3d.ads.api.WebPlayer.getWebPlayerSettings());
|
||||
this._webPlayer.setEventSettings(com.unity3d.ads.api.WebPlayer.getWebPlayerEventSettings());
|
||||
}
|
||||
}
|
||||
|
||||
private void destroyVideoPlayer() {
|
||||
if (VideoPlayer.getVideoPlayerView() != null) {
|
||||
VideoPlayer.getVideoPlayerView().stopVideoProgressTimer();
|
||||
VideoPlayer.getVideoPlayerView().stopPlayback();
|
||||
ViewUtilities.removeViewFromParent(VideoPlayer.getVideoPlayerView());
|
||||
}
|
||||
VideoPlayer.setVideoPlayerView(null);
|
||||
RelativeLayout relativeLayout = this._videoContainer;
|
||||
if (relativeLayout != null) {
|
||||
ViewUtilities.removeViewFromParent(relativeLayout);
|
||||
this._videoContainer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void destroyWebPlayer() {
|
||||
WebPlayer webPlayer = this._webPlayer;
|
||||
if (webPlayer != null) {
|
||||
ViewUtilities.removeViewFromParent(webPlayer);
|
||||
}
|
||||
this._webPlayer = null;
|
||||
}
|
||||
|
||||
private void handleViewPlacement(View view) {
|
||||
if (view.getParent() != null && view.getParent().equals(this._layout)) {
|
||||
this._layout.bringChildToFront(view);
|
||||
return;
|
||||
}
|
||||
ViewUtilities.removeViewFromParent(view);
|
||||
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
|
||||
layoutParams.addRule(13);
|
||||
layoutParams.setMargins(0, 0, 0, 0);
|
||||
view.setPadding(0, 0, 0, 0);
|
||||
this._layout.addView(view, layoutParams);
|
||||
}
|
||||
|
||||
protected void createLayout() {
|
||||
if (this._layout != null) {
|
||||
return;
|
||||
}
|
||||
this._layout = new AdUnitRelativeLayout(this);
|
||||
this._layout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
|
||||
ViewUtilities.setBackground(this._layout, new ColorDrawable(-16777216));
|
||||
}
|
||||
|
||||
public AdUnitRelativeLayout getLayout() {
|
||||
return this._layout;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getViewFrame(String str) {
|
||||
if (str.equals("adunit")) {
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this._layout.getLayoutParams();
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("x", Integer.valueOf(layoutParams.leftMargin));
|
||||
hashMap.put("y", Integer.valueOf(layoutParams.topMargin));
|
||||
hashMap.put(IMediaFormat.KEY_WIDTH, Integer.valueOf(this._layout.getWidth()));
|
||||
hashMap.put(IMediaFormat.KEY_HEIGHT, Integer.valueOf(this._layout.getHeight()));
|
||||
return hashMap;
|
||||
}
|
||||
View webView = str.equals("videoplayer") ? this._videoContainer : str.equals("webview") ? WebViewApp.getCurrentApp().getWebView() : null;
|
||||
if (webView == null) {
|
||||
return null;
|
||||
}
|
||||
RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) webView.getLayoutParams();
|
||||
HashMap hashMap2 = new HashMap();
|
||||
hashMap2.put("x", Integer.valueOf(layoutParams2.leftMargin));
|
||||
hashMap2.put("y", Integer.valueOf(layoutParams2.topMargin));
|
||||
hashMap2.put(IMediaFormat.KEY_WIDTH, Integer.valueOf(webView.getWidth()));
|
||||
hashMap2.put(IMediaFormat.KEY_HEIGHT, Integer.valueOf(webView.getHeight()));
|
||||
return hashMap2;
|
||||
}
|
||||
|
||||
public String[] getViews() {
|
||||
return this._views;
|
||||
}
|
||||
|
||||
public WebPlayer getWebPlayer() {
|
||||
return this._webPlayer;
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
AdUnitEvent adUnitEvent;
|
||||
super.onCreate(bundle);
|
||||
if (WebViewApp.getCurrentApp() == null) {
|
||||
DeviceLog.error("Unity Ads web app is null, closing Unity Ads activity from onCreate");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
AdUnit.setAdUnitActivity(this);
|
||||
createLayout();
|
||||
ViewUtilities.removeViewFromParent(this._layout);
|
||||
AdUnitRelativeLayout adUnitRelativeLayout = this._layout;
|
||||
addContentView(adUnitRelativeLayout, adUnitRelativeLayout.getLayoutParams());
|
||||
if (bundle == null) {
|
||||
this._views = getIntent().getStringArrayExtra(EXTRA_VIEWS);
|
||||
this._keyEventList = getIntent().getIntegerArrayListExtra(EXTRA_KEY_EVENT_LIST);
|
||||
if (getIntent().hasExtra(EXTRA_ORIENTATION)) {
|
||||
this._orientation = getIntent().getIntExtra(EXTRA_ORIENTATION, -1);
|
||||
}
|
||||
if (getIntent().hasExtra(EXTRA_SYSTEM_UI_VISIBILITY)) {
|
||||
this._systemUiVisibility = getIntent().getIntExtra(EXTRA_SYSTEM_UI_VISIBILITY, 0);
|
||||
}
|
||||
if (getIntent().hasExtra(EXTRA_ACTIVITY_ID)) {
|
||||
this._activityId = getIntent().getIntExtra(EXTRA_ACTIVITY_ID, -1);
|
||||
}
|
||||
adUnitEvent = AdUnitEvent.ON_CREATE;
|
||||
} else {
|
||||
this._views = bundle.getStringArray(EXTRA_VIEWS);
|
||||
this._orientation = bundle.getInt(EXTRA_ORIENTATION, -1);
|
||||
this._systemUiVisibility = bundle.getInt(EXTRA_SYSTEM_UI_VISIBILITY, 0);
|
||||
this._keyEventList = bundle.getIntegerArrayList(EXTRA_KEY_EVENT_LIST);
|
||||
this._keepScreenOn = bundle.getBoolean(EXTRA_KEEP_SCREEN_ON);
|
||||
this._activityId = bundle.getInt(EXTRA_ACTIVITY_ID, -1);
|
||||
setKeepScreenOn(this._keepScreenOn);
|
||||
adUnitEvent = AdUnitEvent.ON_RESTORE;
|
||||
}
|
||||
setOrientation(this._orientation);
|
||||
setSystemUiVisibility(this._systemUiVisibility);
|
||||
String[] strArr = this._views;
|
||||
if (strArr != null) {
|
||||
if (Arrays.asList(strArr).contains("videoplayer")) {
|
||||
createVideoPlayer();
|
||||
}
|
||||
if (Arrays.asList(this._views).contains("webplayer")) {
|
||||
createWebPlayer();
|
||||
}
|
||||
}
|
||||
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.ADUNIT, adUnitEvent, Integer.valueOf(this._activityId));
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (WebViewApp.getCurrentApp() == null) {
|
||||
if (isFinishing()) {
|
||||
return;
|
||||
}
|
||||
DeviceLog.error("Unity Ads web app is null, closing Unity Ads activity from onDestroy");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.ADUNIT, AdUnitEvent.ON_DESTROY, Boolean.valueOf(isFinishing()), Integer.valueOf(this._activityId));
|
||||
if (AdUnit.getCurrentAdUnitActivityId() == this._activityId) {
|
||||
AdUnit.setAdUnitActivity(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
ArrayList<Integer> arrayList = this._keyEventList;
|
||||
if (arrayList == null || !arrayList.contains(Integer.valueOf(i))) {
|
||||
return false;
|
||||
}
|
||||
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.ADUNIT, AdUnitEvent.KEY_DOWN, Integer.valueOf(i), Long.valueOf(keyEvent.getEventTime()), Long.valueOf(keyEvent.getDownTime()), Integer.valueOf(keyEvent.getRepeatCount()), Integer.valueOf(this._activityId));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
if (WebViewApp.getCurrentApp() == null) {
|
||||
if (isFinishing()) {
|
||||
return;
|
||||
}
|
||||
DeviceLog.error("Unity Ads web app is null, closing Unity Ads activity from onPause");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
if (isFinishing()) {
|
||||
ViewUtilities.removeViewFromParent(WebViewApp.getCurrentApp().getWebView());
|
||||
}
|
||||
destroyVideoPlayer();
|
||||
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.ADUNIT, AdUnitEvent.ON_PAUSE, Boolean.valueOf(isFinishing()), Integer.valueOf(this._activityId));
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (WebViewApp.getCurrentApp() != null) {
|
||||
setViews(this._views);
|
||||
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.ADUNIT, AdUnitEvent.ON_RESUME, Integer.valueOf(this._activityId));
|
||||
} else {
|
||||
if (isFinishing()) {
|
||||
return;
|
||||
}
|
||||
DeviceLog.error("Unity Ads web app is null, closing Unity Ads activity from onResume");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onSaveInstanceState(Bundle bundle) {
|
||||
super.onSaveInstanceState(bundle);
|
||||
bundle.putInt(EXTRA_ORIENTATION, this._orientation);
|
||||
bundle.putInt(EXTRA_SYSTEM_UI_VISIBILITY, this._systemUiVisibility);
|
||||
bundle.putIntegerArrayList(EXTRA_KEY_EVENT_LIST, this._keyEventList);
|
||||
bundle.putBoolean(EXTRA_KEEP_SCREEN_ON, this._keepScreenOn);
|
||||
bundle.putStringArray(EXTRA_VIEWS, this._views);
|
||||
bundle.putInt(EXTRA_ACTIVITY_ID, this._activityId);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
if (WebViewApp.getCurrentApp() != null) {
|
||||
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.ADUNIT, AdUnitEvent.ON_START, Integer.valueOf(this._activityId));
|
||||
} else {
|
||||
if (isFinishing()) {
|
||||
return;
|
||||
}
|
||||
DeviceLog.error("Unity Ads web app is null, closing Unity Ads activity from onStart");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (WebViewApp.getCurrentApp() != null) {
|
||||
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.ADUNIT, AdUnitEvent.ON_STOP, Integer.valueOf(this._activityId));
|
||||
} else {
|
||||
if (isFinishing()) {
|
||||
return;
|
||||
}
|
||||
DeviceLog.error("Unity Ads web app is null, closing Unity Ads activity from onStop");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.Window.Callback
|
||||
public void onWindowFocusChanged(boolean z) {
|
||||
if (z) {
|
||||
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.ADUNIT, AdUnitEvent.ON_FOCUS_GAINED, Integer.valueOf(this._activityId));
|
||||
} else {
|
||||
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.ADUNIT, AdUnitEvent.ON_FOCUS_LOST, Integer.valueOf(this._activityId));
|
||||
}
|
||||
super.onWindowFocusChanged(z);
|
||||
}
|
||||
|
||||
public boolean setKeepScreenOn(boolean z) {
|
||||
this._keepScreenOn = z;
|
||||
if (getWindow() == null) {
|
||||
return false;
|
||||
}
|
||||
if (z) {
|
||||
getWindow().addFlags(PeripheralType.SERVO);
|
||||
return true;
|
||||
}
|
||||
getWindow().clearFlags(PeripheralType.SERVO);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setKeyEventList(ArrayList<Integer> arrayList) {
|
||||
this._keyEventList = arrayList;
|
||||
}
|
||||
|
||||
public void setOrientation(int i) {
|
||||
this._orientation = i;
|
||||
setRequestedOrientation(i);
|
||||
}
|
||||
|
||||
public boolean setSystemUiVisibility(int i) {
|
||||
this._systemUiVisibility = i;
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
try {
|
||||
getWindow().getDecorView().setSystemUiVisibility(i);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
DeviceLog.exception("Error while setting SystemUIVisibility", e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:6:0x0041 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:9:? A[RETURN, SYNTHETIC] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public void setViewFrame(java.lang.String r3, int r4, int r5, int r6, int r7) {
|
||||
/*
|
||||
r2 = this;
|
||||
java.lang.String r0 = "adunit"
|
||||
boolean r0 = r3.equals(r0)
|
||||
r1 = 0
|
||||
if (r0 == 0) goto L17
|
||||
android.widget.FrameLayout$LayoutParams r3 = new android.widget.FrameLayout$LayoutParams
|
||||
r3.<init>(r6, r7)
|
||||
r3.setMargins(r4, r5, r1, r1)
|
||||
com.unity3d.ads.adunit.AdUnitRelativeLayout r0 = r2._layout
|
||||
r0.setLayoutParams(r3)
|
||||
goto L3e
|
||||
L17:
|
||||
java.lang.String r0 = "videoplayer"
|
||||
boolean r0 = r3.equals(r0)
|
||||
if (r0 == 0) goto L22
|
||||
android.widget.RelativeLayout r3 = r2._videoContainer
|
||||
goto L3f
|
||||
L22:
|
||||
java.lang.String r0 = "webview"
|
||||
boolean r0 = r3.equals(r0)
|
||||
if (r0 == 0) goto L33
|
||||
com.unity3d.ads.webview.WebViewApp r3 = com.unity3d.ads.webview.WebViewApp.getCurrentApp()
|
||||
com.unity3d.ads.webview.WebView r3 = r3.getWebView()
|
||||
goto L3f
|
||||
L33:
|
||||
java.lang.String r0 = "webplayer"
|
||||
boolean r3 = r3.equals(r0)
|
||||
if (r3 == 0) goto L3e
|
||||
com.unity3d.ads.webplayer.WebPlayer r3 = r2._webPlayer
|
||||
goto L3f
|
||||
L3e:
|
||||
r3 = 0
|
||||
L3f:
|
||||
if (r3 == 0) goto L4c
|
||||
android.widget.RelativeLayout$LayoutParams r0 = new android.widget.RelativeLayout$LayoutParams
|
||||
r0.<init>(r6, r7)
|
||||
r0.setMargins(r4, r5, r1, r1)
|
||||
r3.setLayoutParams(r0)
|
||||
L4c:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.unity3d.ads.adunit.AdUnitActivity.setViewFrame(java.lang.String, int, int, int, int):void");
|
||||
}
|
||||
|
||||
public void setViews(String[] strArr) {
|
||||
if (strArr == null) {
|
||||
strArr = new String[0];
|
||||
}
|
||||
ArrayList arrayList = new ArrayList(Arrays.asList(strArr));
|
||||
if (this._views == null) {
|
||||
this._views = new String[0];
|
||||
}
|
||||
ArrayList arrayList2 = new ArrayList(Arrays.asList(this._views));
|
||||
arrayList2.removeAll(arrayList);
|
||||
Iterator it = arrayList2.iterator();
|
||||
while (it.hasNext()) {
|
||||
String str = (String) it.next();
|
||||
char c = 65535;
|
||||
int hashCode = str.hashCode();
|
||||
if (hashCode != -318269643) {
|
||||
if (hashCode != 1224424441) {
|
||||
if (hashCode == 1865295644 && str.equals("videoplayer")) {
|
||||
c = 0;
|
||||
}
|
||||
} else if (str.equals("webview")) {
|
||||
c = 1;
|
||||
}
|
||||
} else if (str.equals("webplayer")) {
|
||||
c = 2;
|
||||
}
|
||||
if (c == 0) {
|
||||
destroyVideoPlayer();
|
||||
} else if (c == 1) {
|
||||
ViewUtilities.removeViewFromParent(WebViewApp.getCurrentApp().getWebView());
|
||||
} else if (c == 2) {
|
||||
destroyWebPlayer();
|
||||
}
|
||||
}
|
||||
this._views = strArr;
|
||||
for (String str2 : strArr) {
|
||||
if (str2 != null) {
|
||||
if (str2.equals("videoplayer")) {
|
||||
createVideoPlayer();
|
||||
handleViewPlacement(this._videoContainer);
|
||||
} else if (str2.equals("webview")) {
|
||||
if (WebViewApp.getCurrentApp() == null) {
|
||||
DeviceLog.error("WebApp IS NULL!");
|
||||
throw new NullPointerException();
|
||||
}
|
||||
handleViewPlacement(WebViewApp.getCurrentApp().getWebView());
|
||||
} else if (str2.equals("webplayer")) {
|
||||
createWebPlayer();
|
||||
handleViewPlacement(this._webPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
16
sources/com/unity3d/ads/adunit/AdUnitError.java
Normal file
16
sources/com/unity3d/ads/adunit/AdUnitError.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.unity3d.ads.adunit;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public enum AdUnitError {
|
||||
ADUNIT_NULL,
|
||||
ACTIVITY_ID,
|
||||
GENERIC,
|
||||
ORIENTATION,
|
||||
SCREENVISIBILITY,
|
||||
CORRUPTED_VIEWLIST,
|
||||
CORRUPTED_KEYEVENTLIST,
|
||||
SYSTEM_UI_VISIBILITY,
|
||||
UNKNOWN_VIEW,
|
||||
LAYOUT_NULL,
|
||||
MAX_MOTION_EVENT_COUNT_REACHED
|
||||
}
|
15
sources/com/unity3d/ads/adunit/AdUnitEvent.java
Normal file
15
sources/com/unity3d/ads/adunit/AdUnitEvent.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.unity3d.ads.adunit;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public enum AdUnitEvent {
|
||||
ON_START,
|
||||
ON_CREATE,
|
||||
ON_RESUME,
|
||||
ON_DESTROY,
|
||||
ON_PAUSE,
|
||||
KEY_DOWN,
|
||||
ON_RESTORE,
|
||||
ON_STOP,
|
||||
ON_FOCUS_GAINED,
|
||||
ON_FOCUS_LOST
|
||||
}
|
68
sources/com/unity3d/ads/adunit/AdUnitMotionEvent.java
Normal file
68
sources/com/unity3d/ads/adunit/AdUnitMotionEvent.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package com.unity3d.ads.adunit;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AdUnitMotionEvent {
|
||||
private int _action;
|
||||
private int _deviceId;
|
||||
private long _eventTime;
|
||||
private boolean _isObscured;
|
||||
private float _pressure;
|
||||
private float _size;
|
||||
private int _source;
|
||||
private int _toolType;
|
||||
private float _x;
|
||||
private float _y;
|
||||
|
||||
public AdUnitMotionEvent(int i, boolean z, int i2, int i3, int i4, float f, float f2, long j, float f3, float f4) {
|
||||
this._action = i;
|
||||
this._isObscured = z;
|
||||
this._toolType = i2;
|
||||
this._source = i3;
|
||||
this._deviceId = i4;
|
||||
this._x = f;
|
||||
this._y = f2;
|
||||
this._eventTime = j;
|
||||
this._pressure = f3;
|
||||
this._size = f4;
|
||||
}
|
||||
|
||||
public int getAction() {
|
||||
return this._action;
|
||||
}
|
||||
|
||||
public int getDeviceId() {
|
||||
return this._deviceId;
|
||||
}
|
||||
|
||||
public long getEventTime() {
|
||||
return this._eventTime;
|
||||
}
|
||||
|
||||
public float getPressure() {
|
||||
return this._pressure;
|
||||
}
|
||||
|
||||
public float getSize() {
|
||||
return this._size;
|
||||
}
|
||||
|
||||
public int getSource() {
|
||||
return this._source;
|
||||
}
|
||||
|
||||
public int getToolType() {
|
||||
return this._toolType;
|
||||
}
|
||||
|
||||
public float getX() {
|
||||
return this._x;
|
||||
}
|
||||
|
||||
public float getY() {
|
||||
return this._y;
|
||||
}
|
||||
|
||||
public boolean isObscured() {
|
||||
return this._isObscured;
|
||||
}
|
||||
}
|
33
sources/com/unity3d/ads/adunit/AdUnitOpen.java
Normal file
33
sources/com/unity3d/ads/adunit/AdUnitOpen.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.unity3d.ads.adunit;
|
||||
|
||||
import android.os.ConditionVariable;
|
||||
import com.ubt.jimu.transport.model.TransportFile;
|
||||
import com.unity3d.ads.properties.SdkProperties;
|
||||
import com.unity3d.ads.webview.WebViewApp;
|
||||
import com.unity3d.ads.webview.bridge.CallbackStatus;
|
||||
import java.lang.reflect.Method;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AdUnitOpen {
|
||||
private static ConditionVariable _waitShowStatus;
|
||||
|
||||
public static synchronized boolean open(String str, JSONObject jSONObject) throws NoSuchMethodException {
|
||||
boolean block;
|
||||
synchronized (AdUnitOpen.class) {
|
||||
Method method = AdUnitOpen.class.getMethod("showCallback", CallbackStatus.class);
|
||||
_waitShowStatus = new ConditionVariable();
|
||||
WebViewApp.getCurrentApp().invokeMethod("webview", TransportFile.TYPE_DIY_SHOW, method, str, jSONObject);
|
||||
block = _waitShowStatus.block(SdkProperties.getShowTimeout());
|
||||
_waitShowStatus = null;
|
||||
}
|
||||
return block;
|
||||
}
|
||||
|
||||
public static void showCallback(CallbackStatus callbackStatus) {
|
||||
if (_waitShowStatus == null || !callbackStatus.equals(CallbackStatus.OK)) {
|
||||
return;
|
||||
}
|
||||
_waitShowStatus.open();
|
||||
}
|
||||
}
|
111
sources/com/unity3d/ads/adunit/AdUnitRelativeLayout.java
Normal file
111
sources/com/unity3d/ads/adunit/AdUnitRelativeLayout.java
Normal file
@@ -0,0 +1,111 @@
|
||||
package com.unity3d.ads.adunit;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.RelativeLayout;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AdUnitRelativeLayout extends RelativeLayout {
|
||||
private int _maxEvents;
|
||||
private final ArrayList<AdUnitMotionEvent> _motionEvents;
|
||||
private boolean _shouldCapture;
|
||||
|
||||
public AdUnitRelativeLayout(Context context) {
|
||||
super(context);
|
||||
this._motionEvents = new ArrayList<>();
|
||||
this._maxEvents = XStream.PRIORITY_VERY_HIGH;
|
||||
this._shouldCapture = false;
|
||||
}
|
||||
|
||||
public void clearCapture() {
|
||||
synchronized (this._motionEvents) {
|
||||
this._motionEvents.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void endCapture() {
|
||||
this._shouldCapture = false;
|
||||
}
|
||||
|
||||
public int getCurrentEventCount() {
|
||||
int size;
|
||||
synchronized (this._motionEvents) {
|
||||
size = this._motionEvents.size();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
public SparseIntArray getEventCount(ArrayList<Integer> arrayList) {
|
||||
SparseIntArray sparseIntArray = new SparseIntArray();
|
||||
synchronized (this._motionEvents) {
|
||||
Iterator<AdUnitMotionEvent> it = this._motionEvents.iterator();
|
||||
while (it.hasNext()) {
|
||||
AdUnitMotionEvent next = it.next();
|
||||
Iterator<Integer> it2 = arrayList.iterator();
|
||||
while (true) {
|
||||
if (it2.hasNext()) {
|
||||
Integer next2 = it2.next();
|
||||
if (next.getAction() == next2.intValue()) {
|
||||
sparseIntArray.put(next2.intValue(), sparseIntArray.get(next2.intValue(), 0) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sparseIntArray;
|
||||
}
|
||||
|
||||
public SparseArray<SparseArray<AdUnitMotionEvent>> getEvents(SparseArray<ArrayList<Integer>> sparseArray) {
|
||||
SparseIntArray sparseIntArray = new SparseIntArray();
|
||||
SparseArray<SparseArray<AdUnitMotionEvent>> sparseArray2 = new SparseArray<>();
|
||||
synchronized (this._motionEvents) {
|
||||
Iterator<AdUnitMotionEvent> it = this._motionEvents.iterator();
|
||||
while (it.hasNext()) {
|
||||
AdUnitMotionEvent next = it.next();
|
||||
ArrayList<Integer> arrayList = sparseArray.get(next.getAction());
|
||||
if (arrayList != null) {
|
||||
int intValue = arrayList.get(0).intValue();
|
||||
if (sparseIntArray.get(next.getAction(), 0) == intValue) {
|
||||
if (sparseArray2.get(next.getAction()) == null) {
|
||||
sparseArray2.put(next.getAction(), new SparseArray<>());
|
||||
}
|
||||
sparseArray2.get(next.getAction()).put(intValue, next);
|
||||
arrayList.remove(0);
|
||||
}
|
||||
sparseIntArray.put(next.getAction(), sparseIntArray.get(next.getAction()) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sparseArray2;
|
||||
}
|
||||
|
||||
public int getMaxEventCount() {
|
||||
return this._maxEvents;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
@TargetApi(14)
|
||||
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
|
||||
super.onInterceptTouchEvent(motionEvent);
|
||||
if (!this._shouldCapture || this._motionEvents.size() >= this._maxEvents) {
|
||||
return false;
|
||||
}
|
||||
boolean z = (motionEvent.getFlags() & 1) != 0;
|
||||
synchronized (this._motionEvents) {
|
||||
this._motionEvents.add(new AdUnitMotionEvent(motionEvent.getActionMasked(), z, motionEvent.getToolType(0), motionEvent.getSource(), motionEvent.getDeviceId(), motionEvent.getX(0), motionEvent.getY(0), motionEvent.getEventTime(), motionEvent.getPressure(0), motionEvent.getSize(0)));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void startCapture(int i) {
|
||||
this._maxEvents = i;
|
||||
this._shouldCapture = true;
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package com.unity3d.ads.adunit;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AdUnitSoftwareActivity extends AdUnitActivity {
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package com.unity3d.ads.adunit;
|
||||
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import com.unity3d.ads.misc.ViewUtilities;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AdUnitTransparentActivity extends AdUnitActivity {
|
||||
@Override // com.unity3d.ads.adunit.AdUnitActivity
|
||||
protected void createLayout() {
|
||||
super.createLayout();
|
||||
ViewUtilities.setBackground(this._layout, new ColorDrawable(0));
|
||||
}
|
||||
|
||||
@Override // com.unity3d.ads.adunit.AdUnitActivity, android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
ViewUtilities.setBackground(this._layout, new ColorDrawable(0));
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package com.unity3d.ads.adunit;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AdUnitTransparentSoftwareActivity extends AdUnitTransparentActivity {
|
||||
}
|
Reference in New Issue
Block a user