diff --git a/app/src/main/java/com/gh/common/FixedRateJobHelper.kt b/app/src/main/java/com/gh/common/FixedRateJobHelper.kt index a506787ddb..276e411813 100644 --- a/app/src/main/java/com/gh/common/FixedRateJobHelper.kt +++ b/app/src/main/java/com/gh/common/FixedRateJobHelper.kt @@ -2,14 +2,15 @@ package com.gh.common import com.gh.common.exposure.ExposureManager import com.gh.common.filter.RegionSettingHelper -import com.gh.gamecenter.common.loghub.LoghubUtils -import com.gh.gamecenter.common.utils.doOnMainProcessOnly -import com.gh.gamecenter.common.utils.tryCatchInRelease +import com.gh.common.util.AdHelper import com.gh.common.videolog.VideoRecordUtils import com.gh.download.DownloadDataHelper -import com.gh.gamecenter.entity.TimeEntity +import com.gh.gamecenter.common.loghub.LoghubUtils import com.gh.gamecenter.common.retrofit.Response +import com.gh.gamecenter.common.utils.doOnMainProcessOnly +import com.gh.gamecenter.common.utils.tryCatchInRelease import com.gh.gamecenter.core.runOnUiThread +import com.gh.gamecenter.entity.TimeEntity import com.gh.gamecenter.retrofit.RetrofitManager import com.halo.assistant.HaloApp import io.reactivex.schedulers.Schedulers @@ -25,6 +26,7 @@ object FixedRateJobHelper { private const val DOWNLOAD_HEARTBEAT_PERIOD: Long = 60 * 1000L private const val DOWNLOAD_HEARTBEAT_SHEET_PERIOD: Long = 15 * 1000L + private const val STARTUP_AD: Long = 30 * 60 * 1000L private var mExecuteCount: Int = 0 @@ -82,6 +84,11 @@ object FixedRateJobHelper { VideoRecordUtils.commitVideoRecord() } + // 获取启动广告 + if ((mExecuteCount * CHECKER_PERIOD) % STARTUP_AD == 0L) { + AdHelper.getSettingAdCache() + } + // ExposureUtils.logADownloadCompleteExposureEvent(GameEntity(id = mExecuteCount.toString(), name = "测试曝光上传"), platform = "", trace = null, downloadType = ExposureUtils.DownloadType.DOWNLOAD) mExecuteCount++ } diff --git a/app/src/main/java/com/gh/common/constant/Config.java b/app/src/main/java/com/gh/common/constant/Config.java index e019ae0198..23ba6310e0 100644 --- a/app/src/main/java/com/gh/common/constant/Config.java +++ b/app/src/main/java/com/gh/common/constant/Config.java @@ -8,6 +8,7 @@ import android.text.TextUtils; import androidx.annotation.Nullable; +import com.gh.common.util.AdHelper; import com.gh.gamecenter.common.utils.DarkModeUtils; import com.gh.gamecenter.common.utils.EnvHelper; import com.gh.gamecenter.common.constant.Constants; @@ -195,6 +196,7 @@ public class Config { public static void setSettings(SettingsEntity settingsEntity) { getPreferences().edit().putString(SETTINGS_KEY, GsonUtils.toJson(settingsEntity)).apply(); mSettingsEntity = settingsEntity; + AdHelper.prefetchStartUpAd(settingsEntity); // 更新设置状态 mSettingsEntity.showArticleEntrance(); diff --git a/app/src/main/java/com/gh/common/util/AdHelper.kt b/app/src/main/java/com/gh/common/util/AdHelper.kt index 2c651118d1..883a352dcc 100644 --- a/app/src/main/java/com/gh/common/util/AdHelper.kt +++ b/app/src/main/java/com/gh/common/util/AdHelper.kt @@ -1,15 +1,14 @@ package com.gh.common.util import android.annotation.SuppressLint -import androidx.lifecycle.MutableLiveData import com.gh.common.constant.Config -import com.gh.gamecenter.common.utils.NetworkUtils +import com.gh.gamecenter.common.retrofit.Response +import com.gh.gamecenter.common.utils.ImageUtils +import com.gh.gamecenter.common.utils.observableToMain import com.gh.gamecenter.entity.SettingsEntity import com.gh.gamecenter.entity.StartupAdEntity -import com.gh.gamecenter.common.retrofit.BiResponse import com.gh.gamecenter.retrofit.RetrofitManager import com.halo.assistant.HaloApp -import io.reactivex.schedulers.Schedulers object AdHelper { @@ -19,24 +18,38 @@ object AdHelper { const val LOCATION_SUGGESTION_FUNCTION = "suggestion_function" const val LOCATION_SIMULATOR_GAME = "simulator_game" - @JvmField - var startupAd = MutableLiveData() - @JvmStatic @SuppressLint("CheckResult") - fun getStartUpAd() { - if (!NetworkUtils.isNetworkConnected(HaloApp.getInstance())) { - startupAd.postValue(null) - return + fun getStartUpAd(): StartupAdEntity? { + val startAd = Config.getSettings()?.startAd + if (startAd != null) { + return startAd } + return Config.getSettings()?.startup + } - RetrofitManager.getInstance() - .api - .getSplashAd(HaloApp.getInstance().channel) - .subscribeOn(Schedulers.io()) - .subscribe(object : BiResponse() { - override fun onSuccess(data: StartupAdEntity) { - startupAd.postValue(data) + @JvmStatic + fun prefetchStartUpAd(settingsEntity: SettingsEntity) { + if (settingsEntity.startAd != null && !settingsEntity.startAd?.img.isNullOrEmpty()) { + ImageUtils.prefetchToDiskCache(settingsEntity.startAd?.img!!) + } + } + + fun getSettingAdCache() { + RetrofitManager.getInstance().api + .getSettingAdCache(HaloApp.getInstance().channel) + .compose(observableToMain()) + .subscribe(object : Response() { + override fun onResponse(response: SettingsEntity?) { + super.onResponse(response) + val settings = Config.getSettings() + if (settings != null) { + settings.startAd = response?.startAd + Config.setSettings(settings) + if (response != null) { + prefetchStartUpAd(response) + } + } } }) } diff --git a/app/src/main/java/com/gh/common/util/DirectUtils.kt b/app/src/main/java/com/gh/common/util/DirectUtils.kt index 22499a596a..4c8a543399 100644 --- a/app/src/main/java/com/gh/common/util/DirectUtils.kt +++ b/app/src/main/java/com/gh/common/util/DirectUtils.kt @@ -9,31 +9,31 @@ import android.os.Build import android.os.Bundle import android.text.TextUtils import androidx.appcompat.app.AppCompatActivity -import com.gh.gamecenter.common.base.activity.BaseActivity -import com.gh.gamecenter.common.base.activity.BaseActivity_TabLayout -import com.gh.gamecenter.common.base.activity.ToolBarActivity -import com.gh.gamecenter.common.base.fragment.BaseFragment_TabLayout -import com.gh.gamecenter.core.AppExecutor import com.gh.common.constant.Config -import com.gh.gamecenter.common.constant.Constants import com.gh.common.exposure.ExposureEvent import com.gh.common.exposure.ExposureEvent.Companion.createEvent import com.gh.common.exposure.ExposureManager.log import com.gh.common.exposure.ExposureTraceUtils.appendTrace import com.gh.common.exposure.ExposureType -import com.gh.gamecenter.common.constant.EntranceConsts.* -import com.gh.common.util.EntranceUtils.* +import com.gh.common.util.EntranceUtils.jumpActivity import com.gh.gamecenter.* import com.gh.gamecenter.amway.AmwayActivity import com.gh.gamecenter.catalog.CatalogActivity import com.gh.gamecenter.category.CategoryDirectoryActivity import com.gh.gamecenter.category2.CategoryV2Activity +import com.gh.gamecenter.common.base.activity.BaseActivity +import com.gh.gamecenter.common.base.activity.BaseActivity_TabLayout +import com.gh.gamecenter.common.base.activity.ToolBarActivity +import com.gh.gamecenter.common.base.fragment.BaseFragment_TabLayout +import com.gh.gamecenter.common.constant.Constants import com.gh.gamecenter.common.constant.EntranceConsts +import com.gh.gamecenter.common.constant.EntranceConsts.* import com.gh.gamecenter.common.entity.CommunityEntity import com.gh.gamecenter.common.entity.Display import com.gh.gamecenter.common.entity.LinkEntity import com.gh.gamecenter.common.retrofit.Response import com.gh.gamecenter.common.utils.* +import com.gh.gamecenter.core.AppExecutor import com.gh.gamecenter.core.utils.ToastUtils import com.gh.gamecenter.discovery.DiscoveryActivity import com.gh.gamecenter.download.DownloadFragment.Companion.INDEX_UPDATE @@ -144,6 +144,7 @@ object DirectUtils { directToLinkPage(context, linkEntity, entrance, path, null) } + @JvmStatic fun directToLinkPage( context: Context, linkEntity: LinkEntity, diff --git a/app/src/main/java/com/gh/common/util/NewFlatLogUtils.kt b/app/src/main/java/com/gh/common/util/NewFlatLogUtils.kt index 810efdfb15..7213650469 100644 --- a/app/src/main/java/com/gh/common/util/NewFlatLogUtils.kt +++ b/app/src/main/java/com/gh/common/util/NewFlatLogUtils.kt @@ -824,4 +824,18 @@ object NewFlatLogUtils { log(json, "event", false) } + //跳过广告 + @JvmStatic + fun logOpenScreenAdSkip(adId: String, linkText: String, linkType: String, linkId: String) { + val json = json { + "event" to "open_screen_ad_skip" + "ad_id" to adId + "link_text" to linkText + "link_type" to linkType + "link_id" to linkId + parseAndPutMeta().invoke(this) + } + log(json, "event", false) + } + } \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/MainActivity.java b/app/src/main/java/com/gh/gamecenter/MainActivity.java index c832bd5b02..39c62230fd 100644 --- a/app/src/main/java/com/gh/gamecenter/MainActivity.java +++ b/app/src/main/java/com/gh/gamecenter/MainActivity.java @@ -1,7 +1,7 @@ package com.gh.gamecenter; +import static com.gh.gamecenter.common.constant.Constants.LOGIN_TAG; import static com.gh.gamecenter.common.constant.Constants.LOGOUT_TAG; -import static com.gh.gamecenter.login.utils.LoginHelper.WEIBO_SCOPE; import static com.gh.gamecenter.common.constant.EntranceConsts.ENTRANCE_BROWSER; import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_LAUNCH_SIMULATOR_GAME; import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_QQ; @@ -14,7 +14,7 @@ import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_TO; import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_TYPE; import static com.gh.gamecenter.common.utils.ExtensionsKt.observableToMain; import static com.gh.gamecenter.fragment.MainWrapperFragment.INDEX_PERSONAL; -import static com.gh.gamecenter.common.constant.Constants.LOGIN_TAG; +import static com.gh.gamecenter.login.utils.LoginHelper.WEIBO_SCOPE; import android.annotation.SuppressLint; import android.app.Activity; @@ -26,6 +26,7 @@ import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.os.SystemClock; import android.preference.PreferenceManager; import android.text.Html; @@ -40,8 +41,13 @@ import androidx.constraintlayout.widget.ConstraintLayout; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProviders; +import com.facebook.drawee.view.SimpleDraweeView; import com.gh.common.DefaultUrlHandler; import com.gh.common.constant.Config; +import com.gh.common.exposure.ExposureEvent; +import com.gh.common.exposure.ExposureManager; +import com.gh.common.exposure.ExposureSource; +import com.gh.common.exposure.ExposureType; import com.gh.common.history.HistoryDatabase; import com.gh.common.history.HistoryHelper; import com.gh.common.repository.ReservationRepository; @@ -58,8 +64,7 @@ import com.gh.common.util.ErrorHelper; import com.gh.common.util.HomePluggableHelper; import com.gh.common.util.LogUtils; import com.gh.common.util.LunchType; -import com.gh.gamecenter.common.eventbus.EBReuse; -import com.gh.gamecenter.common.utils.NotificationHelper; +import com.gh.common.util.NewFlatLogUtils; import com.gh.common.util.PackageInstaller; import com.gh.common.util.PackageUtils; import com.gh.common.util.PlatformUtils; @@ -72,12 +77,17 @@ import com.gh.gamecenter.common.base.fragment.BaseFragment_ViewPager; import com.gh.gamecenter.common.base.fragment.ToolbarFragment; import com.gh.gamecenter.common.constant.Constants; import com.gh.gamecenter.common.constant.EntranceConsts; +import com.gh.gamecenter.common.entity.LinkEntity; +import com.gh.gamecenter.common.entity.NotificationUgc; +import com.gh.gamecenter.common.eventbus.EBReuse; import com.gh.gamecenter.common.exposure.meta.MetaUtil; import com.gh.gamecenter.common.retrofit.BiResponse; import com.gh.gamecenter.common.retrofit.Response; import com.gh.gamecenter.common.utils.DeviceUtils; import com.gh.gamecenter.common.utils.DialogHelper; import com.gh.gamecenter.common.utils.ExtensionsKt; +import com.gh.gamecenter.common.utils.ImageUtils; +import com.gh.gamecenter.common.utils.NotificationHelper; import com.gh.gamecenter.common.utils.ShareUtils; import com.gh.gamecenter.core.AppExecutor; import com.gh.gamecenter.core.utils.ClassUtils; @@ -86,21 +96,21 @@ import com.gh.gamecenter.core.utils.GsonUtils; import com.gh.gamecenter.core.utils.MtaHelper; import com.gh.gamecenter.core.utils.SPUtils; import com.gh.gamecenter.core.utils.SentryHelper; +import com.gh.gamecenter.core.utils.TimeUtils; import com.gh.gamecenter.core.utils.ToastUtils; import com.gh.gamecenter.core.utils.UrlFilterUtils; import com.gh.gamecenter.download.DownloadFragment; import com.gh.gamecenter.entity.GameEntity; import com.gh.gamecenter.entity.InnerMetaInfoEntity; -import com.gh.gamecenter.common.entity.NotificationUgc; import com.gh.gamecenter.entity.StartupAdEntity; import com.gh.gamecenter.eventbus.EBNetworkState; import com.gh.gamecenter.eventbus.EBSkip; import com.gh.gamecenter.fragment.MainWrapperFragment; import com.gh.gamecenter.home.skip.PackageSkipActivity; +import com.gh.gamecenter.login.user.UserManager; import com.gh.gamecenter.login.utils.QuickLoginHelper; import com.gh.gamecenter.manager.DataCollectionManager; import com.gh.gamecenter.manager.UpdateManager; -import com.gh.gamecenter.login.user.UserManager; import com.gh.gamecenter.packagehelper.PackageViewModel; import com.gh.gamecenter.retrofit.RetrofitManager; import com.gh.gamecenter.room.AppDatabase; @@ -136,6 +146,7 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Timer; import java.util.TimerTask; @@ -159,6 +170,9 @@ public class MainActivity extends BaseActivity { public final static String SWITCH_TO_COMMUNITY = "switch_to_community"; public final static String SWITCH_TO_VIDEO = "switch_to_video"; public final static String SHOW_AD = "show_ad"; + private final static int COUNTDOWN_AD = 100; + private final static int countdownMaxCount = 3; + private int countdownCount = 0; private final static String CURRENT_PAGE = "current_page"; @@ -475,37 +489,75 @@ public class MainActivity extends BaseActivity { } private void observeAd() { - AdHelper.startupAd.observe(this, startupAdEntity -> { - if (showAd) { - if (startupAdEntity == null) { - hideAd(true); - } else { - showAd(startupAdEntity); - AppExecutor.getUiExecutor().execute(() -> { - AppExecutor.getUiExecutor().executeWithDelay(() -> hideAd(true), 2000); - }); - } + final StartupAdEntity startUpAd = AdHelper.getStartUpAd(); + if (showAd) { + if (startUpAd == null) { + hideAd(); + return; } - }); - - AppExecutor.getUiExecutor().executeWithDelay(() -> hideAd(false), 950); + if (!startUpAd.getImg().isEmpty()) { + final String showedTodayTimestamp = SPUtils.getString(Constants.SP_STARTUP_AD_TIMESTAMP, ""); + final String rule = startUpAd.getRule(); + switch (rule) { + case "each": + showAd(startUpAd); + break; + case "once": + if (TextUtils.isEmpty(showedTodayTimestamp)) { + showAd(startUpAd); + } + break; + case "everyday": + final String today = TimeUtils.getToday(); + if (!TextUtils.equals(today, showedTodayTimestamp)) { + showAd(startUpAd); + } + break; + default: + // Do nothing + break; + } + SPUtils.setString(Constants.SP_STARTUP_AD_TIMESTAMP, TimeUtils.getToday()); + } else { + showAd(startUpAd); + AppExecutor.getUiExecutor().executeWithDelay(() -> hideAd(), 2000); + } + } } - private void hideAd(boolean forceToHide) { - if (forceToHide || AdHelper.startupAd.getValue() == null) { - showAd = false; - getIntent().putExtra(SHOW_AD, false); - View view = findViewById(R.id.maskContainer); - - if (view != null) { - view.setVisibility(View.GONE); - ExtensionsKt.removeFromParent(view); + @Override + protected void handleMessage(Message msg) { + super.handleMessage(msg); + if (msg.what == COUNTDOWN_AD) { + countdownCount++; + TextView jumpBtn = findViewById(R.id.jumpBtn); + jumpBtn.setText(String.format(Locale.CHINA, "跳过 %d", countdownMaxCount - countdownCount)); + if (countdownMaxCount <= countdownCount) { + hideAd(); + } else { + mBaseHandler.sendEmptyMessageDelayed(COUNTDOWN_AD, 1000); } - - checkDialog(); } } + private void hideAd() { + showAd = false; + getIntent().putExtra(SHOW_AD, false); + View maskContainer = findViewById(R.id.maskContainer); + View startAdContainer = findViewById(R.id.startAdContainer); + + if (maskContainer != null) { + maskContainer.setVisibility(View.GONE); + ExtensionsKt.removeFromParent(maskContainer); + } + if (startAdContainer != null) { + startAdContainer.setVisibility(View.GONE); + ExtensionsKt.removeFromParent(startAdContainer); + } + + checkDialog(); + } + private void checkDialog() { // 检查通知权限 checkNotificationPermission(); @@ -518,26 +570,65 @@ public class MainActivity extends BaseActivity { } private void showAd(StartupAdEntity ad) { - TextView adContentTv = findViewById(R.id.adContentTv); - View containerView = findViewById(R.id.maskContainer); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - containerView.setElevation(500F); - } - containerView.setOnClickListener(v -> { - // do nothing 只是为了点击拦截事件,避免传递到下面的页面 - }); - adContentTv.setText(ad.getDesc()); - adContentTv.setVisibility(View.VISIBLE); - if (ad.getButton()) { - View btn = findViewById(R.id.adBtn); - btn.setOnClickListener((v) -> { - DirectUtils.directToLinkPage(this, ad.getJump(), "(启动广告)", ""); - LogUtils.logStartAd("click_watch_start_ads", ad); + if (!ad.getImg().isEmpty()) { + View startAdContainer = findViewById(R.id.startAdContainer); + View jumpBtn = findViewById(R.id.jumpBtn); + TextView jumpDetailBtn = findViewById(R.id.jumpDetailBtn); + SimpleDraweeView adImage = findViewById(R.id.adImage); + startAdContainer.setVisibility(View.VISIBLE); + jumpDetailBtn.setText(ad.getDesc()); + ImageUtils.display(adImage, ad.getImg()); + startAdContainer.setOnClickListener(v -> { + // do nothing 只是为了点击拦截事件,避免传递到下面的页面 }); - btn.setVisibility(View.VISIBLE); - LogUtils.logStartAd("watch_start_ads", ad); + jumpBtn.setOnClickListener(v -> { + mBaseHandler.removeMessages(COUNTDOWN_AD); + hideAd(); + LinkEntity linkEntity = ad.getJump(); + NewFlatLogUtils.logOpenScreenAdSkip( + ad.getId(), + linkEntity.getText() != null ? linkEntity.getText() : "", + linkEntity.getType() != null ? linkEntity.getType() : "", + linkEntity.getLink() != null ? linkEntity.getLink() : "" + ); + }); + List sources = new ArrayList<>(); + sources.add(new ExposureSource("开屏广告", ad.getId())); + final ExposureEvent event = ExposureEvent.createEvent(null, sources, null, ExposureType.EXPOSURE); + ExposureManager.INSTANCE.log(event); + if (ad.getButton()) { + jumpDetailBtn.setOnClickListener(v -> { + DirectUtils.directToLinkPage(this, ad.getJump(), "(启动广告)", "", event); + }); + jumpDetailBtn.setVisibility(View.VISIBLE); + LogUtils.logStartAd("watch_start_ads", ad); + } else { + LogUtils.logStartAd("start_ads", ad); + } + mBaseHandler.sendEmptyMessageDelayed(COUNTDOWN_AD, 1000); } else { - LogUtils.logStartAd("start_ads", ad); + TextView adContentTv = findViewById(R.id.adContentTv); + View containerView = findViewById(R.id.maskContainer); + containerView.setVisibility(View.VISIBLE); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + containerView.setElevation(500F); + } + containerView.setOnClickListener(v -> { + // do nothing 只是为了点击拦截事件,避免传递到下面的页面 + }); + adContentTv.setText(ad.getDesc()); + adContentTv.setVisibility(View.VISIBLE); + if (ad.getButton()) { + View adBtn = findViewById(R.id.adBtn); + adBtn.setOnClickListener(v -> { + DirectUtils.directToLinkPage(this, ad.getJump(), "(启动广告)", ""); + LogUtils.logStartAd("click_watch_start_ads", ad); + }); + adBtn.setVisibility(View.VISIBLE); + LogUtils.logStartAd("watch_start_ads", ad); + } else { + LogUtils.logStartAd("start_ads", ad); + } } } diff --git a/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.kt b/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.kt index 971b5d4320..7a1af6732d 100644 --- a/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.kt @@ -255,7 +255,6 @@ class SplashScreenActivity : BaseActivity() { SPUtils.setLong(Constants.SP_GH_LAST_UPDATE_TIME, PackageUtils.getHaloLastUpdateTime()) HaloApp.getInstance().postInit(true) TrackerLogger.logAppLaunchSuccessful() - AdHelper.getStartUpAd() if (mShouldPrefetchData) { prefetchData() } diff --git a/app/src/main/java/com/gh/gamecenter/entity/SettingsEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/SettingsEntity.kt index cf7cc0a520..3cae74c4da 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/SettingsEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/SettingsEntity.kt @@ -6,6 +6,7 @@ import com.gh.common.exposure.ExposureEvent import com.gh.gamecenter.common.entity.CommunityEntity import com.gh.gamecenter.common.entity.Display import com.gh.gamecenter.common.entity.LinkEntity +import com.google.android.exoplayer2.offline.Download import com.google.gson.annotations.SerializedName import com.halo.assistant.HaloApp @@ -40,6 +41,9 @@ data class SettingsEntity( var gameSmooth: String = "off", // 畅玩功能,on/off,默认off @SerializedName("webview_download_url") var webviewDownloadUrl: String = "",//webview下载地址 + @SerializedName("start_ad") + var startAd: StartupAdEntity? = null,//开屏图片广告 + var startup: StartupAdEntity? = null//启动文案广告 ) { fun setCommunityEntrance(communityEntrance: String) { diff --git a/app/src/main/java/com/gh/gamecenter/entity/StartupAdEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/StartupAdEntity.kt index 401306d15e..53f3017616 100644 --- a/app/src/main/java/com/gh/gamecenter/entity/StartupAdEntity.kt +++ b/app/src/main/java/com/gh/gamecenter/entity/StartupAdEntity.kt @@ -8,5 +8,8 @@ data class StartupAdEntity( val id: String, val desc: String, val button: Boolean, - val jump: LinkEntity + val jump: LinkEntity, + val img: String = "", + // 显示规则: none无, each每一次打开, everyday每一天一次, once一次 + val rule: String = "" ) \ No newline at end of file diff --git a/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java b/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java index c45e5026da..fc3bfec100 100644 --- a/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java +++ b/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java @@ -2264,12 +2264,6 @@ public interface ApiService { @GET("./bbses:search") Observable> searchForumContent(@QueryMap HashMap map, @Query("page") int page); - /** - * 启动广告 - */ - @GET("startup") - Single getSplashAd(@Query("channel") String channel); - /** * 获取一级分类数据 */ @@ -2954,4 +2948,10 @@ public interface ApiService { */ @POST("home/explore/games/{game_id}/feedback") Single discorveryFeedback(@Path("game_id") String gameId, @Body RequestBody body); + + /** + * 启动广告缓存信息读取 + */ + @GET("/setting_cache") + Observable getSettingAdCache(@Query("channel") String channel); } \ No newline at end of file diff --git a/app/src/main/res/drawable-xxxhdpi/ic_start_ad_logo.webp b/app/src/main/res/drawable-xxxhdpi/ic_start_ad_logo.webp new file mode 100644 index 0000000000..e6e845c19f Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_start_ad_logo.webp differ diff --git a/app/src/main/res/drawable/button_round_black_alpha_50.xml b/app/src/main/res/drawable/button_round_black_alpha_50.xml new file mode 100644 index 0000000000..a08df13087 --- /dev/null +++ b/app/src/main/res/drawable/button_round_black_alpha_50.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button_round_black_alpha_50_stroke_white_20.xml b/app/src/main/res/drawable/button_round_black_alpha_50_stroke_white_20.xml new file mode 100644 index 0000000000..86664220a5 --- /dev/null +++ b/app/src/main/res/drawable/button_round_black_alpha_50_stroke_white_20.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_startup_ad_arrow.xml b/app/src/main/res/drawable/ic_startup_ad_arrow.xml new file mode 100644 index 0000000000..0e4c17e4d9 --- /dev/null +++ b/app/src/main/res/drawable/ic_startup_ad_arrow.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index b0f463d5d3..60261c0ce6 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -14,7 +14,8 @@ android:id="@+id/maskContainer" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@drawable/launcher_background"> + android:background="@drawable/launcher_background" + android:visibility="gone"> + + + + + + + + + + + + \ No newline at end of file diff --git a/module_common/src/main/java/com/gh/gamecenter/common/constant/Constants.java b/module_common/src/main/java/com/gh/gamecenter/common/constant/Constants.java index ef813e2964..e1514bd4ce 100644 --- a/module_common/src/main/java/com/gh/gamecenter/common/constant/Constants.java +++ b/module_common/src/main/java/com/gh/gamecenter/common/constant/Constants.java @@ -437,4 +437,6 @@ public class Constants { public static final String GIT_LOG_MD5 = "git_log_md5"; public static final String SP_ADDONS_RECOMMEND_HAVE_READ = "addons_recommend_have_read"; + //启动广告 + public static final String SP_STARTUP_AD_TIMESTAMP = "startup_ad_timestamp"; }