Commit 4a7eca0a authored by mengcuiguang's avatar mengcuiguang

添加启动页动画

parent aa7a8865
......@@ -8,6 +8,7 @@ import com.baidu.mapapi.CoordType
import com.baidu.mapapi.SDKInitializer
import com.cuieney.rxpay_annotation.WX
import com.fry.base.base.BaseApp
import com.mints.street.ad.CsjGroMoreManager
import com.mints.street.main.vr.PanoramicActivity
import com.mints.street.manager.UmengManager
import com.orhanobut.logger.AndroidLogAdapter
......@@ -51,7 +52,7 @@ class AppApplication : BaseApp() {
UmengManager.preInit()
// GroMore
// CsjGroMoreManager.init(this)
CsjGroMoreManager.init(this)
//百度地图
// 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext
// 默认本地个性化地图初始化方法
......
package com.mints.street.ad
import com.mints.street.AppApplication
import com.mints.street.ad.TTGroMoreAdManagerHolder
import android.content.Context
import com.bytedance.msdk.api.TTAdConfig
import com.bytedance.msdk.api.TTAdConstant
import com.bytedance.msdk.api.TTMediationAdSdk
import com.bytedance.msdk.api.UserInfoForSegment
import com.mints.street.BuildConfig
import com.mints.street.common.Constant
import com.mints.street.common.DeviceInfo
import java.util.*
/**
* 穿山甲GroMore
* 描述:GroMore (包含穿山甲,快手,优量汇初始化)
* 作者:孟崔广
* 时间:2021/7/12 17:51
*/
object CsjGroMoreManager {
const val TT_AD_APPID = "12345"
private var sInit: Boolean = false
// gromore
var AD_UNIT_SPLASH_ID = "" // 开屏
// 穿山甲id
var AD_CSJ_SPLASH_ID = "" // 开屏
fun init(application: AppApplication) {
TTGroMoreAdManagerHolder.init(application)
fun init(context: Context) {
if (!sInit) {
TTMediationAdSdk.initialize(context, buildConfig())
sInit = true
}
}
private fun buildConfig(): TTAdConfig {
val userInfo = UserInfoForSegment()
val customInfos: Map<String, String> = HashMap()
userInfo.customInfos = customInfos
return TTAdConfig.Builder()
.appId(TT_AD_APPID) //必填 ,不能为空
.appName(Constant.MINTS_APP_NAME) //必填,不能为空
.openAdnTest(false) //开启第三方ADN测试时需要设置为true,会每次重新拉去最新配置,release 包情况下必须关闭.默认false
.isPanglePaid(false) //是否为费用户
.setPublisherDid(DeviceInfo.instance.iMEI) //用户自定义device_id
.openDebugLog(BuildConfig.DEBUG) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
.usePangleTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
.setPangleTitleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
.allowPangleShowNotify(true) //是否允许sdk展示通知栏提示
.allowPangleShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
.setPangleDirectDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI, TTAdConstant.NETWORK_STATE_3G) //允许直接下载的网络状态集合
.needPangleClearTaskReset() //特殊机型过滤,部分机型出现包解析失败问题(大部分是三星)。参数取android.os.Build.MODEL
.setUserInfoForSegment(userInfo) // 设置流量分组的信息
.build()
}
}
\ No newline at end of file
package com.mints.street.ad;
import android.content.Context;
import android.provider.Settings;
import com.bytedance.msdk.api.TTAdConfig;
import com.bytedance.msdk.api.TTAdConstant;
import com.bytedance.msdk.api.TTMediationAdSdk;
import com.bytedance.msdk.api.UserInfoForSegment;
import com.mints.street.common.Constant;
import com.mints.street.BuildConfig;
import java.util.HashMap;
import java.util.Map;
/**
* 可以用一个单例来保存TTAdManager实例,在需要初始化sdk的时候调用
*/
public class TTGroMoreAdManagerHolder {
private static boolean sInit;
public static void init(Context context) {
doInit(context);
}
//step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明
private static void doInit(Context context) {
if (!sInit) {
TTMediationAdSdk.initialize(context, buildConfig(context));
sInit = true;
}
}
private static TTAdConfig buildConfig(Context context) {
UserInfoForSegment userInfo = new UserInfoForSegment();
Map<String, String> customInfos = new HashMap<>();
// customInfos.put("aaaa", "test111");
// customInfos.put("bbbb", "test222");
userInfo.setCustomInfos(customInfos);
return new TTAdConfig.Builder()
.appId(CsjGroMoreManager.TT_AD_APPID) //必填 ,不能为空
.appName(Constant.MINTS_APP_NAME) //必填,不能为空
.openAdnTest(false)//开启第三方ADN测试时需要设置为true,会每次重新拉去最新配置,release 包情况下必须关闭.默认false
.isPanglePaid(false)//是否为费用户
.setPublisherDid(getAndroidId(context)) //用户自定义device_id
.openDebugLog(BuildConfig.DEBUG) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
.usePangleTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
.setPangleTitleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
.allowPangleShowNotify(true) //是否允许sdk展示通知栏提示
.allowPangleShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
.setPangleDirectDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI, TTAdConstant.NETWORK_STATE_3G) //允许直接下载的网络状态集合
.needPangleClearTaskReset()//特殊机型过滤,部分机型出现包解析失败问题(大部分是三星)。参数取android.os.Build.MODEL
.setUserInfoForSegment(userInfo) // 设置流量分组的信息
.build();
}
public static String getAndroidId(Context context) {
String androidId = null;
try {
androidId = Settings.System.getString(context.getContentResolver(), Settings.System.ANDROID_ID);
} catch (Exception e) {
e.printStackTrace();
}
return androidId;
}
}
......@@ -37,7 +37,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
private var msplash: FrameLayout? = null
private var mTTSplashAd: TTSplashAd? = null
private val AD_TIME_OUT = 3000
private val AD_TIME_OUT = 4000
private var onPaused = false
//是否强制跳转到主页面
......@@ -77,7 +77,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
}
super.onResume()
}
override fun onPause() {
......@@ -95,8 +94,8 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
mTTSplashAd?.destroy()
mTTSplashAd = null
msplash?.removeAllViews()
msplash = null
// msplash?.removeAllViews()
// msplash = null
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment