Commit 072dc40d authored by mengcuiguang2's avatar mengcuiguang2

添加广告,联调微信登录

parent 81959caf
......@@ -101,7 +101,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
loginDialog.setListener(object : WxLoginDialog.WxLoginListener {
override fun loginSuc(wxInfo: String) {
if (!isHidden) {//当前fragment正在显示调用微信登陆接口
viewModel.wechatlogin(JsonUtil.toJson(wxInfo))
viewModel.wechatlogin(wxInfo)
}
}
})
......
package com.mints.street.main.my
import android.annotation.SuppressLint
import android.app.Dialog
import android.graphics.Color
import android.os.Bundle
......@@ -80,11 +81,12 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
loginDialog.setListener(object:WxLoginDialog.WxLoginListener{
override fun loginSuc(wxInfo: String) {
viewModel.wechatlogin(JsonUtil.toJson(wxInfo))
viewModel.wechatlogin(wxInfo)
}
})
}
@SuppressLint("InflateParams")
private fun initView() {
val layoutInflater = layoutInflater
......
......@@ -38,7 +38,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
private var msplash: FrameLayout? = null
private var mTTSplashAd: TTSplashAd? = null
private val AD_TIME_OUT = 4000
private var onPaused = false
//是否强制跳转到主页面
private var mForceGoMain = false
......@@ -49,6 +48,8 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
override fun initVariableId() = BR.viewModel
override fun getStatusBarHeightView()=binding.rlSplashRoot
override fun initData() {
super.initData()
//点击Home键后再点击App图标,会回到原来的界面。今天重新打包后,但是在Debug模式下,一切正常,
......@@ -58,7 +59,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
return
}
StatusBarUtil.immersive(this)
// StatusBarUtil.immersive(this)
//校验App签名
checkAppSign()
......@@ -70,10 +71,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
if (mForceGoMain) {
goToMainActivity()
}
if (onPaused) {
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要自己在onResume中跳转主页。
goToMainActivity()
}
}
super.onResume()
......@@ -81,7 +78,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
override fun onPause() {
super.onPause()
onPaused = true
}
override fun onStop() {
......@@ -106,7 +102,16 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
if (!deviceInfo.signInfo) {
finish()
} else {
showPowerDialog()
// showPowerDialog()
isClickAgree = true
try {
msplash = findViewById(R.id.fl_splash)
//加载开屏广告
loadSplashAd()
// goToMainActivity()
} catch (e: Exception) {
goToMainActivity()
}
}
}
......@@ -130,8 +135,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
val ttNetworkRequestInfo: TTNetworkRequestInfo
//穿山甲兜底
ttNetworkRequestInfo = PangleNetworkRequestInfo(CsjGroMoreManager.TT_AD_APPID, CsjGroMoreManager.AD_CSJ_SPLASH_ID)
//step4:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理
mTTSplashAd?.loadAd(adSlot, ttNetworkRequestInfo, object : TTSplashAdLoadCallback {
// mTTSplashAd.loadAd(adSlot, new TTSplashAdLoadCallback() {
......@@ -161,10 +164,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
}
override fun onAdDismiss() {
if (onPaused) {
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要在onResume中跳转主页。
return
}
goToMainActivity()
}
}
......
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item >
<item>
<shape android:shape="rectangle">
<solid android:color="@color/white" />
</shape>
</item>
<item android:bottom="20dp">
<bitmap
android:src="@drawable/bg_splash" />
android:gravity="bottom|center_horizontal"
android:src="@mipmap/ic_launcher_main" />
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:id="@+id/rl_splash_root"
android:layout_width="match_parent"
android:background="#061b45"
android:layout_height="match_parent">
<ImageView
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bg_splash"/>
<FrameLayout
android:id="@+id/fl_splash"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<data>
</RelativeLayout>
<data>
<variable
name="viewModel"
type="com.mints.street.splash.SplashViewModel" />
......
......@@ -21,6 +21,7 @@
<style name="NormalSplash" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash_bg</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorPrimaryDark">@color/white</item>
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="AppTheme.NoneTranslucent" parent="AppTheme.Base">
......
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