Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_goodmoney
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_goodmoney
Commits
cce54922
Commit
cce54922
authored
Oct 26, 2020
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优量汇升级最新版
parent
259f4d8a
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
658 additions
and
188 deletions
+658
-188
build.gradle
GoodMoney/app/build.gradle
+2
-3
GDTSDK.unionNoPlugin.4.270.1140.aar
GoodMoney/app/libs/GDTSDK.unionNoPlugin.4.270.1140.aar
+0
-0
GDTSDK.unionNormal.4.232.1102.aar
GoodMoney/app/libs/GDTSDK.unionNormal.4.232.1102.aar
+0
-0
AndroidManifest.xml
GoodMoney/app/src/main/AndroidManifest.xml
+4
-5
SplashADActivity.kt
...java/com/mints/goodmoney/ui/activitys/SplashADActivity.kt
+0
-175
SplashADActivity2.kt
...ava/com/mints/goodmoney/ui/activitys/SplashADActivity2.kt
+175
-0
SplashActivity2.java
...ava/com/mints/goodmoney/ui/activitys/SplashActivity2.java
+356
-0
SplashYlhActivity.kt
...ava/com/mints/goodmoney/ui/activitys/SplashYlhActivity.kt
+4
-5
activity_splash2.xml
GoodMoney/app/src/main/res/layout/activity_splash2.xml
+117
-0
No files found.
GoodMoney/app/build.gradle
View file @
cce54922
...
@@ -184,9 +184,8 @@ dependencies {
...
@@ -184,9 +184,8 @@ dependencies {
implementation
(
name:
'msa_mdid_1.0.13'
,
ext:
'aar'
)
implementation
(
name:
'msa_mdid_1.0.13'
,
ext:
'aar'
)
// 穿山甲广告
// 穿山甲广告
implementation
(
name:
'open_ad_sdk'
,
ext:
'aar'
)
implementation
(
name:
'open_ad_sdk'
,
ext:
'aar'
)
// implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.6'
// 广点通广告 腾讯
// 广点通广告 腾讯
implementation
(
name:
'GDTSDK.unionNo
rmal.4.232.1102
'
,
ext:
'aar'
)
implementation
(
name:
'GDTSDK.unionNo
Plugin.4.270.1140
'
,
ext:
'aar'
)
// shareSdk
// shareSdk
implementation
project
(
':shareSdkLib'
)
implementation
project
(
':shareSdkLib'
)
// umeng
// umeng
...
@@ -196,7 +195,7 @@ dependencies {
...
@@ -196,7 +195,7 @@ dependencies {
// TalkingDada
// TalkingDada
implementation
files
(
'libs/SaaS_AppAnalytics_Android_SDK_V4.0.36.jar'
)
implementation
files
(
'libs/SaaS_AppAnalytics_Android_SDK_V4.0.36.jar'
)
// 一览视频
// 一览视频
implementation
(
"com.yilan.sdk:ui:2.
0.0.4
"
)
{
implementation
(
"com.yilan.sdk:ui:2.
5.0.10
"
)
{
exclude
group:
'com.yilan.sdk'
,
module:
'toutiao'
exclude
group:
'com.yilan.sdk'
,
module:
'toutiao'
exclude
group:
'com.yilan.sdk'
,
module:
'gdt'
exclude
group:
'com.yilan.sdk'
,
module:
'gdt'
}
}
...
...
GoodMoney/app/libs/GDTSDK.unionNoPlugin.4.270.1140.aar
0 → 100644
View file @
cce54922
File added
GoodMoney/app/libs/GDTSDK.unionNormal.4.232.1102.aar
deleted
100644 → 0
View file @
259f4d8a
File deleted
GoodMoney/app/src/main/AndroidManifest.xml
View file @
cce54922
...
@@ -87,7 +87,7 @@
...
@@ -87,7 +87,7 @@
android:value=
"${JPUSH_CHANNEL}"
/>
android:value=
"${JPUSH_CHANNEL}"
/>
<activity
<activity
android:name=
".ui.activitys.Splash
YlhActivity
"
android:name=
".ui.activitys.Splash
Activity2
"
android:screenOrientation=
"portrait"
>
android:screenOrientation=
"portrait"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
...
@@ -133,8 +133,6 @@
...
@@ -133,8 +133,6 @@
android:screenOrientation=
"portrait"
/>
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".ui.activitys.CoinRecordActivity"
<activity
android:name=
".ui.activitys.CoinRecordActivity"
android:screenOrientation=
"portrait"
/>
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".ui.activitys.SplashADActivity"
android:screenOrientation=
"portrait"
/>
<service
<service
android:name=
".service.UpdateService"
android:name=
".service.UpdateService"
...
@@ -239,14 +237,14 @@
...
@@ -239,14 +237,14 @@
android:resource=
"@xml/file_paths"
/>
android:resource=
"@xml/file_paths"
/>
</provider>
</provider>
<!-- 广点通广告 -->
<uses-library
<uses-library
android:name=
"org.apache.http.legacy"
android:name=
"org.apache.http.legacy"
android:required=
"false"
/>
android:required=
"false"
/>
<!-- 声明SDK所需要的组件 -->
<service
<service
android:name=
"com.qq.e.comm.DownloadService"
android:name=
"com.qq.e.comm.DownloadService"
android:exported=
"false"
/>
android:exported=
"false"
/>
<!-- 请开发者注意字母的大小写,ADActivity,而不是AdActivity -->
<activity
<activity
android:name=
"com.qq.e.ads.ADActivity"
android:name=
"com.qq.e.ads.ADActivity"
android:configChanges=
"keyboard|keyboardHidden|orientation|screenSize"
/>
android:configChanges=
"keyboard|keyboardHidden|orientation|screenSize"
/>
...
@@ -256,6 +254,7 @@
...
@@ -256,6 +254,7 @@
android:screenOrientation=
"portrait"
/>
android:screenOrientation=
"portrait"
/>
<activity
<activity
android:name=
"com.qq.e.ads.LandscapeADActivity"
android:name=
"com.qq.e.ads.LandscapeADActivity"
tools:replace=
"android:screenOrientation"
android:configChanges=
"keyboard|keyboardHidden|orientation|screenSize"
android:configChanges=
"keyboard|keyboardHidden|orientation|screenSize"
android:screenOrientation=
"landscape"
/>
android:screenOrientation=
"landscape"
/>
</application>
</application>
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SplashADActivity.kt
deleted
100644 → 0
View file @
259f4d8a
package
com.mints.goodmoney.ui.activitys
import
android.app.Activity
import
android.os.Handler
import
android.os.Looper
import
android.util.Log
import
android.view.KeyEvent
import
android.view.View
import
android.view.ViewGroup
import
android.widget.TextView
import
com.mints.goodmoney.R
import
com.mints.goodmoney.manager.YlhAdManager
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
import
com.mints.library.net.netstatus.NetUtils
import
com.qq.e.ads.splash.SplashAD
import
com.qq.e.ads.splash.SplashADListener
import
com.qq.e.comm.util.AdError
/**
* 后台返回时每次都展示
*/
class
SplashADActivity
:
BaseActivity
(),
SplashADListener
{
private
var
splashAD
:
SplashAD
?
=
null
private
var
container
:
ViewGroup
?
=
null
private
val
skipView
:
TextView
?
=
null
var
canJump
=
false
/**
* 为防止无广告时造成视觉上类似于"闪退"的情况,设定无广告时页面跳转根据需要延迟一定时间,demo
* 给出的延时逻辑是从拉取广告开始算开屏最少持续多久,仅供参考,开发者可自定义延时逻辑,如果开发者采用demo
* 中给出的延时逻辑,也建议开发者考虑自定义minSplashTimeWhenNoAD的值(单位ms)
*/
private
val
minSplashTimeWhenNoAD
=
3000
/**
* 记录拉取广告的时间
*/
private
var
fetchSplashADTime
:
Long
=
0
private
val
handler
=
Handler
(
Looper
.
getMainLooper
())
override
fun
getContentViewLayoutID
():
Int
{
return
R
.
layout
.
activity_splash_ylh
}
override
fun
initViewsAndEvents
()
{
if
(!
NetUtils
.
isNetworkConnected
(
context
))
{
finish
()
}
else
{
try
{
container
=
findViewById
<
View
>(
R
.
id
.
splash_container
)
as
ViewGroup
fetchSplashAD
(
this
,
container
,
skipView
,
YlhAdManager
.
YLH_AD_SPLASH_POSTID
,
this
,
0
)
}
catch
(
e
:
Exception
)
{
readyGoOtherActivity
()
}
}
}
override
fun
isApplyKitKatTranslucency
():
Boolean
{
return
false
}
/**
* 拉取开屏广告,开屏广告的构造方法有3种,详细说明请参考开发者文档。
*
* @param activity 展示广告的activity
* @param adContainer 展示广告的大容器
* @param skipContainer 自定义的跳过按钮:传入该view给SDK后,SDK会自动给它绑定点击跳过事件。SkipView的样式可以由开发者自由定制,其尺寸限制请参考activity_splash.xml或者接入文档中的说明。
* @param posId 广告位ID
* @param adListener 广告状态监听器
* @param fetchDelay 拉取广告的超时时长:取值范围[3000, 5000],设为0表示使用广点通SDK默认的超时时长。
*/
private
fun
fetchSplashAD
(
activity
:
Activity
,
adContainer
:
ViewGroup
?,
skipContainer
:
View
?,
posId
:
String
,
adListener
:
SplashADListener
,
fetchDelay
:
Int
)
{
fetchSplashADTime
=
System
.
currentTimeMillis
()
splashAD
=
SplashAD
(
activity
,
skipContainer
,
posId
,
adListener
,
fetchDelay
)
splashAD
!!
.
fetchAndShowIn
(
adContainer
)
}
override
fun
onADPresent
()
{
Log
.
i
(
"AD_DEMO"
,
"SplashADPresent"
)
}
override
fun
onADClicked
()
{
Log
.
i
(
"AD_DEMO"
,
"SplashADClicked clickUrl: "
+
if
(
splashAD
!!
.
ext
!=
null
)
splashAD
!!
.
ext
[
"clickUrl"
]
else
""
)
}
/**
* 倒计时回调,返回广告还将被展示的剩余时间。
* 通过这个接口,开发者可以自行决定是否显示倒计时提示,或者还剩几秒的时候显示倒计时
*
* @param millisUntilFinished 剩余毫秒数
*/
override
fun
onADTick
(
millisUntilFinished
:
Long
)
{
Log
.
i
(
"AD_DEMO"
,
"SplashADTick "
+
millisUntilFinished
+
"ms"
)
if
(
skipView
!=
null
)
{
skipView
.
text
=
String
.
format
(
SKIP_TEXT
,
Math
.
round
(
millisUntilFinished
/
1000f
))
}
}
override
fun
onADExposure
()
{
Log
.
i
(
"AD_DEMO"
,
"SplashADExposure"
)
}
override
fun
onADLoaded
(
expireTimestamp
:
Long
)
{
Log
.
i
(
"AD_DEMO"
,
"SplashADFetch expireTimestamp: "
+
expireTimestamp
+
", eCPMLevel = "
+
splashAD
!!
.
ecpmLevel
)
}
override
fun
onADDismissed
()
{
Log
.
i
(
"AD_DEMO"
,
"SplashADDismissed"
)
next
()
}
override
fun
onNoAD
(
error
:
AdError
)
{
val
str
=
String
.
format
(
"LoadSplashADFail, eCode=%d, errorMsg=%s"
,
error
.
errorCode
,
error
.
errorMsg
)
Log
.
i
(
"AD_DEMO"
,
str
)
/**
* 为防止无广告时造成视觉上类似于"闪退"的情况,设定无广告时页面跳转根据需要延迟一定时间,demo
* 给出的延时逻辑是从拉取广告开始算开屏最少持续多久,仅供参考,开发者可自定义延时逻辑,如果开发者采用demo
* 中给出的延时逻辑,也建议开发者考虑自定义minSplashTimeWhenNoAD的值
*/
val
alreadyDelayMills
=
System
.
currentTimeMillis
()
-
fetchSplashADTime
//从拉广告开始到onNoAD已经消耗了多少时间
val
shouldDelayMills
=
if
(
alreadyDelayMills
>
minSplashTimeWhenNoAD
)
0
else
minSplashTimeWhenNoAD
-
alreadyDelayMills
//为防止加载广告失败后立刻跳离开屏可能造成的视觉上类似于"闪退"的情况,根据设置的minSplashTimeWhenNoAD
// 计算出还需要延时多久
handler
.
postDelayed
({
readyGoOtherActivity
()
},
shouldDelayMills
)
}
/**
* 设置一个变量来控制当前开屏页面是否可以跳转,当开屏广告为普链类广告时,点击会打开一个广告落地页,此时开发者还不能打开自己的App主页。当从广告落地页返回以后,
* 才可以跳转到开发者自己的App主页;当开屏广告是App类广告时只会下载App。
*/
private
operator
fun
next
()
{
if
(
canJump
)
{
readyGoOtherActivity
()
}
else
{
canJump
=
true
}
}
override
fun
onPause
()
{
super
.
onPause
()
canJump
=
false
}
override
fun
onResume
()
{
super
.
onResume
()
if
(
canJump
)
{
next
()
}
canJump
=
true
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
handler
.
removeCallbacksAndMessages
(
null
)
}
/**
* 开屏页一定要禁止用户对返回按钮的控制,否则将可能导致用户手动退出了App而广告无法正常曝光和计费
*/
override
fun
onKeyDown
(
keyCode
:
Int
,
event
:
KeyEvent
):
Boolean
{
return
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
true
}
else
super
.
onKeyDown
(
keyCode
,
event
)
}
private
fun
readyGoOtherActivity
()
{
finish
()
}
companion
object
{
private
const
val
SKIP_TEXT
=
"点击跳过 %d"
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SplashADActivity2.kt
0 → 100644
View file @
cce54922
//package com.mints.goodmoney.ui.activitys
//
//import android.app.Activity
//import android.os.Handler
//import android.os.Looper
//import android.util.Log
//import android.view.KeyEvent
//import android.view.View
//import android.view.ViewGroup
//import android.widget.TextView
//import com.mints.goodmoney.R
//import com.mints.goodmoney.manager.YlhAdManager
//import com.mints.goodmoney.ui.activitys.base.BaseActivity
//import com.mints.library.net.netstatus.NetUtils
//import com.qq.e.ads.splash.SplashAD
//import com.qq.e.ads.splash.SplashADListener
//import com.qq.e.comm.util.AdError
//
///**
// * 后台返回时每次都展示
// */
//class SplashADActivity2 : BaseActivity(), SplashADListener {
// private var splashAD: SplashAD? = null
// private var container: ViewGroup? = null
// private val skipView: TextView? = null
// var canJump = false
//
// /**
// * 为防止无广告时造成视觉上类似于"闪退"的情况,设定无广告时页面跳转根据需要延迟一定时间,demo
// * 给出的延时逻辑是从拉取广告开始算开屏最少持续多久,仅供参考,开发者可自定义延时逻辑,如果开发者采用demo
// * 中给出的延时逻辑,也建议开发者考虑自定义minSplashTimeWhenNoAD的值(单位ms)
// */
// private val minSplashTimeWhenNoAD = 3000
//
// /**
// * 记录拉取广告的时间
// */
// private var fetchSplashADTime: Long = 0
// private val handler = Handler(Looper.getMainLooper())
// override fun getContentViewLayoutID(): Int {
// return R.layout.activity_splash_ylh
// }
//
// override fun initViewsAndEvents() {
// if (!NetUtils.isNetworkConnected(context)) {
// finish()
// } else {
// try {
// container = findViewById<View>(R.id.splash_container) as ViewGroup
// fetchSplashAD(this, container, skipView, YlhAdManager.YLH_AD_SPLASH_POSTID, this, 0)
// } catch (e: Exception) {
// readyGoOtherActivity()
// }
// }
// }
//
// override fun isApplyKitKatTranslucency(): Boolean {
// return false
// }
//
// /**
// * 拉取开屏广告,开屏广告的构造方法有3种,详细说明请参考开发者文档。
// *
// * @param activity 展示广告的activity
// * @param adContainer 展示广告的大容器
// * @param skipContainer 自定义的跳过按钮:传入该view给SDK后,SDK会自动给它绑定点击跳过事件。SkipView的样式可以由开发者自由定制,其尺寸限制请参考activity_splash.xml或者接入文档中的说明。
// * @param posId 广告位ID
// * @param adListener 广告状态监听器
// * @param fetchDelay 拉取广告的超时时长:取值范围[3000, 5000],设为0表示使用广点通SDK默认的超时时长。
// */
// private fun fetchSplashAD(activity: Activity, adContainer: ViewGroup?, skipContainer: View?,
// posId: String, adListener: SplashADListener, fetchDelay: Int) {
// fetchSplashADTime = System.currentTimeMillis()
// splashAD = SplashAD(activity, skipContainer, posId, adListener, fetchDelay)
// splashAD!!.fetchAndShowIn(adContainer)
// }
//
// override fun onADPresent() {
// Log.i("AD_DEMO", "SplashADPresent")
// }
//
// override fun onADClicked() {
// Log.i("AD_DEMO", "SplashADClicked clickUrl: "
// + if (splashAD!!.ext != null) splashAD!!.ext["clickUrl"] else "")
// }
//
// /**
// * 倒计时回调,返回广告还将被展示的剩余时间。
// * 通过这个接口,开发者可以自行决定是否显示倒计时提示,或者还剩几秒的时候显示倒计时
// *
// * @param millisUntilFinished 剩余毫秒数
// */
// override fun onADTick(millisUntilFinished: Long) {
// Log.i("AD_DEMO", "SplashADTick " + millisUntilFinished + "ms")
// if (skipView != null) {
// skipView.text = String.format(SKIP_TEXT, Math.round(millisUntilFinished / 1000f))
// }
// }
//
// override fun onADExposure() {
// Log.i("AD_DEMO", "SplashADExposure")
// }
//
// override fun onADLoaded(expireTimestamp: Long) {
// Log.i("AD_DEMO", "SplashADFetch expireTimestamp: " + expireTimestamp
// + ", eCPMLevel = " + splashAD!!.ecpmLevel)
// }
//
// override fun onADDismissed() {
// Log.i("AD_DEMO", "SplashADDismissed")
// next()
// }
//
// override fun onNoAD(error: AdError) {
// val str = String.format("LoadSplashADFail, eCode=%d, errorMsg=%s", error.errorCode,
// error.errorMsg)
// Log.i("AD_DEMO", str)
// /**
// * 为防止无广告时造成视觉上类似于"闪退"的情况,设定无广告时页面跳转根据需要延迟一定时间,demo
// * 给出的延时逻辑是从拉取广告开始算开屏最少持续多久,仅供参考,开发者可自定义延时逻辑,如果开发者采用demo
// * 中给出的延时逻辑,也建议开发者考虑自定义minSplashTimeWhenNoAD的值
// */
// val alreadyDelayMills = System.currentTimeMillis() - fetchSplashADTime //从拉广告开始到onNoAD已经消耗了多少时间
// val shouldDelayMills = if (alreadyDelayMills > minSplashTimeWhenNoAD) 0 else minSplashTimeWhenNoAD - alreadyDelayMills //为防止加载广告失败后立刻跳离开屏可能造成的视觉上类似于"闪退"的情况,根据设置的minSplashTimeWhenNoAD
// // 计算出还需要延时多久
// handler.postDelayed({ readyGoOtherActivity() }, shouldDelayMills)
// }
//
// /**
// * 设置一个变量来控制当前开屏页面是否可以跳转,当开屏广告为普链类广告时,点击会打开一个广告落地页,此时开发者还不能打开自己的App主页。当从广告落地页返回以后,
// * 才可以跳转到开发者自己的App主页;当开屏广告是App类广告时只会下载App。
// */
// private operator fun next() {
// if (canJump) {
// readyGoOtherActivity()
// } else {
// canJump = true
// }
// }
//
// override fun onPause() {
// super.onPause()
// canJump = false
// }
//
// override fun onResume() {
// super.onResume()
// if (canJump) {
// next()
// }
// canJump = true
// }
//
// override fun onDestroy() {
// super.onDestroy()
// handler.removeCallbacksAndMessages(null)
// }
//
// /**
// * 开屏页一定要禁止用户对返回按钮的控制,否则将可能导致用户手动退出了App而广告无法正常曝光和计费
// */
// override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
// return if (keyCode == KeyEvent.KEYCODE_BACK) {
// true
// } else super.onKeyDown(keyCode, event)
// }
//
// private fun readyGoOtherActivity() {
// finish()
// }
//
// companion object {
// private const val SKIP_TEXT = "点击跳过 %d"
// }
//}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SplashActivity2.java
0 → 100644
View file @
cce54922
This diff is collapsed.
Click to expand it.
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SplashYlhActivity.kt
View file @
cce54922
...
@@ -31,7 +31,6 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
...
@@ -31,7 +31,6 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
private
var
splashAD
:
SplashAD
?
=
null
private
var
splashAD
:
SplashAD
?
=
null
private
var
container
:
ViewGroup
?
=
null
private
var
container
:
ViewGroup
?
=
null
private
val
skipView
:
TextView
?
=
null
private
val
ps
by
lazy
{
AppPreferences
(
context
)
}
private
val
ps
by
lazy
{
AppPreferences
(
context
)
}
var
canJump
=
false
var
canJump
=
false
...
@@ -96,7 +95,7 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
...
@@ -96,7 +95,7 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
}
else
{
}
else
{
try
{
try
{
container
=
findViewById
<
View
>(
R
.
id
.
splash_container
)
as
ViewGroup
container
=
findViewById
<
View
>(
R
.
id
.
splash_container
)
as
ViewGroup
fetchSplashAD
(
this
,
container
,
skip
V
iew
,
YlhAdManager
.
YLH_AD_SPLASH_POSTID
,
this
,
0
)
fetchSplashAD
(
this
,
container
,
skip
_v
iew
,
YlhAdManager
.
YLH_AD_SPLASH_POSTID
,
this
,
0
)
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
readyGoOtherActivity
()
readyGoOtherActivity
()
}
}
...
@@ -113,10 +112,10 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
...
@@ -113,10 +112,10 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
* @param adListener 广告状态监听器
* @param adListener 广告状态监听器
* @param fetchDelay 拉取广告的超时时长:取值范围[3000, 5000],设为0表示使用广点通SDK默认的超时时长。
* @param fetchDelay 拉取广告的超时时长:取值范围[3000, 5000],设为0表示使用广点通SDK默认的超时时长。
*/
*/
private
fun
fetchSplashAD
(
activity
:
Activity
,
adContainer
:
ViewGroup
?,
skipContainer
:
View
?
,
private
fun
fetchSplashAD
(
activity
:
Activity
,
adContainer
:
ViewGroup
?,
skipContainer
:
View
,
posId
:
String
,
adListener
:
SplashADListener
,
fetchDelay
:
Int
)
{
posId
:
String
,
adListener
:
SplashADListener
,
fetchDelay
:
Int
)
{
fetchSplashADTime
=
System
.
currentTimeMillis
()
fetchSplashADTime
=
System
.
currentTimeMillis
()
splashAD
=
SplashAD
(
activity
,
skipContainer
,
posId
,
adListener
,
fetchDelay
)
splashAD
=
SplashAD
(
activity
,
skipContainer
,
YlhAdManager
.
YLH_AD_APPID
,
posId
,
adListener
,
fetchDelay
)
splashAD
!!
.
fetchAndShowIn
(
adContainer
)
splashAD
!!
.
fetchAndShowIn
(
adContainer
)
}
}
...
@@ -133,7 +132,7 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
...
@@ -133,7 +132,7 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
* @param millisUntilFinished 剩余毫秒数
* @param millisUntilFinished 剩余毫秒数
*/
*/
override
fun
onADTick
(
millisUntilFinished
:
Long
)
{
override
fun
onADTick
(
millisUntilFinished
:
Long
)
{
skip
V
iew
?.
setText
(
String
.
format
(
SKIP_TEXT
,
Math
.
round
(
millisUntilFinished
/
1000f
)))
skip
_v
iew
?.
setText
(
String
.
format
(
SKIP_TEXT
,
Math
.
round
(
millisUntilFinished
/
1000f
)))
}
}
override
fun
onADExposure
()
{
override
fun
onADExposure
()
{
...
...
GoodMoney/app/src/main/res/layout/activity_splash2.xml
0 → 100644
View file @
cce54922
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
>
<!--这里模拟一张oneshot单的焦点图展示-->
<ImageView
android:id=
"@+id/oneshot_image"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"400px"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
/>
<RelativeLayout
android:id=
"@+id/splash_main"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
>
<!-- 广点通开屏广告支持“半屏/全屏”展示,开发者可以把Logo区域放在屏幕底部,然后在Logo上方提供一个容器来放置半开屏广告,请注意此容器高度不得小于400dp -->
<!-- 1.Logo区域:展示半开屏广告时使用,如果想展示全开屏广告,可以不需要这个Logo区域 -->
<!-- 注意:如需要这个Logo区域,建议开发者使用自己的Logo资源,而不是联盟的Logo资源@drawable/gdt_splash_logo,资源规格可参照@drawable/gdt_splash_logo -->
<ImageView
android:id=
"@+id/app_logo"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_centerHorizontal=
"true"
/>
<!-- 2.预设开屏图片区域: -->
<!-- 开发者可以把自家App设计开屏图片摆放在这里,本示例中放置了一张静态图片。!-->
<!-- 注意1:直接将此图放在广告容器的下面即可,始终不要将广告容器splash_container的设为invisible,否则将不会展示广告无法计费,返回错误码600。-->
<!-- 注意2:建议开发者使用自己的开屏图片资源,而不是联盟的@drawable/splash_holder,资源规格可参照@drawable/splash_holder -->
<ImageView
android:id=
"@+id/splash_holder"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_above=
"@id/app_logo"
android:scaleType=
"fitXY"
/>
<!-- 3.开屏广告容器区域:-->
<!-- 注意:该区域高度不得小于400dp。在本示例中没有写死splash_container的高度值,是因为第1部分的app_logo区域是一个高度很小的图片。 -->
<FrameLayout
android:id=
"@+id/splash_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_above=
"@id/app_logo"
/>
<!-- 4.自定义跳过按钮区域:开发者可以根据需要自己实现不同样式的跳过按钮 -->
<!-- 注意1:根据广告法规定,跳过按钮必须在屏幕当中出现。因此广告展示的时候,必须让将SkipView显示出来,即visible,否则将SDK将不展示广告,返回错误码608。。 -->
<!-- 注意2:SDK除了会检查跳过按钮的可见性,还将检测它的尺寸,其尺寸不得小于3dp*3dp,否则将SDK将不展示广告,返回错误码608。 -->
<TextView
android:id=
"@+id/skip_view"
android:layout_width=
"96dp"
android:visibility=
"gone"
android:layout_height=
"wrap_content"
android:layout_alignParentRight=
"true"
android:layout_alignParentTop=
"true"
android:layout_margin=
"16dp"
android:background=
"@drawable/background_circle"
android:gravity=
"center"
android:textColor=
"@android:color/white"
android:textSize=
"14sp"
/>
<!-- 本示例省略了自定义的倒计时,和跳过按钮放在一起实现了。开发者也可以实现自己的倒计时View,方法是在onADTick回调中获得广告剩余的展示时间,并自由决定倒计时View的样式,SDK对倒计时的View没有要求。 -->
<!-- 自定义wifi预加载按钮,需设置状态为不显示,当素材为视频且视频开始播放时,SDK内部会处理为显示状态-->
<TextView
android:id=
"@+id/preload_view"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentLeft=
"true"
android:layout_alignParentTop=
"true"
android:layout_margin=
"16dp"
android:background=
"@drawable/background_circle"
android:gravity=
"center"
android:text=
"已Wi-Fi预加载"
android:textColor=
"@android:color/white"
android:textSize=
"14sp"
android:visibility=
"gone"
/>
</RelativeLayout>
<!--只加载广告接口,这里展示下加载结果-->
<LinearLayout
android:id=
"@+id/splash_load_ad_only"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:paddingBottom=
"@dimen/activity_vertical_margin"
android:paddingLeft=
"@dimen/activity_horizontal_margin"
android:paddingRight=
"@dimen/activity_horizontal_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
android:visibility=
"gone"
>
<Button
android:id=
"@+id/splash_load_ad_close"
android:text=
"关闭"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<Button
android:id=
"@+id/splash_load_ad_refresh"
android:text=
"刷新"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<Button
android:id=
"@+id/splash_load_ad_display"
android:text=
"显示广告"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<TextView
android:id=
"@+id/splash_load_ad_status"
android:hint=
"当前状态"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment