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
775481e4
Commit
775481e4
authored
Feb 25, 2021
by
mengcuiguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_ad' of
http://39.97.65.143:81/android/android_goodmoney
into dev_ad
parents
0120cce4
706d5c80
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
169 additions
and
11 deletions
+169
-11
AndroidManifest.xml
GoodMoney/app/src/main/AndroidManifest.xml
+3
-0
MintsApplication.java
...p/src/main/java/com/mints/goodmoney/MintsApplication.java
+0
-2
SplashCsjADActivity.kt
...a/com/mints/goodmoney/ui/activitys/SplashCsjADActivity.kt
+149
-0
ForegroundOrBackground.java
...ava/com/mints/goodmoney/utils/ForegroundOrBackground.java
+17
-9
No files found.
GoodMoney/app/src/main/AndroidManifest.xml
View file @
775481e4
...
@@ -194,6 +194,9 @@
...
@@ -194,6 +194,9 @@
<activity
<activity
android:name=
".ui.activitys.SplashKsADActivity"
android:name=
".ui.activitys.SplashKsADActivity"
android:screenOrientation=
"portrait"
/>
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".ui.activitys.SplashCsjADActivity"
android:screenOrientation=
"portrait"
/>
<activity
<activity
android:name=
".ui.activitys.MorningClockActivity"
android:name=
".ui.activitys.MorningClockActivity"
android:screenOrientation=
"portrait"
/>
android:screenOrientation=
"portrait"
/>
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/MintsApplication.java
View file @
775481e4
...
@@ -12,7 +12,6 @@ import androidx.multidex.MultiDexApplication;
...
@@ -12,7 +12,6 @@ import androidx.multidex.MultiDexApplication;
import
com.hjq.toast.ToastUtils
;
import
com.hjq.toast.ToastUtils
;
import
com.mints.goodmoney.common.Constant
;
import
com.mints.goodmoney.common.Constant
;
import
com.mints.goodmoney.manager.ChannelManager
;
import
com.mints.goodmoney.manager.KsManager
;
import
com.mints.goodmoney.manager.KsManager
;
import
com.mints.goodmoney.manager.LiebaoManager
;
import
com.mints.goodmoney.manager.LiebaoManager
;
import
com.mints.goodmoney.manager.MhManager
;
import
com.mints.goodmoney.manager.MhManager
;
...
@@ -23,7 +22,6 @@ import com.mints.goodmoney.manager.TzManager;
...
@@ -23,7 +22,6 @@ import com.mints.goodmoney.manager.TzManager;
import
com.mints.goodmoney.manager.WnManager
;
import
com.mints.goodmoney.manager.WnManager
;
import
com.mints.goodmoney.manager.YlVideoManager
;
import
com.mints.goodmoney.manager.YlVideoManager
;
import
com.mints.goodmoney.manager.YlhAdManager
;
import
com.mints.goodmoney.manager.YlhAdManager
;
import
com.mints.goodmoney.manager.ZhangyueManager
;
import
com.mints.goodmoney.net.LoanService
;
import
com.mints.goodmoney.net.LoanService
;
import
com.mints.goodmoney.utils.ForegroundOrBackground
;
import
com.mints.goodmoney.utils.ForegroundOrBackground
;
import
com.mints.goodmoney.utils.LogUtil
;
import
com.mints.goodmoney.utils.LogUtil
;
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SplashCsjADActivity.kt
0 → 100644
View file @
775481e4
package
com.mints.goodmoney.ui.activitys
import
android.view.KeyEvent
import
android.view.View
import
android.view.ViewGroup
import
com.bytedance.sdk.openadsdk.AdSlot
import
com.bytedance.sdk.openadsdk.TTAdNative
import
com.bytedance.sdk.openadsdk.TTSplashAd
import
com.mints.goodmoney.R
import
com.mints.goodmoney.manager.TTNativeExpressManager
import
com.mints.goodmoney.manager.TtCsjAdManager
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
import
com.mints.library.net.netstatus.NetUtils
private
val
TAG
=
SplashCsjADActivity
::
class
.
java
.
simpleName
/**
* 后台返回时每次都展示 快手广告
*/
class
SplashCsjADActivity
:
BaseActivity
()
{
private
var
container
:
ViewGroup
?
=
null
private
var
mIsPaused
=
false
var
canJump
=
false
private
var
mTTAdNative
:
TTAdNative
?
=
null
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
//step2:创建TTAdNative对象
val
ttNativeExpressManager
=
TTNativeExpressManager
()
mTTAdNative
=
ttNativeExpressManager
.
initTTAd
(
false
)
loadSplashAd
()
}
catch
(
e
:
Exception
)
{
readyGoOtherActivity
()
}
}
}
override
fun
isApplyKitKatTranslucency
():
Boolean
{
return
false
}
private
fun
loadSplashAd
()
{
//step3:创建开屏广告请求参数AdSlot
var
adSlot
:
AdSlot
?
=
AdSlot
.
Builder
()
.
setCodeId
(
TtCsjAdManager
.
TT_AD_SPLASH
)
.
setImageAcceptedSize
(
1080
,
1920
)
.
build
()
mTTAdNative
!!
.
loadSplashAd
(
adSlot
,
object
:
TTAdNative
.
SplashAdListener
{
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
readyGoOtherActivity
()
}
override
fun
onTimeout
()
{
readyGoOtherActivity
()
}
override
fun
onSplashAdLoad
(
ad
:
TTSplashAd
?)
{
if
(
ad
==
null
)
{
readyGoOtherActivity
()
return
}
val
splashView
=
ad
.
splashView
if
(
container
!=
null
&&
!
isFinishing
)
{
container
!!
.
removeAllViews
()
//把SplashView 添加到ViewGroup中,注意开屏广告view:width >=70%屏幕宽;height >=50%屏幕高
container
!!
.
addView
(
splashView
)
//设置不开启开屏广告倒计时功能以及不显示跳过按钮,如果这么设置,您需要自定义倒计时逻辑
//ad.setNotAllowSdkCountdown();
}
else
{
readyGoOtherActivity
()
}
ad
.
setSplashInteractionListener
(
object
:
TTSplashAd
.
AdInteractionListener
{
override
fun
onAdClicked
(
p0
:
View
?,
p1
:
Int
)
{
}
override
fun
onAdShow
(
p0
:
View
?,
p1
:
Int
)
{
}
override
fun
onAdSkip
()
{
readyGoOtherActivity
()
}
override
fun
onAdTimeOver
()
{
readyGoOtherActivity
()
}
})
}
},
3000
)
}
/**
* 设置一个变量来控制当前开屏页面是否可以跳转,当开屏广告为普链类广告时,点击会打开一个广告落地页,此时开发者还不能打开自己的App主页。当从广告落地页返回以后,
* 才可以跳转到开发者自己的App主页;当开屏广告是App类广告时只会下载App。
*/
private
operator
fun
next
()
{
if
(
mIsPaused
)
{
canJump
=
true
}
else
{
readyGoOtherActivity
()
}
}
override
fun
onPause
()
{
super
.
onPause
()
mIsPaused
=
true
}
override
fun
onResume
()
{
super
.
onResume
()
mIsPaused
=
false
if
(
canJump
)
{
next
()
}
}
/**
* 开屏页一定要禁止用户对返回按钮的控制,否则将可能导致用户手动退出了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
()
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/utils/ForegroundOrBackground.java
View file @
775481e4
...
@@ -9,6 +9,7 @@ import android.text.TextUtils;
...
@@ -9,6 +9,7 @@ import android.text.TextUtils;
import
com.mints.goodmoney.manager.TrackManager
;
import
com.mints.goodmoney.manager.TrackManager
;
import
com.mints.goodmoney.mvp.presenters.VersionUpdatePresenter
;
import
com.mints.goodmoney.mvp.presenters.VersionUpdatePresenter
;
import
com.mints.goodmoney.ui.activitys.SplashADActivity
;
import
com.mints.goodmoney.ui.activitys.SplashADActivity
;
import
com.mints.goodmoney.ui.activitys.SplashCsjADActivity
;
import
com.mints.goodmoney.ui.activitys.SplashKsADActivity
;
import
com.mints.goodmoney.ui.activitys.SplashKsADActivity
;
import
java.lang.ref.WeakReference
;
import
java.lang.ref.WeakReference
;
...
@@ -23,14 +24,15 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
...
@@ -23,14 +24,15 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
private
static
ForegroundOrBackground
instance
;
private
static
ForegroundOrBackground
instance
;
public
int
count
=
0
;
public
int
count
=
0
;
private
volatile
boolean
is
Ks
Splash
=
false
;
private
volatile
boolean
is
Ylh
Splash
=
false
;
//获取当前最上层的activity
//获取当前最上层的activity
private
static
WeakReference
<
Activity
>
app_activity
;
private
static
WeakReference
<
Activity
>
app_activity
;
private
VersionUpdatePresenter
vup
;
private
VersionUpdatePresenter
vup
;
private
WeakReference
<
Activity
>
reference
;
private
WeakReference
<
Activity
>
reference
;
private
Intent
ylhIntent
;
private
Intent
ylhIntent
;
private
Intent
ksIntent
;
// private Intent ksIntent;
private
Intent
csjIntent
;
public
static
ForegroundOrBackground
init
(
Application
application
)
{
public
static
ForegroundOrBackground
init
(
Application
application
)
{
if
(
instance
==
null
)
{
if
(
instance
==
null
)
{
...
@@ -101,10 +103,10 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
...
@@ -101,10 +103,10 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
if
(
count
==
0
)
{
if
(
count
==
0
)
{
// LogUtil.d("ForegroundOrBackground", System.currentTimeMillis() - leaveTime + " onActivityStarted");
// LogUtil.d("ForegroundOrBackground", System.currentTimeMillis() - leaveTime + " onActivityStarted");
// 60秒后打开应用 显示开屏广告
// 60秒后打开应用 显示开屏广告
if
(
System
.
currentTimeMillis
()
-
leaveTime
>=
60
000
)
{
if
(
System
.
currentTimeMillis
()
-
leaveTime
>=
3
000
)
{
if
(
is
Ks
Splash
)
{
if
(
is
Ylh
Splash
)
{
is
Ks
Splash
=
false
;
is
Ylh
Splash
=
false
;
if
(
ylhIntent
==
null
)
{
if
(
ylhIntent
==
null
)
{
// 优量汇广告
// 优量汇广告
...
@@ -112,13 +114,19 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
...
@@ -112,13 +114,19 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
}
}
activity
.
startActivity
(
ylhIntent
);
activity
.
startActivity
(
ylhIntent
);
}
else
{
}
else
{
is
Ks
Splash
=
true
;
is
Ylh
Splash
=
true
;
if
(
ks
Intent
==
null
)
{
if
(
csj
Intent
==
null
)
{
// 快手广告
// 快手广告
ksIntent
=
new
Intent
(
activity
,
SplashKs
ADActivity
.
class
);
csjIntent
=
new
Intent
(
activity
,
SplashCsj
ADActivity
.
class
);
}
}
activity
.
startActivity
(
ksIntent
);
activity
.
startActivity
(
csjIntent
);
// if (ksIntent == null) {
// // 快手广告
// ksIntent = new Intent(activity, SplashKsADActivity.class);
// }
// activity.startActivity(ksIntent);
}
}
}
}
...
...
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