feat: 广告位管理第三方广告相关优化—客户端 https://jira.shanqu.cc/browse/GHZSCY-5596
This commit is contained in:
@ -148,6 +148,8 @@ public class MainActivity extends BaseActivity {
|
||||
public static final String SHOW_AD = "show_ad";
|
||||
public static final int COUNTDOWN_AD = 100;
|
||||
private int mCountdownMaxCount = 3;
|
||||
public static final int COUNTDOWN_SDK_AD = 101;
|
||||
public static final int COUNTDOWN_SDK_MAX_COUNT = 5;
|
||||
private int mCountdownCount = 0;
|
||||
|
||||
private static final String CURRENT_PAGE = "current_page";
|
||||
@ -489,6 +491,7 @@ public class MainActivity extends BaseActivity {
|
||||
if (AdDelegateHelper.INSTANCE.shouldShowStartUpAd(false)) {
|
||||
ViewGroup startAdContainer = findViewById(R.id.startAdContainer);
|
||||
ViewGroup sdkStartAdContainer = findViewById(R.id.sdkStartAdContainer);
|
||||
TextView sdkJumpBtn = findViewById(R.id.sdkJumpBtn);
|
||||
FrameLayout adsFl = findViewById(R.id.adsFl);
|
||||
View icpContainer = findViewById(R.id.sdkStartAdIcpContainer);
|
||||
if (icpContainer != null) {
|
||||
@ -517,6 +520,7 @@ public class MainActivity extends BaseActivity {
|
||||
screenHeightInDp,
|
||||
startAdContainer,
|
||||
sdkStartAdContainer,
|
||||
sdkJumpBtn,
|
||||
adsFl,
|
||||
(BaseHandler) mBaseHandler,
|
||||
false,
|
||||
@ -536,13 +540,19 @@ public class MainActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == COUNTDOWN_AD) {
|
||||
if (msg.what == COUNTDOWN_AD || msg.what == COUNTDOWN_SDK_AD) {
|
||||
mCountdownCount++;
|
||||
if (mCountdownMaxCount < mCountdownCount) {
|
||||
int maxCount;
|
||||
if (msg.what == COUNTDOWN_AD) {
|
||||
maxCount = mCountdownMaxCount;
|
||||
} else {
|
||||
maxCount = COUNTDOWN_SDK_MAX_COUNT;
|
||||
}
|
||||
if (maxCount < mCountdownCount) {
|
||||
AdDelegateHelper.INSTANCE.setShowingSplashAd(false);
|
||||
hideSplashAd();
|
||||
|
||||
if (msg.obj instanceof StartupAdEntity) {
|
||||
if (msg.what == COUNTDOWN_AD && msg.obj instanceof StartupAdEntity) {
|
||||
StartupAdEntity ad = (StartupAdEntity) msg.obj;
|
||||
LinkEntity linkEntity = ad.getJump();
|
||||
SensorsBridge.trackEvent(
|
||||
@ -555,14 +565,26 @@ public class MainActivity extends BaseActivity {
|
||||
linkEntity.getLink(),
|
||||
"link_text",
|
||||
linkEntity.getText());
|
||||
} else if (msg.what == COUNTDOWN_SDK_AD) {
|
||||
SPUtils.setLong(Constants.SP_LAST_SPLASH_AD_SHOW_TIME, System.currentTimeMillis());
|
||||
}
|
||||
} else {
|
||||
TextView jumpBtn = findViewById(R.id.jumpBtn);
|
||||
jumpBtn.setText(getString(R.string.splash_jump, mCountdownMaxCount - mCountdownCount));
|
||||
Message newMsg = Message.obtain();
|
||||
newMsg.what = COUNTDOWN_AD;
|
||||
newMsg.obj = msg.obj;
|
||||
mBaseHandler.sendMessageDelayed(newMsg, 1000);
|
||||
if (msg.what == COUNTDOWN_AD) {
|
||||
TextView jumpBtn = findViewById(R.id.jumpBtn);
|
||||
if (jumpBtn != null) {
|
||||
jumpBtn.setText(getString(R.string.splash_jump, maxCount - mCountdownCount));
|
||||
}
|
||||
Message newMsg = Message.obtain();
|
||||
newMsg.what = COUNTDOWN_AD;
|
||||
newMsg.obj = msg.obj;
|
||||
mBaseHandler.sendMessageDelayed(newMsg, 1000);
|
||||
} else {
|
||||
TextView jumpBtn = findViewById(R.id.sdkJumpBtn);
|
||||
if (jumpBtn != null) {
|
||||
jumpBtn.setText(getString(R.string.splash_jump, maxCount - mCountdownCount));
|
||||
}
|
||||
mBaseHandler.sendEmptyMessageDelayed(COUNTDOWN_SDK_AD, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -600,7 +622,11 @@ public class MainActivity extends BaseActivity {
|
||||
ExtensionsKt.removeFromParent(startSdkAdContainer, true);
|
||||
AdDelegateHelper.INSTANCE.cancelSplashAd(this);
|
||||
}
|
||||
|
||||
TextView jumpBtn = findViewById(R.id.sdkJumpBtn);
|
||||
if (jumpBtn != null) {
|
||||
jumpBtn.setVisibility(View.GONE);
|
||||
ExtensionsKt.removeFromParent(jumpBtn, true);
|
||||
}
|
||||
View startSdkAdIcpContainer = findViewById(R.id.sdkStartAdIcpContainer);
|
||||
if (startSdkAdIcpContainer != null) {
|
||||
startSdkAdIcpContainer.setVisibility(View.GONE);
|
||||
|
||||
Reference in New Issue
Block a user