Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_vedio
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_vedio
Commits
cf3b7ef7
Commit
cf3b7ef7
authored
Sep 25, 2023
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加开屏广告
parent
7fb14a0a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
201 additions
and
28 deletions
+201
-28
AndroidManifest.xml
video/app/src/main/AndroidManifest.xml
+7
-0
MintsApplication.java
.../src/main/java/com/duben/dayplaylet/MintsApplication.java
+4
-2
SplashActivity.kt
.../java/com/duben/dayplaylet/ui/activitys/SplashActivity.kt
+1
-1
SplashBackActivity.kt
...a/com/duben/dayplaylet/ui/activitys/SplashBackActivity.kt
+115
-0
ForegroundOrBackground.java
...va/com/duben/dayplaylet/utils/ForegroundOrBackground.java
+27
-25
activity_splash_back.xml
video/app/src/main/res/layout/activity_splash_back.xml
+47
-0
No files found.
video/app/src/main/AndroidManifest.xml
View file @
cf3b7ef7
...
...
@@ -82,6 +82,13 @@
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
".ui.activitys.SplashBackActivity"
android:configChanges=
"orientation|screenSize|keyboardHidden"
android:exported=
"false"
android:theme=
"@style/AppTheme.TranslucentSplash"
>
</activity>
<activity
android:name=
".ui.activitys.SplashAdActivity"
android:exported=
"false"
...
...
video/app/src/main/java/com/duben/dayplaylet/MintsApplication.java
View file @
cf3b7ef7
...
...
@@ -60,6 +60,9 @@ public class MintsApplication extends MultiDexApplication {
// 三方配置
if
(
isMainProcess
(
this
))
{
// 判断应用是否在前台
ForegroundOrBackground
.
init
(
this
);
thirdConfig
();
}
}
...
...
@@ -121,8 +124,7 @@ public class MintsApplication extends MultiDexApplication {
if
(
AppPreferencesManager
.
INSTANCE
.
get
()
.
getBoolean
(
Constant
.
LOAN_PERMISSION_FLAG
,
true
))
return
;
// 判断应用是否在前台
ForegroundOrBackground
.
init
(
this
);
// 数美初始化
ShumeiManager
.
getInstance
().
initShumei
();
...
...
video/app/src/main/java/com/duben/dayplaylet/ui/activitys/SplashActivity.kt
View file @
cf3b7ef7
...
...
@@ -32,7 +32,7 @@ class SplashActivity : BaseActivity() {
var
powerDialog
:
PowerDialog
?
=
null
var
powerDialog2
:
PowerDialog2
?
=
null
private
var
mProgressBar
:
CycleProgress
?
=
null
private
val
AD_TIME_OUT
=
3
000
private
val
AD_TIME_OUT
=
4
000
var
timer
:
CountDownTimerSupport
?
=
null
private
var
isAdSuc
=
false
...
...
video/app/src/main/java/com/duben/dayplaylet/ui/activitys/SplashBackActivity.kt
0 → 100644
View file @
cf3b7ef7
package
com.duben.dayplaylet.ui.activitys
import
android.view.KeyEvent
import
com.duben.dayplaylet.R
import
com.duben.dayplaylet.ad.splash.SplashManager
import
com.duben.dayplaylet.ui.activitys.base.BaseActivity
import
com.duben.dayplaylet.ui.widgets.CycleProgress
import
com.duben.dayplaylet.ui.widgets.countdowntimer.CountDownTimerSupport
import
com.duben.dayplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener
import
com.duben.dayplaylet.utils.LogUtil
/**
* 描述:启动页
* 作者:孟崔广
* 时间:2022/12/4 18:06
*/
class
SplashBackActivity
:
BaseActivity
()
{
private
var
mProgressBar
:
CycleProgress
?
=
null
private
val
AD_TIME_OUT
=
3000
var
timer
:
CountDownTimerSupport
?
=
null
private
var
isAdSuc
=
false
override
fun
toggleOverridePendingTransition
()
=
true
override
fun
getOverridePendingTransitionMode
()
=
TransitionMode
.
FADE
override
fun
getContentViewLayoutID
():
Int
{
return
R
.
layout
.
activity_splash_back
}
override
fun
initViewsAndEvents
()
{
mProgressBar
=
findViewById
(
R
.
id
.
progressBar
)
initData
()
}
private
fun
initData
()
{
SplashManager
.
preLoadAd
(
this
@SplashBackActivity
)
mProgressBar
!!
.
startOneAnim
()
try
{
startTimer
()
}
catch
(
e
:
Exception
)
{
goToMainActivity
()
}
}
fun
startTimer
()
{
if
(
timer
!=
null
)
{
//防止计时器重复
timer
!!
.
stop
()
timer
=
null
}
timer
=
CountDownTimerSupport
(
AD_TIME_OUT
.
toLong
(),
1000
)
timer
!!
.
setOnCountDownTimerListener
(
object
:
OnCountDownTimerListener
{
override
fun
onTick
(
millisUntilFinished
:
Long
)
{
if
(!
isFinishing
)
{
}
}
override
fun
onFinish
()
{
if
(!
isFinishing
)
{
if
(
mProgressBar
!=
null
)
{
mProgressBar
!!
.
setCompleteNoAnim
()
}
if
(
SplashManager
.
isSuccessStatus
())
{
LogUtil
.
d
(
"SplashNewActivity-->"
,
"SplashNewActivity--> ad show"
)
isAdSuc
=
true
if
(
mProgressBar
!=
null
)
{
mProgressBar
!!
.
setCompleteNoAnim
()
}
// 跳转广告
readyGoThenKill
(
SplashForeAdActivity
::
class
.
java
)
}
else
{
goToMainActivity
()
}
}
}
})
timer
!!
.
start
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
if
(
timer
!=
null
)
{
timer
!!
.
stop
()
timer
=
null
}
}
override
fun
isApplyKitKatTranslucency
():
Boolean
{
return
false
}
/**
* 跳转到主页面
*/
private
fun
goToMainActivity
()
{
finish
()
}
override
fun
onKeyDown
(
keyCode
:
Int
,
event
:
KeyEvent
):
Boolean
{
return
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
true
}
else
super
.
onKeyDown
(
keyCode
,
event
)
}
}
\ No newline at end of file
video/app/src/main/java/com/duben/dayplaylet/utils/ForegroundOrBackground.java
View file @
cf3b7ef7
...
...
@@ -12,6 +12,8 @@ import com.duben.dayplaylet.manager.ActivityPageManager;
import
com.duben.dayplaylet.manager.TrackManager
;
import
com.duben.dayplaylet.mvp.presenters.VersionUpdatePresenter
;
import
com.duben.dayplaylet.ui.activitys.MainActivity
;
import
com.duben.dayplaylet.ui.activitys.SplashBackActivity
;
import
com.duben.dayplaylet.ui.activitys.SplashForeAdActivity
;
import
java.lang.ref.WeakReference
;
...
...
@@ -80,44 +82,44 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
if
(
activity
==
null
)
return
;
//
String simpleName = activity.getClass().getSimpleName();
//
if (TextUtils.equals(simpleName, "SplashActivity") ||
//
TextUtils.equals(simpleName, "SplashAdActivity") ||
//
TextUtils.equals(simpleName, "SplashForeAdActivity") ||
// TextUtils.equals(simpleName, "Vip
Activity")) {
//
count++;
// System.out.println("mcg __>>>>>>>:: onActivityStarted simpleName="+simpleName+
" 进入 count=" + count);
//
//
return;
//
}
//
//
if (count == 0) {
String
simpleName
=
activity
.
getClass
().
getSimpleName
();
if
(
TextUtils
.
equals
(
simpleName
,
"SplashActivity"
)
||
TextUtils
.
equals
(
simpleName
,
"SplashAdActivity"
)
||
TextUtils
.
equals
(
simpleName
,
"SplashForeAdActivity"
)
||
TextUtils
.
equals
(
simpleName
,
"SplashBack
Activity"
))
{
count
++;
System
.
out
.
println
(
"mcg __>>>>>>>:: onActivityStarted simpleName="
+
simpleName
+
" 进入 count="
+
count
);
return
;
}
if
(
count
==
0
)
{
// long currentTimeMillis = System.currentTimeMillis();
// long diff = currentTimeMillis - activityStoppedTime;
// long diffInSeconds = diff / 1000;
// System.out.println("mcg -->>>>>:: diffInSeconds=" + diffInSeconds + " adSuccessStatus=" + SplashManager.INSTANCE.isSuccessStatus());
// if (diffInSeconds >= 10 && SplashManager.INSTANCE.isSuccessStatus()) {
// activity.startActivity(new Intent(activity, SplashForeAd
Activity.class));
activity
.
startActivity
(
new
Intent
(
activity
,
SplashBack
Activity
.
class
));
// }
//
}
//
count++;
//
// System.out.println("mcg __>>>>>>>:: onActivityStarted simpleName="+simpleName+
" 进入 count=" + count);
}
count
++;
System
.
out
.
println
(
"mcg __>>>>>>>:: onActivityStarted simpleName="
+
simpleName
+
" 进入 count="
+
count
);
}
@Override
public
void
onActivityStopped
(
Activity
activity
)
{
//
String simpleName = activity.getClass().getSimpleName();
//
//
count--;
// System.out.println("mcg __>>>>>>>:: onActivityStopped simpleName="+simpleName+
" 关闭 count=" + count);
//
if (count < 0) {
//
count = 0;
//
}
String
simpleName
=
activity
.
getClass
().
getSimpleName
();
count
--;
System
.
out
.
println
(
"mcg __>>>>>>>:: onActivityStopped simpleName="
+
simpleName
+
" 关闭 count="
+
count
);
if
(
count
<
0
)
{
count
=
0
;
}
// if (count == 0) {
// System.out.println("mcg -->>>>>:: onActivityStopped");
// activityStoppedTime = System.currentTimeMillis();
// SplashManager.INSTANCE.preLoadAd(activity);
//
//
SplashManager.INSTANCE.preLoadAd(activity);
// }
}
...
...
video/app/src/main/res/layout/activity_splash_back.xml
0 → 100755
View file @
cf3b7ef7
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:background=
"@color/white"
android:layout_height=
"match_parent"
>
<ImageView
android:id=
"@+id/app_logo"
android:layout_width=
"100dp"
android:layout_height=
"100dp"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"120dp"
android:src=
"@mipmap/ic_launcher_main"
/>
<TextView
android:layout_below=
"@+id/app_logo"
android:layout_width=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"40dp"
android:layout_height=
"wrap_content"
android:layout_above=
"@id/progressBar"
android:text=
"@string/app_name"
android:textStyle=
"bold"
android:textColor=
"@color/black"
android:textSize=
"36sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_above=
"@id/progressBar"
android:layout_centerHorizontal=
"true"
android:text=
"正在加载功能模块..."
android:textColor=
"@color/black"
android:textSize=
"16sp"
/>
<com.duben.dayplaylet.ui.widgets.CycleProgress
android:id=
"@+id/progressBar"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_above=
"@id/app_logo"
android:layout_alignParentBottom=
"true"
android:layout_marginStart=
"30dp"
android:layout_marginTop=
"10dp"
android:layout_marginEnd=
"30dp"
android:layout_marginBottom=
"50dp"
/>
</RelativeLayout>
\ 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