Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
B
Browser White
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
Browser White
Commits
266fc864
Commit
266fc864
authored
Aug 29, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
5a94377e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
31 deletions
+79
-31
PrivacyManager.kt
...om/base/browserwhite/ui/activity/splash/PrivacyManager.kt
+3
-2
Splash2Activity.kt
...m/base/browserwhite/ui/activity/splash/Splash2Activity.kt
+52
-22
TaskManager.kt
...a/com/base/browserwhite/ui/activity/splash/TaskManager.kt
+1
-3
AnimationHelper.java
...ain/java/com/base/browserwhite/utils/AnimationHelper.java
+22
-4
activity_splash_2.xml
app/src/main/res/layout/activity_splash_2.xml
+1
-0
d_duoyun.png
app/src/main/res/mipmap-xxhdpi/d_duoyun.png
+0
-0
d_xiaoyu.png
app/src/main/res/mipmap-xxhdpi/d_xiaoyu.png
+0
-0
No files found.
app/src/main/java/com/base/browserwhite/ui/activity/splash/PrivacyManager.kt
View file @
266fc864
...
...
@@ -6,6 +6,7 @@ import android.net.Uri
import
android.text.SpannableString
import
android.text.Spanned
import
android.text.style.UnderlineSpan
import
android.view.View
import
com.base.browserwhite.MyApplication
import
com.base.browserwhite.bean.ConstObject.ifAgreePrivacy
import
com.base.browserwhite.databinding.ActivitySplash2Binding
...
...
@@ -61,12 +62,12 @@ class PrivacyManager {
clicked
=
true
ifAgreePrivacy
=
true
(
context
.
application
as
MyApplication
).
initApp
()
listener
.
onAgreePrivacy
()
listener
.
onAgreePrivacy
(
true
)
}
}
interface
onUserPrivacyAggreementListener
{
fun
onAgreePrivacy
()
fun
onAgreePrivacy
(
isStart
:
Boolean
=
false
)
}
}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/ui/activity/splash/Splash2Activity.kt
View file @
266fc864
...
...
@@ -2,19 +2,19 @@ package com.base.browserwhite.ui.activity.splash
import
CloseNotificationReceiver
import
android.Manifest
import
android.R.attr.duration
import
android.animation.Animator
import
android.animation.AnimatorSet
import
android.animation.ObjectAnimator
import
android.animation.
PropertyValuesHolde
r
import
android.animation.
ValueAnimato
r
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.graphics.Color
import
android.os.Build
import
android.os.Handler
import
android.util.Log
import
android.view.KeyEvent
import
android.view.
animation.LinearInterpolator
import
android.view.
View
import
androidx.activity.result.contract.ActivityResultContracts
import
androidx.core.view.ViewCompat
import
androidx.core.view.isVisible
import
androidx.lifecycle.lifecycleScope
import
com.base.browserwhite.R
import
com.base.browserwhite.ads.AdmobMaxHelper
...
...
@@ -77,6 +77,7 @@ class Splash2Activity : BaseActivity<ActivitySplash2Binding>(),
onAgreePrivacy
()
}
}
else
{
startAnimation
(
false
)
{
PrivacyManager
(
binding
,
this
,
this
)
}
...
...
@@ -85,7 +86,13 @@ class Splash2Activity : BaseActivity<ActivitySplash2Binding>(),
}
@SuppressLint
(
"SetTextI18n"
)
fun
startPbAnimation
(
callback
:
()
->
Unit
)
{
AnimationHelper
.
startAlphaAnimation
(
binding
.
pb
,
800
,
null
)
{
callback
.
invoke
()
}
}
@SuppressLint
(
"SetTextI18n"
,
"Recycle"
)
fun
startAnimation
(
isAgree
:
Boolean
,
callback
:
()
->
Unit
)
{
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
...
...
@@ -105,24 +112,36 @@ class Splash2Activity : BaseActivity<ActivitySplash2Binding>(),
weather
.
tempMin
+
"℃"
+
" / "
+
weather
.
tempMax
+
"℃"
val
icon
=
when
(
weather
.
iconDay
)
{
"Sunny day"
->
R
.
mipmap
.
x
_qing
"Cloudy day"
->
R
.
mipmap
.
x
_yin
"Rainy day"
->
R
.
mipmap
.
x
_dayu
"Snowy day"
->
R
.
mipmap
.
x
_xiaxue
"Greasy day"
->
R
.
mipmap
.
x
_wumaishachengbao
"Unknown"
->
R
.
mipmap
.
x
_qing
else
->
R
.
mipmap
.
x
_qing
"Sunny day"
->
R
.
mipmap
.
d
_qing
"Cloudy day"
->
R
.
mipmap
.
d
_yin
"Rainy day"
->
R
.
mipmap
.
d
_dayu
"Snowy day"
->
R
.
mipmap
.
d
_xiaxue
"Greasy day"
->
R
.
mipmap
.
d
_wumaishachengbao
"Unknown"
->
R
.
mipmap
.
d
_qing
else
->
R
.
mipmap
.
d
_qing
}
binding
.
ivWeather
.
setImageResource
(
icon
)
AnimationHelper
.
startAlphaAnimation
(
binding
.
ivWeather
,
800
)
{
AnimationHelper
.
startAlphaAnimation
(
binding
.
tvDate
,
800
)
{
AnimationHelper
.
startAlphaAnimation
(
binding
.
tvTemperature
,
800
)
{
AnimationHelper
.
startAlphaAnimation
(
binding
.
ivWeather
,
800
,
null
)
{
AnimationHelper
.
startAlphaAnimation
(
binding
.
tvDate
,
800
,
null
)
{
AnimationHelper
.
startAlphaAnimation
(
binding
.
tvTemperature
,
800
,
null
)
{
if
(
isAgree
)
{
AnimationHelper
.
startAlphaAnimation
(
binding
.
pb
,
800
)
{
AnimationHelper
.
startAlphaAnimation
(
binding
.
pb
,
800
,
null
)
{
callback
.
invoke
()
}
}
else
{
AnimationHelper
.
startAlphaAnimation
(
binding
.
idTvStart
,
800
)
{
AnimationHelper
.
startAlphaAnimation
(
binding
.
idTvStart
,
1200
,
{
val
set1
=
AnimatorSet
()
// 创建缩放动画的ObjectAnimator
val
scaleUpAnimator1
=
ObjectAnimator
.
ofFloat
(
binding
.
idTvStart
,
"scaleX"
,
1f
,
0.95f
,
1.05f
)
val
scaleUpAnimator2
=
ObjectAnimator
.
ofFloat
(
binding
.
idTvStart
,
"scaleY"
,
1f
,
0.95f
,
1.05f
)
scaleUpAnimator1
.
duration
=
1200
// 动画持续500毫秒
scaleUpAnimator1
.
repeatCount
=
1
// 重复次数
scaleUpAnimator1
.
repeatMode
=
ValueAnimator
.
REVERSE
// 反向重复,实现缩小效果
scaleUpAnimator2
.
duration
=
1200
// 动画持续500毫秒
scaleUpAnimator2
.
repeatCount
=
1
// 重复次数
set1
.
playTogether
(
scaleUpAnimator1
,
scaleUpAnimator2
)
set1
.
start
()
})
{
callback
.
invoke
()
}
}
...
...
@@ -130,7 +149,6 @@ class Splash2Activity : BaseActivity<ActivitySplash2Binding>(),
}
}
}
}
}
else
{
callback
.
invoke
()
...
...
@@ -147,14 +165,26 @@ class Splash2Activity : BaseActivity<ActivitySplash2Binding>(),
})
}
override
fun
onAgreePrivacy
()
{
override
fun
onAgreePrivacy
(
isStart
:
Boolean
)
{
EventUtils
.
event
(
"app_start"
)
if
(
jumpType
==
0
)
{
startStayNotification
()
}
AdmobMaxHelper
.
preloadAd
(
this
)
mTaskManager
?.
startProgress
()
loadAd
()
binding
.
idTvStart
.
isVisible
=
false
binding
.
llStart
.
visibility
=
View
.
GONE
binding
.
llProgress
.
visibility
=
View
.
VISIBLE
if
(
isStart
)
{
startPbAnimation
{
mTaskManager
?.
startProgress
()
loadAd
()
}
}
else
{
mTaskManager
?.
startProgress
()
loadAd
()
}
}
...
...
app/src/main/java/com/base/browserwhite/ui/activity/splash/TaskManager.kt
View file @
266fc864
...
...
@@ -34,9 +34,7 @@ class TaskManager {
}
fun
startProgress
()
{
binding
.
idTvStart
.
isVisible
=
false
binding
.
llStart
.
visibility
=
View
.
GONE
binding
.
llProgress
.
visibility
=
View
.
VISIBLE
val
mRunnable
:
Runnable
=
object
:
Runnable
{
override
fun
run
()
{
if
(!
mIsPaused
)
{
...
...
app/src/main/java/com/base/browserwhite/utils/AnimationHelper.java
View file @
266fc864
...
...
@@ -12,9 +12,12 @@ public class AnimationHelper {
*
* @param view 要应用动画的视图。
* @param duration 动画持续时间(毫秒)。
* @param
callback
动画结束时调用的回调接口。
* @param
endCallback
动画结束时调用的回调接口。
*/
public
static
void
startAlphaAnimation
(
final
View
view
,
long
duration
,
final
AnimationEndCallback
callback
)
{
public
static
void
startAlphaAnimation
(
final
View
view
,
long
duration
,
final
AnimationStartCallback
startCallback
,
final
AnimationEndCallback
endCallback
)
{
// 确保视图初始透明度为0
view
.
setAlpha
(
0
f
);
...
...
@@ -24,12 +27,20 @@ public class AnimationHelper {
// 设置动画监听器,以便在动画结束时调用回调
alphaAnimator
.
addListener
(
new
AnimatorListenerAdapter
()
{
@Override
public
void
onAnimationStart
(
Animator
animation
)
{
super
.
onAnimationStart
(
animation
);
if
(
startCallback
!=
null
)
{
startCallback
.
onAnimationStart
();
}
}
@Override
public
void
onAnimationEnd
(
Animator
animation
)
{
super
.
onAnimationEnd
(
animation
);
// 调用回调接口的onAnimationEnd方法
if
(
c
allback
!=
null
)
{
c
allback
.
onAnimationEnd
();
if
(
endC
allback
!=
null
)
{
endC
allback
.
onAnimationEnd
();
}
}
});
...
...
@@ -44,4 +55,11 @@ public class AnimationHelper {
public
interface
AnimationEndCallback
{
void
onAnimationEnd
();
}
/**
* 动画结束时的回调接口。
*/
public
interface
AnimationStartCallback
{
void
onAnimationStart
();
}
}
\ No newline at end of file
app/src/main/res/layout/activity_splash_2.xml
View file @
266fc864
...
...
@@ -98,6 +98,7 @@
app:layout_constraintBottom_toBottomOf=
"parent"
>
<TextView
android:layout_marginTop=
"5dp"
android:alpha=
"0"
android:id=
"@+id/id_tv_start"
android:layout_width=
"match_parent"
...
...
app/src/main/res/mipmap-xxhdpi/d_duoyun.png
0 → 100644
View file @
266fc864
17.2 KB
app/src/main/res/mipmap-xxhdpi/d_xiaoyu.png
0 → 100644
View file @
266fc864
10.9 KB
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